rename machine to c_machine
This commit is contained in:
@ -69,7 +69,7 @@ module Vm
|
||||
# (hopefully an instruction) added as code
|
||||
def method_missing(meth, *args, &block)
|
||||
if args.length == 1
|
||||
add_code Machine.instance.send(meth , *args)
|
||||
add_code CMachine.instance.send(meth , *args)
|
||||
else
|
||||
super
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
module Vm
|
||||
|
||||
# Our virtual machine has a number of registers of a given size and uses a stack
|
||||
# Our virtual c-machine has a number of registers of a given size and uses a stack
|
||||
# So much so standard
|
||||
# But our machine is oo, meaning that the register contents is typed.
|
||||
# Off course current hardware does not have that (a perceived issue), but for our machine we pretend.
|
||||
@ -22,7 +22,7 @@ module Vm
|
||||
# Instructions work with options, so you can pass anything in, and the only thing the functions does
|
||||
# is save you typing the clazz.new. It passes the function name as the :opcode
|
||||
|
||||
class Machine
|
||||
class CMachine
|
||||
|
||||
# hmm, not pretty but for now
|
||||
@@instance = nil
|
@ -12,6 +12,7 @@ module Vm
|
||||
attr_reader :function , :args , :name
|
||||
|
||||
def load_args into
|
||||
raise args.inspect
|
||||
args.each_with_index do |arg , index|
|
||||
into.add_code arg.load("r#{index}".to_sym)
|
||||
end
|
||||
|
@ -19,13 +19,13 @@ module Vm
|
||||
class Program < Block
|
||||
|
||||
# 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 Vm::Machine
|
||||
# with a XXXMachine in it that derives from Vm::CMachine
|
||||
def initialize machine = nil
|
||||
super("start")
|
||||
machine = RbConfig::CONFIG["host_cpu"] unless machine
|
||||
machine = "intel" if machine == "x86_64"
|
||||
machine = machine.capitalize
|
||||
Machine.instance = eval("#{machine}::#{machine}Machine").new
|
||||
CMachine.instance = eval("#{machine}::#{machine}Machine").new
|
||||
@context = Context.new(self)
|
||||
#global objects (data)
|
||||
@objects = []
|
||||
|
Reference in New Issue
Block a user