[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 19:47:46 PDT 2019


LuoYuanke added a comment.

In D60039#1453614 <https://reviews.llvm.org/D60039#1453614>, @jyknight wrote:

> I would question whether it's actually worth it to attempt to keep software working that seems to have been abandoned for a decade as part of the llvm test suite? Should this code just be removed, instead of patched?
>
> I'd note that not all platforms support getcontext -- at least Windows and OpenBSD don't. I don't actually know if this is expected to work on those platforms, but it definitely won't after this change.


To be conservatively, we may just fix it for x86_64 on linux.

  #if defined(__x86_64__)
   // On linux, rbp is mangled in jmp buffer, so object that pointed by rbp
   // is collected as garbage. We save rbp to stack_end so that the object
   // pointer can be found when scanning the stack.
   asm volatile ("movq %%rbp, %0":"=m"(stack_end)::);
  #endif

Or we just fix it on linux

  #if defined(linux)
  use getcontext
  #else
  use setjmp
  #endif

I prefer to fixing it on linux, because some register for other arch is also mangled in setjmp buffer.


Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60039/new/

https://reviews.llvm.org/D60039





More information about the llvm-commits mailing list