diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-06-10 17:18:07 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-06-10 17:18:07 +0200 |
commit | fc73f98012ab8a1688f1bdc9063bfe9d63a675c9 (patch) | |
tree | a172910c47478c661fbe44ffe0c3191280de0a38 /erts/emulator/beam/erl_gc.c | |
parent | 09255039607a53e2a74aa8ee1c6972982d647518 (diff) | |
parent | 528954b7ec9642f9ec987707352d558f9fd41446 (diff) | |
download | otp-fc73f98012ab8a1688f1bdc9063bfe9d63a675c9.tar.gz otp-fc73f98012ab8a1688f1bdc9063bfe9d63a675c9.tar.bz2 otp-fc73f98012ab8a1688f1bdc9063bfe9d63a675c9.zip |
Merge branch 'egil/fix-purge-literals/OTP-12821'
* egil/fix-purge-literals/OTP-12821:
erts: Fix garbage collect literals in code purge
Diffstat (limited to 'erts/emulator/beam/erl_gc.c')
-rw-r--r-- | erts/emulator/beam/erl_gc.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c index 1785fc27be..5a3fa33da8 100644 --- a/erts/emulator/beam/erl_gc.c +++ b/erts/emulator/beam/erl_gc.c @@ -677,7 +677,7 @@ erts_garbage_collect_literals(Process* p, Eterm* literals, Uint area_size; Eterm* old_htop; Uint n; - struct erl_off_heap_header** prev; + struct erl_off_heap_header** prev = NULL; if (p->flags & F_DISABLE_GC) return; @@ -786,10 +786,10 @@ erts_garbage_collect_literals(Process* p, Eterm* literals, */ if (oh) { - prev = &MSO(p).first; - while (*prev) { - prev = &(*prev)->next; - } + prev = &MSO(p).first; + while (*prev) { + prev = &(*prev)->next; + } } /* @@ -818,6 +818,10 @@ erts_garbage_collect_literals(Process* p, Eterm* literals, oh = oh->next; } + if (prev) { + *prev = NULL; + } + /* * We no longer need this temporary area. */ @@ -1870,6 +1874,21 @@ sweep_one_heap(Eterm* heap_ptr, Eterm* heap_end, Eterm* htop, char* src, Uint sr if (!header_is_thing(gval)) { heap_ptr++; } else { + if (header_is_bin_matchstate(gval)) { + ErlBinMatchState *ms = (ErlBinMatchState*) heap_ptr; + ErlBinMatchBuffer *mb = &(ms->mb); + Eterm* origptr; + origptr = &(mb->orig); + ptr = boxed_val(*origptr); + val = *ptr; + if (IS_MOVED_BOXED(val)) { + *origptr = val; + mb->base = binary_bytes(*origptr); + } else if (in_area(ptr, src, src_size)) { + MOVE_BOXED(ptr,val,htop,origptr); + mb->base = binary_bytes(*origptr); + } + } heap_ptr += (thing_arityval(gval)+1); } break; |