From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] compile.c (COMPILE_ERROR): reduce GET_THREAD() calls
Date: Tue, 7 Jul 2015 07:36:50 +0000 [thread overview]
Message-ID: <1436254610-9940-1-git-send-email-e@80x24.org> (raw)
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
reply other threads:[~2015-07-07 7:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436254610-9940-1-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).