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
|
||||
@name = name
|
||||
@super_class = superclass
|
||||
@meta_class = MetaClass.new(self)
|
||||
@meta_class = nil#MetaClass.new(self)
|
||||
end
|
||||
|
||||
def name
|
||||
|
@ -45,6 +45,10 @@ module Register
|
||||
objekt.set_position at
|
||||
at += objekt.mem_length
|
||||
end
|
||||
@machine.objects.each do |objekt|
|
||||
objekt.position
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def assemble
|
||||
@ -84,11 +88,16 @@ module Register
|
||||
# and then plonk that binary data into the method.code array
|
||||
def assemble_binary_method method
|
||||
stream = StringIO.new
|
||||
begin
|
||||
method.info.blocks.each do |block|
|
||||
block.codes.each do |code|
|
||||
code.assemble( stream )
|
||||
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
|
||||
index = 1
|
||||
stream.each_byte do |b|
|
||||
|
@ -1,14 +1,14 @@
|
||||
module Register
|
||||
# load a constant into a register
|
||||
#
|
||||
# first arguemnt is the register the constant is loaded into
|
||||
# first arguemnt is the register the constant is loaded into
|
||||
# second is the actual constant
|
||||
|
||||
|
||||
class LoadConstant < Instruction
|
||||
def initialize value , constant
|
||||
@value = value
|
||||
@constant = constant
|
||||
end
|
||||
attr_accessor :value , :constant
|
||||
attr_accessor :value , :constant
|
||||
end
|
||||
end
|
||||
|
@ -60,6 +60,7 @@ module Virtual
|
||||
raise "no such pass-class as #{pass_class}" unless pass
|
||||
pass.new.run(block)
|
||||
end
|
||||
#puts @space.get_main if pass_class == "Virtual::SendImplementation"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -9,8 +9,6 @@ module FakeMem
|
||||
super()
|
||||
@memory = [0,nil]
|
||||
@position = nil
|
||||
@length = -1
|
||||
# Virtual::Machine.instance.add_object self
|
||||
if Virtual::Machine.instance.class_mappings
|
||||
init_layout
|
||||
else
|
||||
@ -26,12 +24,14 @@ module FakeMem
|
||||
end
|
||||
#TODO, this is copied from module Positioned, maybe avoid duplication ?
|
||||
def position
|
||||
if @position == nil
|
||||
raise "position not set for #{self.class} at #{mem_length} for #{self.inspect[0...1000]}"
|
||||
if @position.nil?
|
||||
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
|
||||
@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)
|
||||
|
@ -39,7 +39,7 @@ module Virtual
|
||||
if ref.type.is_a?(Reference) and ref.type.of_class
|
||||
#find method and call
|
||||
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
|
||||
new_codes << MethodCall.new( method )
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user