up to, ut not including, creating frames
This commit is contained in:
@ -14,17 +14,17 @@ module Virtual
|
||||
|
||||
class BootSpace < Virtual::Object
|
||||
|
||||
# Initialize with a string for cpu. Naming conventions are: for Machine XXX there exists a module XXX
|
||||
# with a XXXMachine in it that derives from Virtual::RegisterMachine
|
||||
def initialize machine = nil
|
||||
def initialize
|
||||
super()
|
||||
@classes = Parfait::Hash.new
|
||||
@main = Virtual::CompiledMethod.new("main" , [] )
|
||||
#global objects (data)
|
||||
@objects = []
|
||||
@symbols = []
|
||||
@messages = []
|
||||
@frames = []
|
||||
@messages = 100.times.collect{ ::Message.new }
|
||||
@frames = 100.times.collect{ ::Frame.new }
|
||||
@next_message = @messages.first
|
||||
@next_frame = @frames.first
|
||||
@passes = [ Virtual::SendImplementation ]
|
||||
end
|
||||
attr_reader :main , :classes , :objects , :symbols,:messages,:frames
|
||||
@ -77,7 +77,7 @@ module Virtual
|
||||
obj.add_instance_method Builtin::Object.send(f , @context)
|
||||
end
|
||||
obj = get_or_create_class :Kernel
|
||||
[:main , :__init__,:putstring,:exit,:__send__].each do |f|
|
||||
[:main , :__init__,:putstring,:exit,:__send].each do |f|
|
||||
obj.add_instance_method Builtin::Kernel.send(f , @context)
|
||||
end
|
||||
obj = get_or_create_class :Integer
|
||||
|
@ -44,6 +44,7 @@ module Virtual
|
||||
end
|
||||
#
|
||||
def compile_get method , name
|
||||
raise "CALLED"
|
||||
if method.has_arg(name)
|
||||
method.add_code MessageGet.new(name)
|
||||
else
|
||||
|
@ -1,4 +1,5 @@
|
||||
require_relative "type"
|
||||
require "parfait/message"
|
||||
|
||||
module Virtual
|
||||
# our machine is made up of objects, some of which are code, some data
|
||||
@ -80,6 +81,22 @@ module Virtual
|
||||
end
|
||||
end
|
||||
end
|
||||
::Message.class_eval do
|
||||
def layout
|
||||
Virtual::Object.layout
|
||||
end
|
||||
def mem_length
|
||||
Virtual::Object.new.padded_words(2)
|
||||
end
|
||||
end
|
||||
::Frame.class_eval do
|
||||
def layout
|
||||
Virtual::Object.layout
|
||||
end
|
||||
def mem_length
|
||||
Virtual::Object.new.padded_words(2)
|
||||
end
|
||||
end
|
||||
Parfait::Hash.class_eval do
|
||||
HASH = { :names => [:keys,:values] , :types => [Virtual::Reference,Virtual::Reference]}
|
||||
def layout
|
||||
|
@ -27,7 +27,7 @@ module Virtual
|
||||
# note: this is the current view: call internal send, even the method name says else
|
||||
# but send is "special" and accesses the internal method name and resolves.
|
||||
kernel = Virtual::BootSpace.space.get_or_create_class(:Kernel)
|
||||
method = kernel.get_instance_method(:__send__)
|
||||
method = kernel.get_instance_method(:__send)
|
||||
new_codes << FunctionCall.new( method )
|
||||
raise "unimplemented #{code}"
|
||||
end
|
||||
|
Reference in New Issue
Block a user