function docs improvements
This commit is contained in:
parent
fb6a1a0e01
commit
5015a11108
@ -31,6 +31,9 @@ module Mom
|
||||
def to_s
|
||||
"ArgumentTransfer " + ([@receiver] + @arguments).join(",")
|
||||
end
|
||||
|
||||
# load receiver and then each arg into the new message
|
||||
# delegates to SlotLoad for receiver and to the actual args.to_risc
|
||||
def to_risc(compiler)
|
||||
transfer = SlotLoad.new([:message , :next_message , :receiver] , @receiver, self).to_risc(compiler)
|
||||
compiler.reset_regs
|
||||
|
@ -4,9 +4,10 @@ module Mom
|
||||
# Ie: MessageSetup,ArgumentTransfer,SimpleCall
|
||||
#
|
||||
# MessageSetup does Setup before a call can be made, acquiring and filling the message
|
||||
# basically.Only after MessageSetup is the next_message safe to use.
|
||||
# basically. Only after MessageSetup is the next_message safe to use.
|
||||
#
|
||||
# The Space keeps a linked list of Messages, from which we take and currenty also return.
|
||||
# The Factory (instane kept by Space) keeps a linked list of Messages,
|
||||
# from which we take and currenty also return.
|
||||
#
|
||||
# Message setup set the name to the called method's name, and also set the arg and local
|
||||
# types on the new message, currently for debugging but later for dynamic checking
|
||||
|
@ -17,6 +17,7 @@ module Mom
|
||||
def to_s
|
||||
"SimpleCall #{@method.name}"
|
||||
end
|
||||
|
||||
# Calling a Method is basically jumping to the Binary (+ offset).
|
||||
# We just swap in the new message and go.
|
||||
#
|
||||
|
@ -25,7 +25,9 @@ module Mom
|
||||
# original_source: optinally another mom instruction that wil be passed down to created
|
||||
# risc instructions. (Because SlotLoad is often used internally in mom)
|
||||
class SlotLoad < Instruction
|
||||
|
||||
attr_reader :left , :right , :original_source
|
||||
|
||||
def initialize(left , right, original_source = nil)
|
||||
@left , @right = left , right
|
||||
@left = SlotDefinition.new(@left.shift , @left) if @left.is_a? Array
|
||||
@ -38,6 +40,9 @@ module Mom
|
||||
"SlotLoad #{right} -> #{left}"
|
||||
end
|
||||
|
||||
# resolve the SlotLoad to the respective risc Instructions.
|
||||
# calls sym_to_risc for most (symbols), and ConstantLoad for CacheEntry
|
||||
# after loading the right into register
|
||||
def to_risc(compiler)
|
||||
const_reg = @right.to_register(compiler , original_source)
|
||||
left_slots = @left.slots
|
||||
@ -54,6 +59,11 @@ module Mom
|
||||
compiler.reset_regs
|
||||
end
|
||||
|
||||
# load the data in const_reg into the slot that is named by left symbols
|
||||
# left may usually be only 3 long, as the first is known, then the second is loaded
|
||||
# with type known type (as it comes from message)
|
||||
#
|
||||
# actual lifting is done by RegisterValue resolve_and_add
|
||||
def sym_to_risc(compiler , const_reg)
|
||||
left_slots = @left.slots.dup
|
||||
raise "Not Message #{object}" unless @left.known_object == :message
|
||||
|
@ -5,11 +5,12 @@ module Mains
|
||||
include Risc::Ticker
|
||||
|
||||
def setup
|
||||
@string_input = as_main("a = 98 ; while(a>0) ; a = a - 1 ; end ; return a")
|
||||
@string_input = as_main("a = 1011 ; while(a>0) ; a = a - 1 ; end ; return a")
|
||||
super
|
||||
end
|
||||
def test_chain # max 98 iterations on 300 integers
|
||||
def test_chain # max 1011 iterations on 1014 integers (1024 - 10 reserve)
|
||||
run_all
|
||||
assert_equal Fixnum , get_return.class , " "
|
||||
assert_equal 0 , get_return , " "
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user