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

ruby-changes:42649

From: nobu <ko1@a...>
Date: Sat, 23 Apr 2016 11:27:14 +0900 (JST)
Subject: [ruby-changes:42649] nobu:r54723 (trunk): eval.c: reuse VM tag

nobu	2016-04-23 12:23:51 +0900 (Sat, 23 Apr 2016)

  New Revision: 54723

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

  Log:
    eval.c: reuse VM tag
    
    * eval.c (ruby_cleanup): reuse same VM tag by managing steps.

  Modified files:
    trunk/eval.c
Index: eval.c
===================================================================
--- eval.c	(revision 54722)
+++ eval.c	(revision 54723)
@@ -163,35 +163,34 @@ ruby_cleanup(volatile int ex) https://github.com/ruby/ruby/blob/trunk/eval.c#L163
     rb_thread_t *th = GET_THREAD();
     int nerr;
     volatile int sysex = EXIT_SUCCESS;
+    volatile int step = 0;
 
     rb_threadptr_interrupt(th);
     rb_threadptr_check_signal(th);
     TH_PUSH_TAG(th);
     if ((state = EXEC_TAG()) == 0) {
 	SAVE_ROOT_JMPBUF(th, { RUBY_VM_CHECK_INTS(th); });
-    }
-    TH_POP_TAG();
 
-    errs[1] = th->errinfo;
-    th->safe_level = 0;
-    ruby_init_stack(&errs[STACK_UPPER(errs, 0, 1)]);
+      step_0: step++;
+	errs[1] = th->errinfo;
+	th->safe_level = 0;
+	ruby_init_stack(&errs[STACK_UPPER(errs, 0, 1)]);
 
-    TH_PUSH_TAG(th);
-    if ((state = EXEC_TAG()) == 0) {
 	SAVE_ROOT_JMPBUF(th, ruby_finalize_0());
-    }
-    TH_POP_TAG();
 
-    /* protect from Thread#raise */
-    th->status = THREAD_KILLED;
+      step_1: step++;
+	/* protect from Thread#raise */
+	th->status = THREAD_KILLED;
 
-    errs[0] = th->errinfo;
-    TH_PUSH_TAG(th);
-    if ((state = EXEC_TAG()) == 0) {
+	errs[0] = th->errinfo;
 	SAVE_ROOT_JMPBUF(th, rb_thread_terminate_all());
     }
-    else if (ex == 0) {
-	ex = state;
+    else {
+	switch (step) {
+	  case 0: goto step_0;
+	  case 1: goto step_1;
+	}
+	if (ex == 0) ex = state;
     }
     th->errinfo = errs[1];
     sysex = error_handle(ex);

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

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