From a37463ef14409c81422b3c3d6c35a0dbd21f51b7 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 9 Jun 2008 09:25:32 +0000 Subject: * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc. * *.c: no cache in init functions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 7362a0e6a..0424a8388 100644 --- a/compile.c +++ b/compile.c @@ -761,11 +761,9 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor) static int iseq_set_exception_local_table(rb_iseq_t *iseq) { - static ID id_dollar_bang; + ID id_dollar_bang; - if (!id_dollar_bang) { - id_dollar_bang = rb_intern("#$!"); - } + CONST_ID(id_dollar_bang, "#$!"); iseq->local_table = (ID *)ALLOC_N(ID *, 1); iseq->local_table_size = 1; iseq->local_size = iseq->local_table_size + 1; @@ -3718,15 +3716,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } /* only joke */ { - static ID goto_id; - static ID label_id; + ID goto_id; + ID label_id; VALUE label; VALUE label_sym; - if (goto_id == 0) { - goto_id = rb_intern("__goto__"); - label_id = rb_intern("__label__"); - } + + CONST_ID(goto_id, "__goto__"); + CONST_ID(label_id, "__label__"); if (nd_type(node) == NODE_FCALL && (mid == goto_id || mid == label_id)) { @@ -4319,14 +4316,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) break; } case NODE_SCLASS:{ + ID singletonclass; VALUE iseqval = NEW_ISEQVAL(node->nd_body, rb_str_new2("singletonclass"), ISEQ_TYPE_CLASS); COMPILE(ret, "sclass#recv", node->nd_recv); ADD_INSN (ret, nd_line(node), putnil); + CONST_ID(singletonclass, "singletonclass"); ADD_INSN3(ret, nd_line(node), defineclass, - ID2SYM(rb_intern("singletonclass")), iseqval, INT2FIX(1)); + ID2SYM(singletonclass), iseqval, INT2FIX(1)); if (poped) { ADD_INSN(ret, nd_line(node), pop); @@ -4787,6 +4786,7 @@ register_label(rb_iseq_t *iseq, struct st_table *labels_table, VALUE obj) static VALUE get_exception_sym2type(VALUE sym) { +#undef rb_intern static VALUE symRescue, symEnsure, symRetry; static VALUE symBreak, symRedo, symNext; -- cgit