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

@ -69,7 +69,7 @@ module Arm
operand = reg_code(right)
immediate = 0 # ie not immediate is register
else
raise "invalid operand argument #{right.inspect} , #{inspect}"
raise "invalid operand argument #{right.class} , #{self.class}"
end
op = shift_handling
instuction_class = 0b00 # OPC_DATA_PROCESSING
@ -86,7 +86,7 @@ module Arm
# by now we have the extra add so assemble that
if(@extra)
@extra.assemble(io)
puts "Assemble extra at #{self.position.to_s(16)}"
#puts "Assemble extra at #{self.position.to_s(16)}"
end
end
def shift val , by

View File

@ -117,6 +117,13 @@ module Register
assemble_self( clazz , [clazz.name , clazz.super_class_name, clazz.instance_methods] )
end
def assemble_Message me
assemble_self(me , [])
end
def assemble_Frame me
assemble_self(me , [])
end
def assemble_CompiledMethod(method)
count = method.blocks.inject(0) { |c , block| c += block.mem_length }
word = (count+7) / 32 # all object are multiple of 8 words (7 for header)

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"