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
|
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)
|
# 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
|
# 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
|
def run block
|
||||||
block.codes.dup.each do |code|
|
block.codes.dup.each do |code|
|
||||||
next unless code.is_a? Register::FunctionCall
|
next unless code.is_a? Register::FunctionCall
|
||||||
call = RegisterMachine.instance.call( code.method )
|
call = ArmMachine.instance.call( code.method )
|
||||||
block.replace(code , call )
|
block.replace(code , call )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Virtual::BootSpace.space.add_pass_after CallImplementation , SetImplementation
|
Virtual::BootSpace.space.add_pass_after "Arm::CallImplementation" , "Register::SetImplementation"
|
||||||
end
|
end
|
||||||
|
@ -13,5 +13,5 @@ module Register
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Virtual::BootSpace.space.add_pass_after EnterImplementation , CallImplementation
|
Virtual::BootSpace.space.add_pass_after "Register::EnterImplementation" , "Virtual::GetImplementation"
|
||||||
end
|
end
|
||||||
|
@ -19,5 +19,5 @@ module Register
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Virtual::BootSpace.space.add_pass_after ReturnImplementation , CallImplementation
|
Virtual::BootSpace.space.add_pass_after "Register::ReturnImplementation" , "Virtual::GetImplementation"
|
||||||
end
|
end
|
||||||
|
@ -42,5 +42,5 @@ module Register
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Virtual::BootSpace.space.add_pass_after SetImplementation , Virtual::GetImplementation
|
Virtual::BootSpace.space.add_pass_after "Register::SetImplementation" , "Virtual::GetImplementation"
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
require_relative "instruction"
|
require_relative "instruction"
|
||||||
require_relative "register_reference"
|
require_relative "register_reference"
|
||||||
require "arm/arm_machine"
|
|
||||||
require_relative "assembler"
|
require_relative "assembler"
|
||||||
require_relative "passes/set_implementation"
|
require_relative "passes/set_implementation"
|
||||||
require_relative "passes/call_implementation"
|
|
||||||
require_relative "passes/enter_implementation"
|
require_relative "passes/enter_implementation"
|
||||||
require_relative "passes/return_implementation"
|
require_relative "passes/return_implementation"
|
||||||
|
@ -6,7 +6,8 @@ require "elf/object_writer"
|
|||||||
require 'salama-reader'
|
require 'salama-reader'
|
||||||
require 'parser/transform'
|
require 'parser/transform'
|
||||||
require "sof/all"
|
require "sof/all"
|
||||||
require "register/register_machine"
|
|
||||||
require "virtual/machine"
|
require "virtual/machine"
|
||||||
|
require "register/register_machine"
|
||||||
|
require "arm/arm_machine"
|
||||||
require "ast/all"
|
require "ast/all"
|
||||||
require_relative "stream_reader"
|
require_relative "stream_reader"
|
||||||
|
@ -25,17 +25,19 @@ module Virtual
|
|||||||
@messages = 100.times.collect{ ::Message.new } + frames
|
@messages = 100.times.collect{ ::Message.new } + frames
|
||||||
@next_message = @messages.first
|
@next_message = @messages.first
|
||||||
@next_frame = frames.first
|
@next_frame = frames.first
|
||||||
@passes = [ Virtual::SendImplementation ]
|
@passes = [ "Virtual::SendImplementation" ]
|
||||||
end
|
end
|
||||||
attr_reader :main , :classes , :objects , :symbols,:messages, :next_message , :next_frame
|
attr_reader :main , :classes , :objects , :symbols,:messages, :next_message , :next_frame
|
||||||
|
|
||||||
def run_passes
|
def run_passes
|
||||||
@passes.each do |pass|
|
@passes.each do |pass_class|
|
||||||
all = main.blocks
|
all = main.blocks
|
||||||
@classes.values.each do |c|
|
@classes.values.each do |c|
|
||||||
c.instance_methods.each {|f| all += f.blocks }
|
c.instance_methods.each {|f| all += f.blocks }
|
||||||
end
|
end
|
||||||
all.each do |block|
|
all.each do |block|
|
||||||
|
pass = eval pass_class
|
||||||
|
raise "no such pass-class as #{pass_class}" unless pass
|
||||||
pass.new.run(block)
|
pass.new.run(block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -46,7 +48,6 @@ module Virtual
|
|||||||
@@space
|
@@space
|
||||||
else
|
else
|
||||||
@@space = BootSpace.new
|
@@space = BootSpace.new
|
||||||
@@space.boot_classes! # boot is a verb here
|
|
||||||
@@space
|
@@space
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -57,7 +58,7 @@ module Virtual
|
|||||||
|
|
||||||
def add_pass_after( pass , after)
|
def add_pass_after( pass , after)
|
||||||
index = @passes.index(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)
|
@passes.insert(index+1 , pass)
|
||||||
end
|
end
|
||||||
def add_pass_before( pass , after)
|
def add_pass_before( pass , after)
|
||||||
|
@ -41,6 +41,7 @@ module Virtual
|
|||||||
|
|
||||||
def self.boot
|
def self.boot
|
||||||
machine = Machine.new
|
machine = Machine.new
|
||||||
|
BootSpace.space.boot_classes! # boot is a verb here
|
||||||
machine.boot
|
machine.boot
|
||||||
machine
|
machine
|
||||||
end
|
end
|
||||||
@ -87,5 +88,5 @@ require_relative "passes/send_implementation"
|
|||||||
require_relative "passes/get_implementation"
|
require_relative "passes/get_implementation"
|
||||||
require_relative "passes/frame_implementation"
|
require_relative "passes/frame_implementation"
|
||||||
|
|
||||||
Sof.Volotile.add(Virtual::Block , [:method])
|
Sof::Volotile.add(Virtual::Block , [:method])
|
||||||
Sof.Volotile.add(Virtual::CompiledMethod , [:current])
|
Sof::Volotile.add(Virtual::CompiledMethod , [:current])
|
||||||
|
@ -47,5 +47,5 @@ module Virtual
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Virtual::BootSpace.space.add_pass_after FrameImplementation , GetImplementation
|
Virtual::BootSpace.space.add_pass_after "Virtual::FrameImplementation" , "Virtual::GetImplementation"
|
||||||
end
|
end
|
||||||
|
@ -11,5 +11,5 @@ module Virtual
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Virtual::BootSpace.space.add_pass_after GetImplementation, SendImplementation
|
Virtual::BootSpace.space.add_pass_after "Virtual::GetImplementation", "Virtual::SendImplementation"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user