summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-09 09:25:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-09 09:25:32 +0000
commit5a647a3f5fd011f8558c7f9e90cd65e70e73eb40 (patch)
tree294dcb47e83e5480b1fa992aba8a4b4025c8a626 /compile.c
parent250dd0702111d5c2086f007b1b31ecc1e36ade40 (diff)
* include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/compile.c b/compile.c
index 7362a0e6a5..0424a83884 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;