remove set optimization
will become obsolete soon anyway
This commit is contained in:
parent
8642207158
commit
c3eb295f4e
@ -14,7 +14,6 @@ require "virtual/type"
|
||||
require "virtual/passes/minimizer"
|
||||
require "virtual/passes/collector"
|
||||
require "virtual/passes/enter_implementation"
|
||||
require "virtual/passes/set_optimisation"
|
||||
|
||||
|
||||
class Fixnum
|
||||
|
@ -1,19 +0,0 @@
|
||||
module Virtual
|
||||
|
||||
class SetOptimisation
|
||||
def run block
|
||||
block.codes.dup.each_with_index do |code , i|
|
||||
next unless code.is_a? Virtual::Set
|
||||
next_code = block.codes[i+1]
|
||||
next unless next_code.is_a? Virtual::Set
|
||||
next unless code.to == next_code.from
|
||||
# TODO: a correct implementation would have to check that the code.to
|
||||
# is not used in further blocks, before being assigned to
|
||||
new_code = Virtual::Set.new(code.from , next_code.to )
|
||||
block.replace(code , [new_code] )
|
||||
block.replace(next_code , [] )
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual.machine.add_pass "Virtual::SetOptimisation"
|
||||
end
|
@ -48,7 +48,7 @@ class AddTest < MiniTest::Test
|
||||
assert @interpreter.link
|
||||
end
|
||||
def test_adding
|
||||
done = ticks(23)
|
||||
done = ticks(25)
|
||||
assert_equal Register::OperatorInstruction , done.class
|
||||
left = @interpreter.get_register(done.left)
|
||||
rr = done.right
|
||||
@ -67,7 +67,7 @@ class AddTest < MiniTest::Test
|
||||
["Branch" , "LoadConstant" , "GetSlot" , "SetSlot" , "RegisterTransfer" ,
|
||||
"GetSlot" , "FunctionCall" , "SaveReturn" , "LoadConstant" , "SetSlot" ,
|
||||
"GetSlot" , "GetSlot" , "SetSlot" , "LoadConstant" , "SetSlot" ,
|
||||
"LoadConstant" , "SetSlot" , "RegisterTransfer" , "GetSlot" , "FunctionCall" ,
|
||||
"LoadConstant" , "SetSlot" , "GetSlot" , "SetSlot", "RegisterTransfer" , "GetSlot" , "FunctionCall" ,
|
||||
"SaveReturn" , "GetSlot", "OperatorInstruction" , "RegisterTransfer" , "GetSlot" , "GetSlot" ,
|
||||
"GetSlot" , "FunctionReturn" ,"RegisterTransfer" , "Syscall", "NilClass"].each_with_index do |name , index|
|
||||
got = ticks(1)
|
||||
|
Loading…
Reference in New Issue
Block a user