aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_alloc.types
AgeCommit message (Collapse)Author
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-02-25Merge pull request #2124 from kjellwinblad/kjell/stdlib/iolist_size_trapKjell Winblad
Make iolist_size/1 yield OTP-15631
2019-02-25Make iolist_size/1 yieldKjell Winblad
The iolist_size/1 function did not yield even if the input list was very long and a call to the function did only consume a single reduction. This commit fixes these problems.
2019-02-22erts: Implement fragmentation of distrubution messagesLukas Larsson
2019-02-21erts: Yield later during process exit and allow free procs to runLukas Larsson
OTP-15610
2018-11-15Merge branch 'maint'Sverker Eriksson
2018-11-15erts: Add new module 'counters'Sverker Eriksson
2018-11-15erts: Add new module 'atomics'Sverker Eriksson
2018-11-06Merge branch 'maint'Björn Gustavsson
* maint: Implement a tab for persistent terms in crashdump viewer Add tests of persistent terms for crashdump_viewer Add a persistent term storage Refactor releasing of literals Extend the sharing-preserving routines to optionally copy literals Conflicts: erts/emulator/Makefile.in erts/emulator/beam/erl_process_dump.c erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/init.beam lib/sasl/src/systools_make.erl
2018-11-06Merge branch 'bjorn/erts/persistent_terms/OTP-14669' into maintBjörn Gustavsson
* bjorn/erts/persistent_terms/OTP-14669: Implement a tab for persistent terms in crashdump viewer Add tests of persistent terms for crashdump_viewer Add a persistent term storage Refactor releasing of literals Extend the sharing-preserving routines to optionally copy literals
2018-11-06Add a persistent term storageBjörn Gustavsson
Persistent terms are useful for storing Erlang terms that are never or infrequently updated. They have the following advantages: * Constant time access. A persistent term is not copied when it is looked up. The constant factor is lower than for ETS, and no locks are taken when looking up a term. * Persistent terms are not copied in garbage collections. * There is only ever one copy of a persistent term (until it is deleted). That makes them useful for storing configuration data that needs to be easily accessible by all processes. Persistent terms have the following drawbacks: * Updates are expensive. The hash table holding the keys for the persistent terms are updated whenever a persistent term is added, updated or deleted. * Updating or deleting a persistent term triggers a "global GC", which will schedule a heap scan of all processes to search the heap of all processes for the deleted term. If a process still holds a reference to the deleted term, the process will be garbage collected and the term copied to the heap of the process. This global GC can make the system less responsive for some time. Three BIFs (implemented in C in the emulator) is the entire interface to the persistent term functionality: * put(Key, Value) to store a persistent term. * get(Key) to look up a persistent term. * erase(Key) to delete a persistent term. There are also two additional BIFs to obtain information about persistent terms: * info() to return a map with information about persistent terms. * get() to return a list of a {Key,Value} tuples for all persistent terms. (The values are not copied.)
2018-11-02Merge branch 'maint'John Högberg
* maint: Optimize operator '--' and yield on large inputs Inline erts_cmp Clarify a magical allocation size Fix trapping in lists:reverse/2
2018-10-29Optimize operator '--' and yield on large inputsJohn Högberg
The removal set now uses a red-black tree instead of an array on large inputs, decreasing runtime complexity from `n*n` to `n*log(n)`. It will also exit early when there are no more items left in the removal set, drastically improving performance and memory use when the items to be removed are present near the head of the list. This got a lot more complicated than before as the overhead of always using a red-black tree was unacceptable when either of the inputs were small, but this compromise has okay-to-decent performance regardless of input size. Co-authored-by: Dmytro Lytovchenko <[email protected]>
2018-07-27Change "can not" into "cannot"Raimo Niskanen
I did not find any legitimate use of "can not", however skipped changing e.g RFCs archived in the source tree.
2018-07-27Remove newline between can and notRaimo Niskanen
After this whitespace modification there should be no "can not"s separated by a newline in the entire OTP repository, so to find them all a simple git grep will do just fine.
2018-05-22erts: Purge unused allocation typesSverker Eriksson
2018-05-16Replace previous suspend in setnode/3Rickard Green
2018-05-16New process suspend implementation based on async signalingRickard Green
2018-03-21Implementation of true asynchronous signaling between processesRickard Green
Communication between Erlang processes has conceptually always been performed through asynchronous signaling. The runtime system implementation has however previously preformed most operation synchronously. In a system with only one true thread of execution, this is not problematic (often the opposite). In a system with multiple threads of execution (as current runtime system implementation with SMP support) it becomes problematic. This since it often involves locking of structures when updating them which in turn cause resource contention. Utilizing true asynchronous communication often avoids these resource contention issues. The case that triggered this change was contention on the link lock due to frequent updates of the monitor trees during communication with a frequently used server. The signal order delivery guarantees of the language makes it hard to change the implementation of only some signals to use true asynchronous signaling. Therefore the implementations of (almost) all signals have been changed. Currently the following signals have been implemented as true asynchronous signals: - Message signals - Exit signals - Monitor signals - Demonitor signals - Monitor triggered signals (DOWN, CHANGE, etc) - Link signals - Unlink signals - Group leader signals All of the above already defined as asynchronous signals in the language. The implementation of messages signals was quite asynchronous to begin with, but had quite strict delivery constraints due to the ordering guarantees of signals between a pair of processes. The previously used message queue partitioned into two halves has been replaced by a more general signal queue partitioned into three parts that service all kinds of signals. More details regarding the signal queue can be found in comments in the erl_proc_sig_queue.h file. The monitor and link implementations have also been completely replaced in order to fit the new asynchronous signaling implementation as good as possible. More details regarding the new monitor and link implementations can be found in the erl_monitor_link.h file.
2018-01-03Replace the libc environment with a thread-safe emulationJohn Högberg
putenv(3) and friends aren't thread-safe regardless of how you slice it; a global lock around all environment operations (like before) keeps things safe as far as our own operations go, but we have absolutely no control over what libc or a library dragged in by a driver/NIF does -- they're free to call getenv(3) or putenv(3) without honoring our lock. This commit solves this by setting up an "emulated" environment which can't be touched without going through our interfaces. Third-party libraries can still shoot themselves in the foot but benign uses of os:putenv/2 will no longer risk crashing the emulator.
2017-11-15erts: Transcode tuple fallbacksSverker Eriksson
When finalizing outgoing distribution messages we transcode them into using tuple fallbacks if the receiver does not support bitstrings and export-funs. This can only happen if the message was first encoded toward a pending connection when the receiver was unknown. It's an optimistic approach optmimized for modern beam nodes, that expect real bitstrings and funs (since <R13). Only erl_interface/jinterface lack this support.
2017-10-20Merge branch 'maint'Björn Gustavsson
* maint: Bump version of crash dumps to 0.4 Verify that binaries of different sizes are dumped correctly Don't dump literal areas that are not referenced at all Dump literals separately to avoid incomplete heap data Implement dumping of maps in crash dumps Buffer writing of crash dumps Conflicts: erts/emulator/beam/erl_alloc.types
2017-10-18Don't dump literal areas that are not referenced at allBjörn Gustavsson
2017-10-12Merge branch 'rickard/null-chars/ERL-370/OTP-14543'Rickard Green
* rickard/null-chars/ERL-370/OTP-14543: Don't allow null chars in various strings Conflicts: erts/emulator/beam/erl_alloc.types erts/preloaded/ebin/erlang.beam
2017-10-11Don't allow null chars in various stringsRickard Green
Various places that now reject null chars inside strings - Primitive file operations reject it in filenames. - Primitive environment variable operations reject it in names and values. - os:cmd() reject it in its input. Also '=' characters are rejected by primitive environment variable operations in environment variable names. Documentation has been updated to document null characters in these types of data as invalid. Currently these operations accept null chars at the end of strings, but that will change in the future.
2017-10-02erts: Move all I/O polling to a seperate threadLukas Larsson
2017-09-15erts: Remove undocumented driver_eventSverker Eriksson
2017-09-06stdlib: Improved BIF for binary matches and split.Andrew Bennett
2017-07-17erts: Cleanup alloc.types after non-smp removalLukas Larsson
2017-07-06Allow toggling lock counting at runtimeJohn Högberg
The implementation is still hidden behind ERTS_ENABLE_LOCK_COUNT, and all categories are still enabled by default, but the actual counting can be toggled at will. OTP-13170
2017-05-18Make lock counter info independent of the locks being countedJohn Högberg
This allows us to enable/disable lock counting at will, and greatly improves the performance of erts_debug:lock_counters/1 since we no longer have to worry about the lock counters "dying" while we're enumerating them. OTP-14412
2017-05-04Update copyright yearRaimo Niskanen
2017-04-18Remove accessor BIF timer implementationRickard Green
2017-03-28Merge branch 'sverker/hipe-long-lived'Sverker Eriksson
* sverker/hipe-long-lived: Make hipe_bifs:alloc_data/3 pad addr to alignment erts: Change HIPE allocations from sys_alloc
2017-03-17erts: Change HIPE allocations from sys_allocSverker Eriksson
to long lived, short lived and native stack.
2017-03-02Implement ets:all() using scheduler specific dataRickard Green
2017-02-20Merge branch 'master' into sverker/enif_selectSverker Eriksson
Conflicts: erts/emulator/beam/erl_binary.h erts/emulator/beam/erl_monitors.c erts/emulator/beam/erl_nif.c erts/emulator/beam/global.h erts/emulator/test/nif_SUITE_data/nif_SUITE.c
2017-02-14Fixed typos in ertsAndrew Dryga
2017-02-13Magic indirectionRickard Green
2017-02-06Implement magic referencesRickard Green
Magic references are *intentionally* indistinguishable from ordinary references for the Erlang software. Magic references do not change the language, and are intended as a pure runtime internal optimization. An ordinary reference is typically used as a key in some table. A magic reference has a direct pointer to a reference counted magic binary. This makes it possible to implement various things without having to do lookups in a table, but instead access the data directly. Besides very fast lookups this can also improve scalability by removing a potentially contended table. A couple of examples of planned future usage of magic references are ETS table identifiers, and BIF timer identifiers. Besides future optimizations using magic references it should also be possible to replace the exposed magic binary cludge with magic references. That is, magic binaries that are exposed as empty binaries to the Erlang software.
2017-02-03Merge branch 'master' into sverker/enif_selectSverker Eriksson
2017-01-12Return and exception trace for nif-export scheduled BIFsRickard Green
The support is somewhat primitive, since it is determined at call time if trace on return or exception should be sent.
2016-11-30erts: Add enif_select & enif_open_resource_type_xSverker Eriksson
2016-09-01Merge branch 'rickard/new-purge-strategy/OTP-13833' into maintRickard Green
* rickard/new-purge-strategy/OTP-13833: Fix reclaim of literal areas Conflicts: erts/emulator/beam/beam_bif_load.c
2016-09-01Fix reclaim of literal areasRickard Green
2016-08-29Fix tracing of processes executing dirtyRickard Green
2016-08-29Fix purge of codeRickard Green
Ensure that we cannot get any dangling pointers into code that has been purged. This is done by a two phase purge. At first phase all fun entries pointing into the code to purge are marked for purge. All processes trying to call these funs will be suspended and by this we avoid getting new direct references into the code. When all processes has been checked, these processes are resumed. The new purge strategy now also completely ignore the existence of indirect references to the code (funs). If such exist, they will cause bad fun exceptions to the caller, but will not prevent a soft purge or cause a kill of a process having such live references during a hard purge. This since it is impossible to give any guarantees that no processes in the system have such indirect references. Even when the system is completely clean from such references, new ones can appear via distribution and/or disk.
2016-08-26Reclaim literal area after purge has completedRickard Green
2016-05-11Add better support for communication with a process executing dirty NIFRickard Green
- Termination of a process... - Modify trace flags of process... - Process info on process... - Register/unregister of name on process... - Set group leader on process... ... while it is executing a dirty NIF.
2016-04-26Merge branch 'lukas/erts/non-smp-debug-fixes/OTP-13047'Lukas Larsson
* lukas/erts/non-smp-debug-fixes/OTP-13047: erts: Fix incorrect non-smp debug assert erts: std_alloc is not thread safe on non-smp Conflicts: erts/emulator/beam/erl_alloc_util.c