[Vm-dev] VM Maker: VMMaker.oscog-eem.1369.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Jun 20 18:44:31 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1369.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1369
Author: eem
Time: 20 June 2015, 11:42:33.24 am
UUID: 46477ec0-5610-4000-b7b6-4d32e240b753
Ancestors: VMMaker.oscog-eem.1368
Tweaks to the last commit.
addressCouldBeClassObj: is for asserts only.
Forwarding in prims that will be retried is wasteful.
=============== Diff against VMMaker.oscog-eem.1368 ===============
Item was changed:
----- Method: InterpreterPrimitives>>primitiveBehaviorHash (in category 'object access primitives') -----
primitiveBehaviorHash
| hashOrError |
+ self cppIf: NewspeakVM
- argumentCount > 0
ifTrue:
+ [argumentCount > 0 ifTrue:
+ [((objectMemory isNonImmediate: self stackTop)
+ and: [self objCouldBeClassObj: self stackTop]) ifFalse:
+ [^self primitiveFailFor: PrimErrBadArgument]]].
+ self assert: ((objectMemory isNonImmediate: self stackTop)
+ and: [self addressCouldBeClassObj: self stackTop]).
- [((objectMemory isNonImmediate: self stackTop)
- and: [self addressCouldBeClassObj: self stackTop]) ifFalse:
- [^self primitiveFailFor: PrimErrBadArgument]]
- ifFalse:
- [self assert: ((objectMemory isNonImmediate: self stackTop)
- and: [self addressCouldBeClassObj: self stackTop])].
hashOrError := objectMemory ensureBehaviorHash: self stackTop.
hashOrError >= 0
ifTrue: [self pop: argumentCount + 1 thenPushInteger: hashOrError]
ifFalse: [self primitiveFailFor: hashOrError negated]!
Item was changed:
----- Method: InterpreterPrimitives>>primitiveNew (in category 'object access primitives') -----
primitiveNew
self cppIf: NewspeakVM
ifTrue: "For the mirror prims check that the class obj is actually a valid class."
[(argumentCount < 1
+ or: [self objCouldBeClassObj: self stackTop]) ifFalse:
- or: [self addressCouldBeClassObj: self stackTop]) ifFalse:
[self primitiveFailFor: PrimErrBadArgument]].
objectMemory hasSpurMemoryManagerAPI
ifTrue:
["Allocate a new fixed-size instance. Fail if the allocation would leave
less than lowSpaceThreshold bytes free. This *will not* cause a GC :-)"
(objectMemory instantiateClass: self stackTop)
ifNotNil: [:obj| self pop: argumentCount + 1 thenPush: obj]
ifNil: [self primitiveFailFor: ((objectMemory isFixedSizePointerFormat: (objectMemory instSpecOfClass: self stackTop))
ifTrue: [PrimErrNoMemory]
ifFalse: [PrimErrBadReceiver])]]
ifFalse:
["Allocate a new fixed-size instance. Fail if the allocation would leave
less than lowSpaceThreshold bytes free. May cause a GC."
| spaceOkay |
"The following may cause GC!! Use var for result to permit inlining."
spaceOkay := objectMemory
sufficientSpaceToInstantiate: self stackTop
indexableSize: 0.
spaceOkay
ifTrue:
[self
pop: argumentCount + 1
thenPush: (objectMemory
instantiateClass: self stackTop
indexableSize: 0)]
ifFalse: [self primitiveFailFor: PrimErrNoMemory]]!
Item was changed:
----- Method: StackInterpreterPrimitives>>primitiveExecuteMethodArgsArray (in category 'control primitives') -----
primitiveExecuteMethodArgsArray
"receiver, argsArray, then method are on top of stack. Execute method against
receiver and args. Allow for up to two extra arguments (e.g. for mirror primitives).
Set primitiveFunctionPointer because no cache lookup has been done for the
method, and hence primitiveFunctionPointer is stale."
| methodArgument argCnt rcvr argumentArray primitiveIndex |
methodArgument := self stackTop.
argumentArray := self stackValue: 1.
((objectMemory isOopCompiledMethod: methodArgument)
and: [objectMemory isArray: argumentArray]) ifFalse:
[^self primitiveFailFor: PrimErrBadArgument].
argCnt := self argumentCountOf: methodArgument.
argCnt = (objectMemory numSlotsOf: argumentArray) ifFalse:
[^self primitiveFailFor: PrimErrBadNumArgs].
argumentCount > 2 ifTrue: "CompiledMethod class>>receiver:withArguments:executeMethod:
SqueakObjectPrimitives class>>receiver:withArguments:apply:
VMMirror>>ifFail:object:with:executeMethod: et al"
+ [rcvr := self stackValue: 2.
+ (argumentCount > 4
+ or: [objectMemory isOopForwarded: rcvr]) ifTrue:
- [argumentCount > 4 ifTrue:
[^self primitiveFailFor: PrimErrUnsupported].
- rcvr := self stackValue: 2.
- rcvr := objectMemory followMaybeForwarded: rcvr.
self stackValue: argumentCount put: rcvr]. "replace actual receiver with desired receiver"
"and push the actual arguments"
self pop: argumentCount.
0 to: argCnt - 1 do:
[:i|
self push: (objectMemory fetchPointer: i ofObject: argumentArray)].
newMethod := methodArgument.
primitiveIndex := self primitiveIndexOf: newMethod.
primitiveFunctionPointer := self functionPointerFor: primitiveIndex inClass: nil.
argumentCount := argCnt.
self executeNewMethod.
"Recursive xeq affects primErrorCode"
self initPrimCall!
More information about the Vm-dev
mailing list