Skip to content

Commit

Permalink
Cleanup some old breakpoint cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Phoenix committed Sep 2, 2010
1 parent 903d16d commit 8fdb4a4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 77 deletions.
8 changes: 6 additions & 2 deletions vm/builtin/compiledmethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,12 @@ namespace rubinius {
int i = ip->to_native();
if(backend_method_ == NULL) return Qfalse;
if(!backend_method_->validate_ip(state, i)) return Primitives::failure();
if(backend_method_->get_breakpoint_flags(state, i) == cBreakpoint)
return Qtrue;
if(breakpoints_->nil_p()) return Qfalse;

bool found = false;
breakpoints_->fetch(state, ip, &found);

if(found) return Qtrue;
return Qfalse;
}

Expand Down
46 changes: 0 additions & 46 deletions vm/test/test_vmmethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,50 +72,4 @@ class TestVMMethod : public CxxTest::TestSuite, public VMTest {
TS_ASSERT_EQUALS(vmm->validate_ip(state, 1), false);
TS_ASSERT_EQUALS(vmm->validate_ip(state, 2), true);
}

void test_set_breakpoint_flags() {
CompiledMethod* cm = CompiledMethod::create(state);
Tuple* tup = Tuple::from(state, 1, state->symbol("@blah"));
cm->literals(state, tup);

InstructionSequence* iseq = InstructionSequence::create(state, 3);
iseq->opcodes()->put(state, 0, Fixnum::from(InstructionSequence::insn_push_ivar));
iseq->opcodes()->put(state, 1, Fixnum::from(0));
iseq->opcodes()->put(state, 2, Fixnum::from(InstructionSequence::insn_push_nil));

cm->iseq(state, iseq);

VMMethod* vmm = new VMMethod(state, cm);

vmm->set_breakpoint_flags(state, 0, 1 << 24);
TS_ASSERT_EQUALS(vmm->opcodes[0], (1U << 24) | static_cast<unsigned int>(InstructionSequence::insn_push_ivar));

vmm->set_breakpoint_flags(state, 0, 7 << 24);
TS_ASSERT_EQUALS(vmm->opcodes[0], (7U << 24) | static_cast<unsigned int>(InstructionSequence::insn_push_ivar));

vmm->set_breakpoint_flags(state, 0, 0);
TS_ASSERT_EQUALS(vmm->opcodes[0], static_cast<unsigned int>(InstructionSequence::insn_push_ivar));

vmm->set_breakpoint_flags(state, 1, 1);
TS_ASSERT_EQUALS(vmm->opcodes[1], 0U);
}

void test_get_breakpoint_flags() {
CompiledMethod* cm = CompiledMethod::create(state);
Tuple* tup = Tuple::from(state, 1, state->symbol("@blah"));
cm->literals(state, tup);

InstructionSequence* iseq = InstructionSequence::create(state, 3);
iseq->opcodes()->put(state, 0, Fixnum::from(InstructionSequence::insn_push_ivar));
iseq->opcodes()->put(state, 1, Fixnum::from(0));
iseq->opcodes()->put(state, 2, Fixnum::from(4 << 24 | InstructionSequence::insn_push_nil));

cm->iseq(state, iseq);

VMMethod* vmm = new VMMethod(state, cm);

TS_ASSERT_EQUALS(vmm->get_breakpoint_flags(state, 0), 0U);
TS_ASSERT_EQUALS(vmm->get_breakpoint_flags(state, 2), (4U << 24));
TS_ASSERT_EQUALS(vmm->get_breakpoint_flags(state, 1), 0U);
}
};
20 changes: 0 additions & 20 deletions vm/vmmethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,24 +655,4 @@ namespace rubinius {
}
return ip == iter.position();
}

/*
* Sets breakpoint flags on the specified opcode.
*/
void VMMethod::set_breakpoint_flags(STATE, size_t ip, bpflags flags) {
if(validate_ip(state, ip)) {
opcodes[ip] &= cBreakpointMask; // Clear the high byte
opcodes[ip] |= flags & ~cBreakpointMask;
}
}

/*
* Gets breakpoint flags on the specified opcode.
*/
bpflags VMMethod::get_breakpoint_flags(STATE, size_t ip) {
if(validate_ip(state, ip)) {
return opcodes[ip] & ~cBreakpointMask;
}
return 0;
}
}
10 changes: 1 addition & 9 deletions vm/vmmethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ namespace rubinius {

typedef std::list<Object**> IndirectLiterals;

// Breakpoint flags are set in the high byte of an opcode
const bpflags cBreakpoint = 1 << 24;
const bpflags cBreakAfterSend = 1 << 25;

const unsigned int cBreakpointMask = 0x00ffffff;

class CompiledMethod;
class MethodContext;
class SendSite;
Expand Down Expand Up @@ -124,7 +118,7 @@ namespace rubinius {
#endif

void update_addresses(int index, int operands=0) {
addresses[index] = instructions[opcodes[index] & cBreakpointMask];
addresses[index] = instructions[opcodes[index]];
switch(operands) {
case 2:
addresses[index + 2] = reinterpret_cast<void*>(opcodes[index + 2]);
Expand Down Expand Up @@ -211,8 +205,6 @@ namespace rubinius {
void setup_argument_handler(CompiledMethod* meth);

bool validate_ip(STATE, size_t ip);
void set_breakpoint_flags(STATE, size_t ip, bpflags flags);
bpflags get_breakpoint_flags(STATE, size_t ip);

void fill_opcodes(STATE, CompiledMethod* original);
void initialize_caches(STATE, CompiledMethod* original, int sends);
Expand Down

0 comments on commit 8fdb4a4

Please sign in to comment.