diff --git a/lib/register/assembler.rb b/lib/register/assembler.rb index 7737584b..bcc8aa2e 100644 --- a/lib/register/assembler.rb +++ b/lib/register/assembler.rb @@ -51,12 +51,6 @@ module Register link_object code , at end end - def link_MethodEnter str , at - end - def link_MethodReturn str , at - end - def link_FunctionCall str , at - end def link_String str , at end def link_Symbol sym , at diff --git a/lib/register/enter_implementation.rb b/lib/register/enter_implementation.rb new file mode 100644 index 00000000..f0663a02 --- /dev/null +++ b/lib/register/enter_implementation.rb @@ -0,0 +1,13 @@ +module Register + + class EnterImplementation + def run block + block.codes.dup.each do |code| + next unless code.is_a? Virtual::MethodEnter + # save return register and create a new frame + block.replace(code , [] ) + end + end + end + Virtual::BootSpace.space.add_pass_after EnterImplementation , CallImplementation +end diff --git a/lib/register/register_machine.rb b/lib/register/register_machine.rb index f9c0c18b..ddb23206 100644 --- a/lib/register/register_machine.rb +++ b/lib/register/register_machine.rb @@ -149,5 +149,7 @@ require_relative "register_reference" require_relative "get_implementation" require_relative "set_implementation" require_relative "call_implementation" +require_relative "enter_implementation" +require_relative "return_implementation" require "arm/arm_machine" require_relative "assembler" \ No newline at end of file diff --git a/lib/register/return_implementation.rb b/lib/register/return_implementation.rb new file mode 100644 index 00000000..16d3aad7 --- /dev/null +++ b/lib/register/return_implementation.rb @@ -0,0 +1,12 @@ +module Register + class ReturnImplementation + def run block + block.codes.dup.each do |code| + next unless code.is_a? Virtual::MethodReturn +# call = RegisterMachine.instance.call( code.method ) + block.replace(code , [] ) + end + end + end + Virtual::BootSpace.space.add_pass_after ReturnImplementation , CallImplementation +end