BlockEnvironment* BlockEnvironment::under_call_frame(STATE, CompiledCode* ccode, MachineCode* caller) { MachineCode* mcode = ccode->machine_code(); if(!mcode) { OnStack<1> os(state, ccode); mcode = ccode->internalize(state); if(!mcode) { Exception::internal_error(state, "invalid bytecode method"); return 0; } } BlockEnvironment* be = state->memory()->new_object<BlockEnvironment>(state, G(blokenv)); CallFrame* call_frame = state->vm()->call_frame(); be->scope(state, call_frame->promote_scope(state)); be->top_scope(state, call_frame->top_scope(state)); be->compiled_code(state, ccode); be->constant_scope(state, call_frame->constant_scope()); be->module(state, call_frame->module()); return be; }
BlockEnvironment* BlockEnvironment::dup(STATE) { BlockEnvironment* be = state->new_object_dirty<BlockEnvironment>(G(blokenv)); be->scope(state, scope_); be->top_scope(state, top_scope_); be->compiled_code(state, compiled_code_); be->constant_scope(state, constant_scope_); be->module(state, nil<Module>()); return be; }