small clean
This commit is contained in:
parent
f92e5cf475
commit
bf5576f805
@ -5,7 +5,6 @@ require "virtual/instruction"
|
||||
require "virtual/compiled_method"
|
||||
require "virtual/slots/slot"
|
||||
require "virtual/type"
|
||||
require "virtual/object"
|
||||
require "virtual/constants"
|
||||
# the passes _are_ order dependant
|
||||
require "virtual/passes/send_implementation"
|
||||
|
@ -1,14 +1,12 @@
|
||||
require_relative "object"
|
||||
|
||||
module Virtual
|
||||
|
||||
|
||||
# Think flowcharts: blocks are the boxes. The smallest unit of linear code
|
||||
|
||||
# Blocks must end in control instructions (jump/call/return).
|
||||
# And the only valid argument for a jump is a Block
|
||||
|
||||
|
||||
# Blocks must end in control instructions (jump/call/return).
|
||||
# And the only valid argument for a jump is a Block
|
||||
|
||||
# Blocks form a graph, which is managed by the method
|
||||
|
||||
|
||||
class Block < Virtual::Object
|
||||
|
||||
def initialize(name , method )
|
||||
@ -21,7 +19,7 @@ module Virtual
|
||||
|
||||
attr_reader :name , :codes , :method
|
||||
attr_accessor :branch
|
||||
|
||||
|
||||
def reachable ret = []
|
||||
add_next ret
|
||||
add_branch ret
|
||||
@ -69,14 +67,14 @@ module Virtual
|
||||
end
|
||||
|
||||
private
|
||||
# helper for determining reachable blocks
|
||||
# helper for determining reachable blocks
|
||||
def add_next ret
|
||||
return if @next.nil?
|
||||
return if ret.include? @next
|
||||
ret << @next
|
||||
@next.reachable ret
|
||||
end
|
||||
# helper for determining reachable blocks
|
||||
# helper for determining reachable blocks
|
||||
def add_branch ret
|
||||
return if @branch.nil?
|
||||
return if ret.include? @branch
|
||||
@ -84,4 +82,4 @@ module Virtual
|
||||
@branch.reachable ret
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -38,19 +38,6 @@ module Virtual
|
||||
end
|
||||
attr_reader :me, :next_normal, :next_exception, :arguments , :frame
|
||||
|
||||
# dummy for the eventual
|
||||
def new_frame
|
||||
raise self.inspect
|
||||
end
|
||||
#
|
||||
def compile_get method , name
|
||||
raise "CALLED"
|
||||
if method.has_arg(name)
|
||||
method.add_code MessageGet.new(name)
|
||||
else
|
||||
method.add_code FrameGet.new(name)
|
||||
end
|
||||
method.get_var(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user