do not copy name of method

so that the resolve can compare name identity
which is what is does, not equality
this (and some other bug) is crashing arm currently
This commit is contained in:
Torsten 2020-03-25 12:43:57 +02:00
parent b2dce92883
commit bc558d1f0d
5 changed files with 16 additions and 11 deletions

View File

@ -72,6 +72,7 @@ module Arm
codes << ArmMachine.mov( :pc , code.register)
codes
end
def translate_DynamicJump(code)
index = Parfait.object_space.get_type_by_class_name(:CallableMethod).variable_index(:binary)
codes = ArmMachine.ldr( code.register , code.register , arm_index(index) )

View File

@ -140,6 +140,10 @@ class Symbol
#puts "LL #{l.class}"
l
end
alias :ct_type :get_type
def value
self
end
def padded_length
Parfait::Object.padded( to_s.length + 4)
end

View File

@ -38,7 +38,7 @@ module SlotMachine
# currently a fail results in sys exit
def to_risc( compiler )
builder = compiler.builder(self)
word = builder.load_object(Parfait.new_word(@name.to_s))
word = builder.load_object(@name)
entry = builder.load_object(@cache_entry)
while_start_label = Risc.label(to_s, "resolve_#{name}_#{object_id}")
ok_label = Risc.label(to_s, "ok_resolve_#{name}_#{object_id}")

View File

@ -13,8 +13,8 @@ module SlotMachine
assert_equal 20 , all.length , all_str
end
def test_load_name
assert_load 1, Parfait::Word , "id_word_"
assert_equal "name" , risc(1).constant.to_string
assert_load 1, Symbol , "id_symbol_"
assert_equal "name" , risc(1).constant.to_s
end
def test_load_cache
assert_load 2, Parfait::CacheEntry , "id_cacheentry_"
@ -26,7 +26,7 @@ module SlotMachine
assert_slot_to_reg 4 , "id_cacheentry_.cached_type" , 4 , "id_cacheentry_.cached_type.methods"
end
def test_start_label
assert_label 5 , "while_start_"
assert_label 5 , "resolve_"
end
def test_load_nil
assert_load 6, Parfait::NilClass , "id_nilclass_"
@ -41,10 +41,10 @@ module SlotMachine
assert_slot_to_reg 9, "id_cacheentry_.cached_type.methods" , 6 , "id_cacheentry_.cached_type.methods.name"
end
def test_check_name
assert_operator 10, :- , "id_cacheentry_.cached_type.methods.name" , "id_word_" , "op_-_"
assert_operator 10, :- , "id_cacheentry_.cached_type.methods.name" , "id_symbol_" , "op_-_"
end
def test_nil_branch
assert_zero 11, "ok_label_"
assert_zero 11, "ok_resolve_name_"
end
def test_get_next_method
assert_slot_to_reg 12, "id_cacheentry_.cached_type.methods" , 2 , "id_cacheentry_.cached_type.methods.next_callable"
@ -53,19 +53,19 @@ module SlotMachine
assert_transfer 13 , "id_cacheentry_.cached_type.methods.next" , "id_cacheentry_.cached_type.methods"
end
def test_continue_while
assert_branch 14, "while_start_"
assert_branch 14, "resolve_"
end
def test_goto_exit
assert_label 15, "exit_label_"
assert_label 15, "exit_resolve_name_"
end
def test_move_name
assert_transfer 16, "id_word_" , :r1
assert_transfer 16, "id_symbol_" , :r1
end
def test_sys
assert_syscall 17, :died
end
def test_label
assert_label 18, "ok_label_"
assert_label 18, "ok_resolve_name_"
end
def test_method
assert_reg_to_slot 19 , "id_cacheentry_.cached_type.methods" , "id_cacheentry_" , 2

View File

@ -72,7 +72,7 @@ module Sol
end
def test_check_label
assert_equal NotSameCheck, @ins.class
assert @ins.false_label.name.start_with?("cache_ok_") , @ins.false_label.name
assert @ins.false_label.name.start_with?("send_cache_some_ok_") , @ins.false_label.name
end
def test_array
check_array [NotSameCheck, SlotLoad, ResolveMethod, Label, MessageSetup ,