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

commits at source.squeak.org commits at source.squeak.org
Sat Jun 23 21:16:38 UTC 2012


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

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

Name: VMMaker.oscog-eem.164
Author: eem
Time: 23 June 2012, 11:23:07.021 am
UUID: 4d03e08d-186b-4360-8d3b-8d14d8c7db82
Ancestors: VMMaker.oscog-eem.163

Add shortPrintOop: to printReferencesTo:.  Fix cascade  transformation
for same.  Add addrtess offset to bytecode printing in printOop.

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

Item was changed:
  ----- Method: CascadeNode>>asTranslatorNodeIn: (in category '*VMMaker-C translation') -----
  asTranslatorNodeIn: aTMethod
+ 	"make a CCodeGenerator equivalent of me."
- 	"make a CCodeGenerator equivalent of me"
  	^TStmtListNode new
  		setArguments: #()
  		statements:
  			(Array streamContents:
  				[:s| | receiverNode |
  				receiverNode := receiver asTranslatorNodeIn: aTMethod.
+ 				"don't expand the receiver if it is a send to get an implicit receiver,
+ 				 e.g self interpreter printHex: oop => printHex(oop), /not/ printHex(cascade0,oop)."
+ 				(receiverNode isSend and: [aTMethod definingClass isNonArgumentImplicitReceiverVariableName: receiverNode selector]) ifTrue:
+ 					[receiverNode := TVariableNode new setName: receiverNode selector].
  				receiverNode isLeaf ifFalse:
  					[| varNode |
  					 varNode := aTMethod newCascadeTempFor: receiverNode.
  					 s nextPut: (TAssignmentNode new
  								setVariable: varNode
  								expression: receiverNode).
  					receiverNode := varNode].
  				messages do:
  					[ :msg | s nextPut: ((msg asTranslatorNodeIn: aTMethod) receiver: receiverNode)]]);
  		comment: comment!

Item was changed:
  ----- Method: CoInterpreter class>>isNonArgumentImplicitReceiverVariableName: (in category 'translation') -----
  isNonArgumentImplicitReceiverVariableName: aString
+ 	^#('self' 'stackPages' 'cogit' 'coInterpreter' 'cogMethodZone' 'objectMemory' 'interpreter') includes: aString!
- 	^#('self' 'stackPages' 'cogit' 'coInterpreter' 'cogMethodZone' 'objectMemory') includes: aString!

Item was added:
+ ----- Method: ObjectMemory class>>isNonArgumentImplicitReceiverVariableName: (in category 'translation') -----
+ isNonArgumentImplicitReceiverVariableName: aString
+ 	^#('self' 'interpreter' 'coInterpreter') includes: aString!

