use positions in interpreter
This commit is contained in:
parent
c0f10bb42b
commit
ef2dc932ad
@ -48,7 +48,7 @@ module Risc
|
||||
def set_pc( pos )
|
||||
raise "Not int #{pos}" unless pos.is_a? Numeric
|
||||
position = Position.at(pos)
|
||||
log.debug "Setting Position #{pos}"
|
||||
log.debug "Setting Position #{position}"
|
||||
if position.is_a?(Position::CodePosition)
|
||||
return set_pc(position.at + 12)
|
||||
end
|
||||
|
@ -90,6 +90,7 @@ module Risc
|
||||
before = at
|
||||
Position.set(objekt,at)
|
||||
at += objekt.padded_length
|
||||
log.debug "PADDED #{objekt.padded_length}"
|
||||
log.debug "Object #{objekt.class}:#{before.to_s(16)} len: #{(at - before).to_s(16)}"
|
||||
end
|
||||
at
|
||||
|
@ -15,6 +15,9 @@ module Risc
|
||||
# entails to affected objects.
|
||||
|
||||
module Position
|
||||
include Util::Logging
|
||||
log_level :debug
|
||||
|
||||
@positions = {}
|
||||
|
||||
def self.positions
|
||||
@ -39,7 +42,7 @@ module Risc
|
||||
if pos == nil
|
||||
str = "position accessed but not set, "
|
||||
str += "0x#{object.object_id.to_s(16)}\n"
|
||||
str += "for #{object.class} byte_length #{object.byte_length if object.respond_to?(:byte_length)} for #{object.inspect[0...130]}"
|
||||
str += "for #{object.class} byte_length #{object.byte_length if object.respond_to?(:byte_length)} for #{object.to_s[0...130]}"
|
||||
raise str
|
||||
end
|
||||
pos
|
||||
@ -55,7 +58,7 @@ module Risc
|
||||
def self.set( object , pos , extra = nil)
|
||||
# resetting of position used to be error, but since relink and dynamic instruction size it is ok.
|
||||
# in measures (of 32)
|
||||
#puts "Setting #{pos} for #{self.class}"
|
||||
log.debug "Setting #{pos} for #{object.class}-#{object}" if pos < 3000
|
||||
old = Position.positions[object]
|
||||
if old != nil
|
||||
old.reset_to(pos)
|
||||
@ -64,6 +67,7 @@ module Risc
|
||||
position = for_at( object , pos , extra)
|
||||
self.positions[object] = position
|
||||
position.init(pos)
|
||||
log.debug "Set #{pos} for #{position.class}" if pos < 3000
|
||||
position
|
||||
end
|
||||
|
||||
|
@ -5,6 +5,7 @@ module Risc
|
||||
|
||||
def initialize( at , object)
|
||||
@at = at
|
||||
@object = object
|
||||
raise "not int #{self}-#{at}" unless @at.is_a?(Integer)
|
||||
end
|
||||
|
||||
|
@ -458,7 +458,7 @@ module Util
|
||||
# Default formatter for log messages
|
||||
class Formatter
|
||||
def call(severity, time, progname, msg)
|
||||
"#{severity} #{progname} #{time.strftime("%M-%S-%L")} #{progname}::#{msg2str(msg)}\n"
|
||||
"#{severity} #{progname} #{time.strftime("%M-%S-%L")}::#{msg2str(msg)}\n"
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -10,9 +10,8 @@ module Risc
|
||||
Risc.machine.boot
|
||||
do_clean_compile
|
||||
Vool::VoolCompiler.ruby_to_binary( @string_input , :interpreter)
|
||||
Collector.collect_space
|
||||
@interpreter = Interpreter.new
|
||||
@interpreter.start Risc.machine.risc_init
|
||||
@interpreter.start_machine
|
||||
end
|
||||
alias :do_setup :setup
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user