VM: removes a few methods related to relocation handling

They are only used once, so it is simpler to "inline" them
db4
Björn Lindqvist 2015-12-13 08:23:55 +01:00
parent 7da72ac77c
commit 0c9c0b2f82
3 changed files with 9 additions and 18 deletions

View File

@ -73,14 +73,8 @@ fixnum instruction_operand::load_value(cell relative_to) {
}
}
fixnum instruction_operand::load_value() { return load_value(pointer); }
code_block* instruction_operand::load_code_block(cell relative_to) {
return ((code_block*)load_value(relative_to) - 1);
}
code_block* instruction_operand::load_code_block() {
return load_code_block(pointer);
return ((code_block*)load_value(pointer) - 1);
}
/* Store a 32-bit value into a PowerPC LIS/ORI sequence */
@ -158,8 +152,4 @@ void instruction_operand::store_value(fixnum absolute_value) {
}
}
void instruction_operand::store_code_block(code_block* compiled) {
store_value(compiled->entry_point());
}
}

View File

@ -131,15 +131,12 @@ struct instruction_operand {
fixnum load_value_2_2_2_2();
fixnum load_value_masked(cell mask, cell bits, cell shift);
fixnum load_value(cell relative_to);
fixnum load_value();
code_block* load_code_block(cell relative_to);
code_block* load_code_block();
void store_value_2_2(fixnum value);
void store_value_2_2_2_2(fixnum value);
void store_value_masked(fixnum value, cell mask, cell shift);
void store_value(fixnum value);
void store_code_block(code_block* compiled);
};
}

View File

@ -370,8 +370,10 @@ void slot_visitor<Fixup>::visit_embedded_literals(code_block* compiled) {
return;
auto update_literal_refs = [&](instruction_operand op) {
if (op.rel.type() == RT_LITERAL)
op.store_value(visit_pointer(op.load_value()));
if (op.rel.type() == RT_LITERAL) {
fixnum value = op.load_value(op.pointer);
op.store_value(visit_pointer(value));
}
};
compiled->each_instruction_operand(update_literal_refs);
}
@ -441,8 +443,10 @@ void slot_visitor<Fixup>::visit_embedded_code_pointers(code_block* compiled) {
relocation_type type = op.rel.type();
if (type == RT_ENTRY_POINT ||
type == RT_ENTRY_POINT_PIC ||
type == RT_ENTRY_POINT_PIC_TAIL)
op.store_code_block(fixup.fixup_code(op.load_code_block()));
type == RT_ENTRY_POINT_PIC_TAIL) {
code_block* block = fixup.fixup_code(op.load_code_block());
op.store_value(block->entry_point());
}
};
compiled->each_instruction_operand(update_code_block_refs);
}