diff options
author | Rickard Green <rickard@erlang.org> | 2021-04-15 19:22:12 +0200 |
---|---|---|
committer | Rickard Green <rickard@erlang.org> | 2021-04-27 13:10:37 +0200 |
commit | ae41aa141ea6a09af33a022c5964ad24708419cd (patch) | |
tree | 9efe7b0f88788c844d90b7bf4249cfa21194601d /erts/preloaded/src/erts_internal.erl | |
parent | a819f99cad0f7cf808eeae27d6b7590a4e83ab33 (diff) | |
download | erlang-ae41aa141ea6a09af33a022c5964ad24708419cd.tar.gz |
Prepare for literals in non-message signals
Previously references to literals could only exist in non-message
signals. We, however, at least need to allow literals in messages
passed using the alias-message signal, but also other non-message
signals, such as for example exit signals, should be able to contain
literals.
The most straightforward idea would be to handle all types of signals
that can contain literals. This however become quite complicated since
there are a lot of different signals with different layouts. Instead
of this we pass copy-literal-area signals to all processes after having
set the specific area as "copy literal area". All new signals being
created, after the area has been set, will copy the literals on creation
and will therefore not contain any references to the area being
released. When the copy-literal-area signal is received any references
to the literal area will either have been dropped or converted into
messages placed in the message queue. That is, at this point only the
message queue has to be inspected. By this we don't have to take care
of a lot of different signal types. Also when introducing new signal
types carrying literals we wont have to bother about this.
When the copy-literal-area signal is received, the message queue
is checked and any literals are copied into the messages. After that
the heap is scanned for references to the literal area. If references to
the area are found, a request for literal GC is sent as reply to the
literal-area-collector process; otherwise, a confirmation that the process
is clean is sent as reply. The copy-literal signal is prepared so it can be
reused when sending the reply message to the literal-area-collector
process. By this we significantly reduce the amount of allocations made
for the whole literal GC operation.
If a literal GC is needed, this will be scheduled as a system task at a
later time by the copy-literal-collector process when appropriate (using
the same approach as before).
Diffstat (limited to 'erts/preloaded/src/erts_internal.erl')
-rw-r--r-- | erts/preloaded/src/erts_internal.erl | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/erts/preloaded/src/erts_internal.erl b/erts/preloaded/src/erts_internal.erl index 361a5d42ef..9925dbd3f9 100644 --- a/erts/preloaded/src/erts_internal.erl +++ b/erts/preloaded/src/erts_internal.erl @@ -47,7 +47,7 @@ -export([is_process_executing_dirty/1]). -export([dirty_process_handle_signals/1]). --export([release_literal_area_switch/0, wait_release_literal_area_switch/1]). +-export([wait_release_literal_area_switch/1]). -export([purge_module/2]). @@ -350,11 +350,6 @@ is_process_executing_dirty(_Pid) -> dirty_process_handle_signals(_Pid) -> erlang:nif_error(undefined). --spec release_literal_area_switch() -> 'true' | 'false'. - -release_literal_area_switch() -> - erlang:nif_error(undefined). - -spec wait_release_literal_area_switch(WaitMsg) -> 'true' | 'false' when WaitMsg :: term(). @@ -362,7 +357,7 @@ wait_release_literal_area_switch(WaitMsg) -> %% release_literal_area_switch() traps to here %% when it needs to wait receive WaitMsg -> ok end, - erts_internal:release_literal_area_switch(). + erts_literal_area_collector:release_area_switch(). -spec purge_module(Module, Op) -> boolean() when Module :: module(), |