rename locals to frame

This commit is contained in:
Torsten Ruger
2018-03-14 20:24:47 +05:30
parent 7db329fa6b
commit 559a797100
9 changed files with 25 additions and 25 deletions

View File

@ -15,8 +15,8 @@ module Rubyx
def on_def(statement)
name , args , body = *statement
args_type = make_type(args)
locals_type = make_locals(body)
@methods << Vool::VoolMethod.new(name , args_type , locals_type , body )
frame_type = make_locals(body)
@methods << Vool::VoolMethod.new(name , args_type , frame_type , body )
end
private

View File

@ -31,7 +31,7 @@ module Rubyx
def test_one_local
method = parse_collect("def meth2(arg1); foo = 2 ;end").first
assert method.locals_type.variable_index(:foo) , method.locals_type.inspect
assert method.frame_type.variable_index(:foo) , method.frame_type.inspect
end
end

View File

@ -44,7 +44,7 @@ module Rubyx
def test_method_has_no_locals
method = create_method
assert_equal 1 , method.locals_type.instance_length
assert_equal 1 , method.frame_type.instance_length
end
def test_method_has_args
@ -54,7 +54,7 @@ module Rubyx
def test_method_has_locals
method = create_method_local
assert_equal 2 , method.locals_type.instance_length
assert_equal 2 , method.frame_type.instance_length
end
def test_method_create_tmp
@ -65,7 +65,7 @@ module Rubyx
def test_method_add_tmp
method = create_method_local
method.create_tmp
assert_equal 3 , method.locals_type.instance_length
assert_equal 3 , method.frame_type.instance_length
end
end

View File

@ -31,7 +31,7 @@ module Vm
raise "must define local '#{name}' before using it" unless index
named_list = use_reg :NamedList
add_slot_to_reg("#{name} load locals" , :message , :frame , named_list )
ret = use_reg @method.locals_type( index )
ret = use_reg @method.frame_type( index )
add_slot_to_reg("#{name} load from locals" , named_list , index + 1, ret )
return ret
end