work on Integer.to_s , not a simple task as it turns out

This commit is contained in:
Torsten Ruger
2014-05-15 16:54:23 +03:00
parent 918ede1c02
commit b4c79d218f
12 changed files with 80 additions and 11 deletions

View File

@ -35,6 +35,7 @@ module Vm
def add_code(kode)
raise "alarm #{kode}" if kode.is_a? Word
raise "alarm #{kode}" unless kode.is_a? Code
@codes << kode
self
end

View File

@ -66,6 +66,7 @@ module Vm
# code, and has opcode set to :b and :condition_code set to the condition
CONDITIONS.each do |suffix|
define_instruction_for("b#{suffix}".to_sym , CallInstruction)
define_instruction_for("call#{suffix}".to_sym , CallInstruction)
end
end

View File

@ -1,6 +1,4 @@
require "core/kernel"
require_relative "program"
require "support/hash_attributes"
module Vm
#currently just holding the program in here so we can have global access

View File

@ -9,7 +9,7 @@ module Vm
# Functions have a exactly three blocks, entry, exit and body, which are created for you
# with straight branches between them.
# Also remember that if your den body exists of severa blocks, they must be wrapped in a
# Also remember that if your den body exists of several blocks, they must be wrapped in a
# block as the function really only has the one, and blocks only assemble their codes,
# not their next links
# This comes at zero runtime cost though, as the wrapper is just the sum of it's codes

View File

@ -50,6 +50,10 @@ module Vm
@attributes[:condition_code] = opcode[1,2].to_sym
@attributes[:opcode] = :b
end
if opcode.length == 6 and opcode[0] == "c"
@attributes[:condition_code] = opcode[4,2].to_sym
@attributes[:opcode] = :call
end
end
end
end

View File

@ -1,6 +1,8 @@
require_relative "context"
require_relative "function"
require_relative "call_site"
require "arm/arm_machine"
require "core/kernel"
module Vm
# A Program represents an executable that we want to build
@ -58,7 +60,7 @@ module Vm
def get_or_create_function name
fun = get_function name
unless fun
fun = Core::Kernel.send(name)
fun = Core::Kernel.send(name , context)
raise "no such function '#{name}'" if fun == nil
@functions << fun
end