[Vm-dev] VM Maker: VMMaker.oscog-eem.2092.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 16 01:16:02 UTC 2017


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

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

Name: VMMaker.oscog-eem.2092
Author: eem
Time: 15 January 2017, 5:15:16.260067 pm
UUID: fc6e5ee2-2b3a-4a94-bbf5-d0ac982d8d8d
Ancestors: VMMaker.oscog-eem.2091

Cogit:
Finally understand and fix the non-local return stack depth assert fail issue.

Interpreter:
Make printFrame: lax enough to accept a married context and print its frame without complaint.

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

Item was removed:
- ----- Method: CogVMSimulator>>externalAboutToReturn:through: (in category 'return bytecodes') -----
- externalAboutToReturn: resultOop through: aContext
- 	self transcript ensureCr.
- 	self print: 'externalAboutToReturn: '; printOopShortInner: resultOop;
- 		print: ' through: '; printOopShortInner: aContext;
- 		print: ' in '; printActivationNameFor: (self frameMethodObject: framePointer)
- 					receiver: (self frameReceiver: framePointer)
- 					isBlock: (self frameIsBlockActivation: framePointer)
- 					firstTemporary: (self temporary: 0 in: framePointer);
- 		cr.
- 	^super externalAboutToReturn: resultOop through: aContext!

Item was changed:
  ----- Method: CogVMSimulator>>maybeCheckStackDepth:sp:pc: (in category 'debug support') -----
  maybeCheckStackDepth: delta sp: sp pc: mcpc
  	| asp bcpc startbcpc cogHomeMethod cogBlockMethod csp debugStackPointers |
  	debugStackDepthDictionary ifNil: [^self].
  	(self isMachineCodeFrame: framePointer) ifFalse: [^self].
  	cogBlockMethod := self mframeCogMethod: framePointer.
  	cogHomeMethod := self asCogHomeMethod: cogBlockMethod.
  	debugStackPointers := debugStackDepthDictionary
  								at: cogHomeMethod methodObject
  								ifAbsentPut: [self debugStackPointersFor: cogHomeMethod methodObject].
  	startbcpc := cogHomeMethod = cogBlockMethod
  					ifTrue: [self startPCOfMethod: cogHomeMethod methodObject]
  					ifFalse: [self startPCOfClosure: (self pushedReceiverOrClosureOfFrame: framePointer)].
  	bcpc := cogit bytecodePCFor: mcpc startBcpc: startbcpc in: cogBlockMethod.
  	self assert: bcpc ~= 0.
+ 	(cogBlockMethod ~= cogHomeMethod
+ 	 and: [cogit isNonLocalReturnPC: mcpc]) ifTrue:
- 	cogBlockMethod ~= cogHomeMethod ifTrue:
  		[| lastbcpc |
+ 		 "Method returns within a block (within an unwind-protect) must check the stack depth at the
+ 		  return, not the bytecode following, but the pc mapping maps to the bytecode following the
+ 		  return. lastBytecodePCForBlockAt:in: catches method returns at the end of a block, modifying
+ 		  the bcpc to that of the return.  isNonLocalReturnPC: catches method returns not at the end.
+ 		  Assumes method return bytecodes are 1 bytecode long;a  dodgy assumption, but good enough."
  		 lastbcpc := cogit lastBytecodePCForBlockAt: startbcpc in: cogHomeMethod methodObject.
+ 		 bcpc := bcpc > lastbcpc ifTrue: [lastbcpc] ifFalse: [bcpc - 1]].
- 		 bcpc > lastbcpc ifTrue:
- 			[bcpc := lastbcpc]].
  	asp := self stackPointerIndexForFrame: framePointer WithSP: sp + objectMemory wordSize.
  	csp := debugStackPointers at: bcpc ifAbsent: [-1].
  	"Compensate lazily for absent receiver sends."
  	(NewspeakVM
  	 and: [asp - delta = csp
  	 and: [cogit isAbsentReceiverSendAt: mcpc in: cogHomeMethod]]) ifTrue:
  		[csp := debugStackPointers at: bcpc put: csp + 1].
  	self assert: asp - delta + 1 = csp!

Item was added:
+ ----- Method: Cogit>>isNonLocalReturnPC: (in category 'jit - api') -----
+ isNonLocalReturnPC: retpc
+ 	<doNotGenerate>
+ 	"Answer if the instruction preceding retpc is a call instruction."
+ 	(backEnd isCallPrecedingReturnPC: retpc) ifFalse:
+ 		[^false].
+ 	^(backEnd callTargetFromReturnAddress: retpc) = ceNonLocalReturnTrampoline!

Item was changed:
  ----- Method: StackInterpreter>>printFrame: (in category 'debug printing') -----
  printFrame: theFP
  	| thePage frameAbove theSP |
  	<inline: false>
  	<var: #theFP type: #'char *'>
  	<var: #theSP type: #'char *'>
  	<var: #frameAbove type: #'char *'>
  	<var: #thePage type: #'StackPage *'>
  	(stackPages couldBeFramePointer: theFP) ifFalse:
+ 		[((objectMemory addressCouldBeObj: theFP asInteger)
+ 		  and: [(objectMemory isInMemory: theFP asInteger)
+ 		  and: [(objectMemory isContextNonImm: theFP asInteger)
+ 		  and: [(self checkIsStillMarriedContext: theFP asInteger currentFP: framePointer)]]]) ifTrue:
+ 			[^self printFrame: (self frameOfMarriedContext: theFP asInteger)].
+ 		self printHexPtr: theFP; print: ' is not in the stack zone?!!'; cr.
- 		[self printHexPtr: theFP; print: ' is not in the stack zone?!!'; cr.
  		 ^nil].
  	frameAbove := nil.
  	theFP = framePointer
  		ifTrue: [theSP := stackPointer]
  		ifFalse:
  			[thePage := stackPages stackPageFor: theFP.
  			 (stackPages isFree: thePage) ifTrue:
  				[self printHexPtr: theFP; print: ' is on a free page?!!'; cr.
  				 ^nil].
  			 (thePage ~= stackPage
  			  and: [theFP = thePage headFP])
  				ifTrue: [theSP := thePage headSP]
  				ifFalse:
  					[frameAbove := self safeFindFrameAbove: theFP
  										on: thePage
  										startingFrom: ((thePage = stackPage
  														and: [framePointer
  																between: thePage realStackLimit
  																and: thePage baseAddress])
  														ifTrue: [framePointer]
  														ifFalse: [thePage headFP]).
  					 theSP := frameAbove ifNotNil:
  								[self frameCallerSP: frameAbove]]].
  	theSP ifNil:
  		[self print: 'could not find sp; using bogus value'; cr.
  		 theSP := self frameReceiverLocation: theFP].
  	self printFrame: theFP WithSP: theSP.
  	frameAbove ifNotNil:
  		[self printFrameThing: 'frame pc' at: frameAbove + FoxCallerSavedIP]!



More information about the Vm-dev mailing list