use hex for labels

idea was to be able to compare to positions
(but they are different positions)
This commit is contained in:
Torsten Ruger 2018-05-01 19:20:16 +03:00
parent 06f51da8f1
commit 1c52ab6b67
4 changed files with 14 additions and 15 deletions

View File

@ -35,8 +35,8 @@ module Risc
compiler = compiler_for(:Integer, operator ,{other: :Integer})
builder = compiler.builder(true, compiler.method)
me , other = builder.self_and_int_arg("#{operator} load receiver and arg")
false_label = Risc.label(compiler.method , "false_label_#{builder.object_id}")
merge_label = Risc.label(compiler.method , "merge_label_#{builder.object_id}")
false_label = Risc.label(compiler.method , "false_label_#{builder.object_id.to_s(16)}")
merge_label = Risc.label(compiler.method , "merge_label_#{builder.object_id.to_s(16)}")
builder.reduce_int( "#{operator} fix me", me )
builder.reduce_int( "#{operator} fix arg", other )
if(operator.to_s.start_with?('<') )

View File

@ -15,8 +15,7 @@ module Risc
def initialize( machine)
@machine = machine
@objects = machine.objects
@load_at = 0x8054 # this is linux/arm
@load_at = 0x10054 # this is linux/arm
end
# objects must be written in same order as positioned by the machine, namely
@ -35,7 +34,7 @@ module Risc
# debugging loop to write out positions (in debug)
def write_debug
@objects.each do |id , objekt|
@machine.objects.each do |id , objekt|
next if objekt.is_a?(Risc::Label)
log.debug "Linked #{objekt.class}:0x#{objekt.object_id.to_s(16)} at 0x#{Positioned.position(objekt).to_s(16)} / 0x#{objekt.padded_length.to_s(16)}"
end
@ -44,7 +43,7 @@ module Risc
# Write all the objects
def write_objects
# then the objects , not code yet
@objects.each do | id, objekt|
@machine.objects.each do | id, objekt|
next if objekt.is_a? Parfait::BinaryCode
next if objekt.is_a? Risc::Label # ignore
write_any( objekt )
@ -54,7 +53,7 @@ module Risc
# Write the BinaryCode objects of all methods to stream.
# Really like any other object, it's just about the ordering
def write_code
@objects.each do |id, method|
@machine.objects.each do |id, method|
next unless method.is_a? Parfait::TypedMethod
binary = method.binary
while(binary) do
@ -155,7 +154,7 @@ module Risc
write_ref_for( code.next )
write_ref_for( code.get_type )
@stream.write_signed_int_32( MARKER )
log.debug "Code16 witten stream 0x#{@stream.length.to_s(16)}"
log.debug "Init witten stream 0x#{@stream.length.to_s(16)}"
end
def write_BinaryCode( code )

View File

@ -25,8 +25,8 @@ module Vool
end
def simple_if(method)
true_label = Mom::Label.new( "true_label_#{object_id}")
merge_label = Mom::Label.new( "merge_label_#{object_id}")
true_label = Mom::Label.new( "true_label_#{object_id.to_s(16)}")
merge_label = Mom::Label.new( "merge_label_#{object_id.to_s(16)}")
head = Mom::TruthCheck.new(condition.slot_definition(method) , merge_label)
head << true_label
@ -35,9 +35,9 @@ module Vool
end
def full_if(method)
true_label = Mom::Label.new( "true_label_#{object_id}")
false_label = Mom::Label.new( "false_label_#{object_id}")
merge_label = Mom::Label.new( "merge_label_#{object_id}")
true_label = Mom::Label.new( "true_label_#{object_id.to_s(16)}")
false_label = Mom::Label.new( "false_label_#{object_id.to_s(16)}")
merge_label = Mom::Label.new( "merge_label_#{object_id.to_s(16)}")
head = Mom::TruthCheck.new(condition.slot_definition(method) , false_label)
head << true_label

View File

@ -17,8 +17,8 @@ module Vool
end
def to_mom( method )
merge_label = Mom::Label.new( "merge_label_#{object_id}")
cond_label = Mom::Label.new( "cond_label_#{object_id}")
merge_label = Mom::Label.new( "merge_label_#{object_id.to_s(16)}")
cond_label = Mom::Label.new( "cond_label_#{object_id.to_s(16)}")
codes = cond_label
codes << @hoisted.to_mom(method) if @hoisted
codes << Mom::TruthCheck.new(condition.slot_definition(method) , merge_label)