[Vm-dev] VM Maker: VMMaker.oscog-eem.608.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Feb 5 01:00:27 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.608.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.608
Author: eem
Time: 4 February 2014, 4:56:48.769 pm
UUID: 121bef6b-4756-4027-bde8-b4eb972fa939
Ancestors: VMMaker.oscog-eem.607
Fix Spur's changeClassOf:to:
=============== Diff against VMMaker.oscog-eem.607 ===============
Item was changed:
----- Method: Spur32BitMemoryManager>>changeClassOf:to: (in category 'interpreter access') -----
changeClassOf: rcvr to: argClass
"Attempt to change the class of the receiver to the argument given that the
format of the receiver matches the format of the argument. If successful,
answer 0, otherwise answer an error code indicating the reason for failure.
Fail if the format of the receiver is incompatible with the format of the argument,
or if the argument is a fixed class and the receiver's size differs from the size
that an instance of the argument should have."
<inline: false>
| classFormat fixedFields instFormat normalizedInstFormat newFormat classIndex |
classFormat := self formatOfClass: argClass.
fixedFields := self fixedFieldsOfClassFormat: classFormat.
+ classFormat := self instSpecOfClassFormat: classFormat.
instFormat := self formatOf: rcvr.
normalizedInstFormat := self classFormatForInstanceFormat: instFormat.
+ (normalizedInstFormat > self lastPointerFormat
+ and: [normalizedInstFormat = classFormat])
- normalizedInstFormat = classFormat
ifTrue: [newFormat := instFormat]
ifFalse:
[normalizedInstFormat <= self lastPointerFormat
ifTrue:
[classFormat > self lastPointerFormat ifTrue:
[^PrimErrInappropriate].
(self numSlotsOf: rcvr) < fixedFields ifTrue:
[^PrimErrBadReceiver].
newFormat := classFormat]
ifFalse:
[| instBytes |
instBytes := self byteLengthOf: rcvr.
normalizedInstFormat caseOf: {
[self sixtyFourBitIndexableFormat] ->
[(classFormat < self sixtyFourBitIndexableFormat
or: [classFormat >= self firstCompiledMethodFormat]) ifTrue:
[^PrimErrInappropriate].
newFormat := classFormat].
[self firstLongFormat] ->
[(classFormat < self sixtyFourBitIndexableFormat
or: [classFormat >= self firstCompiledMethodFormat]) ifTrue:
[^PrimErrInappropriate].
(classFormat = self sixtyFourBitIndexableFormat and: [instBytes anyMask: 1]) ifTrue:
[^PrimErrBadReceiver].
newFormat := classFormat].
[self firstShortFormat] ->
[(classFormat < self sixtyFourBitIndexableFormat
or: [classFormat >= self firstCompiledMethodFormat]) ifTrue:
[^PrimErrInappropriate].
classFormat caseOf: {
[self sixtyFourBitIndexableFormat]
-> [(instBytes anyMask: 3) ifTrue: [^PrimErrBadReceiver].
newFormat := classFormat].
[self firstLongFormat]
-> [(instBytes anyMask: 1) ifTrue: [^PrimErrBadReceiver].
newFormat := classFormat].
[self firstByteFormat]
-> [newFormat := classFormat + (4 - instBytes bitAnd: 3)] }].
[self firstByteFormat] ->
[(classFormat < self sixtyFourBitIndexableFormat
or: [classFormat >= self firstCompiledMethodFormat]) ifTrue:
[^PrimErrInappropriate].
classFormat caseOf: {
[self sixtyFourBitIndexableFormat]
-> [(instBytes anyMask: 7) ifTrue: [^PrimErrBadReceiver]].
[self firstLongFormat]
-> [(instBytes anyMask: 3) ifTrue: [^PrimErrBadReceiver]].
[self firstShortFormat]
-> [(instBytes anyMask: 1) ifTrue: [^PrimErrBadReceiver]] }.
newFormat := classFormat].
[self firstCompiledMethodFormat] ->
[classFormat ~= self firstCompiledMethodFormat ifTrue:
[^PrimErrInappropriate].
newFormat := instFormat] }]].
(classIndex := self ensureBehaviorHash: argClass) < 0 ifTrue:
[^classIndex negated].
self setFormatOf: rcvr to: newFormat;
setClassIndexOf: rcvr to: classIndex.
"ok"
^0!
Item was changed:
----- Method: Spur64BitMemoryManager>>changeClassOf:to: (in category 'interpreter access') -----
changeClassOf: rcvr to: argClass
"Attempt to change the class of the receiver to the argument given that the
format of the receiver matches the format of the argument. If successful,
answer 0, otherwise answer an error code indicating the reason for failure.
Fail if the format of the receiver is incompatible with the format of the argument,
or if the argument is a fixed class and the receiver's size differs from the size
that an instance of the argument should have."
<inline: false>
| classFormat fixedFields instFormat normalizedInstFormat newFormat classIndex |
classFormat := self formatOfClass: argClass.
fixedFields := self fixedFieldsOfClassFormat: classFormat.
+ classFormat := self instSpecOfClassFormat: classFormat.
instFormat := self formatOf: rcvr.
normalizedInstFormat := self classFormatForInstanceFormat: instFormat.
+ (normalizedInstFormat > self lastPointerFormat
+ and: [normalizedInstFormat = classFormat])
- normalizedInstFormat = classFormat
ifTrue: [newFormat := instFormat]
ifFalse:
[normalizedInstFormat <= self lastPointerFormat
ifTrue:
[classFormat > self lastPointerFormat ifTrue:
[^PrimErrInappropriate].
(self numSlotsOf: rcvr) < fixedFields ifTrue:
[^PrimErrBadReceiver].
newFormat := classFormat]
ifFalse:
[| instBytes |
instBytes := self byteLengthOf: rcvr.
normalizedInstFormat caseOf: {
[self sixtyFourBitIndexableFormat] ->
[(classFormat < self sixtyFourBitIndexableFormat
or: [classFormat >= self firstCompiledMethodFormat]) ifTrue:
[^PrimErrInappropriate].
newFormat := classFormat].
[self firstLongFormat] ->
[(classFormat < self sixtyFourBitIndexableFormat
or: [classFormat >= self firstCompiledMethodFormat]) ifTrue:
[^PrimErrInappropriate].
(classFormat = self sixtyFourBitIndexableFormat and: [instBytes anyMask: 1]) ifTrue:
[^PrimErrBadReceiver].
newFormat := classFormat].
[self firstShortFormat] ->
[(classFormat < self sixtyFourBitIndexableFormat
or: [classFormat >= self firstCompiledMethodFormat]) ifTrue:
[^PrimErrInappropriate].
classFormat caseOf: {
[self sixtyFourBitIndexableFormat]
-> [(instBytes anyMask: 7) ifTrue: [^PrimErrBadReceiver].
newFormat := classFormat].
[self firstLongFormat]
-> [(instBytes anyMask: 3) ifTrue: [^PrimErrBadReceiver].
newFormat := classFormat + (2 - instBytes bitAnd: 1)].
[self firstByteFormat]
-> [newFormat := classFormat + (8 - instBytes bitAnd: 7)] }].
[self firstByteFormat] ->
[(classFormat < self sixtyFourBitIndexableFormat
or: [classFormat >= self firstCompiledMethodFormat]) ifTrue:
[^PrimErrInappropriate].
classFormat caseOf: {
[self sixtyFourBitIndexableFormat]
-> [(instBytes anyMask: 7) ifTrue: [^PrimErrBadReceiver].
newFormat := classFormat].
[self firstLongFormat]
-> [(instBytes anyMask: 3) ifTrue: [^PrimErrBadReceiver].
newFormat := classFormat + (2 - instBytes bitAnd: 1)].
[self firstShortFormat]
-> [(instBytes anyMask: 1) ifTrue: [^PrimErrBadReceiver].
newFormat := classFormat + (4 - instBytes bitAnd: 3)] }.
newFormat := classFormat].
[self firstCompiledMethodFormat] ->
[classFormat ~= self firstCompiledMethodFormat ifTrue:
[^PrimErrInappropriate].
newFormat := instFormat] }]].
(classIndex := self ensureBehaviorHash: argClass) < 0 ifTrue:
[^classIndex negated].
self setFormatOf: rcvr to: newFormat;
setClassIndexOf: rcvr to: classIndex.
"ok"
^0!
More information about the Vm-dev
mailing list