[Vm-dev] VM Maker: VMMaker.oscog-eem.857.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Aug 12 23:11:05 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.857.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.857
Author: eem
Time: 12 August 2014, 4:08:22.444 pm
UUID: 1be70c52-c55e-45fd-a40a-5b1ad8346269
Ancestors: VMMaker.oscog-eem.856
Fix instantiateClass:indexableSize: to fail for CompiledMethod.
Fixes broken definitions of CompiledMethod>>newFrom:.
=============== Diff against VMMaker.oscog-eem.856 ===============
Item was changed:
----- Method: Spur32BitMemoryManager>>instantiateClass:indexableSize: (in category 'instantiation') -----
instantiateClass: classObj indexableSize: nElements
<var: #nElements type: #usqInt>
| instSpec classFormat numSlots classIndex newObj fillValue |
classFormat := self formatOfClass: classObj.
instSpec := self instSpecOfClassFormat: classFormat.
fillValue := 0.
instSpec caseOf: {
[self arrayFormat] ->
[nElements > self maxSlotsForAlloc ifTrue:
[^nil].
numSlots := nElements.
fillValue := nilObj].
[self indexablePointersFormat] ->
[nElements > (self maxSlotsForAlloc - (self fixedFieldsOfClassFormat: classFormat)) ifTrue:
[^nil].
numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements.
fillValue := nilObj].
[self weakArrayFormat] ->
[nElements > (self maxSlotsForAlloc - (self fixedFieldsOfClassFormat: classFormat)) ifTrue:
[^nil].
numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements.
fillValue := nilObj].
[self sixtyFourBitIndexableFormat] ->
[nElements > (self maxSlotsForAlloc / 2) ifTrue:
[^nil].
numSlots := nElements * 2].
[self firstLongFormat] ->
[nElements > self maxSlotsForAlloc ifTrue:
[^nil].
numSlots := nElements].
[self firstShortFormat] ->
[numSlots := nElements + 1 // 2.
numSlots > self maxSlotsForAlloc ifTrue:
[^nil].
instSpec := instSpec + (nElements bitAnd: 1)].
[self firstByteFormat] ->
[numSlots := nElements + 3 // 4.
numSlots > self maxSlotsForAlloc ifTrue:
+ [^nil]] }
- [^nil].
- instSpec := instSpec + (4 - nElements bitAnd: 3)].
- [self firstCompiledMethodFormat] ->
- [numSlots := nElements + 3 // 4.
- numSlots > self maxSlotsForAlloc ifTrue:
- [^nil].
- instSpec := instSpec + (4 - nElements bitAnd: 3)] }
otherwise: ["some Squeak images include funky fixed subclasses of abstract variable
superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection.
Allow fixed classes to be instantiated here iff nElements = 0."
(nElements ~= 0 or: [instSpec > self lastPointerFormat]) ifTrue:
[^nil].
numSlots := self fixedFieldsOfClassFormat: classFormat]. "non-indexable"
classIndex := self ensureBehaviorHash: classObj.
classIndex < 0 ifTrue:
[coInterpreter primitiveFailFor: classIndex negated.
^nil].
numSlots > self maxSlotsForNewSpaceAlloc
ifTrue: [newObj := self allocateSlotsInOldSpace: numSlots format: instSpec classIndex: classIndex]
ifFalse: [newObj := self allocateSlots: numSlots format: instSpec classIndex: classIndex].
newObj ifNotNil:
[self fillObj: newObj numSlots: numSlots with: fillValue].
^newObj!
Item was changed:
----- Method: Spur64BitMemoryManager>>instantiateClass:indexableSize: (in category 'instantiation') -----
instantiateClass: classObj indexableSize: nElements
<var: #nElements type: #usqInt>
| instSpec classFormat numSlots classIndex newObj fillValue |
classFormat := self formatOfClass: classObj.
instSpec := self instSpecOfClassFormat: classFormat.
fillValue := 0.
instSpec caseOf: {
[self arrayFormat] ->
[numSlots := nElements.
fillValue := nilObj].
[self indexablePointersFormat] ->
[numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements.
fillValue := nilObj].
[self weakArrayFormat] ->
[numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements.
fillValue := nilObj].
[self sixtyFourBitIndexableFormat] ->
[numSlots := nElements].
[self firstLongFormat] ->
[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)].
- [self firstCompiledMethodFormat] ->
- [numSlots := nElements + 7 // 8.
instSpec := instSpec + (8 - nElements bitAnd: 7)] }
otherwise: ["some Squeak images include funky fixed subclasses of abstract variable
superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection.
Allow fixed classes to be instantiated here iff nElements = 0."
(nElements ~= 0 or: [instSpec > self lastPointerFormat]) ifTrue:
[^nil].
numSlots := self fixedFieldsOfClassFormat: classFormat]. "non-indexable"
classIndex := self ensureBehaviorHash: classObj.
classIndex < 0 ifTrue:
[coInterpreter primitiveFailFor: classIndex negated.
^nil].
numSlots > self maxSlotsForNewSpaceAlloc
ifTrue:
[numSlots > self maxSlotsForAlloc ifTrue:
[^nil].
newObj := self allocateSlotsInOldSpace: numSlots format: instSpec classIndex: classIndex]
ifFalse:
[newObj := self allocateSlots: numSlots format: instSpec classIndex: classIndex].
newObj ifNotNil:
[self fillObj: newObj numSlots: numSlots with: fillValue].
^newObj!
More information about the Vm-dev
mailing list