From c56b7cdf093c78fc51abc3a3710d012a84e54288 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 19 May 2014 11:28:37 +0300 Subject: [PATCH] minor --- lib/arm/arm_machine.rb | 1 + lib/arm/constants.rb | 4 ++-- lib/arm/logic_instruction.rb | 2 +- lib/arm/move_instruction.rb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/arm/arm_machine.rb b/lib/arm/arm_machine.rb index 2a13fbc3..6da3276d 100644 --- a/lib/arm/arm_machine.rb +++ b/lib/arm/arm_machine.rb @@ -46,6 +46,7 @@ module Arm raise "Not CallSite #{call.inspect}" unless call.is_a? Vm::CallSite raise "Not linked #{call.inspect}" unless call.function into << call( call.function ) + raise "No return type for #{call.function.name}" unless call.function.return_type call.function.return_type end diff --git a/lib/arm/constants.rb b/lib/arm/constants.rb index 6d52ed54..2ab95c4e 100644 --- a/lib/arm/constants.rb +++ b/lib/arm/constants.rb @@ -22,8 +22,8 @@ module Arm } #return the bit patter that the cpu uses for the current instruction @attributes[:opcode] def op_bit_code - bit_code = OPCODES[@attributes[:opcode]] - bit_code or raise "no code found for #{@attributes[:opcode].inspect}" + bit_code = OPCODES[opcode] + bit_code or raise "no code found for #{opcode} #{inspect}" end #codition codes can be applied to many instructions and thus save branches diff --git a/lib/arm/logic_instruction.rb b/lib/arm/logic_instruction.rb index 165bca4f..b6006c1a 100644 --- a/lib/arm/logic_instruction.rb +++ b/lib/arm/logic_instruction.rb @@ -3,7 +3,7 @@ module Arm class LogicInstruction < Vm::LogicInstruction include Arm::Constants - def initialize(result , left , right , attributes) + def initialize(result , left , right , attributes = {}) super(result ,left , right , attributes) @attributes[:update_status] = 0 if @attributes[:update_status] == nil @attributes[:condition_code] = :al if @attributes[:condition_code] == nil diff --git a/lib/arm/move_instruction.rb b/lib/arm/move_instruction.rb index 3dd0d722..d0392378 100644 --- a/lib/arm/move_instruction.rb +++ b/lib/arm/move_instruction.rb @@ -27,7 +27,7 @@ module Arm right = Vm::IntegerConstant.new( right.position - self.position - 8 ) @rn = :pc end - if( right.is_a? Fixnum ) #HACK to not have to change the code just now + if( right.is_a? Fixnum ) right = Vm::IntegerConstant.new( right ) end if (right.is_a?(Vm::IntegerConstant))