keep risc and cpu instructions separate in method

that overwriting was a bit of thorn
This commit is contained in:
Torsten Ruger
2018-03-25 19:33:50 +03:00
parent a50368c3aa
commit 3090ccffea
6 changed files with 29 additions and 15 deletions

View File

@ -149,9 +149,9 @@ module Risc
super_class_name: :Word , instance_names: :List },
Dictionary: {keys: :List , values: :List } ,
CacheEntry: {cached_type: :Type , cached_method: :TypedMethod } ,
TypedMethod: {name: :Word, source: :Object, instructions: :Object,
binary: :BinaryCode, arguments: :Type , for_type: :Type,
frame: :Type } ,
TypedMethod: {name: :Word, source: :Object, risc_instructions: :Object,
cpu_instructions: :Object, binary: :BinaryCode,
arguments: :Type , for_type: :Type, frame: :Type } ,
}
end

View File

@ -43,7 +43,7 @@ module Risc
def start( instruction )
initialize
set_state(:running)
set_instruction instruction
set_instruction( instruction )
end
def set_state( state )
@ -54,7 +54,7 @@ module Risc
end
def set_instruction( i )
raise "set to same instruction #{i}" if @instruction == i
raise "set to same instruction #{i}:#{i.class}" if @instruction == i
old = @instruction
@instruction = i
trigger(:instruction_changed, old , i)
@ -195,7 +195,7 @@ module Risc
end
def execute_FunctionCall
set_instruction @instruction.method.instructions
set_instruction @instruction.method.risc_instructions
false
end