Change Locals in calling convention

Just like the args, locals are now inlined into the Message.
Message is off course bigger, but as they are created at compile time, that hardly matters
Some programs did get somewhat smaller, especially with both changes, but not super much
This commit is contained in:
2019-08-23 10:23:01 +03:00
parent 5e44e9caaf
commit 8ed013c2b9
4 changed files with 22 additions and 11 deletions

View File

@ -28,17 +28,17 @@ module Mom
# or then the methods arg or frame
def slot_type_for(name)
if index = @callable.arguments_type.variable_index(name)
return ["arg#{index}".to_sym]
elsif @callable.frame_type.variable_index(name)
slot_def = [:frame]
slot_def = ["arg#{index}".to_sym]
elsif index = @callable.frame_type.variable_index(name)
slot_def = ["local#{index}".to_sym]
elsif index = @method.arguments_type.variable_index(name)
return [:caller , :caller , "arg#{index}".to_sym]
elsif @method.frame_type.variable_index(name)
slot_def = [:caller ,:caller , :frame ]
slot_def = [:caller , :caller , "arg#{index}".to_sym]
elsif index = @method.frame_type.variable_index(name)
slot_def = [:caller ,:caller , "local#{index}".to_sym ]
elsif
raise "no variable #{name} , need to resolve at runtime"
end
slot_def << name
return slot_def
end

View File

@ -71,7 +71,9 @@ module Mom
if index = @callable.arguments_type.variable_index(name)
return ["arg#{index}".to_sym]
end
[:frame , name]
index = @callable.frame_type.variable_index(name)
raise "no such local or argument #{name}" unless index
return ["local#{index}".to_sym]
end
def add_block_compiler(compiler)