mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* compile.c, vm.c, insns.def: call FrozenCore.set_postexe method
instead to use "postexe" insn. * id.c, id.h: add a prepared id for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1b62e5ec37
commit
807fbd6940
6 changed files with 39 additions and 26 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Tue Jul 1 21:13:17 2008 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* compile.c, vm.c, insns.def: call FrozenCore.set_postexe method
|
||||||
|
instead to use "postexe" insn.
|
||||||
|
|
||||||
|
* id.c, id.h: add a prepared id for above.
|
||||||
|
|
||||||
Tue Jul 1 21:09:58 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
|
Tue Jul 1 21:09:58 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||||
|
|
||||||
* lib/mkmf.rb (create_tmpsrc): we need to include COMMON_HEADERS,
|
* lib/mkmf.rb (create_tmpsrc): we need to include COMMON_HEADERS,
|
||||||
|
|
10
compile.c
10
compile.c
|
@ -4528,9 +4528,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
||||||
}
|
}
|
||||||
case NODE_POSTEXE:{
|
case NODE_POSTEXE:{
|
||||||
VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK);
|
VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK);
|
||||||
ADD_INSN1(ret, nd_line(node), postexe, block);
|
|
||||||
if (!poped) {
|
ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
|
||||||
ADD_INSN(ret, nd_line(node), putnil);
|
ADD_INSN1(ret, nd_line(node), putiseq, block);
|
||||||
|
ADD_SEND (ret, nd_line(node), ID2SYM(id_core_set_postexe), INT2FIX(1));
|
||||||
|
|
||||||
|
if (poped) {
|
||||||
|
ADD_INSN(ret, nd_line(node), pop);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
1
id.c
1
id.c
|
@ -74,4 +74,5 @@ Init_id(void)
|
||||||
id_core_undef_method = rb_intern("core_undef_method");
|
id_core_undef_method = rb_intern("core_undef_method");
|
||||||
id_core_define_method = rb_intern("core_define_method");
|
id_core_define_method = rb_intern("core_define_method");
|
||||||
id_core_define_singleton_method = rb_intern("core_define_singleton_method");
|
id_core_define_singleton_method = rb_intern("core_define_singleton_method");
|
||||||
|
id_core_set_postexe = rb_intern("core_set_postexe");
|
||||||
}
|
}
|
||||||
|
|
1
id.h
1
id.h
|
@ -58,5 +58,6 @@ extern ID id_core_set_variable_alias;
|
||||||
extern ID id_core_undef_method;
|
extern ID id_core_undef_method;
|
||||||
extern ID id_core_define_method;
|
extern ID id_core_define_method;
|
||||||
extern ID id_core_define_singleton_method;
|
extern ID id_core_define_singleton_method;
|
||||||
|
extern ID id_core_set_postexe;
|
||||||
|
|
||||||
#endif /* RUBY_ID_H */
|
#endif /* RUBY_ID_H */
|
||||||
|
|
23
insns.def
23
insns.def
|
@ -840,29 +840,6 @@ defined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
@c setting
|
|
||||||
@e END{}
|
|
||||||
@j END{} に対応するためにブロックを登録する。
|
|
||||||
*/
|
|
||||||
DEFINE_INSN
|
|
||||||
postexe
|
|
||||||
(ISEQ blockiseq)
|
|
||||||
()
|
|
||||||
()
|
|
||||||
{
|
|
||||||
rb_block_t *blockptr;
|
|
||||||
VALUE proc;
|
|
||||||
extern void rb_call_end_proc(VALUE data);
|
|
||||||
|
|
||||||
blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(GET_CFP());
|
|
||||||
blockptr->iseq = blockiseq;
|
|
||||||
blockptr->proc = 0;
|
|
||||||
|
|
||||||
proc = vm_make_proc(th, GET_CFP(), blockptr);
|
|
||||||
rb_set_end_proc(rb_call_end_proc, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@c setting
|
@c setting
|
||||||
@e trace
|
@e trace
|
||||||
|
|
23
vm.c
23
vm.c
|
@ -1669,6 +1669,28 @@ m_core_define_singleton_method(VALUE self, VALUE cbase, VALUE sym, VALUE iseqval
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
m_core_set_postexe(VALUE self, VALUE iseqval)
|
||||||
|
{
|
||||||
|
rb_iseq_t *blockiseq;
|
||||||
|
rb_block_t *blockptr;
|
||||||
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
rb_control_frame_t *cfp = vm_get_ruby_level_next_cfp(th, th->cfp);
|
||||||
|
VALUE proc;
|
||||||
|
extern void rb_call_end_proc(VALUE data);
|
||||||
|
|
||||||
|
GetISeqPtr(iseqval, blockiseq);
|
||||||
|
|
||||||
|
blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp);
|
||||||
|
blockptr->iseq = blockiseq;
|
||||||
|
blockptr->proc = 0;
|
||||||
|
|
||||||
|
proc = vm_make_proc(th, cfp, blockptr);
|
||||||
|
rb_set_end_proc(rb_call_end_proc, proc);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
VALUE insns_name_array(void);
|
VALUE insns_name_array(void);
|
||||||
extern VALUE *rb_gc_stack_start;
|
extern VALUE *rb_gc_stack_start;
|
||||||
extern size_t rb_gc_stack_maxsize;
|
extern size_t rb_gc_stack_maxsize;
|
||||||
|
@ -1725,6 +1747,7 @@ Init_VM(void)
|
||||||
rb_define_singleton_method(rb_mRubyVMFrozenCore, "core_undef_method", m_core_undef_method, 2);
|
rb_define_singleton_method(rb_mRubyVMFrozenCore, "core_undef_method", m_core_undef_method, 2);
|
||||||
rb_define_singleton_method(rb_mRubyVMFrozenCore, "core_define_method", m_core_define_method, 3);
|
rb_define_singleton_method(rb_mRubyVMFrozenCore, "core_define_method", m_core_define_method, 3);
|
||||||
rb_define_singleton_method(rb_mRubyVMFrozenCore, "core_define_singleton_method", m_core_define_singleton_method, 3);
|
rb_define_singleton_method(rb_mRubyVMFrozenCore, "core_define_singleton_method", m_core_define_singleton_method, 3);
|
||||||
|
rb_define_singleton_method(rb_mRubyVMFrozenCore, "core_set_postexe", m_core_set_postexe, 1);
|
||||||
rb_obj_freeze(rb_mRubyVMFrozenCore);
|
rb_obj_freeze(rb_mRubyVMFrozenCore);
|
||||||
|
|
||||||
/* ::VM::Env */
|
/* ::VM::Env */
|
||||||
|
|
Loading…
Add table
Reference in a new issue