VM Maker: VMMaker.oscog-eem.137.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.137.mcz

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

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

Name: VMMaker.oscog-eem.137
Author: eem
Time: 9 November 2011, 11:26:44.493 am
UUID: fbe64d98-6b1a-4c5b-b3f3-d2b1091406dc
Ancestors: VMMaker.oscog-eem.136

Fix primitiveContextAt[Put] for non-contexts (ContextPart subclasses
other than MethodContext including BlockContext).  stObjectAt[Put]
could fail so args should be popped only on success.  Fixes failures
in ClosureCompilerTest>testSourceRangeAccessForBlueBookInjectInto
as of VMMaker.oscog-eem.118.

Add convenient shortPrintFrame:AndNCallers: for debugging.

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

Item was added:
+ ----- Method: StackInterpreter>>shortPrintFrame:AndNCallers: (in category 'debug printing') -----
+ shortPrintFrame: theFP AndNCallers: n
+ <api>
+ <inline: false>
+ <var: #theFP type: #'char *'>
+ (n > 0 and: [stackPages couldBeFramePointer: theFP]) ifTrue:
+ [self shortPrintFrame: theFP.
+ self shortPrintFrame: (self frameCallerFP: theFP) AndNCallers: n - 1]!

Item was changed:
  ----- Method: StackInterpreterPrimitives>>primitiveContextAt (in category 'indexing primitives') -----
  primitiveContextAt
  "Special version of primitiveAt for accessing contexts.
  Written to be varargs for use from mirror primitives."
  | index value aContext spouseFP hdr fmt totalLength fixedFields stSize |
  <inline: false>
  <var: #spouseFP type: #'char *'>
  index := self stackTop.
  (objectMemory isIntegerObject: index) ifFalse:
  [^self primitiveFailFor: PrimErrBadArgument].
  index := objectMemory integerValueOf: index.
  aContext := self stackValue: 1.
  "Duplicating much of stObject:at:put: here allows stObject:at:put: to omit tests for contexts."
  hdr := objectMemory baseHeader: aContext.
  (objectMemory isContextHeader: hdr) ifFalse: "might be an instance of a subclass"
  [value := self stObject: aContext at: index.
+ ^self successful ifTrue:
+ [self pop: argumentCount + 1 thenPush: value]].
- ^self pop: argumentCount thenPush: value].
  self externalWriteBackHeadFramePointers.
  (self isStillMarriedContext: aContext) ifFalse:
  [fmt := objectMemory formatOfHeader: hdr.
  totalLength := objectMemory lengthOf: aContext baseHeader: hdr format: fmt.
  fixedFields := objectMemory fixedFieldsOf: aContext format: fmt length: totalLength.
  stSize := self fetchStackPointerOf: aContext.
  (index between: 1 and: stSize) ifFalse:
  [^self primitiveFailFor: PrimErrBadIndex].
  value := self subscript: aContext with: (index + fixedFields) format: fmt.
  ^self pop: argumentCount + 1 thenPush: value].
  spouseFP := self frameOfMarriedContext: aContext.
  (index between: 1 and: (self stackPointerIndexForFrame: spouseFP)) ifFalse:
  [^self primitiveFailFor: PrimErrBadIndex].
  value := self temporary: index - 1 in: spouseFP.
  self pop: argumentCount + 1 thenPush: value!

Item was changed:
  ----- Method: StackInterpreterPrimitives>>primitiveContextAtPut (in category 'indexing primitives') -----
  primitiveContextAtPut
  "Special version of primitiveAtPut for accessing contexts.
  Written to be varargs for use from mirror primitives."
  | index value aContext spouseFP hdr fmt totalLength fixedFields stSize |
  <inline: false>
  <var: #spouseFP type: #'char *'>
  value := self stackTop.
  index := self stackValue: 1.
  aContext := self stackValue: 2.
  (objectMemory isIntegerObject: index) ifFalse:
  [^self primitiveFailFor: PrimErrBadArgument].
  "Duplicating much of stObject:at:put: here allows stObject:at:put: to omit tests for contexts."
  hdr := objectMemory baseHeader: aContext.
  index := objectMemory integerValueOf: index.
  (objectMemory isContextHeader: hdr) ifFalse: "might be an instance of a subclass"
  [self stObject: aContext at: index put: value.
+ ^self successful ifTrue:
+ [self pop: argumentCount + 1 thenPush: value]].
- ^self pop: argumentCount + 1 thenPush: value].
  self externalWriteBackHeadFramePointers.
  (self isStillMarriedContext: aContext) ifFalse:
  [fmt := objectMemory formatOfHeader: hdr.
  totalLength := objectMemory lengthOf: aContext baseHeader: hdr format: fmt.
  fixedFields := objectMemory fixedFieldsOf: aContext format: fmt length: totalLength.
  stSize := self fetchStackPointerOf: aContext.
  (index between: 1 and: stSize) ifFalse:
  [^self primitiveFailFor: PrimErrBadIndex].
  self subscript: aContext with: (index + fixedFields) storing: value format: fmt.
  ^self pop: argumentCount + 1 thenPush: value].
  spouseFP := self frameOfMarriedContext: aContext.
  (index between: 1 and: (self stackPointerIndexForFrame: spouseFP)) ifFalse:
  [^self primitiveFailFor: PrimErrBadIndex].
  self temporary: index - 1 in: spouseFP put: value.
  ^self pop: argumentCount + 1 thenPush: value!