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

ruby-changes:37619

From: nobu <ko1@a...>
Date: Mon, 23 Feb 2015 16:05:37 +0900 (JST)
Subject: [ruby-changes:37619] nobu:r49700 (trunk): eval.c: static IDs

nobu	2015-02-23 16:05:30 +0900 (Mon, 23 Feb 2015)

  New Revision: 49700

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

  Log:
    eval.c: static IDs
    
    * eval.c (ruby_static_id_signo, ruby_static_id_status): add static
      IDs, signo and status.

  Modified files:
    trunk/error.c
    trunk/eval.c
    trunk/eval_error.c
    trunk/process.c
    trunk/signal.c
Index: eval_error.c
===================================================================
--- eval_error.c	(revision 49699)
+++ eval_error.c	(revision 49700)
@@ -255,7 +255,7 @@ rb_print_inaccessible(VALUE klass, ID id https://github.com/ruby/ruby/blob/trunk/eval_error.c#L255
 static int
 sysexit_status(VALUE err)
 {
-    VALUE st = rb_iv_get(err, "status");
+    VALUE st = rb_ivar_get(err, id_status);
     return NUM2INT(st);
 }
 
@@ -303,7 +303,7 @@ error_handle(int ex) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L303
 	    status = sysexit_status(errinfo);
 	}
 	else if (rb_obj_is_instance_of(errinfo, rb_eSignal) &&
-		 rb_iv_get(errinfo, "signo") != INT2FIX(SIGSEGV)) {
+		 rb_ivar_get(errinfo, id_signo) != INT2FIX(SIGSEGV)) {
 	    /* no message when exiting by signal */
 	}
 	else {
Index: eval.c
===================================================================
--- eval.c	(revision 49699)
+++ eval.c	(revision 49700)
@@ -24,6 +24,10 @@ NORETURN(void rb_raise_jump(VALUE, VALUE https://github.com/ruby/ruby/blob/trunk/eval.c#L24
 VALUE rb_eLocalJumpError;
 VALUE rb_eSysStackError;
 
+ID ruby_static_id_signo, ruby_static_id_status;
+#define id_signo ruby_static_id_signo
+#define id_status ruby_static_id_status
+
 #define exception_error GET_VM()->special_exceptions[ruby_error_reenter]
 
 #include "eval_error.c"
@@ -218,7 +222,7 @@ ruby_cleanup(volatile int ex) https://github.com/ruby/ruby/blob/trunk/eval.c#L222
 	    break;
 	}
 	else if (rb_obj_is_kind_of(err, rb_eSignal)) {
-	    VALUE sig = rb_iv_get(err, "signo");
+	    VALUE sig = rb_ivar_get(err, id_signo);
 	    state = NUM2INT(sig);
 	    break;
 	}
@@ -1711,4 +1715,7 @@ Init_eval(void) https://github.com/ruby/ruby/blob/trunk/eval.c#L1715
     rb_define_global_function("untrace_var", rb_f_untrace_var, -1);	/* in variable.c */
 
     rb_vm_register_special_exception(ruby_error_reenter, rb_eFatal, "exception reentered");
+
+    id_signo = rb_intern_const("signo");
+    id_status = rb_intern_const("status");
 }
Index: process.c
===================================================================
--- process.c	(revision 49699)
+++ process.c	(revision 49700)
@@ -256,7 +256,7 @@ typedef unsigned LONG_LONG unsigned_cloc https://github.com/ruby/ruby/blob/trunk/process.c#L256
 #endif
 
 static ID id_in, id_out, id_err, id_pid, id_uid, id_gid;
-static ID id_close, id_child, id_status;
+static ID id_close, id_child;
 #ifdef HAVE_SETPGID
 static ID id_pgroup;
 #endif
@@ -279,6 +279,8 @@ static ID id_CLOCK_BASED_CLOCK_PROCESS_C https://github.com/ruby/ruby/blob/trunk/process.c#L279
 static ID id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC;
 #endif
 static ID id_hertz;
+extern ID ruby_static_id_status;
+#define id_status ruby_static_id_status
 
 /*
  *  call-seq:
@@ -7820,7 +7822,6 @@ Init_process(void) https://github.com/ruby/ruby/blob/trunk/process.c#L7822
     id_gid = rb_intern("gid");
     id_close = rb_intern("close");
     id_child = rb_intern("child");
-    id_status = rb_intern("status");
 #ifdef HAVE_SETPGID
     id_pgroup = rb_intern("pgroup");
 #endif
Index: error.c
===================================================================
--- error.c	(revision 49699)
+++ error.c	(revision 49700)
@@ -646,10 +646,12 @@ VALUE rb_mErrno; https://github.com/ruby/ruby/blob/trunk/error.c#L646
 static VALUE rb_eNOERROR;
 
 static ID id_new, id_cause, id_message, id_backtrace;
-static ID id_status, id_name, id_args, id_Errno, id_errno, id_i_path;
+static ID id_name, id_args, id_Errno, id_errno, id_i_path;
+extern ID ruby_static_id_status;
 #define id_bt idBt
 #define id_bt_locations idBt_locations
 #define id_mesg idMesg
+#define id_status ruby_static_id_status
 
 #undef rb_exc_new_cstr
 
@@ -1913,7 +1915,6 @@ Init_Exception(void) https://github.com/ruby/ruby/blob/trunk/error.c#L1915
     id_cause = rb_intern_const("cause");
     id_message = rb_intern_const("message");
     id_backtrace = rb_intern_const("backtrace");
-    id_status = rb_intern_const("status");
     id_name = rb_intern_const("name");
     id_args = rb_intern_const("args");
     id_Errno = rb_intern_const("Errno");
Index: signal.c
===================================================================
--- signal.c	(revision 49699)
+++ signal.c	(revision 49700)
@@ -45,6 +45,9 @@ https://github.com/ruby/ruby/blob/trunk/signal.c#L45
 # include "nacl/signal.h"
 #endif
 
+extern ID ruby_static_id_signo;
+#define id_signo ruby_static_id_signo
+
 #ifdef NEED_RUBY_ATOMIC_OPS
 rb_atomic_t
 ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val)
@@ -326,7 +329,7 @@ esignal_init(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/signal.c#L329
 	sig = rb_sprintf("SIG%s", signm);
     }
     rb_call_super(1, &sig);
-    rb_iv_set(self, "signo", INT2NUM(signo));
+    rb_ivar_set(self, id_signo, INT2NUM(signo));
 
     return self;
 }
@@ -341,7 +344,7 @@ esignal_init(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/signal.c#L344
 static VALUE
 esignal_signo(VALUE self)
 {
-    return rb_iv_get(self, "signo");
+    return rb_ivar_get(self, id_signo);
 }
 
 /* :nodoc: */

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

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