From 6c7004688bbbe6a73742917c4f7492e765a4ce88 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Thu, 25 Sep 2014 20:29:05 +0300 Subject: [PATCH] bit of namespace cleanup --- lib/register/return_implementation.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/register/return_implementation.rb b/lib/register/return_implementation.rb index 04f278bf..3c3a42b9 100644 --- a/lib/register/return_implementation.rb +++ b/lib/register/return_implementation.rb @@ -4,15 +4,17 @@ module Register block.codes.dup.each do |code| next unless code.is_a? Virtual::MethodReturn new_codes = [] + machine = RegisterMachine.instance + slot = Virtual::Slot # move the current message to new_message - new_codes << RegisterMachine.instance.mov( Virtual::Slot::MESSAGE_REGISTER , Virtual::Slot::NEW_MESSAGE_REGISTER ) + new_codes << machine.mov( slot::MESSAGE_REGISTER , slot::NEW_MESSAGE_REGISTER ) # and restore the message from saved value in new_message - new_codes << RegisterMachine.instance.ldr( Virtual::Slot::MESSAGE_REGISTER ,Virtual::Slot::NEW_MESSAGE_REGISTER , Virtual::Slot::MESSAGE_CALLER ) + new_codes << machine.ldr( slot::MESSAGE_REGISTER ,slot::NEW_MESSAGE_REGISTER , slot::MESSAGE_CALLER ) # "roll out" self and frame into their registers - new_codes << RegisterMachine.instance.ldr( Virtual::Slot::SELF_REGISTER ,Virtual::Slot::MESSAGE_REGISTER , Virtual::Slot::MESSAGE_SELF ) - new_codes << RegisterMachine.instance.ldr( Virtual::Slot::FRAME_REGISTER ,Virtual::Slot::MESSAGE_REGISTER , Virtual::Slot::MESSAGE_FRAME ) + new_codes << machine.ldr( slot::SELF_REGISTER ,slot::MESSAGE_REGISTER , slot::MESSAGE_SELF ) + new_codes << machine.ldr( slot::FRAME_REGISTER ,slot::MESSAGE_REGISTER , slot::MESSAGE_FRAME ) #load the return address into pc, affecting return. (other cpus have commands for this, but not arm) - new_codes << RegisterMachine.instance.ldr( :pc ,Virtual::Slot::MESSAGE_REGISTER , Virtual::Slot::MESSAGE_RETURN_ADDRESS ) + new_codes << machine.ldr( :pc ,slot::MESSAGE_REGISTER , slot::MESSAGE_RETURN_ADDRESS ) block.replace(code , new_codes ) end end