Move the Main instruction from register to virtual
also needs a branch in register. This way the register level is self sufficient (noticed while writing debugger)
This commit is contained in:
17
lib/register/passes/main_implementation.rb
Normal file
17
lib/register/passes/main_implementation.rb
Normal file
@ -0,0 +1,17 @@
|
||||
module Register
|
||||
|
||||
# "Boot" the virtual machine at the function given
|
||||
# meaning jump to that function currently. Maybe better to do some machine setup
|
||||
# and possibly some cleanup/exit has to tie in, but that is not this day
|
||||
|
||||
class MainImplementation
|
||||
def run block
|
||||
block.codes.dup.each do |code|
|
||||
next unless code.is_a? Virtual::VirtualMain
|
||||
branch = Register::Branch.new( code.method.source.blocks.first )
|
||||
block.replace(code , branch )
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual.machine.add_pass "Register::MainImplementation"
|
||||
end
|
Reference in New Issue
Block a user