aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
AgeCommit message (Collapse)Author
2018-05-22erts: Let allocator pooled_tree also use Age OrderSverker Eriksson
if configured for the allocator. This was not implemented and pooled_tree always used address order first fit. The "problem" was as a carrier can be part of both the pooled tree (of its owner) and the allocation tree (of a foreign instance) at the same time. Solved by duplicating 'birth_time' in both AOFF_RBTree_t nodes for each carrier. Blocks still cannot use age order and does not pay any memory cost for birth_time.
2018-05-18erts: Add some missing doxygen docsSverker Eriksson
2018-05-18Merge branch 'sverker/ets-delete_all_objects-trap/OTP-15078'Sverker Eriksson
* sverker/ets-delete_all_objects-trap/OTP-15078: erts: Rename untrapping db_free_*empty*_table erts: Make ets:delete_all_objects yield on fixed table erts: Optimize ets delete all in fixed table erts: Refactor ets select iteration code erts: Cleanup ets code erts: Optimize ets hash object deallocactions erts: Refactor pseudo deleted ets objects erts: Make atomic ets:delete_all_objects yield erts: Fix reduction bump for ets:delete/1
2018-05-18Merge branch 'sverker/system-profile-bug/OTP-15085'Sverker Eriksson
* sverker/system-profile-bug/OTP-15085: erts: Fix bug in system_profile
2018-05-18erts: Fix bug in system_profileSverker Eriksson
seen to cause redundant {profile,_,active,_,_} messages when process is terminating.
2018-05-18Merge branch 'rickard/delete_process_schedule/OTP-15081'Rikard Green
* rickard/delete_process_schedule/OTP-15081: Do not hold runq lock while deleting a process
2018-05-17Merge branch 'sverker/maps-iterator-order' againSverker Eriksson
2018-05-17Merge PR-1819 from sverker/enif_binary_to_term-bug/OTP-15080Sverker Eriksson
Fix bug in enif_binary_to_term for immediates
2018-05-16erts: Silence gcc warningsSverker Eriksson
‘res’ may be used uninitialized in this function
2018-05-16erts: Fix bug in enif_binary_to_term for immediatesSverker Eriksson
Symptom: Heap corruption Expanded test case to provoke this bug and test some more term types.
2018-05-16Merge branch 'sverker/maps-iterator-order'Sverker Eriksson
2018-05-16Merge branch 'rickard/suspend/OTP-14964'Rickard Green
* rickard/suspend/OTP-14964: Fix erts_try_lock_sig_free_proc() Update etp Replace previous suspend in setnode/3 New process suspend implementation based on async signaling Teach HiPE to yield from receive
2018-05-16Fix erts_try_lock_sig_free_proc()Rickard Green
2018-05-16Replace previous suspend in setnode/3Rickard Green
2018-05-16New process suspend implementation based on async signalingRickard Green
2018-05-16Teach HiPE to yield from receiveRickard Green
2018-05-15erts: Fix bug when scheduling monitor-msg comboSverker Eriksson
Bug introduced in master by 613cde66c25464121f2f6dace99782bad0e07d9b
2018-05-15erts: Refactor new erts_make_dirty_proc_handledSverker Eriksson
from ensure_dirty_proc_handled as an outline function callable from inline functions.
2018-05-15Do not hold runq lock while deleting a processRickard Green
2018-05-09erts: Try fix contant maps:next orderSverker Eriksson
Symptom: maps:iterator+next returns different orders for the exact same map. Problem: Number of cached key-values within iterator term depends on number of input reductions to erts_internal_map_next_3. Solution: Build cached key-values in destructive non-reverse order to not affect iteration order.
2018-05-08erts: Rename untrapping db_free_*empty*_tableSverker Eriksson
as it's now only used for empty tables by ets:new/2.
2018-05-08erts: Make ets:delete_all_objects yield on fixed tableSverker Eriksson
2018-05-08erts: Optimize ets delete all in fixed tableSverker Eriksson
by only allocating one FixedDeletion with the new "all" flag instead of one FixedDeletion per slot.
2018-05-08erts: Refactor ets select iteration codeSverker Eriksson
* Remove all "mtraversal_" prefixes. * Rename all local context variables as "ctx". * Changed callbacks from function arguments to members of new base context struct "match_callbacks_t" * Remove unnecessary struct initializations "= {0}"
2018-05-08erts: Cleanup ets codeSverker Eriksson
2018-05-08erts: Optimize ets hash object deallocactionsSverker Eriksson
to be done after lock has been released.
2018-05-08erts: Refactor pseudo deleted ets objectsSverker Eriksson
Separate pseudo-deleted-flag from the hash value.
2018-05-08erts: Make atomic ets:delete_all_objects yieldSverker Eriksson
by using a cooperative strategy that will make any process accessing the table execute delelete_all_objects_continue until the table is empty. This is not an optimal solution as concurrent threads will still block on the table lock, but at least thread progress is made.
2018-05-07Merge pull request #1802 from michalmuskala/map-is-key-bifBjörn Gustavsson
Introduce is_map_key/2 guard BIF OTP-15037
2018-04-29Introduce is_map_key/2 guard BIFMichał Muskała
This complements the `map_get/2` guard BIF introduced in #1784. Rationale. `map_get/2` allows accessing map fields in guards, but it might be problematic in more complex guard expressions, for example: foo(X) when map_get(a, X) =:= 1 or is_list(X) -> ... The `is_list/1` part of the guard could never succeed since the `map_get/2` guard would fail the whole guard expression. In this situation, this could be solved by using `;` instead of `or` to separate the guards, but it is not possible in every case. To solve this situation, this PR proposes a `is_map_key/2` guard that allows to check if a map has key inside a guard before trying to access that key. When combined with `is_map/1` this allows to construct a purely boolean guard expression testing a value of a key in a map. Implementation. Given the use case motivating the introduction of this function, the PR contains compiler optimisations that produce optimial code for the following guard expression: foo(X) when is_map(X) and is_map_key(a, X) and map_get(a, X) =:= 1 -> ok; foo(_) -> error. Given all three tests share the failure label, the `is_map_key/2` and `is_map/2` tests are optimised away. As with `map_get/2` the `is_map_key/2` BIF is allowed in match specs.
2018-04-27Merge branch 'sverker/lc-thread-exit-free-fix'Sverker Eriksson
* sverker/lc-thread-exit-free-fix: erts: Fix memory leak in lock checker at thread exit
2018-04-27Merge branch 'rickard/process_info/OTP-14966'Rickard Green
* rickard/process_info/OTP-14966: Fix scheduled process_info() 'status' request Fix handling of process-info requests in receive
2018-04-27Fix scheduled process_info() 'status' requestRickard Green
2018-04-27Merge branch 'siri/kernel/logger/OTP-13295'Siri Hansen
* siri/kernel/logger/OTP-13295: Add documentation of the built-in logger handlers Catch badarg in logger:get_format_depth/0 Add chars_limit option to logger_formatter Don't kill logger process until all other processes are dead Set call timeout for logger_server to infinity Update primary bootstrap Test cuddle for logger Update cth_log_redirect to a logger handler Start using logger internally in kernel and stdlib Remove error_logger process and add logger process Add logger
2018-04-26erts: Optimize monitor signal by message piggybackSverker Eriksson
If no message/signal is sent (to same destination) then monitor signal is flushed when process is scheduled out.
2018-04-26erts: Cleanup some codeSverker Eriksson
2018-04-26Fix handling of process-info requests in receiveRickard Green
2018-04-26erts: Fix memory leak in lock checker at thread exitSverker Eriksson
Leak introduced in 865ac3b740d9efa1a0583349929591c757300412.
2018-04-26Remove error_logger process and add logger processSiri Hansen
2018-04-26Merge branch 'rickard/process_info/OTP-14966'Rickard Green
* rickard/process_info/OTP-14966: Restore merge of signal queues in queue_messages() if main lock is held Fix message tracing
2018-04-25erts: Fix reduction bump for ets:delete/1Sverker Eriksson
2018-04-25Restore merge of signal queues in queue_messages() if main lock is heldRickard Green
2018-04-25Merge branch 'map-get-bif' of git://github.com/michalmuskala/otpBjörn Gustavsson
* 'map-get-bif' of git://github.com/michalmuskala/otp: Introduce map_get guard-safe function OTP-15037
2018-04-24Merge pull request #1790 from jhogberg/john/erts/more-alloc-info/OTP-14961John Högberg
Improve memory instrumentation OTP-15024 OTP-14961
2018-04-24Introduce map_get guard-safe functionMichał Muskała
Rationale Today all compound data types except for maps can be deconstructed in guards. For tuples we have `element/2` and for lists `hd/1` and `tl/1`. Maps are completely opaque to guards. This means matching on maps can't be abstracted into macros, which is often done with repetitive guards. It also means that maps have to be always selected whole from ETS tables, even when only one field would be enough, which creates a potential efficiency issue. This PR introduces an `erlang:map_get/2` guard-safe function that allows extracting a map field in guard. An alternative to this function would be to introduce the syntax for extracting a value from a map that was planned in the original EEP: `Map#{Key}`. Even outside of guards, since this function is a guard-BIF it is more efficient than using `maps:get/2` (since it does not need to set up the stack), and more convenient from pattern matching on the map (compare: `#{key := Value} = Map, Value` to `map_get(key, Map)`). Performance considerations A common concern against adding this function is the notion that "guards have to be fast" and ideally execute in constant time. While there are some counterexamples (`length/1`), what is more important is the fact that adding those functions does not change in any way the time complexity of pattern matching - it's already possible to match on map fields today directly in patterns - adding this ability to guards will niether slow down or speed up the execution, it will only make certain programs more convenient to write. This first version is very naive and does not perform any optimizations.
2018-04-24mikpe/erts-logger-integer-truncation/PR-1795/OTP-15032Lukas Larsson
fix integer truncation bugs in error logger path
2018-04-23Merge branch 'sverker/valgrind-uninit-run_queue-ptr'Sverker Eriksson
* sverker/valgrind-uninit-run_queue-ptr: erts: Fix run queue pointer in proxy process
2018-04-23Merge branch 'sverker/ets-cherries/OTP-15031'Sverker Eriksson
* sverker/ets-cherries/OTP-15031: erts: Use table ref for select continuation erts: Refactor erl_db_hash next() into next_live() erts: Change wrong alloc_fnf
2018-04-23erts: Rewrite memory instrumentationJohn Högberg
This commit replaces the old memory instrumentation with a new implementation that scans carriers instead of wrapping erts_alloc/erts_free. The old implementation could not extract information without halting the emulator, had considerable runtime overhead, and the memory maps it produced were noisy and lacked critical information. Since the new implementation walks through existing data structures there's no longer a need to start the emulator with special flags to get information about carrier utilization/fragmentation. Memory fragmentation is also easier to diagnose as it's presented on a per-carrier basis which eliminates the need to account for "holes" between mmap segments. To help track allocations, each allocation can now be tagged with what it is and who allocated it at the cost of one extra word per allocation. This is controlled on a per-allocator basis with the +M<S>atags option, and is enabled by default for binary_alloc and driver_alloc (which is also used by NIFs).
2018-04-23Fix message tracingRickard Green