summaryrefslogtreecommitdiff
path: root/erts/emulator/internal_doc
Commit message (Collapse)AuthorAgeFilesLines
* Update `perf` workflow for OTP26Michal Kuratczyk2023-04-171-2/+3
| | | | | | Scheduler names changed in OTP26, so we need a different `sed` expresion to merge data from all schedulers. The example is now compatible with versions prior to OTP26 and OTP26+
* beamasm: Add instructions for attaching to a running systemJohn Högberg2023-03-221-2/+7
|
* erts: Require modules to be made writable before modifying codeJohn Högberg2023-03-171-4/+10
| | | | | | | | | | | | | | | | | | | Rather than allowing modules to be writable all the time, either through RWX pages or a dual-mapped RW page, support making them writable only in the brief window that they are actually being modified. To avoid introducing subtle bugs this late in the release cycle, we'll settle for adding assertions that modifications are only made while a module is marked writable. We won't change any page permissions just yet. The one exception to this are the per-thread permissions on MacOS, where a thread can temporarily trade permission to execute MAP_JIT pages for being able to write to them. This permission is added when making a module writable and removed when we're done. This fixes the long-standing issue GH-4911 on Apple Silicon (Intel macs are still affected since we don't want to give up W^X).
* Merge PR-6351 from max-au/call-memory OTP-18440Sverker Eriksson2023-02-081-2/+2
|\ | | | | [erts] Implement call_memory tracing
| * [erts] Implement call_memory tracingMaxim Fedorov2023-02-081-2/+2
| | | | | | | | | | Similar to call_time, erlang:trace_pattern(..., [call_memory]) accumulates memory allocations, allowing for basic heap profiling.
* | Merge branch 'john/erts/instruction-synchronization-barriers/OTP-18418' into ↵John Högberg2023-02-011-33/+24
|\ \ | |/ |/| | | | | | | | | | | | | | | john/erts/merge-isb-26 * john/erts/instruction-synchronization-barriers/OTP-18418: jit: Clear instruction cache ourselves jit: Refactor breakpoints jit: Issue ISBs on all schedulers when modifying code jit: Remove an eyesore
| * jit: Refactor breakpointsJohn Högberg2023-02-011-33/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ARM reference manual, section B2.2.5, says that it's unsafe to concurrently modify non-branch instructions. The hardware has license to explode in our face even if we don't care whether the new or old instruction executes. To be safe, change the MOVZ in the breakpoint to a (slightly slower) LDR in the fragment, letting us change the flag without altering any instructions. While we're at it we'll give x86 the same treatment. The Intel manual is rather unclear about the subject, sometimes saying that we don't need to do anything special[0] and sometimes that we do[1]. I've decided to play it safe by only modifying the initial jump, as there aren't as many things that could go wrong with that. [0]: Intel 64/IA32 software dev manual Vol 3A, section 11.6 [1]: Intel 64/IA32 software dev manual Vol 3A, section 8.1.3
* | Merge branch 'maint'John Högberg2023-01-041-1/+1
|\ \ | |/ | | | | | | * maint: Fix a doc link to flamegraphs on the BeamAsm page
| * Fix a doc link to flamegraphs on the BeamAsm pageTomas Abrahamsson2023-01-031-1/+1
| |
* | erts: Fix race in fun loadingJohn Högberg2022-12-122-13/+14
|/ | | | | | | | | | | | | | | | Because funs are tied to their canonical module rather than a specific instance of a module, they are "moved over" to the newest instance whenever we reload _the exact same module_ over itself. This quirk, together with how fun entries are updated when a module is loaded, caused a small window where it was possible for a holder of an "old" fun to call the new instance before it was fully loaded. This commit fixes that by versioning funs in roughly the same way we do exports. It also fixes a related bug where fun purging could be messed up if a new module instance was loaded in the middle of purging, solving the issue by disallowing code loading while purging a module with funs.
* erts: Normalize formatting and disallow `\` in ops.tabJohn Högberg2022-02-231-7/+5
|
* jit: Refactor ArgVal to catch errors earlierJohn Högberg2022-02-211-1/+1
| | | | | | By breaking ArgVal into subtypes and only letting us take a value when we have a concrete type, we reduce the risk of errors like PR-5727 happening again.
* Fix url [doc] [ci skip]Marc-André Lafortune2022-02-051-3/+3
|
* Update documentation for beam_makeopsBjörn Gustavsson2022-02-031-71/+108
|
* jit: Update BeamAsm.md now that the JIT supports aarch64John Högberg2022-01-201-37/+38
|
* Merge PR-5479 from sverker/sverker/nifs-attribute OTP-17151Sverker Eriksson2021-12-201-1/+1
|\ | | | | Add -nifs() attribute
| * erts: Fix typoSverker Eriksson2021-12-131-1/+1
| |
* | Update copyright yearRickard Green2021-12-161-1/+1
|/
* Fix typos in erts/emulator/internal_doc/Kian-Meng, Ang2021-11-2411-33/+33
|
* Merge branch 'john/erts/improve-internal-tracing-documentation'John Högberg2021-10-271-34/+78
|\ | | | | | | | | * john/erts/improve-internal-tracing-documentation: erts: Minor improvements to internal tracing doc
| * erts: Minor improvements to internal tracing docJohn Högberg2021-10-221-34/+78
| |
* | compiler: Add +absolute_source optionJohn Högberg2021-10-221-0/+4
|/ | | | | | | | | | This lets `perf` and `gdb` show Erlang source code instead of just saying "file.erl:1234" OTP can be built with this information by passing it in the `ERL_COMPILER_OPTIONS` environment variable: ERL_COMPILER_OPTIONS="[absolute_source]" ./otp_build setup -a
* erts: Optimize fun callsJohn Högberg2021-10-201-5/+5
| | | | | | | | | | | | By making local and external funs share the same structure, we can remove a substantial amount of code from the `call_fun` family of instructions. As a result fun calls are now about 15% faster with the interpreter on my machine, 10% faster with the x64 JIT on that same machine, and 15% faster with the AArch64 JIT on my M1 Mac. The improvement is a bit less pronounced for funs with free variables, and a bit more for those without (including external funs).
* Merge branch 'maint'Kjell Winblad2021-09-011-5/+156
|\
| * Add documentation about how to use YCF in ERTSKjell Winblad2021-09-011-5/+156
| | | | | | | | Add text explaineing some best practices for using YCF for ERTS.
* | Merge branch 'maint'Lukas Larsson2021-08-271-0/+5
|\ \ | |/
| * erts: Fix erl -emu_flavor docs and expand BeamJit perfLukas Larsson2021-08-271-0/+5
| |
* | erts: Beam-asm internal documentation fixFrej Drejhammar2021-06-171-3/+3
| | | | | | | | Change wording to be what I think was intended.
* | jit: Implement code generation for ARMBjörn Gustavsson2021-05-251-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On April 9, 2021, we reached the prompt milestone (with -oldshell option). On April 15, 2021, we could run the entire compiler test suite without crashing. The test suites for tools and debugger also ran successfully. On April 16, 2021, we could run the entire test suites for emulator and stdlib. Co-authored-by: John Högberg <john@erlang.org> Co-authored-by: Sverker Eriksson <sverker@erlang.org>
* | jit: Use a span instead of std::vector for instruction argumentsJohn Högberg2021-05-241-3/+3
| | | | | | | | | | This shaves off an allocation on each instruction as we can point directly into the BeamOp's argument array.
* | erts: Support frame pointersJohn Högberg2021-05-243-14/+36
|/ | | | | | This vastly improves `perf` accuracy and makes it usable on platforms that don't support `--call-graph=lbr`, such as most cloud environments.
* jit: Add testcases to test perf supportLukas Larsson2021-04-011-1/+1
|
* Merge branch 'rickard/link-protocol-fix/OTP-17127' into ↵Rickard Green2021-03-151-0/+194
|\ | | | | | | | | | | | | | | rickard/link-protocol-fix/master/OTP-17127 * rickard/link-protocol-fix/OTP-17127: Improve documentation of links Document the new link protocol
| * Document the new link protocolRickard Green2021-03-151-0/+194
| |
* | otp: Update all links to our bug trackerJohn Högberg2021-02-111-1/+2
| |
* | otp: Remove HiPE and HiPE-related accessoriesJohn Högberg2020-11-091-2/+0
| |
* | jit: Make all code read-only, dual-mapping writable pagesJohn Högberg2020-11-051-0/+28
| | | | | | | | | | | | | | | | This allows the JIT to be used on systems that enforce a W^X policy. To help catch related errors at compile time, all code pointers have been marked `const`.
* | jit: Refactor export entries and NIF loading for W^XJohn Högberg2020-10-301-0/+24
| |
* | jit internal docs: Correct instructions for building the interpreterFrej Drejhammar2020-10-131-1/+1
| | | | | | | | The flavor to use for building the interpreter is `emu` not `jit`.
* | jit internal docs: Correct directory for instr_*.cppFrej Drejhammar2020-10-131-1/+1
| | | | | | | | The instruction builder functions are locatated in `jit` not `asm`.
* | jit: Keep active code index in a registerJohn Högberg2020-09-221-0/+1
| |
* | jit: Implement support for perf dumpLukas Larsson2020-09-222-10/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using perf dump is superior to using perf map as we are able to use `perf annotate` which means we can view which x86 assembly instruction was using the most CPU. perf record -k mono erl +JPperf true perf inject --jit -i perf.data -o perf.jitted.data perf report -M intel -i perf.jitted.data The implementation was inspired from the mono repo: https://github.com/mono/mono/blob/master/mono/mini/mini-runtime.c It should be easy to add support for Erlang source file and line mapping if we want to do that.
* | jit: Further polish and optimize BEAMASMBjörn Gustavsson2020-09-222-25/+211
| | | | | | | | | | | | Co-authored-by: Lukas Larsson <lukas@erlang.org> Co-authored-by: John Högberg <john@erlang.org> Co-authored-by: Dan Gudmundsson <dgud@erlang.org>
* | jit: Use the native stack as the Erlang stackJohn Högberg2020-09-224-13725/+71383
| | | | | | | | | | | | Co-authored-by: Lukas Larsson <lukas@erlang.org> Co-authored-by: Björn Gustavsson <bjorn@erlang.org> Co-authored-by: Dan Gudmundsson <dgud@erlang.org>
* | erts: Implement the BeamAsm JITLukas Larsson2020-09-226-5/+28397
| | | | | | | | | | | | Co-authored-by: John Högberg <john@erlang.org> Co-authored-by: Dan Gudmundsson <dgud@erlang.org> Co-authored-by: Björn Gustavsson <bjorn@erlang.org>
* | erts: Break out BEAM file handling to its own moduleJohn Högberg2020-09-211-7/+9
| |
* | Refactor the transformation engineBjörn Gustavsson2020-06-111-37/+66
|/ | | | | | | The predicates (guard constraints) and generators for transformation rules were static functions the `beam_load.c` source code files. Break out the predicates and generators to `predicates.tab` and `generators.tab`, respectively.
* Make ets:insert/2 and ets:insert_new/2 yieldKjell Winblad2019-12-181-0/+9
| | | | | | | | | The `ets:insert/2` and `ets:insert_new/2` functions did not yield even when they were given long lists and a call to one of the functions did only consume a single reduction. This commit fixes these problems. The fix uses the "Yielding C Fun" tool to automatically generate yieldable versions of C functions.
* Add Yielding C FunKjell Winblad2019-12-111-0/+53
| | | | | | | Yielding C Fun (YCF) is a tool that generates yieldable versions of functions written in the C programming language. This commit adds the source code of YCF and a text describing the purpose of YCF (`erts/emulator/internal_doc/AutomaticYieldingOfCCode.md`).
* beam_makeops: Allow 'p' on the right-hand side of transformationsJohn Högberg2019-10-211-1/+3
|