move resolve_method code from word to mom

rather make resolve an instruction.
Since it was coded in risc anyway, we not only save the setup and call
But also makes the mom instruction flow clearer
The method really came from not wanting to code it in risc, but with
the Builder, that is now surprisingly painless
This commit is contained in:
Torsten Ruger
2018-04-08 18:55:17 +03:00
parent 8c322329fb
commit 33ffcf1d88
8 changed files with 84 additions and 28 deletions

View File

@ -27,17 +27,17 @@ module Mom
# Move method name, frame and arguemnt types from the method to the next_message
# Get the message from Space and link it.
def to_risc(compiler)
build_with(compiler.builder)
build_with(compiler.builder(false))
end
# directly called by to_risc
# but also used directly in __init
def build_with(builder)
from = method_source
risc = builder.build_and_return { typed_method << from }
risc << build_message_data(builder)
builder.build { typed_method << from }
build_message_data(builder)
builder.compiler.reset_regs
return risc
return builder.built
end
private
@ -49,7 +49,7 @@ module Mom
# also put it into next_message of current message (and reverse)
# set name and type data in the message, from the method loaded
def build_message_data( builder )
builder.build_and_return do
builder.build do
space << Parfait.object_space
next_message << space[:first_message]
message[:next_message] << next_message