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

ruby-changes:39103

From: normal <ko1@a...>
Date: Tue, 7 Jul 2015 16:48:38 +0900 (JST)
Subject: [ruby-changes:39103] normal:r51184 (trunk): compile.c (COMPILE_ERROR): reduce GET_THREAD() calls

normal	2015-07-07 16:48:25 +0900 (Tue, 07 Jul 2015)

  New Revision: 51184

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

  Log:
    compile.c (COMPILE_ERROR): reduce GET_THREAD() calls
    
    Shorten a long line and reduce global variable access, giving
    a minor code size reduction (at least on 32-bit x86):
    
       text	   data	    bss	    dec	    hex	filename
      96807	    772	     48	  97627	  17d5b	compile.orig
      96775	    772	     48	  97595	  17d3b	compile.o

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51183)
+++ ChangeLog	(revision 51184)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul  7 16:47:30 2015  Eric Wong  <e@8...>
+
+	* compile.c (COMPILE_ERROR): reduce GET_THREAD() calls
+
 Tue Jul  7 16:39:04 2015  Eric Wong  <e@8...>
 
 	* random.c (fill_random_bytes_syscall): return -1 for error
Index: compile.c
===================================================================
--- compile.c	(revision 51183)
+++ compile.c	(revision 51184)
@@ -287,12 +287,13 @@ r_value(VALUE value) https://github.com/ruby/ruby/blob/trunk/compile.c#L287
 /* error */
 #define COMPILE_ERROR(strs)                        \
 {                                                  \
-  VALUE tmp = GET_THREAD()->errinfo;               \
+  rb_thread_t *th = GET_THREAD();                  \
+  VALUE tmp = th->errinfo;                         \
   if (compile_debug) rb_compile_bug strs;          \
-  GET_THREAD()->errinfo = iseq->compile_data->err_info;  \
+  th->errinfo = iseq->compile_data->err_info;      \
   rb_compile_error strs;                           \
-  RB_OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, GET_THREAD()->errinfo); \
-  GET_THREAD()->errinfo = tmp;                     \
+  RB_OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, th->errinfo); \
+  th->errinfo = tmp;                               \
   ret = 0;                                         \
   break;                                           \
 }

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

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