Skip to content

Commit

Permalink
Showing 32 changed files with 357 additions and 312 deletions.
4 changes: 1 addition & 3 deletions machine/call_frame.hpp
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ namespace rubinius {
MachineCode* machine_code;
InterpreterState* is;
UnwindInfoSet* unwinds;
UnwindInfo unwind_info;

// Stack
Object* stk[0];
@@ -186,9 +187,6 @@ namespace rubinius {
ip_ += width;
}

void next_ip() {
}

void ret_ip() {
ip_ = ret_ip_;
}
54 changes: 15 additions & 39 deletions machine/instructions/run_exception.hpp
Original file line number Diff line number Diff line change
@@ -2,20 +2,17 @@

namespace rubinius {
namespace instructions {
inline bool run_exception(STATE, CallFrame* call_frame) {
inline ExceptionContinuation run_exception(STATE, CallFrame* call_frame) {
VMThreadState* th = state->vm()->thread_state();

switch(th->raise_reason()) {
case cException:
if(call_frame->unwinds->has_unwinds()) {
// TODO: instructions, set this in call_frame
UnwindInfo info = call_frame->unwinds->pop();
stack_position(info.stack_depth);
call_frame->set_ip(info.target_ip);
return true;
call_frame->unwind_info = call_frame->unwinds->pop();
return cExceptionUnwind;
} else {
call_frame->scope->flush_to_heap(state);
return false;
}

case cBreak:
@@ -27,9 +24,7 @@ namespace rubinius {
/* Don't return here, because we want to loop back to the top and keep
* running this method.
*/
// TODO: instructions
call_frame->next_ip();
return true;
return cExceptionContinue;
}

// Otherwise, fall through and run the unwinds
@@ -39,14 +34,10 @@ namespace rubinius {
// Otherwise, we're doing a long return/break unwind through
// here. We need to run ensure blocks.
while(call_frame->unwinds->has_unwinds()) {
// TODO: instructions, set this in call_frame
UnwindInfo info = call_frame->unwinds->pop();
if(info.for_ensure()) {
stack_position(info.stack_depth);

call_frame->unwind_info = call_frame->unwinds->pop();
if(call_frame->unwind_info.for_ensure()) {
// Don't reset ep here, we're still handling the return/break.
call_frame->set_ip(info.target_ip);
return true;
return cExceptionUnwind;
}
}

@@ -59,48 +50,33 @@ namespace rubinius {
Object* val = th->raise_value();
th->clear_return();
stack_push(val);
call_frame->ret_ip();
// TODO: instructions
return true;
return cExceptionReturn;
} else {
// Give control of this exception to the caller.
stack_push(NULL);
call_frame->ret_ip();
// TODO: instructions
return false;
stack_push(nullptr);
}

} else { // Not for us!
call_frame->scope->flush_to_heap(state);

// Give control of this exception to the caller.
stack_push(NULL);
call_frame->ret_ip();
// TODO: instructions
return false;
stack_push(nullptr);
}

case cExit:
call_frame->scope->flush_to_heap(state);
stack_push(NULL);
call_frame->ret_ip();
// TODO: instructions
return false;
stack_push(nullptr);
break;
case cFiberCancel:
stack_push(NULL);
call_frame->ret_ip();
// TODO: instructions
return false;
stack_push(nullptr);
break;
default:
Exception::interpreter_error(state, "exception handler failed to dispatch");
stack_push(NULL);
call_frame->ret_ip();
// TODO: instructions
return false;
stack_push(nullptr);
break;
} // switch

return cExceptionReturn;
}
}
}
30 changes: 21 additions & 9 deletions machine/interpreter.cpp
Original file line number Diff line number Diff line change
@@ -21,9 +21,16 @@ namespace rubinius {
size_t calls_count = 0;
size_t constants_count = 0;

// Set exception handler IP
opcodes[total-1] =
reinterpret_cast<intptr_t>(instructions::data_run_exception.interpreter_address);

for(size_t width = 0, ip = 0; ip < total; ip += width) {
opcode op = opcodes[ip] = as<Fixnum>(ops->at(ip))->to_native();
width = Interpreter::instruction_data_(opcodes[ip]).width;
opcode op = as<Fixnum>(ops->at(ip))->to_native();
width = Interpreter::instruction_data_(op).width;

opcodes[ip] =
reinterpret_cast<intptr_t>(Interpreter::instruction_data_(op).interpreter_address);

switch(width) {
case 4:
@@ -67,9 +74,10 @@ namespace rubinius {
bool is_super = false;

for(size_t width = 0, ip = 0; ip < total; ip += width) {
width = InstructionSequence::instruction_width(opcodes[ip]);
opcode op = as<Fixnum>(ops->at(ip))->to_native();
width = Interpreter::instruction_data_(op).width;

switch(opcode op = opcodes[ip]) {
switch(op) {
case instructions::data_push_int.id:
opcodes[ip + 1] = reinterpret_cast<opcode>(Fixnum::from(opcodes[ip + 1]));
break;
@@ -133,10 +141,10 @@ namespace rubinius {

CallSite* call_site = CallSite::create(state, name, ip);

if(op == InstructionSequence::insn_send_vcall) {
if(op == instructions::data_send_vcall.id) {
allow_private = true;
call_site->set_is_vcall();
} else if(op == InstructionSequence::insn_object_to_s) {
} else if(op == instructions::data_object_to_s.id) {
allow_private = true;
}

@@ -173,10 +181,14 @@ namespace rubinius {
UnwindInfoSet unwinds;
Exception* exception = 0;
intptr_t* opcodes = (intptr_t*)machine_code->opcodes;
CallFrame* call_frame = state->vm()->call_frame();

state->vm()->call_frame()->is = &is;
state->vm()->call_frame()->unwinds = &unwinds;
CallFrame* call_frame = state->vm()->call_frame();
call_frame->ret_ip_ = machine_code->total - 2;
call_frame->exception_ip_ = machine_code->total - 1;
call_frame->stack_ptr_ = call_frame->stk - 1;
call_frame->machine_code = machine_code;
call_frame->is = &is;
call_frame->unwinds = &unwinds;

try {
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
3 changes: 1 addition & 2 deletions machine/interpreter/cast_array.cpp
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ namespace rubinius {
namespace interpreter {
intptr_t cast_array(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
if(instructions::cast_array(state, call_frame)) {
call_frame->next_ip();
call_frame->next_ip(instructions::data_cast_array.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_cast_array.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
3 changes: 1 addition & 2 deletions machine/interpreter/cast_for_multi_block_arg.cpp
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ namespace rubinius {
namespace interpreter {
intptr_t cast_for_multi_block_arg(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
if(instructions::cast_for_multi_block_arg(state, call_frame)) {
call_frame->next_ip();
call_frame->next_ip(instructions::data_cast_for_multi_block_arg.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_cast_for_multi_block_arg.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
3 changes: 1 addition & 2 deletions machine/interpreter/cast_for_single_block_arg.cpp
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ namespace rubinius {
namespace interpreter {
intptr_t cast_for_single_block_arg(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
if(instructions::cast_for_single_block_arg(state, call_frame)) {
call_frame->next_ip();
call_frame->next_ip(instructions::data_cast_for_single_block_arg.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_cast_for_single_block_arg.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
3 changes: 1 addition & 2 deletions machine/interpreter/cast_for_splat_block_arg.cpp
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ namespace rubinius {
namespace interpreter {
intptr_t cast_for_splat_block_arg(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
if(instructions::cast_for_splat_block_arg(state, call_frame)) {
call_frame->next_ip();
call_frame->next_ip(instructions::data_cast_for_splat_block_arg.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_cast_for_splat_block_arg.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
3 changes: 1 addition & 2 deletions machine/interpreter/cast_multi_value.cpp
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ namespace rubinius {
namespace interpreter {
intptr_t cast_multi_value(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
if(instructions::cast_multi_value(state, call_frame)) {
call_frame->next_ip();
call_frame->next_ip(instructions::data_cast_multi_value.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_cast_multi_value.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
3 changes: 1 addition & 2 deletions machine/interpreter/check_frozen.cpp
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ namespace rubinius {
namespace interpreter {
intptr_t check_frozen(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
if(instructions::check_frozen(state, call_frame)) {
call_frame->next_ip();
call_frame->next_ip(instructions::data_check_frozen.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_check_frozen.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/create_block.cpp
Original file line number Diff line number Diff line change
@@ -11,9 +11,12 @@ namespace rubinius {
intptr_t create_block(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t literal = argument(0);

instructions::create_block(state, call_frame, literal);
if(instructions::create_block(state, call_frame, literal)) {
call_frame->next_ip(instructions::data_create_block.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_create_block.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/find_const.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t find_const(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t literal = argument(0);

instructions::find_const(state, call_frame, literal);
if(instructions::find_const(state, call_frame, literal)) {
call_frame->next_ip(instructions::data_find_const.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_find_const.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
1 change: 0 additions & 1 deletion machine/interpreter/goto.cpp
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ namespace rubinius {
instructions::goto_(call_frame);
call_frame->set_ip(location);

call_frame->next_ip(instructions::data_goto.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
18 changes: 11 additions & 7 deletions machine/interpreter/instructions.hpp
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@

#include "defines.hpp"
#include "call_frame.hpp"
#include "machine_code.hpp"

#include "interpreter/prototypes.hpp"
#include "instructions/data.hpp"
@@ -15,14 +16,17 @@ typedef intptr_t (*Instruction)(STATE, CallFrame* call_frame, intptr_t const opc

#define CALL_FLAG_CONCAT 2

#define argument(n) opcodes[call_frame->ip() + n]
#define argument(n) opcodes[call_frame->ip() + n + 1]

// TODO: instructions
#define store_literal(x) (x)

#define STACK_PTR call_frame->stack_ptr_

/** We have to use the local here we need to evaluate val before we alter
* the stack. The reason is evaluating val might throw an exception. The
* old code used an undefined behavior, this forces the order. */
/* We have to use the local here we need to evaluate val before we alter the
* stack. The reason is evaluating val might throw an exception. The old code
* used an undefined behavior, this forces the order.
*/
#define stack_push(val) ({ Object* __stack_v = (val); *++STACK_PTR = __stack_v; })
#define stack_pop() (*STACK_PTR--)
#define stack_set_top(val) *STACK_PTR = (val)
@@ -35,7 +39,7 @@ typedef intptr_t (*Instruction)(STATE, CallFrame* call_frame, intptr_t const opc
#define stack_calculate_sp() (STACK_PTR - call_frame->stk)
#define stack_back_position(count) (STACK_PTR - (count - 1))

#define stack_local(which) call_frame->stk[/*machine_code->stack_size - */which - 1]
#define stack_local(which) call_frame->stk[call_frame->machine_code->stack_size - which - 1]

#define both_fixnum_p(_p1, _p2) ((uintptr_t)(_p1) & (uintptr_t)(_p2) & TAG_FIXNUM)

@@ -51,7 +55,7 @@ typedef intptr_t (*Instruction)(STATE, CallFrame* call_frame, intptr_t const opc
Exception::internal_error(state, "assertion failed: " #code); \
}

#define SET_CALL_FLAGS(val) (val) // is.call_flags = (val)
#define CALL_FLAGS() (1) // is.call_flags
#define SET_CALL_FLAGS(val) call_frame->is->call_flags = (val)
#define CALL_FLAGS() call_frame->is->call_flags

#endif
7 changes: 5 additions & 2 deletions machine/interpreter/invoke_primitive.cpp
Original file line number Diff line number Diff line change
@@ -6,9 +6,12 @@ namespace rubinius {
intptr_t literal = argument(0);
intptr_t count = argument(1);

instructions::invoke_primitive(state, call_frame, literal, count);
if(instructions::invoke_primitive(state, call_frame, literal, count)) {
call_frame->next_ip(instructions::data_invoke_primitive.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_invoke_primitive.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/object_to_s.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t object_to_s(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t literal = argument(0);

instructions::object_to_s(state, call_frame, literal);
if(instructions::object_to_s(state, call_frame, literal)) {
call_frame->next_ip(instructions::data_object_to_s.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_object_to_s.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
398 changes: 202 additions & 196 deletions machine/interpreter/prototypes.hpp

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions machine/interpreter/push_const.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t push_const(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t literal = argument(0);

instructions::push_const(state, call_frame, literal);
if(instructions::push_const(state, call_frame, literal)) {
call_frame->next_ip(instructions::data_push_const.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_push_const.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/push_ivar.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t push_ivar(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t literal = argument(0);

instructions::push_ivar(state, call_frame, literal);
if(instructions::push_ivar(state, call_frame, literal)) {
call_frame->next_ip(instructions::data_push_ivar.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_push_ivar.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
3 changes: 1 addition & 2 deletions machine/interpreter/raise_break.cpp
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ namespace rubinius {
namespace interpreter {
intptr_t raise_break(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
if(instructions::raise_break(state, call_frame)) {
call_frame->next_ip();
call_frame->next_ip(instructions::data_raise_break.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_raise_break.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
18 changes: 11 additions & 7 deletions machine/interpreter/run_exception.cpp
Original file line number Diff line number Diff line change
@@ -3,15 +3,19 @@
namespace rubinius {
namespace interpreter {
intptr_t run_exception(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
if(instructions::run_exception(state, call_frame)) {
// TODO: instructions, set unwind IP
call_frame->next_ip();
} else {
call_frame->ret_ip();
switch(instructions::run_exception(state, call_frame)) {
case instructions::cExceptionUnwind:
stack_position(call_frame->unwind_info.stack_depth);
call_frame->set_ip(call_frame->unwind_info.target_ip);
break;
case instructions::cExceptionContinue:
call_frame->next_ip(instructions::data_run_exception.width);
break;
case instructions::cExceptionReturn:
call_frame->ret_ip();
break;
}

// TODO: instructions, add instruction
// call_frame->next_ip(instructions::data_run_exception.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/send_method.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t send_method(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t literal = argument(0);

instructions::send_method(state, call_frame, literal);
if(instructions::send_method(state, call_frame, literal)) {
call_frame->next_ip(instructions::data_send_method.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_send_method.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/send_stack.cpp
Original file line number Diff line number Diff line change
@@ -6,9 +6,12 @@ namespace rubinius {
intptr_t literal = argument(0);
intptr_t count = argument(1);

instructions::send_stack(state, call_frame, literal, count);
if(instructions::send_stack(state, call_frame, literal, count)) {
call_frame->next_ip(instructions::data_send_stack.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_send_stack.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/send_stack_with_block.cpp
Original file line number Diff line number Diff line change
@@ -6,9 +6,12 @@ namespace rubinius {
intptr_t literal = argument(0);
intptr_t count = argument(1);

instructions::send_stack_with_block(state, call_frame, literal, count);
if(instructions::send_stack_with_block(state, call_frame, literal, count)) {
call_frame->next_ip(instructions::data_send_stack_with_block.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_send_stack_with_block.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/send_stack_with_splat.cpp
Original file line number Diff line number Diff line change
@@ -6,9 +6,12 @@ namespace rubinius {
intptr_t literal = argument(0);
intptr_t count = argument(1);

instructions::send_stack_with_splat(state, call_frame, literal, count);
if(instructions::send_stack_with_splat(state, call_frame, literal, count)) {
call_frame->next_ip(instructions::data_send_stack_with_splat.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_send_stack_with_splat.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/send_super_stack_with_block.cpp
Original file line number Diff line number Diff line change
@@ -6,9 +6,12 @@ namespace rubinius {
intptr_t literal = argument(0);
intptr_t count = argument(1);

instructions::send_super_stack_with_block(state, call_frame, literal, count);
if(instructions::send_super_stack_with_block(state, call_frame, literal, count)) {
call_frame->next_ip(instructions::data_send_super_stack_with_block.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_send_super_stack_with_block.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/send_super_stack_with_splat.cpp
Original file line number Diff line number Diff line change
@@ -6,9 +6,12 @@ namespace rubinius {
intptr_t literal = argument(0);
intptr_t count = argument(1);

instructions::send_super_stack_with_splat(state, call_frame, literal, count);
if(instructions::send_super_stack_with_splat(state, call_frame, literal, count)) {
call_frame->next_ip(instructions::data_send_super_stack_with_splat.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_send_super_stack_with_splat.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/send_vcall.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t send_vcall(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t literal = argument(0);

instructions::send_vcall(state, call_frame, literal);
if(instructions::send_vcall(state, call_frame, literal)) {
call_frame->next_ip(instructions::data_send_vcall.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_send_vcall.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/string_dup.cpp
Original file line number Diff line number Diff line change
@@ -3,9 +3,12 @@
namespace rubinius {
namespace interpreter {
intptr_t string_dup(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
instructions::string_dup(state, call_frame);
if(instructions::string_dup(state, call_frame)) {
call_frame->next_ip(instructions::data_string_dup.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_string_dup.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/yield_splat.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t yield_splat(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t count = argument(0);

instructions::yield_splat(state, call_frame, count);
if(instructions::yield_splat(state, call_frame, count)) {
call_frame->next_ip(instructions::data_yield_splat.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_yield_splat.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/yield_stack.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t yield_stack(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t count = argument(0);

instructions::yield_stack(state, call_frame, count);
if(instructions::yield_stack(state, call_frame, count)) {
call_frame->next_ip(instructions::data_yield_stack.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_yield_stack.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
7 changes: 5 additions & 2 deletions machine/interpreter/zsuper.cpp
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@ namespace rubinius {
intptr_t zsuper(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t literal = argument(0);

instructions::zsuper(state, call_frame, literal);
if(instructions::zsuper(state, call_frame, literal)) {
call_frame->next_ip(instructions::data_zsuper.width);
} else {
call_frame->exception_ip();
}

call_frame->next_ip(instructions::data_zsuper.width);
return ((Instruction)opcodes[call_frame->ip()])(state, call_frame, opcodes);
}
}
6 changes: 4 additions & 2 deletions machine/machine_code.cpp
Original file line number Diff line number Diff line change
@@ -81,12 +81,14 @@ namespace rubinius {
keywords_count = code->keywords()->num_fields() / 2;
}

opcodes = new opcode[total];

if(!name_->cpp_str(state).compare("a_very_special_method")) {
opcodes = new opcode[total+1];

run = (InterpreterRunner)Interpreter::execute;
Interpreter::prepare(state, code, this);
} else {
opcodes = new opcode[total];

fill_opcodes(state, code);
}

0 comments on commit 431d99c

Please sign in to comment.