aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe
AgeCommit message (Collapse)Author
2016-10-14erts: Use hipe_free_moduleSverker Eriksson
2016-10-14erts: Check hipe stack in check_process_codeMagnus Lång
This is part of commit 1bd508921dd93086b05e7d0038b816b36c421d86. I did not include the fun-checking as we have a new purge strategy for funs in OTP 20. That remains to be solved some other way for hipe.
2016-10-14Add a loader state for HiPE code loadingMagnus Lång
Just like the BEAM loader state (as returned by erlang:prepare_loading/2), the HiPE loader state is contained in a magic binary. Eventually, we will separate HiPE loading into a prepare and a finalise phase, like the BEAM loader, where the prepare phase will be implemented by hipe_unified_loader and the finalise phase be implemented in C by hipe_load.c and beam_load.c, making prepare side-effect free and finalise atomic. The finalise phase will be exposed through the erlang:finish_loading/1 API, just like the BEAM loader, as this will allow HiPE and BEAM modules to be mixed in the same atomic "commit". The usage of a loader state makes it easier to keep track of all resources allocated during loading, and will not only make it easy to prevent leaks when hipe_unified_loader crashes, but also paves the way for proper, leak-free, unloading of HiPE modules.
2016-10-12erts: Refactor find_function_from_pc to return MFALukas Larsson
2016-10-12erts: Refactor out func_info into structLukas Larsson
This commit adds two new structs to be used to represent erlang code in erts. ErtsCodeInfo is used to describe the i_func_info header that is part of all Export entries and the prelude of each function. This replaces all the BeamInstr * that were previously used to point to these locations. After this change the code should never use BeamInstr * with offsets to figure out different parts of the func_info header. ErtsCodeMFA is a struct that is used to descripe a MFA in code. It is used within ErtsCodeInfo and also in Process->current. All function that previously took Eterm * or BeamInstr * to identify a MFA now use the ErtsCodeMFA or ErtsCodeInfo where appropriate. The code has been tested to work when adding a new field to the ErtsCodeInfo struct, but some updates are needed in ops.tab to make it work.
2016-10-10erts: Remove unused hipe_bifs:code_sizeSverker Eriksson
and hipe_bifs:update_code_size
2016-10-10erts: Improve hipe load/upgrade/purge machinerySverker Eriksson
A step toward better integration of hipe load and purge Highlights: * code_server no longer needs to call hipe_unified_loader:post_beam_load/1 Instead new internal function hipe_redirect_to_module() is called by loading BIFs to patch native call sites if needed. * hipe_purge_module() is called by erts_internal:purge_module/2 to purge any native code. * struct hipe_mfa_info redesigned and only used for exported functions that are called from or implemented by native code. A list of native call sites (struct hipe_ref) are kept for each hipe_mfa_info. * struct hipe_sdesc used by hipe_find_mfa_from_ra() to build native stack traces.
2016-10-10erts: Refactor hipe_sdesc.summary into bit fieldsSverker Eriksson
2016-10-10erts: Refactor rename struct hipe_sdescSverker Eriksson
2016-10-10erts: Refactor rename structs hipe_mfa and hipe_refSverker Eriksson
2016-08-31Remove old purge strategyRickard Green
2016-07-29Merge branch 'margnus1/erts/fix-hipe-literal-gc/PR-1122/OTP-13777' into maintBjörn-Egil Dahlberg
* margnus1/erts/fix-hipe-literal-gc/PR-1122/OTP-13777: check_process_code: Sweep HiPE stack for literals
2016-07-14hipe: Remove performance profiling codeLukas Larsson
This type of statistics is now available through the microstate accounting API.
2016-07-06check_process_code: Sweep HiPE stack for literalsMagnus Lång
Because check_process_code neglected checking the HiPE stack for references to the literal area, such references would survive the purge and subsequent deletion of a module and its literal area. These dangling references would then cause incorrect behaviour or even hard crashes of the VM. By simply adding a scan of the HiPE stack to check_process_code and erts_garbage_collect_literals, this problem is fixed. In order to support full stack walks without deleting the graylimit trap, a new stack walking interface function, nstack_walk_init_sdesc_ignore_trap() was introduced.
2016-06-30hipe: Fix bug in trap frame allocation wrappersMagnus Lång
The trap frame allocation wrappers occasionally call the garbage collector, even though built-in functions are not supposed to. On non-{x86,amd64} platforms, HiPE was optimising the BIF wrapper interface on the basis that BIFs do not GC. So, when hipe_reserve_beam_trap_frame called the garbage collector, the state in the PCB was stale and corruption happened. Now, these particular BIFs are reclassified as GC BIFs. Unfortunately, in order to do that we needed to introduce a gc_bif_interface_3 macro in every hipe_$ARCH_bifs.m4 file.
2016-06-30hipe: Add assertion for gc in bif without wrapperMagnus Lång
An easy source of tricky bugs is to start calling the garbage collector from a built-in function without adding that bif to hipe_bif_list.m4. With this change we, in the debug build, keep track of whether the canonical stack and heap pointers are stored in the PCB or in registers/stack, allowing us to catch this class of mistakes with an assertion.
2016-05-31Merge branch 'rickard/mv-dirty-reds-count/OTP-13123'Rickard Green
* rickard/mv-dirty-reds-count/OTP-13123: Move dirty reduction count to erts_dirty_process_main()
2016-05-31Move dirty reduction count to erts_dirty_process_main()Rickard Green
2016-05-31Merge branch 'sverker/bad-hash'Sverker Eriksson
2016-05-26Merge branch 'margnus1/llvm-compatibility/PR-1057/OTP-13626'Sverker Eriksson
2016-05-26erts: Improve bucket search for hipe_mfa_infoSverker Eriksson
by actually using the cached hash value.
2016-05-26erts: Improve some bad hash functionsSverker Eriksson
Multiplying two atoms will always yield the same low 6 bits. The most important tabke 'export' was saved by the prime number table size which seemed to yield a decent uniform distribution anyway.
2016-05-17erts: Move max_heap_size field so that ErLLVM works againLukas Larsson
2016-05-11hipe_llvm: Allow LLVM-generated constantsMagnus Lång
Since 3.7, LLVM sometimes generates SSE constants in a special constant section with the requisite alignment (".rodata.cst16"). This broke hipe_llvm since it assumed that all constants that were linked from the text section were constants generated by hipe_llvm. As this is the first time alignments larger than 8 have been required, some small changes were required to hipe_consttab and hipe_bifs:alloc_data/2. Note that hipe_bifs:alloc_data/2 still assumes that erl_alloc will provide the requisite alignment.
2016-05-10erts: Fix max heap size exit when in hipe modeLukas Larsson
2016-05-09Merge branch 'sverker/trace-send-receive-matchspec/OTP-13507'Sverker Eriksson
2016-05-04erts: Add Sender in 'receive' trace matchspecSverker Eriksson
All 'EXIT' and monitor messages are sent from 'system' Timeouts are "sent" from 'clock_service'
2016-05-04erts: Add matchspec to 'receive' traceSverker Eriksson
2016-05-04erts: Rename struct typeSverker Eriksson
as is trips up my editor symbol tagging.
2016-05-04hipe_x86: Patch relocations with implicit addendsMagnus Lång
LLVM likes to use relocation addends on x86, which HiPE was ignoring, causing crashes.
2016-05-04Ensure correct reduction countingRickard Green
2016-04-20Merge branch 'sverker/hipe-code-alloc'Sverker Eriksson
2016-04-15erts: Add 'exec_alloc' for hipe codeSverker Eriksson
that uses its own super carrier (erts_exec_mmapper) to guarantee low addressed and executable memory (PROT_EXEC). Currently only used on x86_64 that needs low memory for HiPE/AMD64's small code model. By initializing erts_exec_mapper early we secure its low memory area before erts_literal_mmapper might steal it.
2016-04-15erts: Implement tracer modulesLukas Larsson
Add the possibility to use modules as trace data receivers. The functions in the module have to be nifs as otherwise complex trace probes will be very hard to handle (complex means trace probes for ports for example). This commit changes the way that the ptab->tracer field works from always being an immediate, to now be NIL if no tracer is present or else be the tuple {TracerModule, TracerState} where TracerModule is an atom that is later used to lookup the appropriate tracer callbacks to call and TracerState is just passed to the tracer callback. The default process and port tracers have been rewritten to use the new API. This commit also changes the order which trace messages are delivered to the potential tracer process. Any enif_send done in a tracer module may be delayed indefinitely because of lock order issues. If a message is delayed any other trace message send from that process is also delayed so that order is preserved for each traced entity. This means that for some trace events (i.e. send/receive) the events may come in an unintuitive order (receive before send) to the trace receiver. Timestamps are taken when the trace message is generated so trace messages from differented processes may arrive with the timestamp out of order. Both the erlang:trace and seq_trace:set_system_tracer accept the new tracer module tracers and also the backwards compatible arguments. OTP-10267
2016-03-15update copyright-yearHenrik Nord
2016-02-24Merge branch 'master' into sverk/master/halt-INT_MINSverker Eriksson
2016-02-24erts: Change erl_exit into erts_exitSverker Eriksson
This is mostly a pure refactoring. Except for the buggy cases when calling erlang:halt() with a positive integer in the range -(INT_MIN+2) to -INT_MIN that got confused with ERTS_ABORT_EXIT, ERTS_DUMP_EXIT and ERTS_INTR_EXIT. Outcome OLD erl_exit(n, ) NEW erts_exit(n, ) ------- ------------------- ------------------------------------------- exit(Status) n = -Status <= 0 n = Status >= 0 crashdump+abort n > 0, ignore n n = ERTS_ERROR_EXIT < 0 The outcome of the old ERTS_ABORT_EXIT, ERTS_INTR_EXIT and ERTS_DUMP_EXIT are the same as before (even though their values have changed).
2016-02-18Merge branch 'sverk/erts-hipe_x86_signal-cleanups'Sverker Eriksson
OTP-13341 * sverk/erts-hipe_x86_signal-cleanups: hipe_sigaltstack: correct initialization of ss.ss_flags hipe_x86_signal: cleanups hipe_x86_signal: cleanups hipe_x86_signal: cleanups hipe_x86_signal: cleanups hipe_x86_signal: cleanups hipe_x86_signal: cleanups
2016-02-09hipe_sigaltstack: correct initialization of ss.ss_flagsMikael Pettersson
SS_ONSTACK may be set in oss, but it's not supposed to be set in ss, and some systems correctly reject that; current Linux kernels accept but ignore it in ss
2016-02-02Merge branch 'maint'Zandra
Conflicts: erts/emulator/beam/beam_emu.c
2016-02-02Merge branch 'margnus1/bs_unit_fix' into maintZandra
* margnus1/bs_unit_fix: hipe: Fix signed compares of unsigned sizes beam: Fix overflow bug in i_bs_add_jId hipe: Add tests for bad bit syntax float sizes Add a case testing the handling of guards involving binaries Add some more binary syntax construction tests hipe: Guard against enormous numbers in ranges hipe: Fix constructing huge binaries hipe: Fix binary constructions failing with badarith Add missing corner-case to bs_construct_SUITE hipe: Allow unsigned args in hipe_rtl_arith hipe: test unit size match in bs_put_binary_all hipe: test unit size match in bs_append Fix hipe_rtl_binary_construct:floorlog2/1 OTP-13272
2016-01-31hipe_x86_signal: cleanupsMikael Pettersson
- replace system-specific #ifndef around sigaction() override with a test for OVERRIDE_SIGACTION, #define or #undef that as appropriate in each system-specific block
2016-01-31hipe_x86_signal: cleanupsMikael Pettersson
- move extern declarations of LIBC_SIGACTION() from system-specific blocks to the common LIBC_SIGACTION block
2016-01-31hipe_x86_signal: cleanupsMikael Pettersson
- rename __next_sigaction to next_sigaction, to avoid defining _-prefixed symbols - factor out common code for declaring and initializing next_sigaction, system-specific code now only needs to #define NEXT_SIGACTION
2016-01-31hipe_x86_signal: cleanupsMikael Pettersson
- rename __SIGACTION to LIBC_SIGACTION, to avoid defining _-prefixed symbols
2016-01-31hipe_x86_signal: cleanupsMikael Pettersson
- add block for NetBSD, define dummy INIT() macro - eliminate ifndef NetBSD around INIT() invocation
2016-01-31hipe_x86_signal: cleanupsMikael Pettersson
- remove glibc < 2.3 code - move glibc-2.2 comment to glibc >= 2.3 block - remove obsolete "only supports" comment - remove support for broken sigaltstack() in pre-2.4 Linux kernels
2015-12-18Merge branch 'maint'Henrik Nord
Conflicts: OTP_VERSION erts/vsn.mk
2015-12-17hipe_x86_signal.c: add FreeBSD sigaction codeKenji Rikitake
* erts/emulator/hipe/hipe_x86_signal.c: add FreeBSD sigaction code, based on the Darwin (OS X) code
2015-12-15Merge branch 'lukas/erts/forker'Lukas Larsson
* lukas/erts/forker: (28 commits) erts: Never abort in the forked child erts: Mend ASSERT makro for erl_child_setup erts: Allow enomem failures in port_SUITE erts: iter_port sleep longer on freebsd erts: Allow one dangling fd if there is a gethost port erts: Only use forker StackAck on freebsd erts: It is not possible to exit the forker driver erts: Add forker StartAck for port start flowcontrol erts: Fix large open_port arg segfault for win32 erts: Fix memory leak at async open port kernel: Remove cmd server for unix os:cmd erts: Add testcase for huge port environment erts: Move os_pid to port hash to child setup erts: Handle all EINTR and EAGAIN cases in child setup erts: Make child_setup work with large environments erts: Fix forker driver ifdefs for win32 erts: Fix uds socket handling for os x erts: Fix dereferencing of unaligned integer for sparc erts: Flatten too long io vectors in uds write erts: Add fd count test for spawn_driver ... Conflicts: erts/emulator/beam/erl_node_tables.c erts/preloaded/src/erts_internal.erl