[PATCH] D60039: Fix the bug of garbage collection of siod.
LuoYuanke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 20:11:53 PDT 2019
LuoYuanke updated this revision to Diff 193647.
LuoYuanke added a comment.
Use getcontext() only on linux platform.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60039/new/
https://reviews.llvm.org/D60039
Files:
MultiSource/Applications/siod/slib.c
Index: MultiSource/Applications/siod/slib.c
===================================================================
--- MultiSource/Applications/siod/slib.c
+++ MultiSource/Applications/siod/slib.c
@@ -129,7 +129,11 @@
struct user_type_hooks *user_types = NULL;
long user_tc_next = tc_user_min;
struct gc_protected *protected_registers = NULL;
+#if defined(linux)
+ucontext_t save_regs_gc_mark;
+#else
jmp_buf save_regs_gc_mark;
+#endif
double gc_rt;
long gc_cells_collected;
char *user_ch_readm = "";
@@ -1266,9 +1270,18 @@
{heap->type = tc_free_cell;
heap->gc_mark = 0;
++heap;}
+#if defined(linux)
+ // On linux, some register is mangled in jmp buffer, so object that
+ // is pointed by those register is collected as garbage. We use getcontext
+ // to avoid such issue.
+ getcontext(&save_regs_gc_mark);
+ mark_locations((LISP *) &save_regs_gc_mark.uc_mcontext,
+ (LISP *) (((char *) &save_regs_gc_mark.uc_mcontext) + sizeof(mcontext_t)));
+#else
setjmp(save_regs_gc_mark);
mark_locations((LISP *) save_regs_gc_mark,
(LISP *) (((char *) save_regs_gc_mark) + sizeof(save_regs_gc_mark)));
+#endif
mark_protected_registers();
mark_locations((LISP *) stack_start_ptr,
(LISP *) &stack_end);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60039.193647.patch
Type: text/x-patch
Size: 1236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190404/1135bebe/attachment.bin>
More information about the llvm-commits
mailing list