move type to phial and add type to reg_ref
This commit is contained in:
@ -5,10 +5,10 @@ module Register
|
||||
module ClassMethods
|
||||
def plus c
|
||||
plus_function = Virtual::MethodSource.create_method(:Integer,:int,:plus , [:int] )
|
||||
plus_function.source.return_type = Virtual::Integer
|
||||
plus_function.source.receiver = Virtual::Integer
|
||||
plus_function.source.return_type = Phisol::Type.int
|
||||
plus_function.source.receiver = Phisol::Integer
|
||||
|
||||
tmp = Register.tmp_reg
|
||||
tmp = Register.tmp_reg :int
|
||||
index = Register.arg_index 1
|
||||
plus_function.source.add_code Register.get_slot( plus_function , :message , index , tmp )
|
||||
add = Register::OperatorInstruction.new( plus_function, :add , Register.self_reg , tmp )
|
||||
@ -23,9 +23,9 @@ module Register
|
||||
# As we write before we recurse (save a push) we write the number backwards
|
||||
# arguments: string address , integer
|
||||
# def utoa context
|
||||
# utoa_function = Virtual::MethodSource.create_method(:Integer ,:utoa , [ Virtual::Integer ] )
|
||||
# function.source.return_type = Virtual::Integer
|
||||
# function.source.receiver = Virtual::Integer
|
||||
# utoa_function = Virtual::MethodSource.create_method(:Integer ,:utoa , [ Phisol::Integer ] )
|
||||
# function.source.return_type = Phisol::Type.int
|
||||
# function.source.receiver = Phisol::Integer
|
||||
# return utoa_function
|
||||
# # str_addr = utoa_function.receiver
|
||||
# # number = utoa_function.args.first
|
||||
@ -44,8 +44,8 @@ module Register
|
||||
|
||||
def putint context
|
||||
putint_function = Virtual::MethodSource.create_method(:Integer,:int,:putint , [] )
|
||||
putint_function.source.return_type = Virtual::Integer
|
||||
putint_function.source.receiver = Virtual::Integer
|
||||
putint_function.source.return_type = Phisol::Type.int
|
||||
putint_function.source.receiver = Phisol::Integer
|
||||
return putint_function
|
||||
# buffer = Parfait::Word.new(" ") # create a buffer
|
||||
# context.object_space.add_object buffer # and save it (function local variable: a no no)
|
||||
@ -73,8 +73,8 @@ module Register
|
||||
# not my hand off course, found in the net http://www.peter-cockerell.net/aalp/html/ch-5.html
|
||||
def fibo context
|
||||
fibo_function = Virtual::MethodSource.create_method(:Integer,:int,:fibo , [] )
|
||||
fibo_function.source.return_type = Virtual::Integer
|
||||
fibo_function.source.receiver = Virtual::Integer
|
||||
fibo_function.source.return_type = Phisol::Type.int
|
||||
fibo_function.source.receiver = Phisol::Integer
|
||||
return fibo_function
|
||||
# result = fibo_function.return_type
|
||||
# int = fibo_function.receiver
|
||||
|
@ -7,7 +7,7 @@ module Register
|
||||
# so it is responsible for initial setup
|
||||
def __init__ context
|
||||
function = Virtual::MethodSource.create_method(:Kernel,:int,:__init__ , [])
|
||||
function.source.return_type = Virtual::Integer
|
||||
function.source.return_type = Phisol::Type.int
|
||||
# no method enter or return (automatically added), remove
|
||||
function.source.blocks.first.codes.pop # no Method enter
|
||||
function.source.blocks.last.codes.pop # no Method return
|
||||
@ -26,7 +26,7 @@ module Register
|
||||
end
|
||||
def exit context
|
||||
function = Virtual::MethodSource.create_method(:Kernel,:int,:exit , [])
|
||||
function.source.return_type = Virtual::Integer
|
||||
function.source.return_type = Phisol::Type.int
|
||||
return function
|
||||
ret = Virtual::RegisterMachine.instance.exit(function)
|
||||
function.set_return ret
|
||||
@ -34,7 +34,7 @@ module Register
|
||||
end
|
||||
def __send context
|
||||
function = Virtual::MethodSource.create_method(:Kernel,:int ,:__send , [] )
|
||||
function.source.return_type = Virtual::Integer
|
||||
function.source.return_type = Phisol::Type.int
|
||||
return function
|
||||
end
|
||||
|
||||
@ -53,7 +53,7 @@ module Register
|
||||
end
|
||||
|
||||
def restore_message(function)
|
||||
return_tmp = Register.tmp_reg
|
||||
return_tmp = Register.tmp_reg function.source.return_type
|
||||
# get the sys return out of the way
|
||||
function.source.add_code RegisterTransfer.new(function, Register.message_reg , return_tmp )
|
||||
# load the stored message into the base RegisterMachine
|
||||
|
@ -17,7 +17,7 @@ module Register
|
||||
# end
|
||||
# The at_index is just "below" the api, something we need but don't want to expose,
|
||||
# so we can't code the above in ruby
|
||||
def _get_instance_variable context , name = Virtual::Integer
|
||||
def _get_instance_variable context , name = :int
|
||||
get_function = Virtual::MethodSource.create_method(:Object,:int, :_get_instance_variable , [ ] )
|
||||
return get_function
|
||||
# me = get_function.receiver
|
||||
@ -38,7 +38,7 @@ module Register
|
||||
# return get_function
|
||||
end
|
||||
|
||||
def _set_instance_variable(context , name = Virtual::Integer , value = Virtual::Integer )
|
||||
def _set_instance_variable(context , name = :int , value = :int )
|
||||
set_function = Virtual::MethodSource.create_method(:Object,:int,:_set_instance_variable ,[] )
|
||||
return set_function
|
||||
# receiver set_function
|
||||
|
Reference in New Issue
Block a user