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:
@ -26,3 +26,4 @@ require_relative "instructions/method_return"
|
||||
require_relative "instructions/new_frame"
|
||||
require_relative "instructions/new_message"
|
||||
require_relative "instructions/set"
|
||||
require_relative "instructions/virtual_main"
|
||||
|
19
lib/virtual/instructions/virtual_main.rb
Normal file
19
lib/virtual/instructions/virtual_main.rb
Normal file
@ -0,0 +1,19 @@
|
||||
module Virtual
|
||||
|
||||
# This starts the Virtual machine machine at the given function.
|
||||
|
||||
# The implementation is most likely a jump/branch , but since we have the extra layer
|
||||
# we make good use of it, ie give things descriptive names (what they do, not how)
|
||||
|
||||
class VirtualMain < Instruction
|
||||
include Positioned
|
||||
|
||||
def initialize method
|
||||
@method = method
|
||||
end
|
||||
attr_reader :method
|
||||
def word_length
|
||||
4
|
||||
end
|
||||
end
|
||||
end
|
@ -124,7 +124,7 @@ module Virtual
|
||||
return if @booted
|
||||
boot_parfait!
|
||||
@init = Block.new("init",nil)
|
||||
@init.add_code Register::RegisterMain.new( self.space.get_init )
|
||||
@init.add_code Virtual::VirtualMain.new( self.space.get_init )
|
||||
@booted = true
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user