more test fixes and more to do
This commit is contained in:
@ -6,7 +6,10 @@ module Mom
|
||||
class BlockYield < Instruction
|
||||
attr :arg_index
|
||||
|
||||
def initialize(index)
|
||||
# pass in the source (vool statement) and the index.
|
||||
# The index is the argument index of the block that we call
|
||||
def initialize(source , index)
|
||||
super(source)
|
||||
@arg_index = index
|
||||
end
|
||||
|
||||
@ -14,6 +17,7 @@ module Mom
|
||||
"BlockYield[#{arg_index}] "
|
||||
end
|
||||
|
||||
# almost as simple as a SimpleCall, use a dynamic_jump to get there
|
||||
def to_risc(compiler)
|
||||
return_label = Risc.label("block_yield", "continue_#{object_id}")
|
||||
index = arg_index
|
||||
|
@ -15,7 +15,11 @@ module Mom
|
||||
class ResolveMethod < Instruction
|
||||
attr :cache_entry , :name
|
||||
|
||||
def initialize(name , cache_entry)
|
||||
# pass in source (VoolStatement)
|
||||
# name of the method (don't knwow the actaual method)
|
||||
# and the cache_entry
|
||||
def initialize(source , name , cache_entry)
|
||||
super(source)
|
||||
@name = name
|
||||
@cache_entry = cache_entry
|
||||
end
|
||||
|
@ -53,17 +53,15 @@ module RubyX
|
||||
# translates those to the platform given
|
||||
#
|
||||
# After creating vool, we call to_risc
|
||||
def ruby_to_risc(ruby, platform)
|
||||
def ruby_to_risc(ruby)
|
||||
ruby_to_vool(ruby)
|
||||
to_risc(platform)
|
||||
to_risc()
|
||||
end
|
||||
|
||||
# Process previously stored vool source. First to mom, then to platform.
|
||||
# Translating to platform returns a linker that is returned and can be used
|
||||
# to generate binaries
|
||||
def to_risc(platform)
|
||||
# Process previously stored vool source. First to mom, then to risc.
|
||||
def to_risc()
|
||||
mom = to_mom
|
||||
mom.to_risc(platform)
|
||||
mom.to_risc()
|
||||
end
|
||||
|
||||
# ruby_to_mom does exactly that, it transform the incoming ruby source (string)
|
||||
|
@ -73,10 +73,10 @@ module Vool
|
||||
# if not, change and find method for the type (simple_call to resolve_method)
|
||||
# conceptually easy in ruby, but we have to compile that "easy" ruby
|
||||
def cache_check(compiler)
|
||||
ok = Mom::Label.new("cache_ok_#{self.object_id}")
|
||||
ok = Mom::Label.new(self,"cache_ok_#{self.object_id}")
|
||||
check = build_condition(ok, compiler) # if cached_type != current_type
|
||||
check << Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , receiver_type_definition(compiler))
|
||||
check << Mom::ResolveMethod.new( @name , dynamic_call.cache_entry )
|
||||
check << Mom::SlotLoad.new(self,[dynamic_call.cache_entry, :cached_type] , receiver_type_definition(compiler))
|
||||
check << Mom::ResolveMethod.new(self, @name , dynamic_call.cache_entry )
|
||||
check << ok
|
||||
end
|
||||
|
||||
|
@ -55,8 +55,8 @@ module Vool
|
||||
@arguments.each_with_index do |arg , index| # +1 because of type
|
||||
args << Mom::SlotLoad.new(self, arg_target + [index + 1] , arg.slot_definition(compiler))
|
||||
end
|
||||
setup << Mom::ArgumentTransfer.new( mom_receive , args )
|
||||
setup << Mom::BlockYield.new( arg_index )
|
||||
setup << Mom::ArgumentTransfer.new( self , mom_receive , args )
|
||||
setup << Mom::BlockYield.new( self , arg_index )
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user