[Vm-dev] VM Maker: VMMakerUI-eem.13.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Dec 31 03:26:43 UTC 2019


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

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

Name: VMMakerUI-eem.13
Author: eem
Time: 30 December 2019, 7:26:41.726219 pm
UUID: c312a4d2-81ac-46b0-bd9a-7334a7f4dfa7
Ancestors: VMMakerUI-eem.12

Add a subclass of CogOopInspector, CogBytecodeMethodInspector (you can guess what for).
Add emphasised printing support.

=============== Diff against VMMakerUI-eem.12 ===============

Item was added:
+ ----- Method: CogAbstractFrameInspector>>interpretMethod:value:at: (in category 'evaluating') -----
+ interpretMethod: fieldName value: valueString at: address
+ 	| methodFieldString secondMethodFieldString  |
+ 	methodFieldString := valueString copyUpTo: Character tab.
+ 	secondMethodFieldString := (ReadStream on: valueString from: methodFieldString size + 2 to: valueString size)
+ 									skipSeparators;
+ 									upTo: $:.
+ 	"compare ignoring least signirficant bits, which are flags"
+ 	methodFieldString allButLast = secondMethodFieldString allButLast ifTrue:
+ 		[^(CogBytecodeMethodInspector on: coInterpreter)
+ 			oop: (coInterpreter longAt: address);
+ 			displayPinnable: fieldName, ' ', valueString].
+ 	"It's a CogMethod; use a different inspector"
+ 	self shouldBeImplemented!

Item was added:
+ CogOopInspector subclass: #CogBytecodeMethodInspector
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'VMMakerUI-SqueakInspectors'!

Item was added:
+ ----- Method: CogBytecodeMethodInspector>>textMenu: (in category 'accessing - ui') -----
+ textMenu: aMenuMorph
+ 	aMenuMorph
+ 		addTitle: 'Select print format';
+ 		add: #printOop: action: [self printer: #printOop:on:oopAttribute:];
+ 		add: #longPrintOop: action: [self printer: #longPrintOop:on:oopAttribute:];
+ 		add: #symbolicMethod: action: [self printer: #symbolicMethod:on:oopAttribute:].
+ 	^aMenuMorph!

Item was changed:
  ----- Method: CogOopInspector>>interpretOopString: (in category 'evaluating') -----
  interpretOopString: aStringContainingAnOop
+ 	^(CogOopInspector on: coInterpreter)
- 	^self copy
  		oop: (ExtendedNumberParser on: aStringContainingAnOop readStream skipSeparators) nextInteger;
  		displayPinnable: aStringContainingAnOop withBlanksTrimmed!

Item was added:
+ ----- Method: StackInterpreter>>printDecodeMethodHeaderOop:on: (in category '*VMMakerUI-debug printing') -----
+ printDecodeMethodHeaderOop: methodHeaderOop on: aStream
+ 	self shortPrintOop: methodHeaderOop on: aStream.
+ 	(self methodHeaderHasPrimitive: methodHeaderOop) ifTrue:
+ 		[aStream nextPutAll: ' hasPrim'].
+ 	(self methodHeaderIndicatesLargeFrame: methodHeaderOop) ifTrue:
+ 		[aStream nextPutAll: ' largeFrame'].
+ 	(SistaVM and: [self isOptimizedMethodHeader: methodHeaderOop]) ifTrue:
+ 		[aStream nextPutAll: ' optimized'].
+ 	(MULTIPLEBYTECODESETS and: [(objectMemory integerValueOf: methodHeaderOop) < 0]) ifTrue:
+ 		[aStream nextPutAll: ' altSet'].
+ 	NewspeakVM ifTrue:
+ 		[aStream nextPutAll:
+ 					((self accessModifierOfMethodHeader: methodHeaderOop) caseOf: {
+ 						[0] -> [' public'].
+ 						[1] -> [' private'].
+ 						[2] -> [' protected'].
+ 						[3] -> [' access undefined'] })].
+ 	aStream
+ 		nextPutAll: ' nLits '; print: (objectMemory literalCountOfMethodHeader: methodHeaderOop);
+ 		nextPutAll: ' nArgs '; print: (self argumentCountOfMethodHeader: methodHeaderOop);
+ 		nextPutAll: ' nTemps '; print: (self temporaryCountOfMethodHeader: methodHeaderOop)!

