remove dead code that was produced

This commit is contained in:
Torsten Rüger 2019-09-17 16:08:49 +03:00
parent 61819b7230
commit d58ed8e5e8
5 changed files with 24 additions and 64 deletions

View File

@ -2,11 +2,7 @@ module Mom
class MethodMissing < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source_name)
builder.build do
factory! << Parfait.object_space.get_factory_for(:Integer)
integer_tmp! << factory[:reserve]
Mom::Macro.emit_syscall( builder , :died ) #uses integer_tmp
end
builder.add_code Risc::Syscall.new("Method_missing_died", :died )
return compiler
end
end

View File

@ -10,7 +10,7 @@ module Mom
ResolveMethod.new( "method" , :name , cache_entry )
end
def test_len
assert_equal 25 , all.length , all_str
assert_equal 18 , all.length , all_str
end
def test_1_load_name
assert_load risc(1) , Symbol , :r1
@ -40,6 +40,7 @@ module Mom
def test_9_get_method_name
assert_slot_to_reg risc(9) ,:r4 , 6 , :r6
end
# Syscall, Label, RegToSlot,] #20
def test_10_check_name
assert_operator risc(10) , :- , :r6 , :r1
end
@ -55,35 +56,14 @@ module Mom
def test_14_goto_exit
assert_label risc(14) , "exit_label_"
end
def test_15_load_factory
assert_load risc(15) , Parfait::Factory , :r7
def test_15_die
assert_syscall risc(15) , :died
end
def test_16_load_next_from_factory
assert_slot_to_reg risc(16) , :r7 ,3 ,:r8
def test_16_label
assert_label risc(16) , "ok_label_"
end
def test_17_save_message
assert_transfer risc(17) , :r0 , :r8
end
def test_18_die
assert_syscall risc(18) , :died
end
def test_19_mistake1
assert_transfer risc(19) , :r0 , :r9
end
def test_20_should_not_restore
assert_transfer risc(20) , :r8 , :r0
end
def test_21_dead_code
assert_slot_to_reg risc(21) , :r0 ,5 ,:r10
end
def test_22_dead_code
assert_reg_to_slot risc(22) , :r9 , :r10 , 2
end
def test_23_label
assert_label risc(23) , "ok_label_"
end
def test_24_load_method
assert_reg_to_slot risc(24) , :r4 , :r2 , 2
def test_17_load_method
assert_reg_to_slot risc(17) , :r4 , :r2 , 2
end
end
end

View File

@ -14,7 +14,7 @@ module Mom
assert_equal Risc::MethodCompiler , @method.to_risc.class
end
def test_risc_length
assert_equal 21 , @method.to_risc.risc_instructions.length
assert_equal 14 , @method.to_risc.risc_instructions.length
end
end
end

View File

@ -17,44 +17,28 @@ module Risc
LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg, #15
SlotToReg, LoadConstant, OperatorInstruction, IsZero, SlotToReg, #20
OperatorInstruction, IsZero, RegToSlot, LoadConstant, SlotToReg, #25
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot, #30
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant, #35
SlotToReg, DynamicJump, LoadConstant, SlotToReg, LoadConstant, #40
OperatorInstruction, IsNotZero, SlotToReg, RegToSlot, SlotToReg, #45
SlotToReg, LoadData, OperatorInstruction, RegToSlot, RegToSlot, #50
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #55
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #60
SlotToReg, RegToSlot, Branch, SlotToReg, SlotToReg, #65
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, #70
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #75
SlotToReg, Branch, RegToSlot, SlotToReg, SlotToReg, #30
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #35
LoadConstant, SlotToReg, DynamicJump, LoadConstant, SlotToReg, #40
LoadConstant, OperatorInstruction, IsNotZero, SlotToReg, RegToSlot, #45
SlotToReg, SlotToReg, LoadData, OperatorInstruction, RegToSlot, #50
RegToSlot, SlotToReg, RegToSlot, Branch, SlotToReg, #55
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #60
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #65
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, #70
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #75
NilClass,] #80
assert_equal ::Integer , get_return.class
assert_equal 1 , get_return
end
def test_call_main
call_ins = ticks(main_at)
assert_equal FunctionCall , call_ins.class
assert_equal :main , call_ins.method.name
end
def test_load_entry
call_ins = main_ticks(3)
assert_equal LoadConstant , call_ins.class
assert_equal Parfait::CacheEntry , call_ins.constant.class
end
def test_dyn
cal = main_ticks(37)
cal = main_ticks(38)
assert_equal DynamicJump , cal.class
end
def test_return
ret = main_ticks(70)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal ::Integer , link.class
end
def ttest_sys
sys = main_ticks(112)
assert_equal Syscall , sys.class
end
end
end

View File

@ -28,7 +28,7 @@ GET
assert_equal Mom::MethodMissing , compiler.mom_instructions.next.class
end
def test_risc
assert_equal 21 , compiler.to_risc.risc_instructions.length
assert_equal 14 , compiler.to_risc.risc_instructions.length
end
end
end