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

commits at source.squeak.org commits at source.squeak.org
Tue Jan 7 00:04:26 UTC 2020


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

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

Name: VMMakerUI-eem.14
Author: eem
Time: 6 January 2020, 4:04:25.519543 pm
UUID: 2ac224f3-7e13-422e-8449-bf67ce431ed2
Ancestors: VMMakerUI-eem.13

Emphasize the btarget oop in a forwarder.
Put the occasional new line in the print of a bytte array/large integer.
Also use promptClickStep in the interpreter's click step.

=============== Diff against VMMakerUI-eem.13 ===============

Item was changed:
  ----- Method: CogVMSimulator>>printStringOf:on: (in category '*VMMakerUI-debug printing') -----
  printStringOf: oop on: aStream
  	<doNotGenerate>
  	| fmt len cnt max i |
  	(objectMemory isImmediate: oop) ifTrue:
  		[^self].
  	(objectMemory addressCouldBeObj: oop) ifFalse:
  		[^self].
  	fmt := objectMemory formatOf: oop.
  	fmt < objectMemory firstByteFormat ifTrue: [^self].
  
  	cnt := (max := 128) min: (len := objectMemory lengthOf: oop).
  	i := 0.
  
  	((objectMemory is: oop
  		  instanceOf: (objectMemory splObj: ClassByteArray)
  		  compactClassIndex: classByteArrayCompactIndex)
  	or: [(objectMemory isLargeIntegerInstance: oop)])
  		ifTrue:
  			[[i < cnt] whileTrue:
  				[self printHex: (objectMemory fetchByte: i ofObject: oop) on: aStream.
+ 				 (i := i + 1) \\ 16 = 0 ifTrue: [aStream cr]]]
- 				 i := i + 1]]
  		ifFalse:
  			[[i < cnt] whileTrue:
  				[aStream nextPut: (objectMemory fetchByte: i ofObject: oop) asCharacter.
  				 i := i + 1]].
  	len > max ifTrue:
  		[aStream nextPutAll: '...']!

Item was changed:
  ----- Method: Cogit>>setClickStepBreakBlock (in category '*VMMakerUI-user interface') -----
  setClickStepBreakBlock
  	"Set the break block to present a confirmer, breaking if true, and restoring the previous break block.
  	 If an open debugger on the receiver can be found, proceed it."
  	<doNotGenerate>
  	| previousBreakBlock previousAtEachStepBlock previousBreakPC previousSingleStep previousClickConfirm result |
  	(breakBlock isNil or: [breakBlock method ~~ thisContext method]) ifTrue:
  		[previousBreakBlock := breakBlock.
  		 previousAtEachStepBlock := coInterpreter atEachStepBlock.
  		 previousBreakPC := breakPC.
  		 previousSingleStep := singleStep.
  		 previousClickConfirm := clickConfirm.
  		 breakBlock := [:ign|
  						(processor pc ~= previousBreakPC
  						 and: [(result := self promptClickStep) == true])
  							ifTrue: [false]
  							ifFalse: [breakBlock := previousBreakBlock.
  									coInterpreter atEachStepBlock: previousAtEachStepBlock.
  									breakPC := previousBreakPC.
  									singleStep := previousSingleStep.
  									clickConfirm := previousClickConfirm.
  									true]].
  		 coInterpreter atEachStepBlock:
  								[previousAtEachStepBlock value.
  								 (coInterpreter localIP ~= previousBreakPC
+ 								  and: [(result := self promptClickStep) == true]) ifFalse:
- 								  and: [UIManager confirm: 'step?']) ifFalse:
  									[breakBlock := previousBreakBlock.
  									coInterpreter atEachStepBlock: previousAtEachStepBlock.
  									breakPC := previousBreakPC.
  									singleStep := previousSingleStep.
  									clickConfirm := previousClickConfirm.
  									self halt]].
  		 singleStep := breakPC := clickConfirm := result ~~ #proceed].
  	(World submorphs
  		detect:
  			[:m|
  			 m model isDebugger
  			 and: [(m model interruptedProcess suspendedContext findContextSuchThat:
  					[:ctxt|
  					(ctxt receiver == self
  					 and: [ctxt selector == #simulateCogCodeAt:])
  					or: [ctxt receiver == coInterpreter
  					 and: [ctxt selector == #interpret]]]) notNil]]
  		ifNone: []) ifNotNil:
  			[:debuggerWindow|
  			 WorldState addDeferredUIMessage:
  				[debuggerWindow model proceed]]!

Item was removed:
- ----- Method: StackInterpreter>>printForwarder:on: (in category '*VMMakerUI-debug printing') -----
- printForwarder: oop on: aStream
- 	<doNotGenerate>
- 	aStream nextPutAll: ' is a forwarded object to '.
- 	self printHex: (objectMemory followForwarded: oop) on: aStream.
- 	aStream nextPutAll: ' of slot size '; print: (objectMemory numSlotsOfAny: oop).
- 	objectMemory printHeaderTypeOf: oop on: aStream.
- 	aStream cr!

Item was added:
+ ----- Method: StackInterpreter>>printForwarder:on:oopAttribute: (in category '*VMMakerUI-debug printing') -----
+ printForwarder: oop on: aStream oopAttribute: oopTextAttribute
+ 	<doNotGenerate>
+ 	aStream
+ 		nextPutAll: ' is a forwarded object to ';
+ 		nextPutAll: (self hex: (objectMemory followForwarded: oop) withAttribute: oopTextAttribute);
+ 		nextPutAll: ' of slot size ';
+ 		print: (objectMemory numSlotsOfAny: oop).
+ 	objectMemory printHeaderTypeOf: oop on: aStream.
+ 	aStream cr!

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 oopAttribute: oopTextAttribute].
- 			[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 oopAttribute: oopTextAttribute].
- 		[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: ': '].
  				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]]!



More information about the Vm-dev mailing list