remove positioned copy paste
This commit is contained in:
parent
575d19cb02
commit
5b3045e42a
@ -22,23 +22,6 @@ module FakeMem
|
|||||||
raise "Layout not set #{vm_name}" unless clazz.object_layout
|
raise "Layout not set #{vm_name}" unless clazz.object_layout
|
||||||
self.set_layout clazz.object_layout
|
self.set_layout clazz.object_layout
|
||||||
end
|
end
|
||||||
#TODO, this is copied from module Positioned, maybe avoid duplication ?
|
|
||||||
def position
|
|
||||||
if @position.nil?
|
|
||||||
str = "IN machine #{Virtual.machine.objects.include?(self)}\n"
|
|
||||||
raise str + "position not set for #{self.class} at #{word_length} for #{self.inspect[0...100]}"
|
|
||||||
end
|
|
||||||
@position
|
|
||||||
end
|
|
||||||
def set_position pos
|
|
||||||
raise "Setting of nil not allowed" if pos.nil?
|
|
||||||
# resetting of position used to be error, but since relink and dynamic instruction size it is ok.
|
|
||||||
# in measures (of 32)
|
|
||||||
if @position != nil and ((@position - pos).abs > 32)
|
|
||||||
raise "position set again #{pos}!=#{@position} for #{self.class}"
|
|
||||||
end
|
|
||||||
@position = pos
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
module Virtual
|
module Virtual
|
||||||
def self.new_list array
|
def self.new_list array
|
||||||
@ -99,6 +82,7 @@ module Parfait
|
|||||||
class Object
|
class Object
|
||||||
include FakeMem
|
include FakeMem
|
||||||
include Padding
|
include Padding
|
||||||
|
include Positioned
|
||||||
|
|
||||||
# these internal functions are _really_ internal
|
# these internal functions are _really_ internal
|
||||||
# they respresent the smallest code needed to build larger functionality
|
# they respresent the smallest code needed to build larger functionality
|
||||||
|
@ -2,12 +2,14 @@ require_relative "type"
|
|||||||
|
|
||||||
module Positioned
|
module Positioned
|
||||||
def position
|
def position
|
||||||
if @position == nil
|
if @position.nil?
|
||||||
raise "position accessed but not set at #{word_length} for #{self.inspect[0...500]}"
|
str = "IN machine #{Virtual.machine.objects.include?(self)}\n"
|
||||||
|
raise str + "position not set for #{self.class} at #{word_length} for #{self.inspect[0...100]}"
|
||||||
end
|
end
|
||||||
@position
|
@position
|
||||||
end
|
end
|
||||||
def set_position pos
|
def set_position pos
|
||||||
|
raise "Setting of nil not allowed" if pos.nil?
|
||||||
# resetting of position used to be error, but since relink and dynamic instruction size it is ok.
|
# resetting of position used to be error, but since relink and dynamic instruction size it is ok.
|
||||||
# in measures (of 32)
|
# in measures (of 32)
|
||||||
if @position != nil and ((@position - pos).abs > 32)
|
if @position != nil and ((@position - pos).abs > 32)
|
||||||
@ -15,5 +17,4 @@ module Positioned
|
|||||||
end
|
end
|
||||||
@position = pos
|
@position = pos
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user