give labels an integer that will end up being the position at runtime
Since integers are first class objects, we need to use an integer object as the return address. The actual address can not be stored in an instance variable since it is not an object. The address is unique to the label and never changes after positioning (using the int is next up)
This commit is contained in:
@ -7,7 +7,7 @@ module Risc
|
||||
Risc.machine.boot
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@method = Parfait.object_space.types.values.first.methods
|
||||
@label = Label.new("hi","ho")
|
||||
@label = Risc.label("hi","ho")
|
||||
end
|
||||
def test_set_bin
|
||||
pos = Position.set( @binary , 0 , @method)
|
||||
@ -29,7 +29,7 @@ module Risc
|
||||
machine.translate(:interpreter)
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@method = Parfait.object_space.types.values.first.methods
|
||||
@label = Label.new("hi","ho")
|
||||
@label = Risc.label("hi","ho")
|
||||
end
|
||||
|
||||
def test_bin_propagates_existing
|
||||
|
Reference in New Issue
Block a user