adjust branch names

IsXXX  with xxx as condition, same as after if_xxx
AlwaysBranch is back to Branch
This commit is contained in:
Torsten Ruger
2015-10-19 16:08:00 +03:00
parent 50379a1fea
commit 1fd937927c
10 changed files with 28 additions and 28 deletions

View File

@ -96,13 +96,13 @@ module Interpreter
end
# Instruction interpretation starts here
def execute_AlwaysBranch
def execute_Branch
target = @instruction.block
set_block target
false
end
def execute_IsZeroBranch
def execute_IsZero
#puts @instruction.inspect
if( @flags[:zero] )
target = @instruction.block

View File

@ -15,7 +15,7 @@ module Phisol
is = process(condition)
# TODO should/will use different branches for different conditions.
# just a scetch : cond_val = cond_val.is_true?(method) unless cond_val.is_a? BranchCondition
@method.source.add_code Register::IsZeroBranch.new( condition , true_block )
@method.source.add_code Register::IsZero.new( condition , true_block )
# compile the true block (as we think of it first, even it is second in sequential order)
@method.source.current true_block
@ -25,7 +25,7 @@ module Phisol
# compile the false block
@method.source.current false_block
last = process_all(if_false).last if if_false
@method.source.add_code Register::AlwaysBranch.new(statement, merge_block )
@method.source.add_code Register::Branch.new(statement, merge_block )
#puts "compiled if: end"
@method.source.current merge_block

View File

@ -14,12 +14,12 @@ module Phisol
cond = process(condition)
@method.source.add_code Register::IsZeroBranch.new(condition,merge)
@method.source.add_code Register::IsZero.new(condition,merge)
last = process_all(statements).last
# unconditionally branch to the start
@method.source.add_code Register::AlwaysBranch.new(statement,start)
@method.source.add_code Register::Branch.new(statement,start)
# continue execution / compiling at the merge block
@method.source.current merge

View File

@ -16,16 +16,16 @@ module Register
alias :inspect :to_s
end
class IsZeroBranch < Branch
class IsZero < Branch
end
class IsNegativeBranch < Branch
class IsNotzero < Branch
end
class IsPositiveBranch < Branch
class IsMinus < Branch
end
class AlwaysBranch < Branch
class IsPlus < Branch
end
end

View File

@ -118,7 +118,7 @@ module Virtual
def boot
boot_parfait!
@init = Block.new("init", :__init__ )
branch = Register::AlwaysBranch.new( "__init__" , self.space.get_init.source.blocks.first )
branch = Register::Branch.new( "__init__" , self.space.get_init.source.blocks.first )
@init.add_code branch
@booted = true
self