[Vm-dev] VM Maker: VMMaker.oscog-eem.1819.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Apr 19 16:31:39 UTC 2016
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1819.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1819
Author: eem
Time: 19 April 2016, 9:29:34.944574 am
UUID: ad6ff521-03fe-4a02-a5e1-37394ef3b399
Ancestors: VMMaker.oscog-eem.1818
Spur: Fix bug in following state on primitive failure. The old code would always follow to depth 1, even if the accessor depth was 0. Hard-code primitiveSize's depth to 0 (accessing length in at:[put:] and size causes the stack depth computation to answer 1 instead of 0 for these primitives.
=============== Diff against VMMaker.oscog-eem.1818 ===============
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) < 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 pop: argumentCount + 1 thenPush: (objectMemory integerObjectOf: totalLength - fixedFields)!
Item was changed:
----- Method: StackInterpreter>>checkForAndFollowForwardedPrimitiveState (in category 'primitive support') -----
checkForAndFollowForwardedPrimitiveState
"In Spur a primitive may fail due to encountering a forwarder. On failure,
check the accessorDepth for the primitive and if non-negative scan the
args to the depth, following any forwarders. Answer if any are found so
the prim can be retried. The primitive index is derived from newMethod.
If the primitive is 118, then primitiveDoPrimitiveWithArgs sets newMethod
to a SmallInteger whose value is the primitive it is evaluating."
<option: #SpurObjectMemory>
| primIndex accessorDepth found scannedStackFrame |
self assert: self failed.
found := scannedStackFrame := false.
primIndex := (objectMemory isIntegerObject: newMethod)
ifTrue: [objectMemory integerValueOf: newMethod]
ifFalse:
[self assert: argumentCount = (self argumentCountOf: newMethod).
self primitiveIndexOf: newMethod].
accessorDepth := primitiveAccessorDepthTable at: primIndex.
"For the method-executing primitives, failure could have been in those primitives or the
primitives of the methods they execute. Find out which failed by seeing what is in effect."
((primIndex = 117 and: [primitiveFunctionPointer ~~ #primitiveExternalCall])
or: [primIndex = 218 and: [primitiveFunctionPointer ~~ #primitiveDoNamedPrimitiveWithArgs]])
ifTrue:
[accessorDepth := self primitiveAccessorDepthForExternalPrimitiveMethod: newMethod]
ifFalse:
[self assert: (self saneFunctionPointerForFailureOfPrimIndex: primIndex)].
self assert: (accessorDepth between: -127 and: 127).
accessorDepth >= 0 ifTrue:
[0 to: argumentCount do:
[:index| | oop |
oop := self stackValue: index.
(objectMemory isNonImmediate: oop) ifTrue:
[(objectMemory isForwarded: oop) ifTrue:
[self assert: index < argumentCount. "receiver should have been caught at send time."
found := true.
oop := objectMemory followForwarded: oop.
self stackValue: index put: oop.
scannedStackFrame ifFalse:
[scannedStackFrame := true.
self
followForwardedFrameContents: framePointer
stackPointer: stackPointer + (argumentCount + 1 * objectMemory wordSize) "don't repeat effort"]].
+ (accessorDepth > 0
+ and: [(objectMemory hasPointerFields: oop)
+ and: [objectMemory followForwardedObjectFields: oop toDepth: accessorDepth]]) ifTrue:
- ((objectMemory hasPointerFields: oop)
- and: [objectMemory followForwardedObjectFields: oop toDepth: accessorDepth]) ifTrue:
[found := true]]]].
^found!
More information about the Vm-dev
mailing list