From 8642207158264987b5ca7218382bd5de331c53ae Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 10 Oct 2015 11:17:04 +0300 Subject: [PATCH] remove instance_get instruction --- lib/virtual.rb | 1 - lib/virtual/instruction.rb | 1 - lib/virtual/instructions/instance_get.rb | 13 ------------- lib/virtual/machine.rb | 2 +- lib/virtual/passes/get_implementation.rb | 16 ---------------- 5 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 lib/virtual/instructions/instance_get.rb delete mode 100644 lib/virtual/passes/get_implementation.rb diff --git a/lib/virtual.rb b/lib/virtual.rb index dffac792..5bc91cd5 100644 --- a/lib/virtual.rb +++ b/lib/virtual.rb @@ -13,7 +13,6 @@ require "virtual/type" # the passes _are_ order dependant require "virtual/passes/minimizer" require "virtual/passes/collector" -require "virtual/passes/get_implementation" require "virtual/passes/enter_implementation" require "virtual/passes/set_optimisation" diff --git a/lib/virtual/instruction.rb b/lib/virtual/instruction.rb index 640ed3e8..e311c7d1 100644 --- a/lib/virtual/instruction.rb +++ b/lib/virtual/instruction.rb @@ -14,7 +14,6 @@ module Virtual end require_relative "instructions/halt" -require_relative "instructions/instance_get" require_relative "instructions/method_call" require_relative "instructions/method_enter" require_relative "instructions/method_return" diff --git a/lib/virtual/instructions/instance_get.rb b/lib/virtual/instructions/instance_get.rb deleted file mode 100644 index cf843c14..00000000 --- a/lib/virtual/instructions/instance_get.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Virtual - - # Get a instance variable by _name_ . So we have to resolve the name to an index to - # transform into a Slot - # The slot may the be used in a set on left or right hand. - # The transformation is done by GetImplementation - class InstanceGet < Instruction - def initialize name - @name = name.to_sym - end - attr_reader :name - end -end diff --git a/lib/virtual/machine.rb b/lib/virtual/machine.rb index 35c82bbc..cc2f8229 100644 --- a/lib/virtual/machine.rb +++ b/lib/virtual/machine.rb @@ -36,7 +36,7 @@ module Virtual class Machine - FIRST_PASS = "Virtual::GetImplementation" + FIRST_PASS = "Virtual::EnterImplementation" LAST_PASS = "Virtual::SetOptimisation" def initialize diff --git a/lib/virtual/passes/get_implementation.rb b/lib/virtual/passes/get_implementation.rb deleted file mode 100644 index b53d8e95..00000000 --- a/lib/virtual/passes/get_implementation.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Virtual - # This implements instance variable get (not the opposite of Set, - # such a thing does not exists, their slots) - - # Ivar get needs to acces the layout, find the index of the name, - # and shuffle the data to return register - # In short it's so complicated we implement it in ruby and stick the implementation here - class GetImplementation - def run block - block.codes.dup.each do |code| - next unless code.is_a? Virtual::InstanceGet - raise "Start coding" - end - end - end -end