Changing the call setup and return to be more efficient
Now we are using a statically linked list of messages. This will not work with procs, but that can be solved then. Previous (wrong) thinking was that because of procs messages have to be allocated for every call. This was too slow, and not neccessary
This commit is contained in:
parent
8ed013c2b9
commit
89f32ed74a
@ -59,25 +59,10 @@ module Mom
|
|||||||
"method setup "
|
"method setup "
|
||||||
end
|
end
|
||||||
|
|
||||||
# get the next message from space and unlink it there
|
|
||||||
# also put it into next_message of current message (and reverse)
|
|
||||||
# set the method into the message
|
# set the method into the message
|
||||||
def build_message_data( builder )
|
def build_message_data( builder )
|
||||||
builder.build do
|
builder.build do
|
||||||
factory? << Parfait.object_space.get_factory_for(:Message)
|
next_message?[:method] << callable
|
||||||
next_message? << factory[:next_object]
|
|
||||||
|
|
||||||
#FIXME in a multithreaded future this should be done using lock free compare and swap.
|
|
||||||
next_message_reg! << next_message[:next_message]
|
|
||||||
factory[:next_object] << next_message_reg
|
|
||||||
|
|
||||||
# FIXME: Also we relink used messages at the moment. This will have to stop
|
|
||||||
# when implementing continuations (or block passing/bindings)
|
|
||||||
# then we may run out and that means cheking and maybe getting more
|
|
||||||
message[:next_message] << next_message
|
|
||||||
next_message[:caller] << message
|
|
||||||
next_message[:method] << callable
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -26,19 +26,12 @@ module Mom
|
|||||||
object! << message[:return_value]
|
object! << message[:return_value]
|
||||||
caller_reg! << message[:caller]
|
caller_reg! << message[:caller]
|
||||||
caller_reg[:return_value] << object
|
caller_reg[:return_value] << object
|
||||||
factory? << Parfait.object_space.get_factory_for(:Message)
|
|
||||||
# here we return the current message to the list of messages
|
|
||||||
# which is only correct without blocks or real continuations
|
|
||||||
next_message! << factory[:next_object]
|
|
||||||
message[:next_message] << next_message
|
|
||||||
factory[:next_object] << message
|
|
||||||
end
|
end
|
||||||
compiler.reset_regs
|
|
||||||
builder.build do
|
builder.build do
|
||||||
return_address! << message[:return_address]
|
return_address! << message[:return_address]
|
||||||
return_address << return_address[ Parfait::Integer.integer_index]
|
return_address << return_address[ Parfait::Integer.integer_index]
|
||||||
message << message[:caller]
|
message << message[:caller]
|
||||||
return_address.function_return
|
add_code Risc.function_return("return", return_address)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -171,14 +171,6 @@ module Risc
|
|||||||
op
|
op
|
||||||
end
|
end
|
||||||
|
|
||||||
# generate a Function return instruction
|
|
||||||
# using the register as the parameter where the return address is passed
|
|
||||||
def function_return
|
|
||||||
ret = Risc.function_return("return", self)
|
|
||||||
builder.add_code(ret) if builder
|
|
||||||
ret
|
|
||||||
end
|
|
||||||
|
|
||||||
# create operator instruction for self and add
|
# create operator instruction for self and add
|
||||||
# doesn't read quite as smoothly as one would like, but better than the compiler version
|
# doesn't read quite as smoothly as one would like, but better than the compiler version
|
||||||
def op( operator , right)
|
def op( operator , right)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user