more headway on the (new) frame implementation

This commit is contained in:
Torsten Ruger
2014-09-27 14:59:16 +03:00
parent 2ce17ed5ff
commit 5a17bf3396
5 changed files with 27 additions and 6 deletions

View File

@ -12,7 +12,7 @@ module Virtual
# While data ususally would live in a .data section, we may also "inline" it into the code
# in an oo system all data is represented as objects
class BootSpace < Virtual::Object
class BootSpace < Virtual::ObjectConstant
def initialize
super()

View File

@ -16,11 +16,24 @@ module Virtual
class FrameImplementation
def run block
block.codes.dup.each do |code|
next unless code.is_a?(NewFrame) or code.is_a?(NewMessage)
new_codes = [ ]
if code.is_a?(NewFrame)
kind = :next_frame
elsif code.is_a?(NewMessage)
kind = :next_message
else
next
end
space = BootSpace.space
machine = Register::RegisterMachine.instance
slot = Virtual::Slot
space_tmp = Register::RegisterReference.new(Virtual::Message::TMP_REG)
frame_tmp = space_tmp.next_reg_use
new_codes = [ machine.mov( frame_tmp , space )]
ind = space.layout[:names].index(kind)
new_codes << machine.ldr( frame_tmp , frame_tmp , ind)
block.replace(code , new_codes )
end
end
end
Virtual::BootSpace.space.add_pass_after FrameImplementation , GetImplementation
end

View File

@ -86,3 +86,4 @@ require_relative "constants"
require_relative "boot_space"
require_relative "send_implementation"
require_relative "get_implementation"
require_relative "frame_implementation"