[Vm-dev] VM Maker: VMMakerUI-eem.10.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Dec 28 22:53:39 UTC 2019
Eliot Miranda uploaded a new version of VMMakerUI to project VM Maker:
http://source.squeak.org/VMMaker/VMMakerUI-eem.10.mcz
==================== Summary ====================
Name: VMMakerUI-eem.10
Author: eem
Time: 28 December 2019, 2:53:37.804726 pm
UUID: 9a3faf98-403b-42be-8ac4-23674b202d6d
Ancestors: VMMakerUI-eem.9
Use safeLastPointer: for more robust printing, e.g. when the JIT is producing bogus code.
=============== Diff against VMMakerUI-eem.9 ===============
Item was changed:
----- Method: StackInterpreter>>longPrintOop:on:oopAttribute: (in category '*VMMakerUI-debug printing') -----
longPrintOop: oop on: aStream oopAttribute: oopTextAttribute
<doNotGenerate>
| fmt lastIndex startIP bytecodesPerLine column field |
((objectMemory isImmediate: oop)
or: [(objectMemory addressCouldBeObj: oop) not
or: [(oop bitAnd: objectMemory allocationUnit - 1) ~= 0
or: [(objectMemory isFreeObject: oop)
or: [objectMemory isForwarded: oop]]]]) ifTrue:
[^self printOop: oop on: aStream oopAttribute: oopTextAttribute].
self printHex: oop on: aStream.
(objectMemory fetchClassOfNonImm: oop)
ifNil: [aStream nextPutAll: ' has a nil class!!!!']
ifNotNil: [:class|
aStream nextPutAll: ': a(n) '.
self printNameOfClass: class count: 5 on: aStream.
aStream nextPutAll: ' ('.
objectMemory hasSpurMemoryManagerAPI ifTrue:
[self printHexnp: (objectMemory compactClassIndexOf: oop) on: aStream. aStream nextPutAll: '=>'].
aStream nextPutAll: (self hexnp: class withAttribute: oopTextAttribute); nextPut: $)].
fmt := objectMemory formatOf: oop.
aStream nextPutAll: ' format '. fmt printOn: aStream base: 16.
fmt > objectMemory lastPointerFormat
ifTrue: [aStream nextPutAll: ' nbytes '; print: (objectMemory numBytesOf: oop)]
ifFalse: [(objectMemory isIndexableFormat: fmt) ifTrue:
[| len |
len := objectMemory lengthOf: oop.
aStream nextPutAll: ' size '; print: len - (objectMemory fixedFieldsOf: oop format: fmt length: len)]].
objectMemory printHeaderTypeOf: oop on: aStream.
aStream nextPutAll: ' hash '. (objectMemory rawHashBitsOf: oop) printOn: aStream base: 16. aStream cr.
(fmt between: objectMemory firstByteFormat and: objectMemory firstCompiledMethodFormat - 1) ifTrue:
[self printStringOf: oop on: aStream. ^aStream cr].
(fmt between: objectMemory firstLongFormat and: objectMemory firstByteFormat - 1) ifTrue:
[0 to: ((objectMemory num32BitUnitsOf: oop) min: 256) - 1 do:
[:i|
field := objectMemory fetchLong32: i ofObject: oop.
aStream space; print: i; space. (self printHex: field on: aStream). aStream space; cr].
^self].
objectMemory hasSpurMemoryManagerAPI ifTrue:
[fmt = objectMemory sixtyFourBitIndexableFormat ifTrue:
[0 to: ((objectMemory num64BitUnitsOf: oop) min: 256) - 1 do:
[:i|
field := objectMemory fetchLong64: i ofObject: oop.
aStream space; print: i; space. (self printHex: field on: aStream). aStream space; cr].
^self].
(fmt between: objectMemory firstShortFormat and: objectMemory firstShortFormat + 1) ifTrue:
[0 to: ((objectMemory num16BitUnitsOf: oop) min: 256) - 1 do:
[:i|
field := objectMemory fetchShort16: i ofObject: oop.
aStream space; print: i; space. (self printHex: field on: aStream). aStream space; cr].
^self]].
"this is nonsense. apologies."
+ startIP := (objectMemory safeLastPointerOf: oop) + objectMemory bytesPerOop - objectMemory baseHeaderSize / objectMemory bytesPerOop.
- startIP := (objectMemory lastPointerOf: oop) + objectMemory bytesPerOop - objectMemory baseHeaderSize / objectMemory bytesPerOop.
lastIndex := 256 min: startIP.
lastIndex > 0 ifTrue:
[1 to: lastIndex do:
[:i|
field := objectMemory fetchPointer: i - 1 ofObject: oop.
aStream space; print: i - 1; space; nextPutAll: (self hex: field withAttribute: oopTextAttribute); space.
(i = 1 and: [objectMemory isCompiledMethod: oop])
ifTrue: [self printMethodHeaderOop: field on: aStream]
ifFalse: [aStream nextPutAll: (self shortPrint: field)].
aStream cr]].
(objectMemory isCompiledMethod: oop)
ifFalse:
[startIP > lastIndex 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]]!
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:
[^aStream nextPutAll: ((oop bitAnd: objectMemory allocationUnit - 1) ~= 0
ifTrue: [' is misaligned']
ifFalse: [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:
[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].
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.
- startIP := (objectMemory lastPointerOf: 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; 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]]!
More information about the Vm-dev
mailing list