aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_message.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2016-07-26 10:19:31 +0200
committerBjörn-Egil Dahlberg <[email protected]>2016-08-01 10:58:59 +0200
commita2359927ca4e7c315e9849deec3375b1f2ae4170 (patch)
tree02858a93132a7da7acbd1487877259f63955445c /erts/emulator/beam/erl_message.c
parent8d4560198239256587ccc55895eb8fe2b214e971 (diff)
downloadotp-a2359927ca4e7c315e9849deec3375b1f2ae4170.tar.gz
otp-a2359927ca4e7c315e9849deec3375b1f2ae4170.tar.bz2
otp-a2359927ca4e7c315e9849deec3375b1f2ae4170.zip
erts: Remove the need for copying of literals
* Literals are not copied between processes for messages or spawn Increases performance of message sent and processes spawned when literals are involved in messages or arguments.
Diffstat (limited to 'erts/emulator/beam/erl_message.c')
-rw-r--r--erts/emulator/beam/erl_message.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index 91e06cde2d..14ee07a304 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -696,6 +696,9 @@ erts_send_message(Process* sender,
erts_aint32_t receiver_state;
#ifdef SHCOPY_SEND
erts_shcopy_t info;
+#else
+ Eterm *lit_purge_ptr = erts_clrange.ptr;
+ Uint lit_purge_sz = erts_clrange.sz;
#endif
#ifdef USE_VM_PROBES
@@ -725,7 +728,7 @@ erts_send_message(Process* sender,
*/
if (have_seqtrace(stoken)) {
seq_trace_update_send(sender);
- seq_trace_output(stoken, message, SEQ_TRACE_SEND,
+ seq_trace_output(stoken, message, SEQ_TRACE_SEND,
receiver->common.id, sender);
seq_trace_size = 6; /* TUPLE5 */
}
@@ -741,7 +744,7 @@ erts_send_message(Process* sender,
INITIALIZE_SHCOPY(info);
msize = copy_shared_calculate(message, &info);
#else
- msize = size_object(message);
+ msize = size_object_litopt(message, lit_purge_ptr, lit_purge_sz);
#endif
mp = erts_alloc_message_heap_state(receiver,
&receiver_state,
@@ -760,7 +763,8 @@ erts_send_message(Process* sender,
DESTROY_SHCOPY(info);
#else
if (is_not_immed(message))
- message = copy_struct(message, msize, &hp, ohp);
+ message = copy_struct_litopt(message, msize, &hp, ohp,
+ lit_purge_ptr, lit_purge_sz);
#endif
if (is_immed(stoken))
token = stoken;
@@ -796,7 +800,7 @@ erts_send_message(Process* sender,
INITIALIZE_SHCOPY(info);
msize = copy_shared_calculate(message, &info);
#else
- msize = size_object(message);
+ msize = size_object_litopt(message, lit_purge_ptr, lit_purge_sz);
#endif
mp = erts_alloc_message_heap_state(receiver,
&receiver_state,
@@ -810,7 +814,8 @@ erts_send_message(Process* sender,
DESTROY_SHCOPY(info);
#else
if (is_not_immed(message))
- message = copy_struct(message, msize, &hp, ohp);
+ message = copy_struct_litopt(message, msize, &hp, ohp,
+ lit_purge_ptr, lit_purge_sz);
#endif
}
#ifdef USE_VM_PROBES
@@ -998,8 +1003,8 @@ erts_move_messages_off_heap(Process *c_p)
hp = hfrag->mem;
if (is_not_immed(ERL_MESSAGE_TERM(mp)))
ERL_MESSAGE_TERM(mp) = copy_struct(ERL_MESSAGE_TERM(mp),
- msg_sz, &hp,
- &hfrag->off_heap);
+ msg_sz, &hp,
+ &hfrag->off_heap);
if (is_not_immed(ERL_MESSAGE_TOKEN(mp)))
ERL_MESSAGE_TOKEN(mp) = copy_struct(ERL_MESSAGE_TOKEN(mp),
token_sz, &hp,