e$B1sF#$G$9!#e(B
NODE_FOR e$B$Ne(B internal_id e$B$,e(B VM::InstructionSequence#to_a
e$B$G=PNOe(B
e$B$5$l$J$$$?$a!"e(Bto_a e$B$7$Fe(B load e$B$7$Fe(B eval
e$B$9$k$HJQ$J$3$H$K$J$j$^$9!#e(B
$ ./ruby -e ’
VM::InstructionSequence.load(
VM::InstructionSequence.compile(
“for i in [1, 2, 3]; p i; end”
).to_a
).eval
’
-605544602
-605544602
-605544602
e$B$"$s$^$j<+?.$J$$$G$9$,!"%Q%C%A$r$D$1$^$9!#e(B
internal_id e$B$O%P%$%H%3!<%I>e$Ge(B nil
e$B$GI=$9$h$&$K$7$F$_$^$7$?!#e(B
e$B$D$$$G$K!“e(BVM::InstructionSequence.load
e$B$r%3%a%s%H%”%&%H$G$O$J$/e(B
e$B%^%/%m$GL58z2=$9$k$N$O$I$&$G$7$g$&$+!#e(BCFLAGS
e$B$@$1$GM-8z$K$G$-$ke(B
e$B$N$G3Z$G$9!#%F%9%H$r$7$F$/$l$ke(B (e$BCOMk$rF’$s$G$/$l$ke(B)
e$B?M$,A}$($ke(B
e$B$+$b$7$l$^$;$s!#e(B
Index: iseq.c
— iseq.c (revision 17564)
+++ iseq.c (working copy)
@@ -1034,11 +1034,11 @@
/* locals */
for (i=0; ilocal_table_size; i++) {
ID lid = iseq->local_table[i];
- if (lid) {
-
if (rb_id2str(lid)) rb_ary_push(locals, ID2SYM(lid));
- if (lid && rb_id2str(lid)) {
-
}rb_ary_push(locals, ID2SYM(lid));
else {
-
rb_ary_push(locals, ID2SYM(rb_intern("#arg_rest")));
-
}rb_ary_push(locals, Qnil);
}
@@ -1299,8 +1299,11 @@
rb_define_method(rb_cISeq, “eval”, iseq_eval, 0);
/* disable this feature because there is no verifier. */
- /* rb_define_singleton_method(rb_cISeq, “load”, iseq_s_load, -1);
*/
+#ifdef ANGEROUS_ISEQ_LOAD
-
rb_define_singleton_method(rb_cISeq, “load”, iseq_s_load, -1);
+#else
(void)iseq_s_load;
+#endifrb_define_singleton_method(rb_cISeq, “compile”, iseq_s_compile,
-1);
rb_define_singleton_method(rb_cISeq, “new”, iseq_s_compile, -1);
Index: compile.c
===================================================================
— compile.c (revision 17564)
+++ compile.c (working copy)
@@ -4996,7 +4996,7 @@for (i=0; i<RARRAY_LEN(locals); i++) {
VALUE lv = RARRAY_PTR(locals)[i];
- tbl[i] = FIXNUM_P(lv) ? FIX2INT(lv) : SYM2ID(CHECK_SYMBOL(lv));
-
tbl[i] = NIL_P(lv) ? 0 : SYM2ID(CHECK_SYMBOL(lv));
}/* args */