Item was added:
+ ----- Method: StackInterpreter>>printMethodHeaderOop:on: (in category '*VMMakerUI-debug printing') -----
+ printMethodHeaderOop: headerOop on: aStream
+ 	<doNotGenerate>
+ 	self printDecodeMethodHeaderOop: headerOop on: aStream!

Item was changed:
  ----- Method: StackInterpreter>>printOop:on:oopAttribute: (in category '*VMMakerUI-debug printing') -----
  printOop: oop on: aStream oopAttribute: oopTextAttribute
  	<doNotGenerate>
  	| cls fmt lastIndex startIP bytecodesPerLine column |
  	<inline: false>
  	(objectMemory isImmediate: oop) ifTrue:
  		[^self shortPrintOop: oop on: aStream].
  	self printHex: oop on: aStream.
  	(objectMemory addressCouldBeObj: oop) ifFalse:
  		[(oop bitAnd: objectMemory allocationUnit - 1) ~= 0 ifTrue: [^aStream nextPutAll: ' is misaligned'; cr].
  		 ((objectMemory isInNewSpace: oop)
  		  and: [objectMemory isForwarded: oop]) ifTrue:
  			[self printForwarder: oop on: aStream].
  		 ^aStream nextPutAll: (self whereIs: oop); cr].
  	(objectMemory isFreeObject: oop) ifTrue:
  		[aStream nextPutAll: ' is a free chunk of size '; print: (objectMemory sizeOfFree: oop).
  		 objectMemory hasSpurMemoryManagerAPI ifTrue:
  			[aStream nextPutAll: ' 0th: '. self printHex: (objectMemory fetchPointer: 0 ofFreeChunk: oop) on: aStream.
  			 objectMemory printHeaderTypeOf: oop on: aStream].
  		 ^aStream cr].
  	(objectMemory isForwarded: oop) ifTrue:
  		[self printForwarder: oop on: aStream].
  	aStream nextPutAll: ': a(n) '.
  	self printNameOfClass: (cls := objectMemory fetchClassOfNonImm: oop) count: 5 on: aStream.
  	cls = (objectMemory splObj: ClassFloat) ifTrue:
  		[^aStream cr; print: (objectMemory dbgFloatValueOf: oop); cr].
  	fmt := objectMemory formatOf: oop.
  	fmt > objectMemory lastPointerFormat ifTrue:
  		[aStream nextPutAll: ' nbytes '; print: (objectMemory numBytesOf: oop)].
  	aStream cr.
  	(fmt between: objectMemory firstLongFormat and: objectMemory firstCompiledMethodFormat - 1) ifTrue:
  		["This will answer false if splObj: ClassAlien is nilObject"
  		 (self is: oop KindOfClass: (objectMemory splObj: ClassAlien)) ifTrue:
  			[aStream nextPutAll: ' datasize '; print: (self sizeOfAlienData: oop).
  			aStream nextPutAll: ((self isIndirectAlien: oop)
  							ifTrue: [' indirect @ ']
  							ifFalse:
  								[(self isPointerAlien: oop)
  									ifTrue: [' pointer @ ']
  									ifFalse: [' direct @ ']]).
  			 self printHex: (self startOfAlienData: oop) on: aStream. ^aStream cr].
  		 (objectMemory isWordsNonImm: oop) ifTrue:
  			[lastIndex := 64 min: ((objectMemory numBytesOf: oop) / objectMemory wordSize).
  			 lastIndex > 0 ifTrue:
  				[1 to: lastIndex do:
  					[:index|
  					self printHex: (objectMemory fetchLong32: index - 1 ofObject: oop) on: aStream.
  					index \\ self elementsPerPrintOopLine = 0 ifTrue:
  						[aStream cr]].
  				lastIndex \\ self elementsPerPrintOopLine = 0 ifFalse:
  					[aStream cr]].
  			^self].
  		self printStringOf: oop on: aStream.
  		^aStream cr].
  	"this is nonsense.  apologies."
  	startIP := (objectMemory safeLastPointerOf: oop) + objectMemory bytesPerOop - objectMemory baseHeaderSize / objectMemory bytesPerOop.
  	lastIndex := 256 min: startIP.
  	lastIndex > 0 ifTrue:
  		[1 to: lastIndex do:
  			[:index|
  			aStream space; nextPutAll: (self hex: (objectMemory fetchPointer: index - 1 ofObject: oop) withAttribute: oopTextAttribute); space.
  			aStream nextPutAll: (self shortPrint: (objectMemory fetchPointer: index - 1 ofObject: oop)).
  			index \\ self elementsPerPrintOopLine = 0 ifTrue:
  				[aStream cr]].
  		lastIndex \\ self elementsPerPrintOopLine = 0 ifFalse:
  			[aStream cr]].
  	(objectMemory isCompiledMethod: oop)
  		ifFalse:
  			[startIP > 64 ifTrue: [aStream nextPutAll: '...'; cr]]
  		ifTrue:
  			[startIP := startIP * objectMemory wordSize + 1.
  			 lastIndex := objectMemory lengthOf: oop.
  			 lastIndex - startIP > 100 ifTrue:
  				[lastIndex := startIP + 100].
  			 bytecodesPerLine := 8.
  			 column := 1.
  			 startIP to: lastIndex do:
  				[:index| | byte |
  				column = 1 ifTrue:
+ 					[aStream nextPutAll: (oop+objectMemory baseHeaderSize+index-1) hex; nextPutAll: ': '].
- 					[aStream nextPutAll: (oop+objectMemory baseHeaderSize+index-1) hex; print: ': '].
  				byte := objectMemory fetchByte: index - 1 ofObject: oop.
  				aStream space. byte printOn: aStream base: 16. aStream nextPut: $/. byte printOn: aStream.
  				column := column + 1.
  				column > bytecodesPerLine ifTrue:
  					[column := 1. aStream cr]].
  			column = 1 ifFalse:
  				[aStream cr]]!

