[前][次][番号順一覧][スレッド一覧]

ruby-changes:27465

From: naruse <ko1@a...>
Date: Wed, 27 Feb 2013 12:23:04 +0900 (JST)
Subject: [ruby-changes:27465] naruse:r39517 (trunk): * vm_exec.h (END_INSN): llvm-gcc may optimize out reg_cfp and cause

naruse	2013-02-27 12:22:50 +0900 (Wed, 27 Feb 2013)

  New Revision: 39517

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39517

  Log:
    * 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]

  Modified files:
    trunk/ChangeLog
    trunk/vm_exec.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39516)
+++ ChangeLog	(revision 39517)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Feb 27 12:13:32 2013  NARUSE, Yui  <naruse@r...>
+
+	* 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  <zachary@z...>
 
 	* thread.c (thread_raise_m): rdoc formatting
Index: vm_exec.h
===================================================================
--- vm_exec.h	(revision 39516)
+++ vm_exec.h	(revision 39517)
@@ -116,9 +116,21 @@ error ! https://github.com/ruby/ruby/blob/trunk/vm_exec.h#L116
 
 #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);        \
+  TC_DISPATCH(insn);
+#else
+#define END_INSN(insn)      \
+  DEBUG_END_INSN();         \
+  TC_DISPATCH(insn);
+#endif
 
 #define INSN_DISPATCH()     \
   TC_DISPATCH(__START__)    \

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]