From 0c9c0b2f8241e33813703b705643dc60bf82981b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Sun, 13 Dec 2015 08:23:55 +0100 Subject: [PATCH] VM: removes a few methods related to relocation handling They are only used once, so it is simpler to "inline" them --- vm/instruction_operands.cpp | 12 +----------- vm/instruction_operands.hpp | 3 --- vm/slot_visitor.hpp | 12 ++++++++---- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/vm/instruction_operands.cpp b/vm/instruction_operands.cpp index d0e6d255b6..2bb62211d8 100644 --- a/vm/instruction_operands.cpp +++ b/vm/instruction_operands.cpp @@ -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()); -} - } diff --git a/vm/instruction_operands.hpp b/vm/instruction_operands.hpp index a8e0994fa7..eb3ef31a27 100644 --- a/vm/instruction_operands.hpp +++ b/vm/instruction_operands.hpp @@ -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); }; } diff --git a/vm/slot_visitor.hpp b/vm/slot_visitor.hpp index b8af8314bf..e1c1c7f803 100644 --- a/vm/slot_visitor.hpp +++ b/vm/slot_visitor.hpp @@ -370,8 +370,10 @@ void slot_visitor::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::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); }