aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_message.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-05-27 10:21:30 +0200
committerRickard Green <[email protected]>2016-05-27 10:21:30 +0200
commita390d27f5c39d5a120db1f3e8e7185f85a05debd (patch)
tree3bd2a5e996576f5d07213f298e67b5a947b68ccf /erts/emulator/beam/erl_message.c
parent48d0c9844b1d205683dd3ef2ab6719e3f0f14aba (diff)
parent20383144c26512fe33e72f49dff52dc628666923 (diff)
downloadotp-a390d27f5c39d5a120db1f3e8e7185f85a05debd.tar.gz
otp-a390d27f5c39d5a120db1f3e8e7185f85a05debd.tar.bz2
otp-a390d27f5c39d5a120db1f3e8e7185f85a05debd.zip
Merge branch 'rickard/on_heap-fix/OTP-13366'
* rickard/on_heap-fix/OTP-13366: Improve message allocation in enif_send() Fix message queue update on replacement and removal of message
Diffstat (limited to 'erts/emulator/beam/erl_message.c')
-rw-r--r--erts/emulator/beam/erl_message.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index d82532b354..ac7b9d6606 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -1345,10 +1345,10 @@ erts_prep_msgq_for_inspection(Process *c_p, Process *rp,
mpp = i == 0 ? &rp->msg.first : &mip[i-1].msgp->next;
- if (rp->msg.save == &bad_mp->next)
- rp->msg.save = mpp;
- if (rp->msg.last == &bad_mp->next)
- rp->msg.last = mpp;
+ ASSERT((*mpp)->next == bad_mp);
+
+ erts_msgq_update_internal_pointers(&rp->msg, mpp, &bad_mp->next);
+
mp = mp->next;
*mpp = mp;
rp->msg.len--;
@@ -1385,12 +1385,7 @@ erts_prep_msgq_for_inspection(Process *c_p, Process *rp,
sys_memcpy((void *) tmp->m, (void *) mp->m,
sizeof(Eterm)*ERL_MESSAGE_REF_ARRAY_SZ);
mpp = i == 0 ? &rp->msg.first : &mip[i-1].msgp->next;
- tmp->next = mp->next;
- if (rp->msg.save == &mp->next)
- rp->msg.save = &tmp->next;
- if (rp->msg.last == &mp->next)
- rp->msg.last = &tmp->next;
- *mpp = tmp;
+ erts_msgq_replace_msg_ref(&rp->msg, tmp, mpp);
erts_save_message_in_proc(rp, mp);
mp = tmp;
}