diff --git a/lib/register/passes/frame_implementation.rb b/lib/register/passes/frame_implementation.rb deleted file mode 100644 index 3382bdcc..00000000 --- a/lib/register/passes/frame_implementation.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Register - # This implements the creation of a new frame object. - # Or to be more precise, it makes the frame available in a register, as the message (any message) - # carries a frame around which is reused. - - # Just as a reminder: a message object is used to send and holds return address/message - # and arguments + self - # frames are used by a method and hold local and temporary variables - - - class FrameImplementation - def run block - block.codes.dup.each do |code| - next unless code.is_a?(Virtual::NewFrame) - # load the frame from message by index, simple get_slot - new_codes = [ Register.get_slot( code, :message , :frame , Register.resolve_to_register(:frame))] - block.replace(code , new_codes ) - end - end - end - Virtual.machine.add_pass "Register::FrameImplementation" -end diff --git a/lib/register/register.rb b/lib/register/register.rb index 386a247a..4a377a97 100644 --- a/lib/register/register.rb +++ b/lib/register/register.rb @@ -1,7 +1,6 @@ require_relative "instruction" require_relative "register_value" require_relative "assembler" -require_relative "passes/frame_implementation" require_relative "passes/return_implementation" require_relative "passes/call_implementation" diff --git a/lib/virtual/instruction.rb b/lib/virtual/instruction.rb index e3b34d17..33704713 100644 --- a/lib/virtual/instruction.rb +++ b/lib/virtual/instruction.rb @@ -17,4 +17,3 @@ require_relative "instructions/halt" require_relative "instructions/method_call" require_relative "instructions/method_enter" require_relative "instructions/method_return" -require_relative "instructions/new_frame" diff --git a/lib/virtual/instructions/new_frame.rb b/lib/virtual/instructions/new_frame.rb deleted file mode 100644 index aa4366fd..00000000 --- a/lib/virtual/instructions/new_frame.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Virtual - - class NewFrame < Instruction - end - -end diff --git a/lib/virtual/passes/enter_implementation.rb b/lib/virtual/passes/enter_implementation.rb index d3b93d65..722cb13c 100644 --- a/lib/virtual/passes/enter_implementation.rb +++ b/lib/virtual/passes/enter_implementation.rb @@ -9,7 +9,7 @@ module Virtual new_codes << Register.save_return(code, :message , :return_address) # and create a new frame if needed unless code.method.locals.empty? - new_codes << Virtual::NewFrame.new + new_codes << Register.get_slot( code, :message , :frame , Register.resolve_to_register(:frame)) end block.replace(code , new_codes ) end