diff --git a/array.c b/array.c index 7edbd54..3bbf935 100644 --- a/array.c +++ b/array.c @@ -17,6 +17,7 @@ #include "ruby/encoding.h" #include "internal.h" #include "probes.h" +#include "id.h" #ifndef ARRAY_DEBUG # define NDEBUG @@ -3045,7 +3046,7 @@ take_items(VALUE obj, long n) if (!NIL_P(result)) return rb_ary_subseq(result, 0, n); result = rb_ary_new2(n); args[0] = result; args[1] = (VALUE)n; - if (rb_check_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args) == Qundef) + if (rb_check_block_call(obj, idEach, 0, 0, take_i, (VALUE)args) == Qundef) Check_Type(obj, T_ARRAY); return result; } diff --git a/enum.c b/enum.c index 9cce3e2..6da9370 100644 --- a/enum.c +++ b/enum.c @@ -2498,7 +2498,7 @@ enum_chunk(int argc, VALUE *argv, VALUE enumerable) rb_ivar_set(enumerator, rb_intern("chunk_enumerable"), enumerable); rb_ivar_set(enumerator, rb_intern("chunk_categorize"), rb_block_proc()); rb_ivar_set(enumerator, rb_intern("chunk_initial_state"), initial_state); - rb_block_call(enumerator, rb_intern("initialize"), 0, 0, chunk_i, enumerator); + rb_block_call(enumerator, idInitialize, 0, 0, chunk_i, enumerator); return enumerator; } @@ -2720,7 +2720,7 @@ enum_slice_before(int argc, VALUE *argv, VALUE enumerable) rb_ivar_set(enumerator, rb_intern("slicebefore_sep_pat"), sep_pat); } rb_ivar_set(enumerator, rb_intern("slicebefore_enumerable"), enumerable); - rb_block_call(enumerator, rb_intern("initialize"), 0, 0, slicebefore_i, enumerator); + rb_block_call(enumerator, idInitialize, 0, 0, slicebefore_i, enumerator); return enumerator; } diff --git a/insns.def b/insns.def index c491896..dc7a013 100644 --- a/insns.def +++ b/insns.def @@ -751,7 +751,7 @@ defined VALUE r; args[0] = obj; args[1] = Qfalse; - r = rb_check_funcall(v, rb_intern("respond_to_missing?"), 2, args); + r = rb_check_funcall(v, idRespond_to_missing, 2, args); if (r != Qundef && RTEST(r)) expr_type = DEFINED_METHOD; } diff --git a/io.c b/io.c index 7a89654..c678cc3 100644 --- a/io.c +++ b/io.c @@ -16,6 +16,7 @@ #include "ruby/thread.h" #include "dln.h" #include "internal.h" +#include "id.h" #include #include @@ -7579,7 +7580,7 @@ argf_getline(int argc, VALUE *argv, VALUE argf) retry: if (!next_argv()) return Qnil; if (ARGF_GENERIC_INPUT_P()) { - line = rb_funcall3(ARGF.current_file, rb_intern("gets"), argc, argv); + line = rb_funcall3(ARGF.current_file, idGets, argc, argv); } else { if (argc == 0 && rb_rs == rb_default_rs) { @@ -7657,7 +7658,7 @@ rb_f_gets(int argc, VALUE *argv, VALUE recv) if (recv == argf) { return argf_gets(argc, argv, argf); } - return rb_funcall2(argf, rb_intern("gets"), argc, argv); + return rb_funcall2(argf, idGets, argc, argv); } /* diff --git a/numeric.c b/numeric.c index 7912c62..c2562f4 100644 --- a/numeric.c +++ b/numeric.c @@ -13,6 +13,7 @@ #include "ruby/encoding.h" #include "ruby/util.h" #include "internal.h" +#include "id.h" #include #include #include @@ -1528,7 +1529,7 @@ int_round_0(VALUE num, int ndigits) ID op; /* If 10**N / 2 > num, then return 0 */ /* We have log_256(10) > 0.415241 and log_256(1/2) = -0.125, so */ - bytes = FIXNUM_P(num) ? sizeof(long) : rb_funcall(num, rb_intern("size"), 0); + bytes = FIXNUM_P(num) ? sizeof(long) : rb_funcall(num, idSize, 0); if (-0.415241 * ndigits - 0.125 > bytes ) { return INT2FIX(0); } diff --git a/parse.y b/parse.y index e458d4e..4788547 100644 --- a/parse.y +++ b/parse.y @@ -2837,13 +2837,13 @@ primary : literal m->nd_next = block_append( NEW_IF( NEW_NODE(NODE_AND, - NEW_CALL(NEW_CALL(NEW_DVAR(id), rb_intern("length"), 0), - rb_intern("=="), one), - NEW_CALL(NEW_CALL(NEW_DVAR(id), rb_intern("[]"), zero), + NEW_CALL(NEW_CALL(NEW_DVAR(id), idLength, 0), + idEq, one), + NEW_CALL(NEW_CALL(NEW_DVAR(id), idAREF, zero), rb_intern("kind_of?"), NEW_LIST(NEW_LIT(rb_cArray))), 0), NEW_DASGN_CURR(id, - NEW_CALL(NEW_DVAR(id), rb_intern("[]"), zero)), + NEW_CALL(NEW_DVAR(id), idAREF, zero)), 0), node_assign($2, NEW_DVAR(id))); diff --git a/process.c b/process.c index 1bda315..468498d 100644 --- a/process.c +++ b/process.c @@ -2851,7 +2851,7 @@ save_env(struct rb_execarg *sargp) VALUE env = rb_const_get(rb_cObject, rb_intern("ENV")); if (RTEST(env)) { VALUE ary = hide_obj(rb_ary_new()); - rb_block_call(env, rb_intern("each"), 0, 0, save_env_i, + rb_block_call(env, idEach, 0, 0, save_env_i, (VALUE)ary); sargp->env_modification = ary; } diff --git a/range.c b/range.c index 443ee6e..43c3389 100644 --- a/range.c +++ b/range.c @@ -12,6 +12,7 @@ #include "ruby/ruby.h" #include "ruby/encoding.h" #include "internal.h" +#include "id.h" #ifdef HAVE_FLOAT_H #include @@ -88,7 +89,7 @@ range_initialize(int argc, VALUE *argv, VALUE range) rb_scan_args(argc, argv, "21", &beg, &end, &flags); /* Ranges are immutable, so that they should be initialized only once. */ if (RANGE_EXCL(range) != Qnil) { - rb_name_error(rb_intern("initialize"), "`initialize' called twice"); + rb_name_error(idInitialize, "`initialize' called twice"); } range_init(range, beg, end, RTEST(flags)); return Qnil; @@ -432,7 +433,7 @@ range_step(int argc, VALUE *argv, VALUE range) else if (rb_obj_is_kind_of(b, rb_cNumeric) || !NIL_P(rb_check_to_integer(b, "to_int")) || !NIL_P(rb_check_to_integer(e, "to_int"))) { - ID op = EXCL(range) ? '<' : rb_intern("<="); + ID op = EXCL(range) ? '<' : idLE; VALUE v = b; int i = 0; @@ -924,7 +925,7 @@ range_first(int argc, VALUE *argv, VALUE range) rb_scan_args(argc, argv, "1", &n); ary[0] = n; ary[1] = rb_ary_new2(NUM2LONG(n)); - rb_block_call(range, rb_intern("each"), 0, 0, first_i, (VALUE)ary); + rb_block_call(range, idEach, 0, 0, first_i, (VALUE)ary); return ary[1]; }