[squeak-dev] The Trunk: Kernel-nice.1039.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Oct 20 20:47:21 UTC 2016


Hi Eliot,
I don't remember about this conversation. Anyway I was on the process of
adopting DoubleByte, so this was only transitory.
I perfectly agree about Words... Even without quitting own Squeak world
this is already highly polymorphic:
There are virtual machine words (sizeof void *)
There are image words (sizeof Oop)
Above two matches on Cog & Spur VM, but as you said 32bits image on 64bits
image could be interesting.
There are variableWord collections (allways 32bits) and now
variableDoubleWords...

2016-10-20 22:10 GMT+02:00 Eliot Miranda <eliot.miranda at gmail.com>:

> Nicolas,
>
>     I thought that there had been a conversation about this and that Bert
> had expressed a preference for DoubleByte and DoubleWord.  Hence I kept to
> that.  If I'm mistaken forgive me.  But personally I don't like HalfWord.
>  t's as ambiguous as word.  At least DoubleByte is not ambiguous.
>
> On Thu, Oct 20, 2016 at 12:59 PM, <commits at source.squeak.org> wrote:
>
>> Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
>> http://source.squeak.org/trunk/Kernel-nice.1039.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Kernel-nice.1039
>> Author: nice
>> Time: 20 September 2016, 11:00:27.302558 pm
>> UUID: b0aeabf6-f73d-44c4-be8b-d2c66a73486f
>> Ancestors: Kernel-bf.1038
>>
>> Introduce HalfWord (16 bits) and DoubleWord (64 bits) subclasses which
>> are possible in Spur format, but yet not exploited.
>>
>> =============== Diff against Kernel-bf.1038 ===============
>>
>> Item was added:
>> + ----- Method: Behavior>>isDoubleWords (in category 'testing') -----
>> + isDoubleWords
>> +       "Answer true if the receiver is made of 64-bit instance
>> variables."
>> +
>> +       ^self instSpec = 2r1001!
>>
>> Item was added:
>> + ----- Method: Behavior>>isHalfWords (in category 'testing') -----
>> + isHalfWords
>> +       "Answer true if the receiver is made of 16-bit instance
>> variables."
>> +
>> +       ^(self instSpec bitAnd: 2r11100) = 2r1100!
>>
>> Item was changed:
>>   ----- Method: Behavior>>isWords (in category 'testing') -----
>>   isWords
>>         "Answer true if the receiver is made of 32-bit instance
>> variables."
>>
>> +       ^(self instSpec bitAnd: 2r11110) = 2r1010!
>> -       ^self isBytes not!
>>
>> Item was added:
>> + ----- Method: Class>>variableDoubleWordSubcl
>> ass:instanceVariableNames:classVariableNames:poolDictionaries:category:
>> (in category 'subclass creation') -----
>> + variableDoubleWordSubclass: t instanceVariableNames: f
>> +       classVariableNames: d poolDictionaries: s category: cat
>> +       "This is the standard initialization message for creating a new
>> class as a
>> +       subclass of an existing class (the receiver) in which the
>> subclass is to
>> +       have indexable double-word-sized nonpointer variables."
>> +       ^(ClassBuilder new)
>> +               superclass: self
>> +               variableDoubleWordSubclass: t
>> +               instanceVariableNames: f
>> +               classVariableNames: d
>> +               poolDictionaries: s
>> +               category: cat
>> + !
>>
>> Item was added:
>> + ----- Method: Class>>variableDoubleWordSubclass:uses:
>> instanceVariableNames:classVariableNames:poolDictionaries:category: (in
>> category 'subclass creation') -----
>> + variableDoubleWordSubclass: t uses: aTraitCompositionOrArray
>> instanceVariableNames: f
>> +       classVariableNames: d poolDictionaries: s category: cat
>> +       "This is the standard initialization message for creating a new
>> class as a
>> +       subclass of an existing class (the receiver) in which the
>> subclass is to
>> +       have indexable double-word-sized nonpointer variables."
>> +
>> +       | newClass copyOfOldClass |
>> +       copyOfOldClass := self copy.
>> +       newClass := self
>> +               variableDoubleWordSubclass: t
>> +               instanceVariableNames: f
>> +               classVariableNames: d
>> +               poolDictionaries: s
>> +               category: cat.
>> +
>> +       newClass setTraitComposition: aTraitCompositionOrArray
>> asTraitComposition.
>> +       SystemChangeNotifier uniqueInstance
>> +               classDefinitionChangedFrom: copyOfOldClass to: newClass.
>> +       ^newClass
>> + !
>>
>> Item was added:
>> + ----- Method: Class>>variableHalfWordSubclas
>> s:instanceVariableNames:classVariableNames:poolDictionaries:category:
>> (in category 'subclass creation') -----
>> + variableHalfWordSubclass: t instanceVariableNames: f
>> +       classVariableNames: d poolDictionaries: s category: cat
>> +       "This is the standard initialization message for creating a new
>> class as a
>> +       subclass of an existing class (the receiver) in which the
>> subclass is to
>> +       have indexable half-word-sized nonpointer variables."
>> +       ^(ClassBuilder new)
>> +               superclass: self
>> +               variableHalfWordSubclass: t
>> +               instanceVariableNames: f
>> +               classVariableNames: d
>> +               poolDictionaries: s
>> +               category: cat
>> + !
>>
>> Item was added:
>> + ----- Method: Class>>variableHalfWordSubclas
>> s:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:
>> (in category 'subclass creation') -----
>> + variableHalfWordSubclass: t uses: aTraitCompositionOrArray
>> instanceVariableNames: f
>> +       classVariableNames: d poolDictionaries: s category: cat
>> +       "This is the standard initialization message for creating a new
>> class as a
>> +       subclass of an existing class (the receiver) in which the
>> subclass is to
>> +       have indexable half-word-sized nonpointer variables."
>> +
>> +       | newClass copyOfOldClass |
>> +       copyOfOldClass := self copy.
>> +       newClass := self
>> +               variableHalfWordSubclass: t
>> +               instanceVariableNames: f
>> +               classVariableNames: d
>> +               poolDictionaries: s
>> +               category: cat.
>> +
>> +       newClass setTraitComposition: aTraitCompositionOrArray
>> asTraitComposition.
>> +       SystemChangeNotifier uniqueInstance
>> +               classDefinitionChangedFrom: copyOfOldClass to: newClass.
>> +       ^newClass!
>>
>> Item was changed:
>>   ----- Method: ClassBuilder>>superclass:varia
>> bleByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
>> (in category 'public') -----
>>   superclass: aClass
>>         variableByteSubclass: t instanceVariableNames: f
>>         classVariableNames: d poolDictionaries: s category: cat
>>         "This is the standard initialization message for creating a new
>> class as a
>>         subclass of an existing class in which the subclass is to
>>         have indexable byte-sized nonpointer variables."
>>         | oldClassOrNil actualType env |
>>         (aClass instSize > 0)
>>                 ifTrue: [^self error: 'cannot make a byte subclass of a
>> class with named fields'].
>>         (aClass isVariable and: [aClass isWords])
>>                 ifTrue: [^self error: 'cannot make a byte subclass of a
>> class with word fields'].
>> +       (aClass isVariable and: [aClass isHalfWords])
>> +               ifTrue: [^self error: 'cannot make a byte subclass of a
>> class with half word fields'].
>> +       (aClass isVariable and: [aClass isDoubleWords])
>> +               ifTrue: [^self error: 'cannot make a byte subclass of a
>> class with double word fields'].
>>         (aClass isVariable and: [aClass isPointers])
>>                 ifTrue: [^self error: 'cannot make a byte subclass of a
>> class with pointer fields'].
>>         oldClassOrNil := aClass environment at: t ifAbsent:[nil].
>>         actualType := (oldClassOrNil notNil
>>                                    and: [oldClassOrNil typeOfClass ==
>> #compiledMethod])
>>                                         ifTrue: [#compiledMethod]
>>                                         ifFalse: [#bytes].
>>         env := CurrentEnvironment signal ifNil: [aClass environment].
>>         ^self
>>                 name: t
>>                 inEnvironment: env
>>                 subclassOf: aClass
>>                 type: actualType
>>                 instanceVariableNames: f
>>                 classVariableNames: d
>>                 poolDictionaries: s
>>                 category: cat!
>>
>> Item was added:
>> + ----- Method: ClassBuilder>>superclass:varia
>> bleDoubleWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
>> (in category 'public') -----
>> + superclass: aClass
>> +       variableDoubleWordSubclass: t instanceVariableNames: f
>> +       classVariableNames: d poolDictionaries: s category: cat
>> +       "This is the standard initialization message for creating a new
>> class as a
>> +       subclass of an existing class in which the subclass is to
>> +       have indexable double-word-sized nonpointer variables."
>> +       | env |
>> +       (aClass instSize > 0)
>> +               ifTrue: [^self error: 'cannot make a double word subclass
>> of a class with named fields'].
>> +       (aClass isVariable and: [aClass isBytes])
>> +               ifTrue: [^self error: 'cannot make a double word subclass
>> of a class with byte fields'].
>> +       (aClass isVariable and: [aClass isHalfWords])
>> +               ifTrue: [^self error: 'cannot make a double word subclass
>> of a class with half word fields'].
>> +       (aClass isVariable and: [aClass isWords])
>> +               ifTrue: [^self error: 'cannot make a double word subclass
>> of a class with word fields'].
>> +       (aClass isVariable and: [aClass isPointers])
>> +               ifTrue: [^self error: 'cannot make a double word subclass
>> of a class with pointer fields'].
>> +       env := CurrentEnvironment signal ifNil: [aClass environment].
>> +       ^self
>> +               name: t
>> +               inEnvironment: env
>> +               subclassOf: aClass
>> +               type: #longs
>> +               instanceVariableNames: f
>> +               classVariableNames: d
>> +               poolDictionaries: s
>> +               category: cat!
>>
>> Item was added:
>> + ----- Method: ClassBuilder>>superclass:varia
>> bleHalfWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
>> (in category 'public') -----
>> + superclass: aClass
>> +       variableHalfWordSubclass: t instanceVariableNames: f
>> +       classVariableNames: d poolDictionaries: s category: cat
>> +       "This is the standard initialization message for creating a new
>> class as a
>> +       subclass of an existing class in which the subclass is to
>> +       have indexable half-word-sized nonpointer variables."
>> +       | env |
>> +       (aClass instSize > 0)
>> +               ifTrue: [^self error: 'cannot make a half word subclass
>> of a class with named fields'].
>> +       (aClass isVariable and: [aClass isBytes])
>> +               ifTrue: [^self error: 'cannot make a half word subclass
>> of a class with byte fields'].
>> +       (aClass isVariable and: [aClass isWords])
>> +               ifTrue: [^self error: 'cannot make a half word subclass
>> of a class with word fields'].
>> +       (aClass isVariable and: [aClass isDoubleWords])
>> +               ifTrue: [^self error: 'cannot make a half word subclass
>> of a class with double word fields'].
>> +       (aClass isVariable and: [aClass isPointers])
>> +               ifTrue: [^self error: 'cannot make a half word subclass
>> of a class with pointer fields'].
>> +       env := CurrentEnvironment signal ifNil: [aClass environment].
>> +       ^self
>> +               name: t
>> +               inEnvironment: env
>> +               subclassOf: aClass
>> +               type: #shorts
>> +               instanceVariableNames: f
>> +               classVariableNames: d
>> +               poolDictionaries: s
>> +               category: cat!
>>
>> Item was changed:
>>   ----- Method: ClassBuilder>>superclass:varia
>> bleWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
>> (in category 'public') -----
>>   superclass: aClass
>>         variableWordSubclass: t instanceVariableNames: f
>>         classVariableNames: d poolDictionaries: s category: cat
>>         "This is the standard initialization message for creating a new
>> class as a
>>         subclass of an existing class in which the subclass is to
>>         have indexable word-sized nonpointer variables."
>>         | env |
>>         (aClass instSize > 0)
>>                 ifTrue: [^self error: 'cannot make a word subclass of a
>> class with named fields'].
>>         (aClass isVariable and: [aClass isBytes])
>>                 ifTrue: [^self error: 'cannot make a word subclass of a
>> class with byte fields'].
>> +       (aClass isVariable and: [aClass isHalfWords])
>> +               ifTrue: [^self error: 'cannot make a word subclass of a
>> class with half word fields'].
>> +       (aClass isVariable and: [aClass isDoubleWords])
>> +               ifTrue: [^self error: 'cannot make a word subclass of a
>> class with double word fields'].
>>         (aClass isVariable and: [aClass isPointers])
>>                 ifTrue: [^self error: 'cannot make a word subclass of a
>> class with pointer fields'].
>>         env := CurrentEnvironment signal ifNil: [aClass environment].
>>         ^self
>>                 name: t
>>                 inEnvironment: env
>>                 subclassOf: aClass
>>                 type: #words
>>                 instanceVariableNames: f
>>                 classVariableNames: d
>>                 poolDictionaries: s
>>                 category: cat!
>>
>>
>>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20161020/6288619b/attachment.htm


More information about the Squeak-dev mailing list