change boot to new hash syntax

This commit is contained in:
Torsten Ruger 2018-03-25 13:27:15 +03:00
parent de7e02b0b8
commit bc4d4b428a
3 changed files with 29 additions and 28 deletions

View File

@ -47,7 +47,7 @@ module Mom
Parfait.object_space.get_class_by_name(:Word).instance_type
end
end
class SymbolConstant < String
class SymbolConstant < Constant
def ct_type
Parfait.object_space.get_class_by_name(:Word).instance_type
end

View File

@ -110,43 +110,44 @@ module Risc
type = types[name]
clazz = classes[name]
type.set_object_class( clazz )
type.init_lists({:type => :Type }.merge(ivars))
type.init_lists({type: :Type }.merge(ivars))
end
end
# superclasses other than default object
def super_class_names
{ :Object => :Kernel , :Kernel => :Value , :Integer => :Value , :BinaryCode => :Word }
{ Object: :Kernel , Kernel: :Value , Integer: :Value , BinaryCode: :Word }
end
# the function really just returns a constant (just avoiding the constant)
# unfortuantely that constant condenses every detail about the system, class names
# and all instance variable names. Really have to find a better way
def type_names
{ :Word => {:char_length => :Integer} ,
:List => {:indexed_length => :Integer} ,
:Message => { :next_message => :Message, :receiver => :Object, :frame => :NamedList ,
:return_address => :Integer, :return_value => :Integer,
:caller => :Message , :name => :Word , :arguments => :NamedList },
:Integer => {},
:TrueClass => {},
:FalseClass => {},
:NilClass => {},
:Object => {},
:Kernel => {}, #fix, kernel is a class, but should be a module
:BinaryCode => {:char_length => :Integer} ,
:Space => {:classes => :Dictionary , :types => :Dictionary ,
:first_message => :Message , single_true: :TrueClass,
{ Word: {char_length: :Integer} ,
List: {indexed_length: :Integer} ,
Message: { next_message: :Message, receiver: :Object, frame: :NamedList ,
return_address: :Integer, return_value: :Integer,
caller: :Message , name: :Word , arguments: :NamedList },
Integer: {},
TrueClass: {},
FalseClass: {},
NilClass: {},
Object: {},
Kernel: {}, #fix, kernel is a class, but should be a module
BinaryCode: {char_length: :Integer} ,
Space: {classes: :Dictionary , types: :Dictionary ,
first_message: :Message , single_true: :TrueClass,
single_false: :FalseClass , single_nil: :NilClass},
:NamedList => {},
:Type => {:names => :List , :types => :List ,
:object_class => :Class, :methods => :List } ,
:Class => {:instance_methods => :List, :instance_type => :Type, :name => :Word,
:super_class_name => :Word , :instance_names => :List },
:Dictionary => {:keys => :List , :values => :List } ,
:CacheEntry => {:cached_type => :Type , :cached_method => :TypedMethod } ,
:TypedMethod => {:name => :Word, :source => :Object, :instructions => :Object, :binary => :Object,
:arguments => :Type , :for_type => :Type, :frame => :Type } ,
NamedList: {},
Type: {names: :List , types: :List ,
object_class: :Class, methods: :List } ,
Class: {instance_methods: :List, instance_type: :Type, name: :Word,
super_class_name: :Word , instance_names: :List },
Dictionary: {keys: :List , values: :List } ,
CacheEntry: {cached_type: :Type , cached_method: :TypedMethod } ,
TypedMethod: {name: :Word, source: :Object, instructions: :Object,
binary: :BinaryCode, arguments: :Type , for_type: :Type,
frame: :Type } ,
}
end

View File

@ -118,7 +118,7 @@ module Vool
Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , [:message , :receiver , :type])
end
def build_method_cache_update(in_method)
receiver = StringConstant.new(@name)
receiver = SymbolConstant.new(@name)
resolve = SendStatement.new(:resolve_method , receiver , [SelfExpression.new])
move_method = Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_method] , [:message , :return_value])
resolve.to_mom(in_method) << move_method