Item was added:
+ ----- Method: StackInterpreter>>symbolicMethod:on:oopAttribute: (in category '*VMMakerUI-debug printing') -----
+ symbolicMethod: aMethod on: aStream oopAttribute: oopTextAttribute
+ 	<doNotGenerate>
+ 	| prim |
+ 	(prim := self primitiveIndexOf: aMethod) > 0 ifTrue:
+ 		[aStream nextPutAll: '<primitive: '; print: prim; nextPut: $>.
+ 		(self isQuickPrimitiveIndex: prim) ifTrue:
+ 			[aStream nextPutAll: ' quick method'; cr; flush.
+ 			 ^self].
+ 		aStream cr].
+ 	0 to: (objectMemory literalCountOf: aMethod) do:
+ 		[:i| | field |
+ 		i * objectMemory bytesPerOop + objectMemory baseHeaderSize + aMethod printOn: aStream base: 16.
+ 		aStream space; print: i; nextPutAll: ': '.
+ 		field := objectMemory fetchPointer: i ofObject: aMethod.
+ 		aStream nextPutAll: (self hex: field withAttribute: oopTextAttribute); space.
+ 		i = 0
+ 			ifTrue: [self printMethodHeaderOop: field on: aStream]
+ 			ifFalse: [aStream nextPutAll: (self shortPrint: field)].
+ 		aStream cr].
+ 	(InstructionPrinter
+ 			on: ((VMCompiledMethodProxy new
+ 					for: aMethod
+ 					coInterpreter: self
+ 					objectMemory: objectMemory)
+ 						printPretty: true;
+ 						yourself))
+ 		indent: 0;
+ 		printInstructionsOn: aStream!



More information about the Vm-dev mailing list