type attr cleanup

and sizes up top
This commit is contained in:
Torsten Rüger 2019-09-10 00:18:20 +03:00
parent d82cedf4c0
commit c3c2ab606c
16 changed files with 61 additions and 44 deletions

View File

@ -7,7 +7,7 @@ module Parfait
# and as the last code of each link is a jump to the next link.
#
class BinaryCode < Data32
attr_reader :type, :next_code
attr_reader :next_code
def self.type_length
2 #type + next (could get from space, maybe later)

View File

@ -8,9 +8,10 @@
module Parfait
class CacheEntry < Object
attr_reader :type, :cached_type, :cached_method
attr_reader :cached_type, :cached_method
def initialize(type , method)
super()
@cached_type = type
@cached_method = method
end

View File

@ -12,13 +12,16 @@ module Parfait
#
class Callable < Object
attr_reader :type, :self_type , :arguments_type , :frame_type , :binary
attr_reader :self_type , :arguments_type , :frame_type , :binary
attr_reader :blocks , :name
attr_reader :next_callable
def self.type_length
8
end
def self.memory_size
8
end
def initialize( name , self_type , arguments_type , frame_type)
super()

View File

@ -18,12 +18,15 @@ module Parfait
class Class < Object
include Behaviour
attr_reader :type, :instance_type , :name , :instance_methods
attr_reader :instance_type , :name , :instance_methods
attr_reader :super_class_name , :meta_class
def self.type_length
6
end
def self.memory_size
8
end
def initialize( name , superclass , instance_type)
super()

View File

@ -3,11 +3,14 @@
module Parfait
class Dictionary < Object
attr_reader :type, :i_keys , :i_values
attr_reader :i_keys , :i_values
def self.type_length
3
end
def self.memory_size
8
end
# only empty initialization for now
#

View File

@ -14,7 +14,13 @@
module Parfait
class Factory < Object
attr_reader :type , :for_type , :next_object , :reserve , :attribute_name , :page_size
attr_reader :for_type , :next_object , :reserve , :attribute_name , :page_size
def self.type_length
6
end
def self.memory_size
8
end
# initialize for a given type (for_type). The attribute that is used to create the
# list is the first that starts with next_ . "next" itself would have been nice and general

View File

@ -6,17 +6,7 @@
module Parfait
class Integer < Data4
attr_reader :type, :next_integer
def initialize(value , next_i = nil)
super()
@next_integer = next_i
set_internal_word(Integer.integer_index, value)
end
def value
get_internal_word(Integer.integer_index)
end
attr_reader :next_integer
def self.type_length
2 # 0 type, 1 next_i
@ -30,6 +20,16 @@ module Parfait
type_length
end
def initialize(value , next_i = nil)
super()
@next_integer = next_i
set_internal_word(Integer.integer_index, value)
end
def value
get_internal_word(Integer.integer_index)
end
def to_s
"Integer " + value.to_s
end

View File

@ -7,7 +7,7 @@
module Parfait
class List < Data16
attr_reader :type, :indexed_length , :next_list
attr_reader :indexed_length , :next_list
def self.type_length
3 # 0 type , 1 length , 2 - next_list

View File

@ -11,22 +11,15 @@
module Parfait
class Message < Object
# :next_message => :Message, :receiver => :Object, :frame => :NamedList ,
# :return_address => :Integer, :return_value => :Integer,
# :caller => :Message , :name => :Word , :arguments => :NamedList
attr_reader :type, :next_message
attr_reader :receiver
attr_reader :next_message, :receiver
attr_reader :return_address, :return_value
attr_reader :caller , :method
attr_reader :arguments_given
attr_reader :arg1 , :arg2, :arg3, :arg4, :arg5, :arg6
attr_reader :locals_used
attr_reader :local1 , :local2, :local3, :local4, :local5, :local6 ,:local7,:local8
attr_reader :local9 ,:local10, :local11 , :local12, :local13, :local14
attr_reader :arguments_given, :arg1 , :arg2, :arg3, :arg4, :arg5, :arg6
attr_reader :locals_used, :local1 , :local2, :local3, :local4, :local5, :local6 ,:local7
attr_reader :local8 , :local9 ,:local10, :local11 , :local12, :local13, :local14
def self.type_length
31
30
end
def self.memory_size
32

View File

@ -20,11 +20,14 @@ module Parfait
class MetaClass < Object
include Behaviour
attr_reader :type, :instance_type , :instance_methods , :clazz
attr_reader :instance_type , :instance_methods , :clazz
def self.type_length
4
end
def self.memory_size
8
end
def initialize( clazz )
super()

View File

@ -23,8 +23,6 @@
module Parfait
class NamedList < Object
attr_reader :type
def self.memory_size
16
end

View File

@ -15,6 +15,14 @@
module Parfait
class Object
attr_reader :type
def self.type_length
1
end
def self.memory_size
4
end
def type=(t)
set_type( t )
end

View File

@ -30,8 +30,14 @@ module Parfait
class Space < Object
attr_reader :type, :classes , :types , :factories
attr_reader :classes , :types , :factories
attr_reader :true_object , :false_object , :nil_object
def self.type_length
7
end
def self.memory_size
8
end
def initialize( classes , pages)
@classes = classes
@ -54,13 +60,6 @@ module Parfait
@nil_object = Parfait::NilClass.new
end
def self.type_length
12
end
def self.memory_size
16
end
def init_message_chain( message )
prev = nil
while(message)

View File

@ -36,7 +36,7 @@ module Parfait
class Type < Object
attr_reader :type, :object_class , :names , :types , :methods
attr_reader :object_class , :names , :types , :methods
def self.type_length
5

View File

@ -12,7 +12,7 @@ module Parfait
#
class VoolMethod < Object
attr_reader :type, :name , :args_type , :frame_type
attr_reader :name , :args_type , :frame_type
attr_reader :source
def initialize(name , args_type , frame_type , source )

View File

@ -13,7 +13,7 @@ module Parfait
# Object length is measured in non-type cells though
class Word < Data8
attr_reader :type, :char_length
attr_reader :char_length
def self.type_length
2 # 0 type , 1 char_length