diff --git a/lib/risc/builtin/object.rb b/lib/risc/builtin/object.rb index a42d8718..39386561 100644 --- a/lib/risc/builtin/object.rb +++ b/lib/risc/builtin/object.rb @@ -71,6 +71,7 @@ module Risc add_function_call( "__init__ issue call" , Parfait.object_space.get_main , ret_tmp) add_code exit_label end + compiler.reset_regs emit_syscall( builder , :exit ) return compiler.method end diff --git a/lib/risc/method_compiler.rb b/lib/risc/method_compiler.rb index 2d825cc4..37032be2 100644 --- a/lib/risc/method_compiler.rb +++ b/lib/risc/method_compiler.rb @@ -50,6 +50,7 @@ module Risc #puts "adding mom #{instruction.to_s}:#{instruction.next.to_s}" risc = instruction.to_risc( self ) add_code(risc) + reset_regs #puts "adding risc #{risc.to_s}:#{risc.next.to_s}" instruction = instruction.next end diff --git a/lib/risc/risc_value.rb b/lib/risc/risc_value.rb index 196aa0bc..b716202c 100644 --- a/lib/risc/risc_value.rb +++ b/lib/risc/risc_value.rb @@ -47,7 +47,7 @@ module Risc #helper method to calculate with register symbols def next_reg_use( type , value = nil ) int = @symbol[1,3].to_i - raise "No more registers #{self}" if int > 8 + raise "No more registers #{self}" if int > 11 sym = "r#{int + 1}".to_sym RiscValue.new( sym , type, value) end @@ -64,14 +64,14 @@ module Risc # - an RValue, resulting in an SlotToReg def <<( right ) case right - when Parfait::Object + when Parfait::Object , Symbol ins = Risc.load_constant("#{right.class} to #{self.type}" , right , self) when RiscValue ins = Risc.transfer("#{right.type} to #{self.type}" , right , self) when RValue ins = Risc.slot_to_reg("#{right.register.type}[#{right.index}] -> #{self.type}" , right.register , right.index , self) else - raise "not implemented" + raise "not implemented for #{right.class}:#{right}" end builder.add_code(ins) if builder return ins diff --git a/test/support/interpreter_helpers.rb b/test/support/interpreter_helpers.rb index c61603f6..1c79a026 100644 --- a/test/support/interpreter_helpers.rb +++ b/test/support/interpreter_helpers.rb @@ -47,7 +47,7 @@ module Risc classes = [] tick = 1 begin - while true and (classes.length < 200) + while true and (classes.length < 300) cl = ticks(1).class tick += 1 classes << cl