dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] compile.c (COMPILE_ERROR): reduce GET_THREAD() calls
@ 2015-07-07  7:36 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-07-07  7:36 UTC (permalink / raw)
  To: spew

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
---
 compile.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/compile.c b/compile.c
index 6757ea3..3249e9f 100644
--- a/compile.c
+++ b/compile.c
@@ -287,12 +287,13 @@ r_value(VALUE value)
 /* 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;                                           \
 }
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-07  7:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-07  7:36 [PATCH] compile.c (COMPILE_ERROR): reduce GET_THREAD() calls Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).