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

commits at source.squeak.org commits at source.squeak.org
Tue Sep 6 08:08:46 UTC 2016

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-eem.1941
Author: eem
Time: 6 September 2016, 10:06:17.574 am
UUID: ccc9d9be-c2f0-437a-bdfe-13dfc9c7225c
Ancestors: VMMaker.oscog-cb.1940

Improve stack backtrace printing for full blocks.

=============== Diff against VMMaker.oscog-cb.1940 ===============

Item was changed:
  ----- Method: StackInterpreter>>findSelectorOfMethod: (in category 'debug support') -----
+ findSelectorOfMethod: meth
+ 	| classObj classDict classDictSize methodArray i |
+ 	(objectMemory addressCouldBeObj: meth) ifFalse:
- findSelectorOfMethod: methArg
- 	| meth classObj classDict classDictSize methodArray i |
- 	(objectMemory addressCouldBeObj: methArg) ifFalse:
  		[^objectMemory nilObject].
+ 	(objectMemory isForwarded: meth) ifTrue:
+ 		[^self findSelectorOfMethod: (objectMemory followForwarded: meth)].
- 	(objectMemory isForwarded: methArg)
- 		ifTrue: [meth := objectMemory followForwarded: methArg]
- 		ifFalse: [meth := methArg].
  	 (objectMemory isOopCompiledMethod: meth) ifFalse:
  		[^objectMemory nilObject].
+ 	(self maybeSelectorOfMethod: meth) ifNotNil:
+ 		[:selector| ^selector].
- 	NewspeakVM ifTrue:
- 		[(self maybeSelectorOfMethod: meth) ifNotNil:
- 			[:selector| ^selector]].
  	classObj := self safeMethodClassOf: meth.
  	(self addressCouldBeClassObj: classObj) ifTrue:
  		[classDict := objectMemory fetchPointer: MethodDictionaryIndex ofObject: classObj.
  		 classDictSize := objectMemory numSlotsOf: classDict.
  		 classDictSize > MethodArrayIndex ifTrue:
  			[methodArray := objectMemory fetchPointer: MethodArrayIndex ofObject: classDict.
  			 i := 0.
  			 [i < (classDictSize - SelectorStart)] whileTrue:
  				[meth = (objectMemory fetchPointer: i ofObject: methodArray) ifTrue:
  					[^(objectMemory fetchPointer: i + SelectorStart ofObject: classDict)].
  					 i := i + 1]]].
  	^objectMemory nilObject!

Item was changed:
  ----- Method: StackInterpreter>>maybeSelectorOfMethod: (in category 'debug support') -----
  maybeSelectorOfMethod: methodObj
  	"Answer the selector of a method, assuming its penultimate literal is either
  	 a symbol or a pointer object whose first slot references the method and
  	 whose second slot is a symbol (i.e. an AdditionalMethodState).  If a Symbol
  	 can't be found answer nil.  This isn't satisfactory, as it puts a lot of information
+ 	 into the VM, but it is needed for adequate crash debugging at Cadence.
+ 	 With full blocks as of 9/2016 the last literal of a CompiledBlock is a back pointer
+ 	 to the enclosing block or compiled method."
+ 	| ultimateLiteral penultimateLiteral maybeSelector |
- 	 into the VM, but it is needed for adequate crash debugging at Cadence."
- 	| penultimateLiteral maybeSelector |
  	self assert: (objectMemory isOopCompiledMethod: methodObj).
+ 	ultimateLiteral := self ultimateLiteralOf: methodObj.
+ 	(objectMemory isOopCompiledMethod: ultimateLiteral) ifTrue:
+ 		[^self maybeSelectorOfMethod: ultimateLiteral].
  	penultimateLiteral := self penultimateLiteralOf: methodObj.
  	(objectMemory isWordsOrBytes: penultimateLiteral) ifTrue:
  		[^(objectMemory fetchClassTagOfNonImm: penultimateLiteral)
  			= (objectMemory fetchClassTagOfNonImm: (objectMemory splObj: SelectorDoesNotUnderstand)) ifTrue:
  	^((objectMemory isPointers: penultimateLiteral)
  	 and: [(objectMemory numSlotsOf: penultimateLiteral) >= 2
  	 and: [(objectMemory fetchPointer: 0 ofObject: penultimateLiteral) = methodObj
  	 and: [maybeSelector := objectMemory fetchPointer: 1 ofObject: penultimateLiteral.
  		(objectMemory isWordsOrBytes: maybeSelector)
  	 and: [(objectMemory fetchClassTagOfNonImm: maybeSelector)
  			= (objectMemory fetchClassTagOfNonImm: (objectMemory splObj: SelectorDoesNotUnderstand))]]]]) ifTrue:

Item was added:
+ ----- Method: StackInterpreter>>ultimateLiteralOf: (in category 'debug printing') -----
+ ultimateLiteralOf: aMethodOop
+ 	<api>
+ 	self assert: (objectMemory isOopCompiledMethod: aMethodOop).
+ 	^self literal: (objectMemory literalCountOf: aMethodOop) - 1 ofMethod: aMethodOop!

More information about the Vm-dev mailing list