fix method_missing register
logic is still wrong, even it is slightly less (at least loading the method name)
This commit is contained in:
parent
ede103e73d
commit
8867d60c13
@ -11,7 +11,7 @@ module SlotMachine
|
||||
|
||||
def to_risc(compiler)
|
||||
builder = compiler.builder(compiler.source_name)
|
||||
from = Risc::RegisterValue.new(@name , :Word)
|
||||
from = compiler.load_object(Parfait.new_word(@name))
|
||||
to = Risc::RegisterValue.new(:r1 , :Word)
|
||||
builder.add_code Risc::Transfer.new(self , from , to)
|
||||
builder.add_code Risc::Syscall.new(self, :died )
|
||||
|
@ -17,16 +17,16 @@ module SlotMachine
|
||||
assert_equal 15 , @method.to_risc.risc_instructions.length
|
||||
end
|
||||
def test_all
|
||||
assert_transfer risc(1) , :r1 , :r1
|
||||
assert_equal Risc::Syscall, risc(2).class
|
||||
assert_slot_to_reg risc(3),:r0 , 5 , :r2
|
||||
assert_slot_to_reg risc(3),:r0 , 5 , :r2
|
||||
assert_reg_to_slot risc(4) , :r2 , :r0 , 5
|
||||
assert_branch risc(5) , "return_label"
|
||||
assert_label risc(6) , "return_label"
|
||||
assert_load 1 , Parfait::Word , "id_word_"
|
||||
assert_transfer 2 , "id_word_" , :r1
|
||||
assert_syscall 3 , :died
|
||||
assert_slot_to_reg 4 , :message , 5 , "message.return_value"
|
||||
assert_reg_to_slot 5 , "message.return_value" , :message , 5
|
||||
assert_branch 6 , "return_label"
|
||||
assert_label 7 , "return_label"
|
||||
end
|
||||
def test_return
|
||||
assert_return(6)
|
||||
assert_return(7)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user