From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.4 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: spew@80x24.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 02C56633803 for ; Tue, 7 Jul 2015 07:36:50 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] compile.c (COMPILE_ERROR): reduce GET_THREAD() calls Date: Tue, 7 Jul 2015 07:36:50 +0000 Message-Id: <1436254610-9940-1-git-send-email-e@80x24.org> List-Id: 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