a long string of import order and namespace issues which is not over yet
This commit is contained in:
parent
1347a85eb7
commit
c5655b1059
@ -146,3 +146,4 @@ module Arm
|
||||
end
|
||||
end
|
||||
end
|
||||
require_relative "passes/call_implementation"
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Register
|
||||
module Arm
|
||||
# This implements call logic, which is simply like a c call (not send, that involves lookup and all sorts)
|
||||
#
|
||||
# The only target for a call is a CompiledMethod, so we just need to get the address for the code
|
||||
@ -10,10 +10,10 @@ module Register
|
||||
def run block
|
||||
block.codes.dup.each do |code|
|
||||
next unless code.is_a? Register::FunctionCall
|
||||
call = RegisterMachine.instance.call( code.method )
|
||||
call = ArmMachine.instance.call( code.method )
|
||||
block.replace(code , call )
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::BootSpace.space.add_pass_after CallImplementation , SetImplementation
|
||||
Virtual::BootSpace.space.add_pass_after "Arm::CallImplementation" , "Register::SetImplementation"
|
||||
end
|
||||
|
@ -13,5 +13,5 @@ module Register
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::BootSpace.space.add_pass_after EnterImplementation , CallImplementation
|
||||
Virtual::BootSpace.space.add_pass_after "Register::EnterImplementation" , "Virtual::GetImplementation"
|
||||
end
|
||||
|
@ -19,5 +19,5 @@ module Register
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::BootSpace.space.add_pass_after ReturnImplementation , CallImplementation
|
||||
Virtual::BootSpace.space.add_pass_after "Register::ReturnImplementation" , "Virtual::GetImplementation"
|
||||
end
|
||||
|
@ -42,5 +42,5 @@ module Register
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::BootSpace.space.add_pass_after SetImplementation , Virtual::GetImplementation
|
||||
Virtual::BootSpace.space.add_pass_after "Register::SetImplementation" , "Virtual::GetImplementation"
|
||||
end
|
||||
|
@ -1,8 +1,6 @@
|
||||
require_relative "instruction"
|
||||
require_relative "register_reference"
|
||||
require "arm/arm_machine"
|
||||
require_relative "assembler"
|
||||
require_relative "passes/set_implementation"
|
||||
require_relative "passes/call_implementation"
|
||||
require_relative "passes/enter_implementation"
|
||||
require_relative "passes/return_implementation"
|
||||
|
@ -6,7 +6,8 @@ require "elf/object_writer"
|
||||
require 'salama-reader'
|
||||
require 'parser/transform'
|
||||
require "sof/all"
|
||||
require "register/register_machine"
|
||||
require "virtual/machine"
|
||||
require "register/register_machine"
|
||||
require "arm/arm_machine"
|
||||
require "ast/all"
|
||||
require_relative "stream_reader"
|
||||
|
@ -25,17 +25,19 @@ module Virtual
|
||||
@messages = 100.times.collect{ ::Message.new } + frames
|
||||
@next_message = @messages.first
|
||||
@next_frame = frames.first
|
||||
@passes = [ Virtual::SendImplementation ]
|
||||
@passes = [ "Virtual::SendImplementation" ]
|
||||
end
|
||||
attr_reader :main , :classes , :objects , :symbols,:messages, :next_message , :next_frame
|
||||
|
||||
def run_passes
|
||||
@passes.each do |pass|
|
||||
@passes.each do |pass_class|
|
||||
all = main.blocks
|
||||
@classes.values.each do |c|
|
||||
c.instance_methods.each {|f| all += f.blocks }
|
||||
end
|
||||
all.each do |block|
|
||||
pass = eval pass_class
|
||||
raise "no such pass-class as #{pass_class}" unless pass
|
||||
pass.new.run(block)
|
||||
end
|
||||
end
|
||||
@ -46,7 +48,6 @@ module Virtual
|
||||
@@space
|
||||
else
|
||||
@@space = BootSpace.new
|
||||
@@space.boot_classes! # boot is a verb here
|
||||
@@space
|
||||
end
|
||||
end
|
||||
@ -57,7 +58,7 @@ module Virtual
|
||||
|
||||
def add_pass_after( pass , after)
|
||||
index = @passes.index(after)
|
||||
raise "No such pass to add after: #{after}" unless index
|
||||
raise "No such pass (#{pass}) to add after: #{after}" unless index
|
||||
@passes.insert(index+1 , pass)
|
||||
end
|
||||
def add_pass_before( pass , after)
|
||||
|
@ -41,6 +41,7 @@ module Virtual
|
||||
|
||||
def self.boot
|
||||
machine = Machine.new
|
||||
BootSpace.space.boot_classes! # boot is a verb here
|
||||
machine.boot
|
||||
machine
|
||||
end
|
||||
@ -87,5 +88,5 @@ require_relative "passes/send_implementation"
|
||||
require_relative "passes/get_implementation"
|
||||
require_relative "passes/frame_implementation"
|
||||
|
||||
Sof.Volotile.add(Virtual::Block , [:method])
|
||||
Sof.Volotile.add(Virtual::CompiledMethod , [:current])
|
||||
Sof::Volotile.add(Virtual::Block , [:method])
|
||||
Sof::Volotile.add(Virtual::CompiledMethod , [:current])
|
||||
|
@ -47,5 +47,5 @@ module Virtual
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::BootSpace.space.add_pass_after FrameImplementation , GetImplementation
|
||||
Virtual::BootSpace.space.add_pass_after "Virtual::FrameImplementation" , "Virtual::GetImplementation"
|
||||
end
|
||||
|
@ -11,5 +11,5 @@ module Virtual
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::BootSpace.space.add_pass_after GetImplementation, SendImplementation
|
||||
Virtual::BootSpace.space.add_pass_after "Virtual::GetImplementation", "Virtual::SendImplementation"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user