got it down to string equality/identity
This commit is contained in:
parent
1509e7ba2f
commit
5d870ef154
@ -19,7 +19,7 @@ module Parfait
|
|||||||
@instance_methods = List.new_object
|
@instance_methods = List.new_object
|
||||||
@name = name
|
@name = name
|
||||||
@super_class = superclass
|
@super_class = superclass
|
||||||
@meta_class = MetaClass.new(self)
|
@meta_class = nil#MetaClass.new(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
def name
|
def name
|
||||||
|
@ -45,6 +45,10 @@ module Register
|
|||||||
objekt.set_position at
|
objekt.set_position at
|
||||||
at += objekt.mem_length
|
at += objekt.mem_length
|
||||||
end
|
end
|
||||||
|
@machine.objects.each do |objekt|
|
||||||
|
objekt.position
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def assemble
|
def assemble
|
||||||
@ -84,11 +88,16 @@ module Register
|
|||||||
# and then plonk that binary data into the method.code array
|
# and then plonk that binary data into the method.code array
|
||||||
def assemble_binary_method method
|
def assemble_binary_method method
|
||||||
stream = StringIO.new
|
stream = StringIO.new
|
||||||
|
begin
|
||||||
method.info.blocks.each do |block|
|
method.info.blocks.each do |block|
|
||||||
block.codes.each do |code|
|
block.codes.each do |code|
|
||||||
code.assemble( stream )
|
code.assemble( stream )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
rescue => e
|
||||||
|
puts "Method error #{method.name}\n#{Sof::Writer.write(method.info.blocks).to_s[0...2000]}"
|
||||||
|
raise e
|
||||||
|
end
|
||||||
method.code.fill_with 0
|
method.code.fill_with 0
|
||||||
index = 1
|
index = 1
|
||||||
stream.each_byte do |b|
|
stream.each_byte do |b|
|
||||||
|
@ -60,6 +60,7 @@ module Virtual
|
|||||||
raise "no such pass-class as #{pass_class}" unless pass
|
raise "no such pass-class as #{pass_class}" unless pass
|
||||||
pass.new.run(block)
|
pass.new.run(block)
|
||||||
end
|
end
|
||||||
|
#puts @space.get_main if pass_class == "Virtual::SendImplementation"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@ module FakeMem
|
|||||||
super()
|
super()
|
||||||
@memory = [0,nil]
|
@memory = [0,nil]
|
||||||
@position = nil
|
@position = nil
|
||||||
@length = -1
|
|
||||||
# Virtual::Machine.instance.add_object self
|
|
||||||
if Virtual::Machine.instance.class_mappings
|
if Virtual::Machine.instance.class_mappings
|
||||||
init_layout
|
init_layout
|
||||||
else
|
else
|
||||||
@ -26,12 +24,14 @@ module FakeMem
|
|||||||
end
|
end
|
||||||
#TODO, this is copied from module Positioned, maybe avoid duplication ?
|
#TODO, this is copied from module Positioned, maybe avoid duplication ?
|
||||||
def position
|
def position
|
||||||
if @position == nil
|
if @position.nil?
|
||||||
raise "position not set for #{self.class} at #{mem_length} for #{self.inspect[0...1000]}"
|
str = "IN machine #{Virtual::Machine.instance.objects.include?(self)}\n"
|
||||||
|
raise str + "position not set for #{self.class} at #{mem_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)
|
||||||
|
@ -39,7 +39,7 @@ module Virtual
|
|||||||
if ref.type.is_a?(Reference) and ref.type.of_class
|
if ref.type.is_a?(Reference) and ref.type.of_class
|
||||||
#find method and call
|
#find method and call
|
||||||
clazz = ref.type.of_class
|
clazz = ref.type.of_class
|
||||||
method = clazz.resolve_method code.name
|
method = clazz.resolve_method code.name.to_s
|
||||||
raise "No method found #{code.name}" unless method
|
raise "No method found #{code.name}" unless method
|
||||||
new_codes << MethodCall.new( method )
|
new_codes << MethodCall.new( method )
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user