[Vm-dev] VM Maker: VMMaker.oscog-eem.3198.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Jun 21 23:56:15 UTC 2022
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3198.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3198
Author: eem
Time: 21 June 2022, 4:56:02.230689 pm
UUID: 10ccdad4-5851-42c4-9d31-841e6eafc085
Ancestors: VMMaker.oscog-eem.3197
Implement the missing Spur32BitMemoryManager>>instantiateUninitializedClass:indexableSize:. Nuke an unused temp in the 64-bit dual.
No need to support instantiating pointer classes with zero indexable fields here.
=============== Diff against VMMaker.oscog-eem.3197 ===============
Item was added:
+ ----- Method: Spur32BitMemoryManager>>instantiateUninitializedClass:indexableSize: (in category 'instantiation') -----
+ instantiateUninitializedClass: classObj indexableSize: nElements
+ <api>
+ <var: #nElements type: #usqInt>
+ "Allocate an instance of a variable class, excepting CompiledMethod."
+ | instSpec classFormat numSlots classIndex newObj |
+ classFormat := self formatOfClass: classObj.
+ instSpec := self instSpecOfClassFormat: classFormat.
+ classIndex := self rawHashBitsOf: classObj.
+ self assert: (self isPureBitsFormat: instSpec).
+ instSpec caseOf: {
+ [self sixtyFourBitIndexableFormat] ->
+ [nElements > (self maxSlotsForAlloc / 2) ifTrue:
+ [coInterpreter primitiveFailFor: PrimErrUnsupported.
+ ^nil].
+ numSlots := nElements * 2].
+ [self firstLongFormat] ->
+ [(classIndex = ClassFloatCompactIndex and: [nElements ~= 2]) ifTrue:
+ [coInterpreter primitiveFailFor: PrimErrBadReceiver.
+ ^nil].
+ numSlots := nElements].
+ [self firstShortFormat] ->
+ [numSlots := nElements + 1 // 2.
+ instSpec := instSpec + (nElements bitAnd: 1)].
+ [self firstByteFormat] ->
+ [numSlots := nElements + 3 // 4.
+ instSpec := instSpec + (4 - nElements bitAnd: 3)] }
+ otherwise: "not bits indexable"
+ [coInterpreter primitiveFailFor: PrimErrBadReceiver.
+ ^nil].
+ classIndex = 0 ifTrue:
+ [classIndex := self ensureBehaviorHash: classObj.
+ classIndex < 0 ifTrue:
+ [coInterpreter primitiveFailFor: classIndex negated.
+ ^nil]].
+ numSlots > self maxSlotsForNewSpaceAlloc
+ ifTrue:
+ [numSlots > self maxSlotsForAlloc ifTrue:
+ [coInterpreter primitiveFailFor: PrimErrUnsupported.
+ ^nil].
+ newObj := self allocateSlotsInOldSpace: numSlots format: instSpec classIndex: classIndex]
+ ifFalse:
+ [newObj := self allocateSlots: numSlots format: instSpec classIndex: classIndex].
+ ^newObj!
Item was changed:
----- Method: Spur64BitMemoryManager>>instantiateUninitializedClass:indexableSize: (in category 'instantiation') -----
instantiateUninitializedClass: classObj indexableSize: nElements
<api>
<var: #nElements type: #usqInt>
"Allocate an instance of a variable class, excepting CompiledMethod."
+ | instSpec classFormat numSlots classIndex newObj |
- | instSpec classFormat numSlots classIndex newObj fillValue |
classFormat := self formatOfClass: classObj.
instSpec := self instSpecOfClassFormat: classFormat.
classIndex := self rawHashBitsOf: classObj.
- fillValue := 0.
self assert: (self isPureBitsFormat: instSpec).
instSpec caseOf: {
[self sixtyFourBitIndexableFormat] ->
[numSlots := nElements].
[self firstLongFormat] ->
[(classIndex = ClassFloatCompactIndex and: [nElements ~= 2]) ifTrue:
[coInterpreter primitiveFailFor: PrimErrBadReceiver.
^nil].
numSlots := nElements + 1 // 2.
instSpec := instSpec + (nElements bitAnd: 1)].
[self firstShortFormat] ->
[numSlots := nElements + 3 // 4.
instSpec := instSpec + (4 - nElements bitAnd: 3)].
[self firstByteFormat] ->
[numSlots := nElements + 7 // 8.
instSpec := instSpec + (8 - nElements bitAnd: 7)] }
+ otherwise: "not bits indexable"
+ [coInterpreter primitiveFailFor: PrimErrBadReceiver.
+ ^nil].
- otherwise: "non-indexable"
- ["Some Squeak images include funky fixed subclasses of abstract variable
- superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection.
- The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via
- this method.
- Hence allow fixed classes to be instantiated here iff nElements = 0."
- (nElements ~= 0 or: [instSpec > self lastPointerFormat]) ifTrue:
- [^nil].
- numSlots := self fixedFieldsOfClassFormat: classFormat.
- fillValue := nilObj].
classIndex = 0 ifTrue:
[classIndex := self ensureBehaviorHash: classObj.
classIndex < 0 ifTrue:
[coInterpreter primitiveFailFor: classIndex negated.
^nil]].
numSlots > self maxSlotsForNewSpaceAlloc
ifTrue:
[numSlots > self maxSlotsForAlloc ifTrue:
[coInterpreter primitiveFailFor: PrimErrUnsupported.
^nil].
newObj := self allocateSlotsInOldSpace: numSlots format: instSpec classIndex: classIndex]
ifFalse:
[newObj := self allocateSlots: numSlots format: instSpec classIndex: classIndex].
^newObj!
More information about the Vm-dev
mailing list