first resolved call running though
and returning an int, as it should just the value . . .
This commit is contained in:
parent
fabe4db4f6
commit
59e6298879
@ -27,12 +27,24 @@ module Mom
|
||||
# Move method name, frame and arguemnt types from the method to the next_message
|
||||
# Get the message from Space and link it.
|
||||
def to_risc(compiler)
|
||||
build_with(compiler.builder(false))
|
||||
builder = compiler.builder(false)
|
||||
build_with(builder)
|
||||
end
|
||||
|
||||
# directly called by to_risc
|
||||
# but also used directly in __init
|
||||
def build_with(builder)
|
||||
case from = method_source
|
||||
when Parfait::TypedMethod
|
||||
builder.build { typed_method << from }
|
||||
when Parfait::CacheEntry
|
||||
builder.build do
|
||||
cache_entry << from
|
||||
typed_method << cache_entry[:cached_method]
|
||||
end
|
||||
else
|
||||
raise "unknown source #{method_source}"
|
||||
end
|
||||
build_message_data(builder)
|
||||
return builder.built
|
||||
end
|
||||
@ -46,9 +58,7 @@ module Mom
|
||||
# also put it into next_message of current message (and reverse)
|
||||
# set name and type data in the message, from the method loaded
|
||||
def build_message_data( builder )
|
||||
from = method_source
|
||||
builder.build do
|
||||
typed_method << from
|
||||
space << Parfait.object_space
|
||||
next_message << space[:first_message]
|
||||
message[:next_message] << next_message
|
||||
|
@ -91,11 +91,11 @@ module Risc
|
||||
def execute_Label
|
||||
true
|
||||
end
|
||||
|
||||
# Instruction interpretation starts here
|
||||
def execute_DynamicJump
|
||||
label = get_register(@instruction.register)
|
||||
puts "Jump to :#{label}:"
|
||||
set_instruction label
|
||||
method = get_register(@instruction.register)
|
||||
set_instruction( method.risc_instructions )
|
||||
end
|
||||
def execute_Branch
|
||||
label = @instruction.label
|
||||
|
@ -15,11 +15,11 @@ module Risc
|
||||
Branch, Label, Transfer, Syscall, Transfer,
|
||||
Transfer, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, Label, RegToSlot, Label,
|
||||
LoadConstant, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
RegToSlot, SlotToReg, RegToSlot, SlotToReg, RegToSlot,
|
||||
SlotToReg, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
|
||||
SlotToReg, DynamicJump]
|
||||
LoadConstant, SlotToReg, LoadConstant, SlotToReg, RegToSlot,
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, RegToSlot, SlotToReg,
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, RegToSlot,
|
||||
LoadConstant, SlotToReg, DynamicJump]
|
||||
end
|
||||
|
||||
def test_send_instructions
|
||||
@ -37,7 +37,7 @@ module Risc
|
||||
end
|
||||
def test_function_call
|
||||
produced = produce_body
|
||||
assert_equal DynamicJump , produced.next(61).class
|
||||
assert_equal DynamicJump , produced.next(62).class
|
||||
end
|
||||
def test_cache_check
|
||||
produced = produce_body
|
||||
|
@ -12,14 +12,34 @@ module Risc
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [Label, LoadConstant, SlotToReg, RegToSlot, LoadConstant,
|
||||
SlotToReg, SlotToReg, SlotToReg, OperatorInstruction, IsZero,
|
||||
SlotToReg, SlotToReg, LoadConstant, RegToSlot, LoadConstant,
|
||||
LoadConstant, SlotToReg, SlotToReg, Label, LoadConstant,
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, OperatorInstruction,
|
||||
IsZero, SlotToReg, Branch, Label, LoadConstant,
|
||||
SlotToReg, OperatorInstruction, IsZero, Label, Transfer,
|
||||
Syscall, NilClass]
|
||||
#assert_equal 1 , get_return
|
||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction,
|
||||
IsZero, SlotToReg, SlotToReg, SlotToReg, LoadConstant,
|
||||
RegToSlot, LoadConstant, LoadConstant, SlotToReg, SlotToReg,
|
||||
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
|
||||
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
|
||||
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
|
||||
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
|
||||
SlotToReg, OperatorInstruction, IsZero, Label, RegToSlot,
|
||||
Label, LoadConstant, SlotToReg, LoadConstant, SlotToReg,
|
||||
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, RegToSlot,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, DynamicJump, Label,
|
||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
|
||||
SlotToReg, LoadData, OperatorInstruction, LoadData, OperatorInstruction,
|
||||
OperatorInstruction, LoadData, Transfer, OperatorInstruction, OperatorInstruction,
|
||||
LoadData, Transfer, OperatorInstruction, OperatorInstruction, LoadData,
|
||||
Transfer, OperatorInstruction, OperatorInstruction, LoadData, OperatorInstruction,
|
||||
LoadData, Transfer, OperatorInstruction, OperatorInstruction, Transfer,
|
||||
LoadData, OperatorInstruction, LoadData, OperatorInstruction, OperatorInstruction,
|
||||
LoadConstant, SlotToReg, SlotToReg, RegToSlot, RegToSlot,
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, FunctionReturn, Transfer, Syscall, NilClass]
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
#assert_equal 1 , get_return.value
|
||||
end
|
||||
|
||||
def test_call_main
|
||||
|
Loading…
Reference in New Issue
Block a user