diff options
author | Björn Gustavsson <[email protected]> | 2018-04-04 06:46:10 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-04-06 13:06:52 +0200 |
commit | 90853d8e7b50be13a3b71f4a1ed6b0407e1f7c2f (patch) | |
tree | ccd63569a72f6e16c9cbf678cbea72d084d5917d /lib/compiler/src/core_parse.yrl | |
parent | 1328163db6d64d4a8309306cd4caeb43ffd5ecbb (diff) | |
download | otp-90853d8e7b50be13a3b71f4a1ed6b0407e1f7c2f.tar.gz otp-90853d8e7b50be13a3b71f4a1ed6b0407e1f7c2f.tar.bz2 otp-90853d8e7b50be13a3b71f4a1ed6b0407e1f7c2f.zip |
Check that messages outside of the heap are not corrupted
Waiting messages for a process may be stored in a queue
outside of any heap or heap fragment belonging to the process.
This is an optimization added in a recent major release to
avoid garbage collection messages again and again if there
is a long message queue.
Until such message has been matched and accepted by
the remove_message/0 instruction, the message must not be
included in the root set for a garbage collection, as that
would corrupt the message. The loop_rec/2 instruction explicitly
turns off garbage collection of the process as long messages
are being matched.
However, if the compiler were to put references to a message
outside of the heap in an Y register (on the stack) and there
happened to be a GC when the process had been scheduled out,
the message would be corrupted and the runtime system would
crash sooner or later.
To ensure that doesn't happen, teach beam_validator to check
for references on the stack to messages outside of the heap.
Diffstat (limited to 'lib/compiler/src/core_parse.yrl')
0 files changed, 0 insertions, 0 deletions