[Vm-dev] VM Maker: VMMaker.oscog-eem.1370.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Jun 20 22:28:47 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1370.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1370
Author: eem
Time: 20 June 2015, 3:26:27.254 pm
UUID: 779d3751-cd1b-4882-b870-156bf7da752a
Ancestors: VMMaker.oscog-eem.1369
Whoops! isForwarded: is the api, not isObjectForwarded:, which is V3 compaction-related.
=============== Diff against VMMaker.oscog-eem.1369 ===============
Item was changed:
----- Method: InterpreterPrimitives>>primitiveClone (in category 'object access primitives') -----
primitiveClone
"Return a shallow copy of the receiver."
| rcvr newCopy |
rcvr := self stackTop.
(objectMemory isImmediate: rcvr)
ifTrue:
[newCopy := rcvr]
ifFalse:
[(argumentCount = 0
+ or: [(objectMemory isForwarded: rcvr) not])
- or: [(objectMemory isObjectForwarded: rcvr) not])
ifTrue: [newCopy := objectMemory clone: rcvr]
ifFalse: [newCopy := 0].
newCopy = 0 ifTrue: "not enough memory most likely"
[^self primitiveFail]].
self pop: argumentCount + 1 thenPush: newCopy!
Item was changed:
----- Method: InterpreterPrimitives>>primitiveIdentityHash (in category 'object access primitives') -----
primitiveIdentityHash
| thisReceiver |
thisReceiver := self stackTop.
((objectMemory isImmediate: thisReceiver)
or: [argumentCount > 0
+ and: [objectMemory isForwarded: thisReceiver]])
- and: [objectMemory isObjectForwarded: thisReceiver]])
ifTrue: [self primitiveFail]
ifFalse: [self pop: argumentCount + 1
thenPushInteger: (objectMemory hashBitsOf: thisReceiver)]!
Item was changed:
----- Method: StackInterpreter>>commonAt: (in category 'indexing primitive support') -----
commonAt: stringy
"This code is called if the receiver responds primitively to at:.
N.B. this does *not* use the at cache, instead inlining stObject:at:.
Using the at cache here would require that callers set messageSelector
and lkupClass and that is onerous and error-prone, and in any case,
inlining produces much better performance than using the at cache here."
| index rcvr result |
<inline: true> "to get it inlined in primitiveAt and primitiveStringAt"
self initPrimCall.
rcvr := self stackValue: 1.
index := self stackTop.
(objectMemory isImmediate: rcvr) ifTrue:
[^self primitiveFailFor: PrimErrInappropriate].
"No need to test for large positive integers here. No object has 1g elements"
((objectMemory isNonIntegerObject: index)
or: [argumentCount > 1 "e.g. object:basicAt:"
+ and: [objectMemory isForwarded: rcvr]]) ifTrue:
- and: [objectMemory isObjectForwarded: rcvr]]) ifTrue:
[^self primitiveFailFor: PrimErrBadArgument].
index := objectMemory integerValueOf: index.
result := self stObject: rcvr at: index.
self successful ifTrue:
[stringy ifTrue: [result := self characterForAscii: (objectMemory integerValueOf: result)].
self pop: argumentCount+1 thenPush: result]!
Item was changed:
----- Method: StackInterpreter>>commonAtPut: (in category 'indexing primitive support') -----
commonAtPut: stringy
"This code is called if the receiver responds primitively to at:Put:.
N.B. this does *not* use the at cache, instead inlining stObject:at:put:.
Using the at cache here would require that callers set messageSelector
and lkupClass and that is onerous and error-prone, and in any case,
inlining produces much better performance than using the at cache here."
| value index rcvr |
<inline: true> "to get it inlined in primitiveAtPut and primitiveStringAtPut"
self initPrimCall.
rcvr := self stackValue: 2.
index := self stackValue: 1.
value := self stackTop.
(objectMemory isImmediate: rcvr) ifTrue:
[^self primitiveFailFor: PrimErrInappropriate].
"No need to test for large positive integers here. No object has 1g elements"
((objectMemory isNonIntegerObject: index)
or: [argumentCount > 2 "e.g. object:basicAt:put:"
+ and: [objectMemory isForwarded: rcvr]]) ifTrue:
- and: [objectMemory isObjectForwarded: rcvr]]) ifTrue:
[^self primitiveFailFor: PrimErrBadArgument].
index := objectMemory integerValueOf: index.
stringy
ifTrue: [self stObject: rcvr at: index put: (self asciiOfCharacter: value)]
ifFalse: [self stObject: rcvr at: index put: value].
self successful ifTrue:
[self pop: argumentCount+1 thenPush: value]!
Item was changed:
----- Method: StackInterpreterPrimitives>>primitiveClone (in category 'object access primitives') -----
primitiveClone
"Return a shallow copy of the receiver.
Special-case non-single contexts (because of context-to-stack mapping).
Can't fail for contexts cuz of image context instantiation code (sigh)."
| rcvr newCopy |
rcvr := self stackTop.
(objectMemory isImmediate: rcvr)
ifTrue:
[newCopy := rcvr]
ifFalse:
[(objectMemory isContextNonImm: rcvr)
ifTrue:
[newCopy := self cloneContext: rcvr]
ifFalse:
[(argumentCount = 0
+ or: [(objectMemory isForwarded: rcvr) not])
- or: [(objectMemory isObjectForwarded: rcvr) not])
ifTrue: [newCopy := objectMemory clone: rcvr]
ifFalse: [newCopy := 0]].
newCopy = 0 ifTrue:
[^self primitiveFailFor: PrimErrNoMemory]].
self pop: argumentCount + 1 thenPush: newCopy!
More information about the Vm-dev
mailing list