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

ruby-changes:29152

From: nobu <ko1@a...>
Date: Mon, 10 Jun 2013 15:34:34 +0900 (JST)
Subject: [ruby-changes:29152] nobu:r41204 (trunk): eval_error.c: reduce setjmp

nobu	2013-06-10 15:34:28 +0900 (Mon, 10 Jun 2013)

  New Revision: 41204

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

  Log:
    eval_error.c: reduce setjmp
    
    * eval_error.c (error_print): reduce calling setjmp.

  Modified files:
    trunk/ChangeLog
    trunk/eval_error.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41203)
+++ ChangeLog	(revision 41204)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jun 10 15:34:26 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval_error.c (error_print): reduce calling setjmp.
+
 Mon Jun 10 12:10:06 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (integer_unpack_num_bdigits_small: Extracted from
Index: eval_error.c
===================================================================
--- eval_error.c	(revision 41203)
+++ eval_error.c	(revision 41204)
@@ -78,11 +78,11 @@ set_backtrace(VALUE info, VALUE bt) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L78
 static void
 error_print(void)
 {
-    volatile VALUE errat = Qnil;		/* OK */
+    volatile VALUE errat = Qundef;
     rb_thread_t *th = GET_THREAD();
     VALUE errinfo = th->errinfo;
     int raised_flag = th->raised_flag;
-    volatile VALUE eclass, e;
+    volatile VALUE eclass = Qundef, e = Qundef;
     const char *volatile einfo;
     volatile long elen;
 
@@ -94,11 +94,15 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L94
     if (TH_EXEC_TAG() == 0) {
 	errat = get_backtrace(errinfo);
     }
-    else {
+    else if (errat == Qundef) {
 	errat = Qnil;
     }
-    if (TH_EXEC_TAG())
+    else if (eclass == Qundef || e != Qundef) {
 	goto error;
+    }
+    else {
+	goto no_message;
+    }
     if (NIL_P(errat)) {
 	const char *file = rb_sourcefile();
 	int line = rb_sourceline();
@@ -123,18 +127,17 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L127
     }
 
     eclass = CLASS_OF(errinfo);
-    if (TH_EXEC_TAG() == 0) {
+    if (eclass != Qundef) {
 	e = rb_funcall(errinfo, rb_intern("message"), 0, 0);
 	StringValue(e);
 	einfo = RSTRING_PTR(e);
 	elen = RSTRING_LEN(e);
     }
     else {
+      no_message:
 	einfo = "";
 	elen = 0;
     }
-    if (TH_EXEC_TAG())
-	goto error;
     if (eclass == rb_eRuntimeError && elen == 0) {
 	warn_print(": unhandled exception\n");
     }

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

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