Item was changed:
  ----- Method: ObjectMemory>>printReferencesTo: (in category 'debug printing') -----
  printReferencesTo: anOop
  	"Scan the heap printing the oops of any and all objects that refer to anOop"
  	| oop i |
  	<api>
  	oop := self firstAccessibleObject.
  	[oop = nil] whileFalse:
  		[((self isPointers: oop) or: [self isCompiledMethod: oop]) ifTrue:
  			[(self isCompiledMethod: oop)
  				ifTrue:
  					[i := (self literalCountOf: oop) - 1]
  				ifFalse:
  					[(self isContext: oop)
  						ifTrue: [i := CtxtTempFrameStart + (self fetchStackPointerOf: oop) - 1]
  						ifFalse: [i := (self lengthOf: oop) - 1]].
  			[i >= 0] whileTrue:
  				[anOop = (self fetchPointer: i ofObject: oop) ifTrue:
+ 					[self interpreter printHex: oop; print: ' @ '; printNum: i; space; printOopShort: oop; cr.
- 					[self printHex: oop; print: ' @ '; printNum: i; cr.
  					 i := 0].
  				 i := i - 1]].
  		 oop := self accessibleObjectAfter: oop]!

Item was changed:
  ----- Method: StackInterpreter>>elementsPerPrintOopLine (in category 'debug printing') -----
  elementsPerPrintOopLine
  	^5!

Item was changed:
  ----- Method: StackInterpreter>>printOop: (in category 'debug printing') -----
  printOop: oop
+ 	| cls fmt lastIndex startIP bytecodesPerLine column |
- 	| cls fmt lastIndex startIP bytecodesPerLine |
  	<inline: false>
  	self printHex: oop.
  	(objectMemory isIntegerObject: oop) ifTrue:
  		[^self
  			cCode: 'printf("=%ld\n", integerValueOf(oop))'
  			inSmalltalk: [self print: (self shortPrint: oop); cr]].
  	(oop between: objectMemory startOfMemory and: objectMemory freeStart) ifFalse:
  		[self printHex: oop; print: ' is not on the heap'; cr.
  		 ^nil].
  	(oop bitAnd: (BytesPerWord - 1)) ~= 0 ifTrue:
  		[self printHex: oop; print: ' is misaligned'; cr.
  		 ^nil].
  	(objectMemory isFreeObject: oop) ifTrue:
  		[self print: ' free chunk of size '; printNum: (objectMemory sizeOfFree: oop); cr.
  		 ^nil].
+ "
  	self print: ': a(n) '.
+ "
  	self printNameOfClass: (cls := objectMemory fetchClassOfNonInt: oop) count: 5.
  	cls = (objectMemory splObj: ClassFloat) ifTrue:
  		[self cr; printFloat: (self dbgFloatValueOf: oop); cr.
  		 ^nil].
  	fmt := objectMemory formatOf: oop.
  	fmt > 4 ifTrue:
  		[self print: ' nbytes '; printNum: (objectMemory byteSizeOf: oop)].
  	self cr.
  	(fmt > 4 and: [fmt < 12]) ifTrue:
  		["This will answer false if splObj: ClassAlien is nilObject"
  		 (self is: oop KindOfClass: (objectMemory splObj: ClassAlien)) ifTrue:
  			[self print: ' datasize '; printNum: (self sizeOfAlienData: oop).
  			self print: ((self isIndirectAlien: oop)
  							ifTrue: [' indirect @ ']
  							ifFalse:
  								[(self isPointerAlien: oop)
  									ifTrue: [' pointer @ ']
  									ifFalse: [' direct @ ']]).
  			 self printHex: (self startOfAlienData: oop) asUnsignedInteger; cr.
  			 ^nil].
  		 (objectMemory isWords: oop) ifTrue:
  			[lastIndex := 64 min: ((objectMemory byteSizeOf: oop) / BytesPerWord).
  			 lastIndex > 0 ifTrue:
  				[1 to: lastIndex do:
  					[:index|
  					self space; printHex: (objectMemory fetchLong32: index - 1 ofObject: oop).
  					(index \\ self elementsPerPrintOopLine) = 0 ifTrue:
  						[self cr]].
  				(lastIndex \\ self elementsPerPrintOopLine) = 0 ifFalse:
  					[self cr]].
  			^nil].
  		^self printStringOf: oop; cr].
  	lastIndex := 64 min: (startIP := (objectMemory lastPointerOf: oop) / BytesPerWord).
  	lastIndex > 0 ifTrue:
  		[1 to: lastIndex do:
  			[:index|
  			self cCode: 'printHex(fetchPointerofObject(index - 1, oop)); putchar('' '')'
  				inSmalltalk: [self space; printHex: (objectMemory fetchPointer: index - 1 ofObject: oop); space.
  							 self print: (self shortPrint: (objectMemory fetchPointer: index - 1 ofObject: oop))].
  			(index \\ self elementsPerPrintOopLine) = 0 ifTrue:
  				[self cr]].
  		(lastIndex \\ self elementsPerPrintOopLine) = 0 ifFalse:
  			[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.
- 			 bytecodesPerLine := 10.
  			 startIP to: lastIndex do:
  				[:index| | byte |
+ 				(column = 1) ifTrue:[
+ 					self cCode: 'printf("%08x: ", oop+index-1)'
+ 						inSmalltalk: [self print: (oop+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:
- 				((index - startIP + 1) \\ bytecodesPerLine) = 0 ifTrue:
- 					[self cr]].
- 			((lastIndex - startIP + 1) \\ bytecodesPerLine) = 0 ifFalse:
  				[self cr]]!



More information about the Vm-dev mailing list