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

ruby-changes:47097

From: nobu <ko1@a...>
Date: Fri, 30 Jun 2017 11:09:46 +0900 (JST)
Subject: [ruby-changes:47097] nobu:r59212 (trunk): compile.c: dump iseq

nobu	2017-06-30 11:09:42 +0900 (Fri, 30 Jun 2017)

  New Revision: 59212

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59212

  Log:
    compile.c: dump iseq
    
    * compile.c (append_compile_error): raise a fatal error when
      compile_debug is enabled.
    
    * compile.c (COMPILE_ERROR): dump the disassembled instruction
      instruction sequence always.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 59211)
+++ compile.c	(revision 59212)
@@ -321,7 +321,9 @@ struct iseq_compile_data_ensure_node_sta https://github.com/ruby/ruby/blob/trunk/compile.c#L321
 #define IS_INSN_ID(iobj, insn) (INSN_OF(iobj) == BIN(insn))
 
 /* error */
-typedef void (*compile_error_func)(rb_iseq_t *, int, const char *, ...);
+#if CPDEBUG > 0
+NORETURN(static void append_compile_error(rb_iseq_t *iseq, int line, const char *fmt, ...));
+#endif
 
 static void
 append_compile_error(rb_iseq_t *iseq, int line, const char *fmt, ...)
@@ -341,6 +343,7 @@ append_compile_error(rb_iseq_t *iseq, in https://github.com/ruby/ruby/blob/trunk/compile.c#L343
     else if (!err_info) {
 	RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->err_info, Qtrue);
     }
+    if (compile_debug) rb_exc_fatal(err);
 }
 
 static void
@@ -353,16 +356,7 @@ compile_bug(rb_iseq_t *iseq, int line, c https://github.com/ruby/ruby/blob/trunk/compile.c#L356
     abort();
 }
 
-NOINLINE(static compile_error_func prepare_compile_error(rb_iseq_t *iseq));
-
-static compile_error_func
-prepare_compile_error(rb_iseq_t *iseq)
-{
-    if (compile_debug) return &compile_bug;
-    return &append_compile_error;
-}
-
-#define COMPILE_ERROR prepare_compile_error(iseq)
+#define COMPILE_ERROR append_compile_error
 
 #define ERROR_ARGS_AT(n) iseq, nd_line(n),
 #define ERROR_ARGS ERROR_ARGS_AT(node)

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

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