]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: removes a few methods related to relocation handling
authorBjörn Lindqvist <bjourne@gmail.com>
Sun, 13 Dec 2015 07:23:55 +0000 (08:23 +0100)
committerBjörn Lindqvist <bjourne@gmail.com>
Sun, 13 Dec 2015 12:56:36 +0000 (13:56 +0100)
They are only used once, so it is simpler to "inline" them

vm/instruction_operands.cpp
vm/instruction_operands.hpp
vm/slot_visitor.hpp

index d0e6d255b6b386d538c748508389d947960cbdc4..2bb62211d80d3bd874890fa6d4a5d13568889316 100644 (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());
-}
-
 }
index a8e0994fa7783179e070f43f67364da70d28d5eb..eb3ef31a2755a51929679e376e17eb69a42fc912 100644 (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);
 };
 
 }
index b8af8314bf53be3bfe9d614c840f7b7c65e093c5..e1c1c7f803241c2089eb1e9922f067c7c8e7343f 100644 (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);
 }