aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
AgeCommit message (Collapse)Author
2019-04-18Merge branch 'kjell/emulator/persistent_term_yield/OTP-15615'Kjell Winblad
* kjell/emulator/persistent_term_yield/OTP-15615: Make persistent_term:put/2 and persistent_term:erase/1 yield
2019-04-18Merge branch 'rickard/dist-system-limit/OTP-15708'Rickard Green
* rickard/dist-system-limit/OTP-15708: Fail when we cannot encode term in binary
2019-04-18Make persistent_term:put/2 and persistent_term:erase/1 yieldKjell Winblad
Prior to this commit, the functions put/2 and erase/1 in the persistent_term module did not yield even if the persistent term table was large (the persistent term table is copied every time put/2 or erase/1 is called). Furthermore, a call to put/2 or erase/1 did only consume a single reduction. This commit fixes these problems.
2019-04-18Merge branch 'lukas/OTP-22-rc2/misc-fixes/OTP-15773'Lukas Larsson
* lukas/OTP-22-rc2/misc-fixes/OTP-15773: erts: Yield correctly when iterating over distr exit messages erts: Fix cerl -rr to use correct etp file erts: Fix etp-process-info to print exiting and free processes tools: Adjust instrument abort tc to better trigger faults erts: Fix cleanup of message factory undo erts: Make dump_SUITE:free_dump not dump via rpc erts: Add extra debugging to dist frag testcases erts: Run smaller dist frag test to 32 bit machines erl_docgen: Remove accidentally merged debug printout erts: Fix z_SUITE to always look for cerl in ERL_TOP otp: make top Makefile app target respect TYPE variable vxworks: Make vxworks configure use environment CFLAGS erts: Make erts_free debug failure easier to diagnose erts: Fix gcc warning in to_erl
2019-04-18erts: Yield correctly when iterating over distr exit messagesLukas Larsson
Before this fix the process would continue to process more distributed down or exit messages until it ran out of reductions instead of being suspended immediately.
2019-04-18erts: Fix cleanup of message factory undoLukas Larsson
2019-04-18Fix broken ETS test caseKjell Winblad
This commit fixes an ETS test case that tests the decentralized memory counter in tables of type ordered_set with the write_concurrency option turned on. The test case assumed that the memory consumption of the table would only grow monotonically when terms are inserted. However, this was not the case when the emulator was compiled in debug mode as random splits and joins of CA tree nodes could happen. This commit fixes the test case by disabling random splits and joins in the tested table.
2019-04-15Merge branch 'bjorn/cuddle-with-tests'Björn Gustavsson
* bjorn/cuddle-with-tests: crash dump: Fix printing of "OldBinVHeap unused" crash dump: Include correct IP for a garbing process fun_SUITE: Make refc/1 test more reliable Remove redundant rule from Emakefile Turn off more optimizations for no_opt modules test_server_node: Bump compiler compatibility version to OTP 20 erts_test_utils: Bump compiler compatibility version to OTP 20 distribution_SUITE: Remove irrelevant test atom_roundtrip_r16b bs_construct_SUITE: Rename bs_add_overflow/1 to bs_append_overflow/1 bs_construct_SUITE: Remove troublesome test huge_binary/1 bs_construct_SUITE: Remove incorrect purpose line
2019-04-12crash dump: Fix printing of "OldBinVHeap unused"Björn Gustavsson
During a garbage collection, there could have been an overflow in the old virtual heap.
2019-04-12crash dump: Include correct IP for a garbing processBjörn Gustavsson
Make sure that the instruction pointer is correct for a garbing process in a crash dump.
2019-04-12Merge branch 'bjorn/erts/measure-process_main/OTP-15620'Björn Gustavsson
* bjorn/erts/measure-process_main/OTP-15620: Add benchmark Add erts_debug:interpreter_size/0
2019-04-11Merge branch 'sverker/node-table-cmp-0-creation-fix'Sverker Eriksson
* sverker/node-table-cmp-0-creation-fix: erts: Revert creation 0 as wildcard in node_table_cmp
2019-04-11Merge branch 'sverker/revert-big-creation'Sverker Eriksson
* sverker/revert-big-creation: Revert "erts: Make DFLAG_BIG_CREATION mandatory" Revert "erts: Remove old encoding of pids, ports and refs" Revert "erl_interface: Remove old encoding of pid,port,refs" Revert "epmd: Support 32-bit creation values in local node" Revert "jinterface: Remove old encoding of pid,port,refs" Revert "erl_interface: Support 32-bit creation local cnode" Revert "erts: Document new EPMD response ALIVE2_X_RESP"
2019-04-10erts: Revert creation 0 as wildcard in node_table_cmpSverker Eriksson
This is a partial revert of bf7c722bd3b30e04a56c2d369fd9f5501a8316d0. It does not make sense to treat 0 as a wild card in cmp function for the hash table as creation is part of the hash calculation.
2019-04-10Decentralized counters for ETS ordered_set with write_concurrencyKjell Winblad
Previously, all ETS tables used centralized counter variables to keep track of the number of items stored and the amount of memory consumed. These counters can cause scalability problems (especially on big NUMA systems). This commit adds an implementation of a decentralized counter and modifies the implementation of ETS so that ETS tables of type ordered_set with write_concurrency enabled use the decentralized counter. [Experiments][1] indicate that this change substantially improves the scalability of ETS ordered_set tables with write_concurrency enabled in scenarios with frequent `ets:insert/2` and `ets:delete/2` calls. The new counter is implemented in the module erts_flxctr (`erts_flxctr.h` and `erts_flxctr.c`). The module has the suffix flxctr as it contains the implementation of a flexible counter (i.e., counter instances can be configured to be either centralized or decentralized). Counters that are configured to be centralized are implemented with a single counter variable which is modified with atomic operations. Decentralized counters are spread over several cache lines (how many can be configured with the parameter `+dcg`). The scheduler threads are mapped to cache lines so that there is no single point of contention when decentralized counters are updated. The thread progress functionality of the Erlang VM is utilized to implement support for linearizable snapshots of decentralized counters. The snapshot functionality is used by the `ets:info/1` and `ets:info/2` functions. [1]: http://winsh.me/ets_catree_benchmark/flxctr_res.html
2019-04-10erts: Make erts_free debug failure easier to diagnoseLukas Larsson
2019-04-10Merge pull request #2204 from jhogberg/john/erts/optimize-arith-ops/OTP-15740John Högberg
erts: Optimize arithmetic ops using overflow intrinsics
2019-04-10Merge branch 'john/merge-re-replace-fix'John Högberg
* john/merge-re-replace-fix: erts: Skip ERTS_NOINLINE on non-GCC-compatible compilers cleanup: beam_emu.c: use ERTS_NOINLINE instead of NOINLINE stdlib: fix re:replace on LTO builds
2019-04-09Revert "erts: Make DFLAG_BIG_CREATION mandatory"Sverker Eriksson
This reverts commit 321dc6ee0241f802c940def174c0a77262e11f21.
2019-04-09Revert "erts: Remove old encoding of pids, ports and refs"Sverker Eriksson
This reverts commit 0b74eec2a1fd5716ba6e21d8c6715433d8d34510.
2019-04-09Revert "epmd: Support 32-bit creation values in local node"Sverker Eriksson
This reverts commit bd8f6106d44a58c261920eef72842bb3bc5a4968. PLUS a little change in epmd_srv.c:750 ("4" -> "replylen") that was part of e2cf4a8a4b03b9f430ba228276c3b2629159e832 by mistake.
2019-04-09erts: Fix dist sequence yield state allocator typeLukas Larsson
The wrong allocator type was given to erts_free.
2019-04-09erts: Yield when exiting/free process is suspended by deLukas Larsson
Complementory fix to 922fd355831575965
2019-04-09erts: Fix alignment of ErtsDistExternal on sparcLukas Larsson
The edep->data values need to be 64-bit aligned as it contains 64-bit values.
2019-04-09erts: Fix incorrect gcc may be used init warningLukas Larsson
2019-04-09erts: Fix lock order violation in system_info(procs)Lukas Larsson
2019-04-09erts: Fix buffer alignment bug in alloc_dist_obufLukas Larsson
Cannot do unaligned word writes on sparc!
2019-04-09erts: Fix build of dist_ctrl_get_data return termLukas Larsson
2019-04-08Add erts_debug:interpreter_size/0Björn Gustavsson
Add erts_debug:interpreter_size/0 for retrieving the approximate size of the BEAM interpreter (process_main()).
2019-04-08erts: Optimize arithmetic ops using overflow intrinsicsJohn Högberg
2019-04-08erts: Skip ERTS_NOINLINE on non-GCC-compatible compilersJohn Högberg
__declspec(noinline) works fine on MSVC but requires us to place the macro before a function rather than after, which in turn causes early versions of GCC to puke since they only accept __attribute__ at the end of a function declaration. Since this is a new macro that previously only saw use in beam_emu, I figured it's easiest to leave it disabled on MSVC.
2019-04-05Fail when we cannot encode term in binaryRickard Green
Fail when we cannot encode term in binary instead of producing a faulty result.
2019-04-05Optimize the i_minus instructionBjörn Gustavsson
Measurements show that i_minus instructions (subtraction) are frequent enough to warrant creating specialized i_minus instructions. Thanks to José Valim for doing instruction counting on Elixir code.
2019-04-05Merge remote-tracking branch 'trofi/master' into john/merge-re-replace-fixJohn Högberg
PR 2194, stdlib: fix re:replace on LTO builds * trofi/master: cleanup: beam_emu.c: use ERTS_NOINLINE instead of NOINLINE stdlib: fix re:replace on LTO builds
2019-04-01Merge branch 'john/kernel/cuddle-file-suite'John Högberg
* john/kernel/cuddle-file-suite: file_name_SUITE: Darwin 18 broke support for 'icky' names file_SUITE: Ignore EILSEQ on Darwin in +fnu/latin1 test
2019-03-29cleanup: beam_emu.c: use ERTS_NOINLINE instead of NOINLINESergei Trofimovich
Signed-off-by: Sergei Trofimovich <[email protected]>
2019-03-29stdlib: fix re:replace on LTO buildsSergei Trofimovich
Fabio Coatti reported elixir build failure in https://bugs.gentoo.org/681778. The minimal reproducer looks like that (from otp git tree): $ ./configure CFLAGS='-O2 -flto' LDFLAGS='-O2 -flto=8' $ make $ ERL_TOP=$PWD \ PATH=$ERL_TOP/bin:$PATH \ \ bin/erl \ \ -noshell -eval 're:replace("a","b","c",[{return,list}]).' \ -s erlang halt {"init terminating in do_boot",{badarg,[{re,replace,["a","b","c",[{return,list}]], [{file,"re.erl"},{line,362}]}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,680}]}, {init,start_it,1,[]}, {init,start_em,1,[]}, {init,do_boot,3,[]}]}} init terminating in do_boot ({badarg,[{re,replace,[[_],[_],[_],[_]],[{_},{_}]}, {erl_eval,do_apply,6,[{_},{_}]},{init,start_it,1,[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}) Crash dump is being written to: erl_crash.dump...done The failure happens in libpcre2 where stack overflow is mis-identified at function entry of erts_pcre_compile2() compile_regex() if (PUBL(stack_guard) != NULL && PUBL(stack_guard)()) { *errorcodeptr= ERR85; return FALSE; } The stack "overflow" detection happens in thr_wrapper() ethr_set_stacklimit__() because the stack usage code relies on the fact that ethr_set_stacklimit__() and similar functions don't get inlined into callers for stack growth measurement. Before the change inlining avoidance was achieved by putting functions into standalone translation units. LTO makes this technique inefficient. The change marks functions explicitly as __attribute__((__noinline__)) on gcc. Reported-by: Fabio Coatti Bug: https://bugs.gentoo.org/681778 Signed-off-by: Sergei Trofimovich <[email protected]>
2019-03-29Merge branch 'sverker/process_info-reductions-fix/OTP-15709' into maint-21Erlang/OTP
* sverker/process_info-reductions-fix/OTP-15709: erts: Fix bug in process_info(reductions) erts: Use ptr_val for pointer in gc msg copy
2019-03-29Merge branch 'maint'Sverker Eriksson
2019-03-29Merge branch 'sverker/process_info-reductions-fix/OTP-15709' into maintSverker Eriksson
* sverker/process_info-reductions-fix/OTP-15709: erts: Fix bug in process_info(reductions) erts: Use ptr_val for pointer in gc msg copy
2019-03-29Fix out of memory bug in the implementation of mapsKjell Winblad
This commit fixes a bug that could cause a crash or memory usage to grow until the machine ran out of memory when adding a key-value pair to a map. This could happen when inserting a new key-value pair with a key K1 containing a binary B1 into a map M having a key K2 with a binary B2 if the following conditions were met: * size(B1) >= 4294967296 * size(B2) >= 4294967296 * size(M) >= 32 * (size(B1) rem 4294967296) == (size(B2) rem 4294967296) * the first (size(B1) rem 4294967296) bytes are the same both in B1 and B2 * substituting B1 in K1 with B2 would result in a term with the same value as K2 The root cause of the bug is that the map implementation only hashed the first (X modulo 4294967296) bytes of binaries so that different binaries could get hashed to the same hash value independently of the hash seed.
2019-03-29file_SUITE: Ignore EILSEQ on Darwin in +fnu/latin1 testJohn Högberg
There's no way to create the file in question, so we may as well skip the test.
2019-03-28erts: Fix bug in process_info(reductions)Sverker Eriksson
returning incorrect result as * current process might not be RUNNING in which case REDS_IN is actually used as def_arg_reg[5] * FCALLS might not have been swapped out * the SAVED_CALLS case was wrong and returned number of reds left
2019-03-28erts: Use ptr_val for pointer in gc msg copySverker Eriksson
Cherry-pick: 3d7d66b84b69f3eb42e8bcd8dc510b6676e31cac Without this fix asserts would trigger in debug build but nothing else would break.
2019-03-28Merge branch 'john/erts/remove-destructive-bs_get_binary2/ERL-901'John Högberg
* john/erts/remove-destructive-bs_get_binary2/ERL-901: erts: Remove unsafe bs_get_binary2 optimization from loader
2019-03-27erts: Remove unsafe bs_get_binary2 optimization from loaderJohn Högberg
A load-time optimization assumed that match contexts had no further uses when a bs_get_binary2 overwrote the match context's register, and figured it would be safe to reuse the match context's memory for the resulting binary. This is no longer safe as of OTP 22, as a match context may be reused after being passed to another function.
2019-03-27Merge branch 'john/erts/seq_trace-sigq-clearing/OTP-15704'John Högberg
* john/erts/seq_trace-sigq-clearing/OTP-15704: erts: Handle all signal types when clearing seq_trace token
2019-03-27erts: Handle all signal types when clearing seq_trace tokenJohn Högberg
We walk through all signal queues in the system when clearing seq_trace, so we must be prepared to encounter all kinds of signals.
2019-03-27Fix unsafe optimization made by the loaderBjörn Gustavsson
Fix the unsafe load-time optimization introduced in 07bdbb3a1edc. https://bugs.erlang.org/browse/ERL-899
2019-03-26Merge branch 'john/erts/explain-empty-stack-check-in-next_catch'John Högberg
* john/erts/explain-empty-stack-check-in-next_catch: erts: Add an explanation for the empty stack check in next_catch