Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.177.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.177 Author: eem Time: 27 June 2012, 12:25:12.409 pm UUID: 4d05e29b-763c-451f-9354-f5f0cef201a1 Ancestors: VMMaker.oscog-eem.176
Add internalStackValue:put:. Comment the purpose of the prim response routines.
=============== Diff against VMMaker.oscog-eem.176 ===============
Item was changed: ----- Method: CoInterpreter>>slowPrimitiveResponse (in category 'primitive support') ----- slowPrimitiveResponse + "Invoke a normal (non-quick) primitive. + Called under the assumption that primFunctionPtr has been preloaded" - "Called under the assumption that primFunctionPtr has been preloaded" | nArgs savedFramePointer savedStackPointer | <inline: true> <asmLabel: false> <var: #savedFramePointer type: #'char *'> <var: #savedStackPointer type: #'char *'> cogit recordPrimTrace ifTrue: [self fastLogPrim: messageSelector]. FailImbalancedPrimitives ifTrue: [nArgs := argumentCount. savedStackPointer := stackPointer. savedFramePointer := framePointer]. self initPrimCall. self dispatchFunctionPointer: primitiveFunctionPointer. (FailImbalancedPrimitives and: [self successful and: [framePointer = savedFramePointer and: [(self isMachineCodeFrame: framePointer) not]]]) ifTrue:"Don't fail if primitive has done something radical, e.g. perform:" [stackPointer ~= (savedStackPointer + (nArgs * BytesPerWord)) ifTrue: [self flag: 'Would be nice to make this a message send of e.g. unbalancedPrimitive to the current process or context'. "This is necessary but insufficient; the result may still have been written to the stack. At least we'll know something is wrong." stackPointer := savedStackPointer. self failUnbalancedPrimitive]]. "If we are profiling, take accurate primitive measures" nextProfileTick > 0 ifTrue: [self checkProfileTick: newMethod]. ^self successful!
Item was changed: ----- Method: StackInterpreter>>externalQuickPrimitiveResponse (in category 'primitive support') ----- externalQuickPrimitiveResponse + "Invoke a quick primitive. + Called under the assumption that primFunctionPtr has been preloaded" - "Called under the assumption that primFunctionPtr has been preloaded" | localPrimIndex | self assert: self isPrimitiveFunctionPointerAnIndex. localPrimIndex := self cCoerceSimple: primitiveFunctionPointer to: #sqInt. self assert: (localPrimIndex > 255 and: [localPrimIndex < 520]). "Quick return inst vars" localPrimIndex >= 264 ifTrue: [self pop: 1 thenPush: (objectMemory fetchPointer: localPrimIndex - 264 ofObject: self stackTop). ^true]. "Quick return constants" localPrimIndex = 256 ifTrue: [^true "return self"]. localPrimIndex = 257 ifTrue: [self pop: 1 thenPush: objectMemory trueObject. ^true]. localPrimIndex = 258 ifTrue: [self pop: 1 thenPush: objectMemory falseObject. ^true]. localPrimIndex = 259 ifTrue: [self pop: 1 thenPush: objectMemory nilObject. ^true]. self pop: 1 thenPush: (objectMemory integerObjectOf: localPrimIndex - 261). ^true!
Item was changed: ----- Method: StackInterpreter>>internalQuickPrimitiveResponse (in category 'primitive support') ----- internalQuickPrimitiveResponse + "Invoke a quick primitive. + Called under the assumption that primFunctionPtr has been preloaded" - "Called under the assumption that primFunctionPtr has been preloaded" | localPrimIndex | self assert: self isPrimitiveFunctionPointerAnIndex. localPrimIndex := self cCoerceSimple: primitiveFunctionPointer to: #sqInt. self assert: (localPrimIndex > 255 and: [localPrimIndex < 520]). "Quick return inst vars" localPrimIndex >= 264 ifTrue: [self internalStackTopPut: (objectMemory fetchPointer: localPrimIndex - 264 ofObject: self internalStackTop). ^true]. "Quick return constants" localPrimIndex = 256 ifTrue: [^true "return self"]. localPrimIndex = 257 ifTrue: [self internalStackTopPut: objectMemory trueObject. ^true]. localPrimIndex = 258 ifTrue: [self internalStackTopPut: objectMemory falseObject. ^true]. localPrimIndex = 259 ifTrue: [self internalStackTopPut: objectMemory nilObject. ^true]. self internalStackTopPut: (objectMemory integerObjectOf: localPrimIndex - 261). ^true!
Item was added: + ----- Method: StackInterpreter>>internalStackValue:put: (in category 'internal interpreter access') ----- + internalStackValue: offset put: aValue + "In the StackInterpreter stacks grow down." + ^stackPages longAtPointer: localSP + (offset * BytesPerWord) put: aValue!
Item was changed: ----- Method: StackInterpreter>>slowPrimitiveResponse (in category 'primitive support') ----- slowPrimitiveResponse + "Invoke a normal (non-quick) primitive. + Called under the assumption that primFunctionPtr has been preloaded" - "Called under the assumption that primFunctionPtr has been preloaded" | nArgs savedFramePointer savedStackPointer | <inline: true> <asmLabel: false> <var: #savedFramePointer type: #'char *'> <var: #savedStackPointer type: #'char *'> FailImbalancedPrimitives ifTrue: [nArgs := argumentCount. savedStackPointer := stackPointer. savedFramePointer := framePointer]. self initPrimCall. self dispatchFunctionPointer: primitiveFunctionPointer. (FailImbalancedPrimitives and: [self successful and: [framePointer = savedFramePointer]]) ifTrue:"Don't fail if primitive has done something radical, e.g. perform:" [stackPointer ~= (savedStackPointer + (nArgs * BytesPerWord)) ifTrue: [self flag: 'Would be nice to make this a message send of e.g. unbalancedPrimitive to the current process or context'. "This is necessary but insufficient; the result may still have been written to the stack. At least we'll know something is wrong." stackPointer := savedStackPointer. self failUnbalancedPrimitive]]. "If we are profiling, take accurate primitive measures" nextProfileTick > 0 ifTrue: [self checkProfileTick: newMethod]. ^self successful!
vm-dev@lists.squeakfoundation.org