Project

General

Profile

Feature #3638 » macro_yarv.patch

wanabe (_ wanabe), 08/01/2010 07:44 AM

View differences:

eval.c
{
rb_thread_t *th = GET_THREAD();
if ((th->cfp->lfp[0] & 0x02) == 0 &&
GC_GUARDED_PTR_REF(th->cfp->lfp[0])) {
if (!IN_CLASS_DEF(th->cfp) && BLOCK_PTR_REF(th->cfp)) {
return TRUE;
}
else {
......
while (RUBY_VM_VALID_CONTROL_FRAME_P(cfp, end_cfp)) {
if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) {
if (cfp->iseq->type == ISEQ_TYPE_RESCUE) {
return &cfp->dfp[-2];
return &ERRINFO(cfp);
}
else if (cfp->iseq->type == ISEQ_TYPE_ENSURE &&
TYPE(cfp->dfp[-2]) != T_NODE &&
!FIXNUM_P(cfp->dfp[-2])) {
return &cfp->dfp[-2];
TYPE(ERRINFO(cfp)) != T_NODE &&
!FIXNUM_P(ERRINFO(cfp))) {
return &ERRINFO(cfp);
}
}
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
eval_intern.h
#include "vm_core.h"
#define PASS_PASSED_BLOCK_TH(th) do { \
(th)->passed_block = GC_GUARDED_PTR_REF((rb_block_t *)(th)->cfp->lfp[0]); \
(th)->passed_block = BLOCK_PTR_REF((th)->cfp); \
(th)->cfp->flag |= VM_FRAME_FLAG_PASSED; \
} while (0)
proc.c
rb_control_frame_t *cfp = th->cfp;
rb_block_t *block;
if ((GC_GUARDED_PTR_REF(cfp->lfp[0])) != 0) {
if (BLOCK_PTR_REF(cfp) != 0) {
block = GC_GUARDED_PTR_REF(cfp->lfp[0]);
block = BLOCK_PTR_REF(cfp);
}
else {
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
if ((GC_GUARDED_PTR_REF(cfp->lfp[0])) != 0) {
if (BLOCK_PTR_REF(cfp) != 0) {
block = GC_GUARDED_PTR_REF(cfp->lfp[0]);
block = BLOCK_PTR_REF(cfp);
if (is_lambda) {
rb_warn("tried to create Proc object without a block");
vm.c
rb_vm_set_finish_env(rb_thread_t * th)
{
vm_push_frame(th, 0, VM_FRAME_MAGIC_FINISH,
Qnil, th->cfp->lfp[0], 0,
Qnil, BLOCK_PTR_RAW(th->cfp), 0,
th->cfp->sp, 0, 1);
th->cfp->pc = (VALUE *)&finish_insn_seq[0];
return Qtrue;
......
th->cfp->sp, block->lfp, iseq->local_size);
if (cref) {
th->cfp->dfp[-1] = (VALUE)cref;
CREF(th->cfp) = (VALUE)cref;
}
CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max);
......
rb_bug("rb_vm_make_proc: Proc value is already created.");
}
if (GC_GUARDED_PTR_REF(cfp->lfp[0])) {
if (BLOCK_PTR_REF(cfp)) {
rb_proc_t *p;
blockprocval = vm_make_proc_from_block(
......
th->passed_me = 0;
if (cref) {
th->cfp->dfp[-1] = (VALUE)cref;
CREF(th->cfp) = (VALUE)cref;
}
return vm_exec(th);
......
static inline const rb_block_t *
check_block(rb_thread_t *th)
{
const rb_block_t *blockptr = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
const rb_block_t *blockptr = BLOCK_PTR_REF(th->cfp);
if (blockptr == 0) {
rb_vm_localjump_error("no block given", Qnil, 0);
vm_core.h
#pragma GCC visibility pop
#endif
#define BLOCK_PTR_RAW(cfp) (cfp)->lfp[0]
#define BLOCK_PTR_REF(cfp) (GC_GUARDED_PTR_REF(BLOCK_PTR_RAW(cfp)))
#define IN_CLASS_DEF(cfp) (BLOCK_PTR_RAW(cfp) & 0x02)
#define SET_BLOCK_PTR(cfp, ptr) BLOCK_PTR_RAW(cfp) = GC_GUARDED_PTR(ptr)
#define ERRINFO(cfp) (cfp)->dfp[-2]
#define CREF(cfp) (cfp)->dfp[-1]
#define PREV_DFP_REF(cfp) GC_GUARDED_PTR_REF((cfp)->dfp[0])
#endif /* RUBY_VM_CORE_H */
vm_eval.c
blockptr->proc = 0;
}
else {
blockptr = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
blockptr = BLOCK_PTR_REF(th->cfp);
}
th->passed_block = blockptr;
}
......
rb_block_t block, *blockptr;
NODE *cref;
if ((blockptr = GC_GUARDED_PTR_REF(th->cfp->lfp[0])) != 0) {
if ((blockptr = BLOCK_PTR_REF(th->cfp)) != 0) {
block = *blockptr;
block.self = self;
th->cfp->lfp[0] = GC_GUARDED_PTR(&block);
SET_BLOCK_PTR(th->cfp, &block);
}
cref = vm_cref_push(th, under, NOEX_PUBLIC, blockptr);
cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
......
}
if (cfp->lfp != cfp->dfp) {
/* block */
VALUE *dfp = GC_GUARDED_PTR_REF(cfp->dfp[0]);
VALUE *dfp = PREV_DFP_REF(cfp);
if (vm_collect_local_variables_in_heap(th, dfp, ary)) {
break;
......
cfp = vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
if (cfp != 0 &&
(cfp->lfp[0] & 0x02) == 0 &&
GC_GUARDED_PTR_REF(cfp->lfp[0])) {
!IN_CLASS_DEF(cfp) &&
BLOCK_PTR_REF(cfp)) {
return Qtrue;
}
else {
    (1-1/1)