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

commits at source.squeak.org commits at source.squeak.org
Sat Sep 21 15:52:32 UTC 2013


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

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

Name: VMMaker.oscog-eem.401
Author: eem
Time: 21 September 2013, 8:48:57.895 am
UUID: d0d762fc-2668-4ebc-b4a3-047bb4899a53
Ancestors: VMMaker.oscog-eem.400

Fix stupid slip in SpurMemMgr>>hashBitsOf:, answer what's set!!

Add size and nicer contents printing to longPrintOop:

Skip separators in promptHex:

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

Item was changed:
  ----- Method: SpurMemoryManager>>hashBitsOf: (in category 'header access') -----
  hashBitsOf: objOop
  	| hash |
  	hash := self rawHashBitsOf: objOop.
  	hash = 0 ifTrue:
  		["would like to assert
  			self assert: (coInterpreter addressCouldBeClassObj: objOop) not
  		  but instance-specific behaviors that are instances of themselves may
  		  fail this test."
+ 		 hash := self newObjectHash bitAnd: self identityHashHalfWordMask.
+ 		 self setHashBitsOf: objOop to: hash].
- 		 hash := self newObjectHash.
- 		 self setHashBitsOf: objOop to: (hash bitAnd: self identityHashHalfWordMask)].
  	^hash!

Item was changed:
  ----- Method: StackInterpreter>>longPrintOop: (in category 'debug printing') -----
  longPrintOop: oop
  	<api>
  	| class fmt lastIndex startIP bytecodesPerLine column |
  	((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].
  	class := objectMemory fetchClassOfNonImm: oop.
  	self printHex: oop;
  		print: ': a(n) '; printNameOfClass: class count: 5;
  		print: ' ('; printHex: class; print: ')'.
  	fmt := objectMemory formatOf: oop.
  	self print: ' format '; printHexnp: fmt.
+ 	fmt > objectMemory lastPointerFormat
+ 		ifTrue: [self print: ' nbytes '; printNum: (objectMemory byteLengthOf: oop)]
+ 		ifFalse: [(objectMemory isIndexableFormat: fmt) ifTrue:
+ 					[| len |
+ 					len := objectMemory lengthOf: oop.
+ 					self print: ' size '; printNum: len - (objectMemory fixedFieldsOf: oop format: fmt length: len)]].
- 	fmt > objectMemory lastPointerFormat ifTrue:
- 		[self print: ' nbytes '; printNum: (objectMemory byteLengthOf: oop)].
  	objectMemory printHeaderTypeOf: oop.
  	self print: ' hash '; printHexnp: (objectMemory rawHashBitsOf: oop).
  	self cr.
  	(fmt between: objectMemory firstLongFormat and: objectMemory firstCompiledMethodFormat - 1) ifTrue:
  		[^self].
  	"this is nonsense.  apologies."
  	startIP := (objectMemory lastPointerOf: oop) + BytesPerOop - objectMemory baseHeaderSize / BytesPerOop.
  	lastIndex := 256 min: startIP.
  	lastIndex > 0 ifTrue:
  		[1 to: lastIndex do:
  			[:i| | fieldOop |
  			fieldOop := objectMemory fetchPointer: i - 1 ofObject: oop.
  			self space; printNum: i - 1; space; printHex: fieldOop; space.
  			(i = 1 and: [objectMemory isCompiledMethod: oop])
  				ifTrue: [self printMethodHeaderOop: fieldOop]
+ 				ifFalse: [self cCode: [self printOopShort: fieldOop]
+ 							inSmalltalk: [self print: (self shortPrint: fieldOop)]].
- 				ifFalse: [self printOopShort: fieldOop].
  			self cr]].
  	(objectMemory isCompiledMethod: oop)
  		ifFalse:
  			[startIP > 64 ifTrue: [self print: '...'; cr]]
  		ifTrue:
  			[startIP := startIP * BytesPerWord + 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:
  					[self cCode: 'printf("0x%08x: ", oop+BaseHeaderSize+index-1)'
  						inSmalltalk: [self print: (oop+BaseHeaderSize+index-1) hex; print: ': ']].
  				byte := objectMemory fetchByte: index - 1 ofObject: oop.
  				self cCode: 'printf(" %02x/%-3d", byte,byte)'
  					inSmalltalk: [self space; print: (byte radix: 16); printChar: $/; printNum: byte].
  				column := column + 1.
  				column > bytecodesPerLine ifTrue:
  					[column := 1. self cr]].
  			column = 1 ifFalse:
  				[self cr]]!

Item was added:
+ ----- Method: StackInterpreterSimulator>>primitiveIdentityHash (in category 'debugging traps') -----
+ primitiveIdentityHash
+ 	| oop |
+ 	oop := self stackTop.
+ 	((objectMemory isBytes: oop)
+ 	and: [(objectMemory lengthOf: oop) = 'smallSelect' size
+ 	and: [(self stringOf: oop) = 'smallSelect']]) ifTrue:
+ 		[self halt].
+ 	^super primitiveIdentityHash!

Item was changed:
  ----- Method: VMClass>>promptHex: (in category 'simulation support') -----
  promptHex: string
  	<doNotGenerate>
  	| s |
  	s := UIManager default request: string, ' (hex)'.
+ 	s := s withBlanksTrimmed.
  	^s notEmpty ifTrue:
  		[(s includes: $r)
  			ifTrue:
  				[Number readFrom: s readStream]
  			ifFalse:
  				[(#('0x' '-0x') detect: [:prefix| s beginsWith: prefix] ifNone: []) ifNotNil:
  					[:prefix|
  					s := s allButFirst: prefix size.
  					prefix first = $- ifTrue: [s := '-', s]].
  				Integer readFrom: s readStream base: 16]]!



More information about the Vm-dev mailing list