get those integers crated and used
This commit is contained in:
@ -129,7 +129,7 @@ module Risc
|
||||
Message: { next_message: :Message, receiver: :Object, frame: :NamedList ,
|
||||
return_address: :Integer, return_value: :Integer,
|
||||
caller: :Message , name: :Word , arguments: :NamedList },
|
||||
Integer: {next_i: :Integer},
|
||||
Integer: {next_integer: :Integer},
|
||||
DataObject: {},
|
||||
Data4: {},
|
||||
Data8: {},
|
||||
@ -140,7 +140,7 @@ module Risc
|
||||
Kernel: {}, #fix, kernel is a class, but should be a module
|
||||
BinaryCode: {next: :BinaryCode} ,
|
||||
Space: {classes: :Dictionary , types: :Dictionary ,
|
||||
first_message: :Message , first_integer: :Integer ,
|
||||
first_message: :Message , next_integer: :Integer ,
|
||||
true_object: :TrueClass,
|
||||
false_object: :FalseClass , nil_object: :NilClass},
|
||||
NamedList: {},
|
||||
|
@ -23,9 +23,9 @@ module Risc
|
||||
compiler.add_slot_to_reg( source + "2" , me , Parfait::Integer.integer_index , me)
|
||||
compiler.add_slot_to_reg( source + "3", other , Parfait::Integer.integer_index , other)
|
||||
compiler.add_code Risc.op( source + "4", :+ , me , other)
|
||||
#TODO must get an Integer and put the value there then return the integer (object not value)
|
||||
# and put it back into the return value
|
||||
compiler.add_reg_to_slot( source + "5" , me , :message , :return_value)
|
||||
compiler.add_new_int(other)
|
||||
compiler.add_reg_to_slot( source + "5" , me , other , Parfait::Integer.integer_index)
|
||||
compiler.add_reg_to_slot( source + "5" , other , :message , :return_value)
|
||||
return compiler.method
|
||||
|
||||
end
|
||||
|
@ -132,6 +132,18 @@ module Risc
|
||||
@regs.clear
|
||||
end
|
||||
|
||||
# grab an integer from space and stick it in the register.
|
||||
def add_new_int( register )
|
||||
source = "add_new_int "
|
||||
space = use_reg(:Space)
|
||||
int = use_reg(:Integer)
|
||||
space_i = Risc.resolve_to_index(:Space, :next_integer)
|
||||
add_load_constant( source + "space" , Parfait.object_space , space )
|
||||
add_slot_to_reg( source + "next_i1" , space , space_i , register)
|
||||
add_slot_to_reg( source + "next_i2" , register , Risc.resolve_to_index(:Integer, :next_integer) , int)
|
||||
add_reg_to_slot( source + "store link" , int , space , space_i )
|
||||
# store 2nd next_i to spce next_i
|
||||
end
|
||||
def add_constant(const)
|
||||
Risc.machine.add_constant(const)
|
||||
end
|
||||
|
Reference in New Issue
Block a user