From 3fe35e34ec3883d77f88d571be1fa630cd726b79 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sun, 21 Jun 2015 17:22:51 +0300 Subject: [PATCH] fix slot constant access --- lib/register/passes/call_implementation.rb | 4 ++-- lib/register/passes/return_implementation.rb | 10 +++++----- lib/virtual.rb | 2 +- lib/virtual/passes/enter_implementation.rb | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/register/passes/call_implementation.rb b/lib/register/passes/call_implementation.rb index 14597932..7dc35571 100644 --- a/lib/register/passes/call_implementation.rb +++ b/lib/register/passes/call_implementation.rb @@ -1,6 +1,6 @@ module Register - # Defines the method call, ie + # Defines the method call, ie # - move the new_message to message # - unroll self and # - register call @@ -16,7 +16,7 @@ module Register # move the current new_message to message new_codes << RegisterTransfer.new( slot::NEW_MESSAGE_REGISTER , slot::MESSAGE_REGISTER ) # "roll out" self into its register - new_codes << GetSlot.new( slot::SELF_REGISTER ,slot::MESSAGE_REGISTER , slot::MESSAGE_SELF ) + new_codes << GetSlot.new( slot::SELF_REGISTER ,slot::MESSAGE_REGISTER , Virtual::MESSAGE_SELF ) # do the register call new_codes << FunctionCall.new( code.method ) block.replace(code , new_codes ) diff --git a/lib/register/passes/return_implementation.rb b/lib/register/passes/return_implementation.rb index 8b6b9694..d02a9d9f 100644 --- a/lib/register/passes/return_implementation.rb +++ b/lib/register/passes/return_implementation.rb @@ -1,19 +1,19 @@ module Register class ReturnImplementation def run block + slot = Virtual::Slot block.codes.dup.each do |code| next unless code.is_a? Virtual::MethodReturn new_codes = [] - slot = Virtual::Slot # move the current message to new_message new_codes << RegisterTransfer.new( slot::MESSAGE_REGISTER , slot::NEW_MESSAGE_REGISTER ) # and restore the message from saved value in new_message - new_codes << GetSlot.new( slot::MESSAGE_REGISTER , slot::NEW_MESSAGE_REGISTER , slot::MESSAGE_CALLER ) + new_codes << GetSlot.new( slot::MESSAGE_REGISTER , slot::NEW_MESSAGE_REGISTER , Virtual::MESSAGE_CALLER ) # "roll out" self and frame into their registers - new_codes << GetSlot.new( slot::SELF_REGISTER ,slot::MESSAGE_REGISTER , slot::MESSAGE_SELF ) - new_codes << GetSlot.new( slot::FRAME_REGISTER ,slot::MESSAGE_REGISTER , slot::MESSAGE_FRAME ) + new_codes << GetSlot.new( slot::SELF_REGISTER ,slot::MESSAGE_REGISTER , Virtual::MESSAGE_SELF ) + new_codes << GetSlot.new( slot::FRAME_REGISTER ,slot::MESSAGE_REGISTER , Virtual::MESSAGE_FRAME ) #load the return address into pc, affecting return. (other cpus have commands for this, but not arm) - new_codes << FunctionReturn.new( slot::MESSAGE_REGISTER , slot::MESSAGE_RETURN_ADDRESS ) + new_codes << FunctionReturn.new( slot::MESSAGE_REGISTER , Virtual::MESSAGE_RETURN_ADDRESS ) block.replace(code , new_codes ) end end diff --git a/lib/virtual.rb b/lib/virtual.rb index 9ec57813..13aaad17 100644 --- a/lib/virtual.rb +++ b/lib/virtual.rb @@ -16,7 +16,7 @@ require "virtual/passes/collector" require "virtual/passes/send_implementation" require "virtual/passes/get_implementation" require "virtual/passes/enter_implementation" -require "virtual/passes/frame_implementation" +require "virtual/passes/set_optimisation" Sof::Volotile.add(Parfait::Object , [:memory]) Sof::Volotile.add(Parfait::Method , [:memory]) diff --git a/lib/virtual/passes/enter_implementation.rb b/lib/virtual/passes/enter_implementation.rb index 793f25bf..6cc2da7b 100644 --- a/lib/virtual/passes/enter_implementation.rb +++ b/lib/virtual/passes/enter_implementation.rb @@ -7,7 +7,7 @@ module Virtual new_codes = [] # save return register and create a new frame # lr is link register, ie where arm stores the return address when call is issued - new_codes << Register::SaveReturn.new( Virtual::Slot::MESSAGE_REGISTER , Virtual::Slot::MESSAGE_RETURN_ADDRESS ) + new_codes << Register::SaveReturn.new( Virtual::Slot::MESSAGE_REGISTER , Virtual::MESSAGE_RETURN_ADDRESS ) new_codes << Virtual::NewFrame.new block.replace(code , new_codes ) end