minor
This commit is contained in:
parent
a99e2602ae
commit
965e5f2a0f
@ -1,7 +1,7 @@
|
|||||||
module Register
|
module Register
|
||||||
|
|
||||||
# return from a function call
|
# return from a function call
|
||||||
#register and index specify where the return address is stored
|
# register and index specify where the return address is stored
|
||||||
|
|
||||||
class FunctionReturn < Instruction
|
class FunctionReturn < Instruction
|
||||||
def initialize register , index
|
def initialize register , index
|
||||||
|
@ -3,6 +3,9 @@ module Register
|
|||||||
# save the return address of a call
|
# save the return address of a call
|
||||||
# register and index specify where the return address is stored
|
# register and index specify where the return address is stored
|
||||||
|
|
||||||
|
# This instruction exists mainly, so we don't have to hard-code where the machine stores the
|
||||||
|
# address. In arm that is a register, but intel may (?) push it, and who knows, what other machines do.
|
||||||
|
|
||||||
class SaveReturn < Instruction
|
class SaveReturn < Instruction
|
||||||
def initialize register , index
|
def initialize register , index
|
||||||
@register = register
|
@register = register
|
||||||
|
@ -35,6 +35,7 @@ module Virtual
|
|||||||
@classes.values.each do |c|
|
@classes.values.each do |c|
|
||||||
c.instance_methods.each {|f| all += f.blocks }
|
c.instance_methods.each {|f| all += f.blocks }
|
||||||
end
|
end
|
||||||
|
#puts "running #{pass_class}"
|
||||||
all.each do |block|
|
all.each do |block|
|
||||||
pass = eval pass_class
|
pass = eval pass_class
|
||||||
raise "no such pass-class as #{pass_class}" unless pass
|
raise "no such pass-class as #{pass_class}" unless pass
|
||||||
@ -52,10 +53,14 @@ module Virtual
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Passes are initiated empty and added to by anyone who want (basically)
|
# Passes are initiated empty and added to by anyone who wants (basically)
|
||||||
# Even linking and assembly are passes and so there are quite a few system passes neccesary to result in a
|
# This is intentionally quite flexible, though one sometimes has to watch the order of them
|
||||||
# working binary. Other than that, this is intentionally quite flexible
|
# most ordering is achieved by ordering the requires and using add_pass
|
||||||
|
# but more precise control is possible with the _after and _before versions
|
||||||
|
|
||||||
|
def add_pass pass
|
||||||
|
@passes << pass
|
||||||
|
end
|
||||||
def add_pass_after( pass , after)
|
def add_pass_after( pass , after)
|
||||||
index = @passes.index(after)
|
index = @passes.index(after)
|
||||||
raise "No such pass (#{pass}) to add after: #{after}" unless index
|
raise "No such pass (#{pass}) to add after: #{after}" unless index
|
||||||
|
@ -44,7 +44,7 @@ module Virtual
|
|||||||
inspect
|
inspect
|
||||||
end
|
end
|
||||||
def mem_length
|
def mem_length
|
||||||
raise "abstract #{self}"
|
raise "abstract #{self.class}"
|
||||||
end
|
end
|
||||||
@@EMPTY = { :names => [] , :types => []}
|
@@EMPTY = { :names => [] , :types => []}
|
||||||
def layout
|
def layout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user