aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_gc.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-05-26 16:17:45 +0200
committerRickard Green <[email protected]>2016-05-26 16:49:25 +0200
commit8241eb36a733d6fee7c4a6f12c8bdfc206889795 (patch)
treea8270151f11bd96846ae837bd99d72b49522a576 /erts/emulator/beam/erl_gc.c
parente5f436615f0649a4d19b03762c016e91e0dce0eb (diff)
downloadotp-8241eb36a733d6fee7c4a6f12c8bdfc206889795.tar.gz
otp-8241eb36a733d6fee7c4a6f12c8bdfc206889795.tar.bz2
otp-8241eb36a733d6fee7c4a6f12c8bdfc206889795.zip
Fix message queue update on replacement and removal of message
Diffstat (limited to 'erts/emulator/beam/erl_gc.c')
-rw-r--r--erts/emulator/beam/erl_gc.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index 374da9407c..c7bbbd5ca0 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -2293,18 +2293,13 @@ move_msgq_to_heap(Process *p)
free_message_buffer(bp);
}
else {
- ErtsMessage *tmp = erts_alloc_message(0, NULL);
- sys_memcpy((void *) tmp->m, (void *) mp->m,
- sizeof(Eterm)*ERL_MESSAGE_REF_ARRAY_SZ);
- tmp->next = mp->next;
- if (p->msg.save == &mp->next)
- p->msg.save = &tmp->next;
- if (p->msg.last == &mp->next)
- p->msg.last = &tmp->next;
- *mpp = tmp;
+ ErtsMessage *new_mp = erts_alloc_message(0, NULL);
+ sys_memcpy((void *) new_mp->m, (void *) mp->m,
+ sizeof(Eterm)*ERL_MESSAGE_REF_ARRAY_SZ);
+ erts_msgq_replace_msg_ref(&p->msg, new_mp, mpp);
mp->next = NULL;
erts_cleanup_messages(mp);
- mp = tmp;
+ mp = new_mp;
}
}