start on passes

after all that booting and vm/parfait changes
passes have gone out of sync, start to fix
This commit is contained in:
Torsten Ruger 2015-05-24 13:55:05 +03:00
parent 47abdffd1a
commit 6786855e95
3 changed files with 25 additions and 12 deletions

View File

@ -23,7 +23,7 @@ module Virtual
else
next
end
space = Space.space
space = Parfait::Space.object_space
slot = Virtual::Slot
# a place to store a reference to the space, we grab the next_frame from the space
space_tmp = Register::RegisterReference.new(Virtual::Message::TMP_REG)

View File

@ -13,7 +13,7 @@ module Virtual
next unless code.is_a? MessageSend
new_codes = [ ]
ref = code.me
raise "only refs implemented #{ref.inspect}" unless ( ref.type == Reference)
raise "only refs implemented #{ref.type}" unless ( ref.type.is_a? Reference)
# value known at compile time, got do something with it
if(ref.value)
me = ref.value
@ -34,9 +34,17 @@ module Virtual
raise "unimplemented: \n#{code}"
end
else
# must defer send to run-time
# So inlining the code from message.send (in the future)
raise "not constant/ known object for send #{ref.inspect}"
if ref.type.is_a?(Reference) and ref.type.of_class
#find method and call
clazz = ref.type.of_class
method = clazz.resolve_method Virtual.new_word(code.name)
raise "No method found #{code.name}" unless method
new_codes << MethodCall.new( method )
else
# must defer send to run-time
# So inlining the code from message.send (in the future)
raise "not constant/ known object for send #{ref.inspect}"
end
end
block.replace(code , new_codes )
end

View File

@ -13,6 +13,11 @@ module Virtual
end
class Reference < Type
# possibly unknown value, but known class (as in methods)
def initialize clazz = nil
@of_class = clazz
end
attr_reader :of_class
end
class Mystery < Type