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

Chris Muller asqueaker at gmail.com
Tue Sep 20 21:42:13 UTC 2016


Cool.  So we already have variableWord subclasses which provide a
32-bit integral per slot.  This adds variableHalfWord and
variableDoubleWord for 16 and 64-bit slots sizes, respectively.  May I
assume these new class formats will work fine in both 32 and 64-bit
spur images?

Applications should be careful about assuming (#isWords =false) =
(#isBytes = true) in this broader context.

On Tue, Sep 20, 2016 at 4:00 PM,  <commits at source.squeak.org> wrote:
> Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
> http://source.squeak.org/inbox/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>>variableDoubleWordSubclass: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>>variableHalfWordSubclass: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>>variableHalfWordSubclass: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:variableByteSubclass: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:variableDoubleWordSubclass: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:variableHalfWordSubclass: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:variableWordSubclass: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!
>
>


More information about the Squeak-dev mailing list