VM Maker: VMMaker.oscog-eem.2957.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-eem.2957.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2957.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.2957
Author: eem
Time: 4 May 2021, 2:57:14.47864 pm
UUID: 1905cffe-ff84-45bc-b423-79e7978ecfd7
Ancestors: VMMaker.oscog-eem.2956

Fix https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/566. The primitiveSize primtiive (#62) failed to check for its argument being a forwarder when the primtiive is used as a mirror primitive (num args > 0). As a minro simplification use methodReturnInteger: in it and primitiveContextSize, sicne both are varargs.

=============== Diff against VMMaker.oscog-eem.2956 ===============

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveSize (in category 'indexing primitives') -----
  primitiveSize
  <accessorDepth: 0>
  | rcvr hdr fmt fixedFields totalLength |
  rcvr := self stackTop.
  ((objectMemory isImmediate: rcvr) "Integers are not indexable"
  or: [hdr := objectMemory baseHeader: rcvr.
+ (fmt := objectMemory formatOfHeader: hdr) < objectMemory arrayFormat "This is not an indexable object"
+ or: [objectMemory isForwarderFormat: fmt]]) "And if Spur, this is a forwarder."
- (fmt := objectMemory formatOfHeader: hdr) < 2]) "This is not an indexable object"
  ifTrue:
  [^self primitiveFailFor: PrimErrBadReceiver].
  (fmt = objectMemory indexablePointersFormat
  and: [objectMemory isContextHeader: hdr]) ifTrue:
  [^self primitiveContextSize].
  totalLength := objectMemory lengthOf: rcvr baseHeader: hdr format: fmt.
  fixedFields := objectMemory fixedFieldsOf: rcvr format: fmt length: totalLength.
+ self methodReturnInteger: totalLength - fixedFields!
- self pop: argumentCount + 1 thenPush: (objectMemory integerObjectOf: totalLength - fixedFields)!

Item was added:
+ ----- Method: ObjectMemory>>isForwarderFormat: (in category 'header access') -----
+ isForwarderFormat: format
+ ^false!

Item was added:
+ ----- Method: SpurMemoryManager>>isForwarderFormat: (in category 'header formats') -----
+ isForwarderFormat: format
+ ^format = self forwardedFormat!

Item was changed:
  ----- Method: StackInterpreterPrimitives>>primitiveContextSize (in category 'indexing primitives') -----
  primitiveContextSize
  "Special version of primitiveSize for accessing contexts.
  Written to be varargs for use from mirror primitives."
  | rcvr sz hdr fmt totalLength fixedFields |
  <inline: false>
  rcvr := self stackTop.
  hdr := objectMemory baseHeader: rcvr.
  fmt := objectMemory formatOfHeader: hdr.
  totalLength := objectMemory lengthOf: rcvr baseHeader: hdr format: fmt.
  fixedFields := objectMemory fixedFieldsOf: rcvr format: fmt length: totalLength.
  (objectMemory isContextHeader: hdr)
  ifTrue:
  [self externalWriteBackHeadFramePointers.
  sz := self stackPointerForMaybeMarriedContext: rcvr]
  ifFalse: [sz := totalLength - fixedFields].
+ self methodReturnInteger: sz!
- self pop: argumentCount + 1 thenPush: (objectMemory integerObjectOf: sz)!