* vm.c (invoke_block_from_c): fix to point right cfp.

* vm.c (vm_make_proc, vm_make_proc_from_block), vm_core.h:
  remove unused parameter cfp.
* vm_insnhelper.c, proc.c (proc_new): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2008-12-24 12:56:58 +00:00
Родитель 7160543aeb
Коммит f23e8d87c0
5 изменённых файлов: 25 добавлений и 20 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Sun Dec 21 13:38:04 2008 Koichi Sasada <ko1@atdot.net>
* vm.c (invoke_block_from_c): fix to point right cfp.
* vm.c (vm_make_proc, vm_make_proc_from_block), vm_core.h:
remove unused parameter cfp.
* vm_insnhelper.c, proc.c (proc_new): ditto.
Wed Dec 24 20:59:12 2008 Koichi Sasada <ko1@atdot.net>
* error.c (exc_equal): == method should not raise Exception.

2
proc.c
Просмотреть файл

@ -387,7 +387,7 @@ proc_new(VALUE klass, int is_lambda)
return procval;
}
procval = vm_make_proc(th, cfp, block, klass);
procval = vm_make_proc(th, block, klass);
if (is_lambda) {
rb_proc_t *proc;

25
vm.c
Просмотреть файл

@ -385,43 +385,41 @@ vm_stack_to_heap(rb_thread_t * const th)
/* Proc */
static VALUE
vm_make_proc_from_block(rb_thread_t *th, rb_control_frame_t *cfp,
rb_block_t *block, VALUE klass)
vm_make_proc_from_block(rb_thread_t *th, rb_block_t *block, VALUE klass)
{
VALUE procval;
rb_control_frame_t *bcfp;
VALUE *bdfp; /* to gc mark */
procval = block->proc;
if (procval && RBASIC(procval)->klass == klass) {
return procval;
}
bcfp = RUBY_VM_GET_CFP_FROM_BLOCK_PTR(block);
bdfp = bcfp->dfp;
procval = vm_make_proc(th, bcfp, block, klass);
if (!block->proc) block->proc = procval;
procval = vm_make_proc(th, block, klass);
if (!block->proc) {
block->proc = procval;
}
return procval;
}
VALUE
vm_make_proc(rb_thread_t *th, rb_control_frame_t *cfp,
const rb_block_t *block, VALUE klass)
vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass)
{
VALUE procval, envval, blockprocval = 0;
rb_proc_t *proc;
rb_control_frame_t *cfp = RUBY_VM_GET_CFP_FROM_BLOCK_PTR(block);
if (GC_GUARDED_PTR_REF(cfp->lfp[0])) {
if (!RUBY_VM_CLASS_SPECIAL_P(cfp->lfp[0])) {
rb_proc_t *p;
blockprocval = vm_make_proc_from_block(
th, cfp, (rb_block_t *)GC_GUARDED_PTR_REF(*cfp->lfp), klass);
th, (rb_block_t *)GC_GUARDED_PTR_REF(*cfp->lfp), klass);
GetProcPtr(blockprocval, p);
*cfp->lfp = GC_GUARDED_PTR(&p->block);
}
}
envval = vm_make_env_object(th, cfp);
if (PROCDEBUG) {
@ -459,13 +457,14 @@ invoke_block_from_c(rb_thread_t *th, const rb_block_t *block,
{
if (BUILTIN_TYPE(block->iseq) != T_NODE) {
const rb_iseq_t *iseq = block->iseq;
const rb_control_frame_t *cfp = th->cfp;
const rb_control_frame_t *cfp;
int i, opt_pc, arg_size = iseq->arg_size;
int type = block_proc_is_lambda(block->proc) ?
VM_FRAME_MAGIC_LAMBDA : VM_FRAME_MAGIC_BLOCK;
rb_vm_set_finish_env(th);
cfp = th->cfp;
CHECK_STACK_OVERFLOW(cfp, argc + iseq->stack_max);
for (i=0; i<argc; i++) {
@ -1731,7 +1730,7 @@ m_core_set_postexe(VALUE self, VALUE iseqval)
blockptr->iseq = blockiseq;
blockptr->proc = 0;
proc = vm_make_proc(th, cfp, blockptr, rb_cProc);
proc = vm_make_proc(th, blockptr, rb_cProc);
rb_set_end_proc(rb_call_end_proc, proc);
});
return Qnil;

Просмотреть файл

@ -582,7 +582,7 @@ int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
VALUE vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
int argc, const VALUE *argv, rb_block_t *blockptr);
VALUE vm_make_proc(rb_thread_t *th, rb_control_frame_t *cfp, const rb_block_t *block, VALUE klass);
VALUE vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
VALUE vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));

Просмотреть файл

@ -185,10 +185,7 @@ vm_callee_setup_arg_complex(rb_thread_t *th, const rb_iseq_t * iseq,
/* make Proc object */
if (blockptr->proc == 0) {
rb_proc_t *proc;
blockval = vm_make_proc(th, RUBY_VM_GET_CFP_FROM_BLOCK_PTR(blockptr),
blockptr, rb_cProc);
blockval = vm_make_proc(th, blockptr, rb_cProc);
GetProcPtr(blockval, proc);
*block = &proc->block;
}
@ -664,7 +661,7 @@ vm_yield_with_cfunc(rb_thread_t *th, const rb_block_t *block,
}
if (blockptr) {
blockarg = vm_make_proc(th, th->cfp, blockptr, rb_cProc);
blockarg = vm_make_proc(th, blockptr, rb_cProc);
}
else {
blockarg = Qnil;