diff --git a/ChangeLog b/ChangeLog index 7ae04cb693..6e21900052 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Feb 27 12:13:32 2013 NARUSE, Yui + + * vm_exec.h (END_INSN): llvm-gcc may optimize out reg_cfp and cause + Stack/cfp consistency error when the instruction doesn't use reg_cfp. + Usually instructions use PUSH() but for example trace doesn't. + This hack cause speed down but you shouldn't use llvm-gcc, use clang. + [Bug #7938] + Wed Feb 27 10:23:00 2013 Zachary Scott * thread.c (thread_raise_m): rdoc formatting diff --git a/vm_exec.h b/vm_exec.h index 1853be9c2d..d371054bc9 100644 --- a/vm_exec.h +++ b/vm_exec.h @@ -116,9 +116,21 @@ error ! #endif /* DISPATCH_DIRECT_THREADED_CODE */ +#if defined(__llvm__) && !defined(__clang__) + /* llvm-gcc may optimize out reg_cfp and cause Stack/cfp consistency error + * when the instruction doesn't use reg_cfp. + * Usually instructions use PUSH() but for example trace doesn't. + * This hack cause speed down but you shouldn't use llvm-gcc, use clang. + */ +#define END_INSN(insn) \ + { rb_control_frame_t *volatile RB_UNUSED_VAR(tmpcfp) = reg_cfp; } \ + DEBUG_END_INSN(); \ + TC_DISPATCH(insn); +#else #define END_INSN(insn) \ DEBUG_END_INSN(); \ - TC_DISPATCH(insn); \ + TC_DISPATCH(insn); +#endif #define INSN_DISPATCH() \ TC_DISPATCH(__START__) \