more on set

This commit is contained in:
Torsten Ruger 2014-09-11 21:26:22 +03:00
parent 1d33c03537
commit b7e0d3fba4
3 changed files with 14 additions and 3 deletions

View File

@ -15,7 +15,7 @@ module Builtin
clazz = Virtual::BootSpace.space.get_or_create_class :Kernel
method = clazz.resolve_method :main
me = Virtual::Self.new(Virtual::Reference)
code = Virtual::Set.new(Virtual::NewSelf.new(me.type), me)
code = Virtual::Set.new(Virtual::Self.new(me.type), me)
function.add_code(code)
function.add_code Virtual::FunctionCall.new(method)
return function

View File

@ -6,9 +6,13 @@ module Register
def run block
block.codes.dup.each do |code|
next unless code.is_a? Virtual::Set
tmp = RegisterReference.new(Virtual::Message::TMP_REG)
if( code.to.is_a? Virtual::NewMessageSlot)
to = RegisterReference.new(:r0)
tmp = RegisterReference.new(:r5)
to = Virtual::Message::NEW_MESSAGE_REG
move = RegisterMachine.instance.ldr( to , tmp , code.to.index )
block.replace(code , move )
elsif( code.to.is_a? Virtual::Self)
to = RegisterReference.new(Virtual::Message::SELF_REG)
move = RegisterMachine.instance.ldr( to , tmp , code.to.index )
block.replace(code , move )
else

View File

@ -24,6 +24,13 @@ module Virtual
EXCEPTION = 3
SELF = 4
SELF_REG = :r0
MESSAGE_REG = :r1
FRAME_REG = :r2
NEW_MESSAGE_REG = :r3
TMP_REG = :r4
def initialize me , normal , exceptional
@me = me
@next_normal = normal