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

commits at source.squeak.org commits at source.squeak.org
Fri May 15 17:35:29 UTC 2015


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

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

Name: VMMaker.oscog-eem.1305
Author: eem
Time: 15 May 2015, 10:33:30.524 am
UUID: 7e7b9dc3-41a0-4822-ba38-eb6af5d7f32b
Ancestors: VMMaker.oscog-tpr.1304

Put the eassert: expressions in blocks so that in the
simulator they are not evaluated unless enabled.

Fix lookupAddress: selector printing in Newspeak.

Remove the setRememberedSetRedZone simulation
hook.

Add MNU breakpointing to the simulator's
ceMNUFromPICMNUMethod:receiver: to stop before
the action.

=============== Diff against VMMaker.oscog-tpr.1304 ===============

Item was changed:
  ----- Method: CogVMSimulator>>ceMNUFromPICMNUMethod:receiver: (in category 'trampolines') -----
  ceMNUFromPICMNUMethod: aMethodObj receiver: rcvr
+ 	| cPIC |
+ 	cPIC := self cCoerceSimple: self popStack - cogit mnuOffset to: #'CogMethod *'.
+ 	self assert: (cPIC cmType = CMClosedPIC or: [cPIC cmType = CMOpenPIC]).
+ 	self mnuBreakpoint: cPIC selector receiver: nil.
- 	"self halt."
  	^super ceMNUFromPICMNUMethod: aMethodObj receiver: rcvr!

Item was removed:
- ----- Method: SpurGenerationScavengerSimulator>>setRememberedSetRedZone (in category 'remembered set') -----
- setRememberedSetRedZone
- 	self halt.
- 	^super setRememberedSetRedZone!

Item was changed:
  ----- Method: SpurMemoryManager>>emptyObjStack: (in category 'obj stacks') -----
  emptyObjStack: objStack
  	"Remove all the entries on the stack.  Do so by setting Topx to 0
  	 on the first page, and adding all subsequent pages to the free list."
  	| nextPage nextNextPage |
  	objStack = nilObj ifTrue:
  		[^self].
+ 	self eassert: [self isValidObjStack: objStack].
- 	self eassert: (self isValidObjStack: objStack).
  	self storePointer: ObjStackTopx ofObjStack: objStack withValue: 0.
  	nextPage := self fetchPointer: ObjStackNextx ofObject: objStack.
  	[nextPage ~= 0] whileTrue:
  		[nextNextPage := self fetchPointer: ObjStackNextx ofObject: nextPage.
  		 self storePointer: ObjStackFreex
  			ofObjStack: nextPage
  			withValue: (self fetchPointer: ObjStackFreex ofObject: objStack).
  		 self storePointer: ObjStackNextx ofObjStack: nextPage withValue: 0.
  		 self storePointer: ObjStackFreex ofObjStack: objStack withValue: nextPage.
  		 nextPage := nextNextPage].
  	self storePointer: ObjStackNextx ofObjStack: objStack withValue: 0.
+ 	self eassert: [self isValidObjStack: objStack]!
- 	self eassert: (self isValidObjStack: objStack)!

Item was changed:
  ----- Method: SpurMemoryManager>>isEmptyObjStack: (in category 'obj stacks') -----
  isEmptyObjStack: objStack
  	objStack = nilObj ifTrue:
  		[^true].
+ 	self eassert: [self isValidObjStack: objStack].
- 	self eassert: (self isValidObjStack: objStack).
  	^0 = (self fetchPointer: ObjStackTopx ofObject: objStack)
  	  and: [0 = (self fetchPointer: ObjStackNextx ofObject: objStack)]!

Item was changed:
  ----- Method: SpurMemoryManager>>lookupAddress: (in category 'simulation only') -----
  lookupAddress: address
  	"If address appears to be that of a Symbol or a few well-known objects (such as classes) answer it, otherwise answer nil.
  	 For code disassembly"
  	<doNotGenerate>
  	| fmt size string class classSize maybeThisClass classNameIndex thisClassIndex |
  	((self addressCouldBeObj: address)
  	 and: [(thisClassIndex := self classIndexOf: address) > 0]) ifFalse:
  		[^address = scavengeThreshold ifTrue:
  			['scavengeThreshold']].
  	address - self baseHeaderSize = hiddenRootsObj ifTrue:
  		[^'(hiddenRootsObj+baseHeaderSize)'].
  	fmt := self formatOf: address.
  	size := self lengthOf: address baseHeader: (self baseHeader: address) format: fmt.
  	size = 0 ifTrue:
  		[^address caseOf: { [nilObj] -> ['nil']. [trueObj] -> ['true']. [falseObj] -> ['false'] } otherwise: []].
  	((fmt between: self firstByteFormat and: self firstCompiledMethodFormat - 1) "indexable byte fields"
  	and: [(size between: 1 and: 64)
+ 	and: [(Scanner isLiteralSymbol: (string := (0 to: size - 1) collect: [:i| Character value: (self fetchByte: i ofObject: address)]))
+ 		or: [NewspeakVM and: [string noneSatisfy: [:c| c isSeparator or: [c asInteger > 126]]]]]]) ifTrue:
- 	and: [Scanner isLiteralSymbol: (string := (0 to: size - 1) collect: [:i| Character value: (self fetchByte: i ofObject: address)])]]) ifTrue:
  		[^'#', (ByteString withAll: string)].
  	class := self noCheckClassAtIndex: thisClassIndex.
  	(class isNil or: [class = nilObj]) ifTrue:
  		[^nil].
  	"address is either a class or a metaclass, or an instance of a class or invalid.  determine which."
  	classNameIndex := coInterpreter classNameIndex.
  	thisClassIndex := coInterpreter thisClassIndex.
  	((classSize := self numSlotsOf: class) <= (classNameIndex max: thisClassIndex)
  	 or: [classSize > 255]) ifTrue:
  		[^nil].
  	"Address could be a class or a metaclass"
  	(fmt = 1 and: [size > classNameIndex]) ifTrue:
  		["Is address a class? If so class's thisClass is address."
  		 (self lookupAddress: (self fetchPointer: classNameIndex ofObject: address)) ifNotNil:
  			[:maybeClassName|
  			(self fetchPointer: thisClassIndex ofObject: class) = address ifTrue:
  				[^maybeClassName allButFirst]].
  		"Is address a Metaclass?  If so class's name is Metaclass and address's thisClass holds the class name"
  		((self isBytes: (self fetchPointer: classNameIndex ofObject: class))
  		 and: [(self lookupAddress: (self fetchPointer: classNameIndex ofObject: class)) = '#Metaclass'
  		 and: [size >= thisClassIndex]]) ifTrue:
  			[maybeThisClass := self fetchPointer: thisClassIndex ofObject: address.
  			(self lookupAddress: (self fetchPointer: classNameIndex ofObject: maybeThisClass)) ifNotNil:
  				[:maybeThisClassName| ^maybeThisClassName allButFirst, ' class']]].
  	^(self lookupAddress: (self fetchPointer: classNameIndex ofObject: class)) ifNotNil:
  		[:maybeClassName| 'a(n) ', maybeClassName allButFirst]!

Item was changed:
  ----- Method: SpurMemoryManager>>nilUnmarkedWeaklingSlots (in category 'weakness and ephemerality') -----
  nilUnmarkedWeaklingSlots
  	"Nil the unmarked slots in the weaklings on the
  	 weakling stack, finalizing those that lost references.
  	 Finally, empty the weaklingStack."
  	<inline: #never> "for profiling"
  	self cCode: '' inSmalltalk: [coInterpreter transcript nextPutAll: 'nilling...'; flush].
+ 	self eassert: [self allOldMarkedWeakObjectsOnWeaklingStack].
- 	self eassert: self allOldMarkedWeakObjectsOnWeaklingStack.
  	weaklingStack = nilObj ifTrue:
  		[^self].
  	self objStack: weaklingStack from: 0 do:
  		[:weakling| | anyUnmarked |
  		anyUnmarked := self nilUnmarkedWeaklingSlotsIn: weakling.
  		anyUnmarked ifTrue:
  			[coInterpreter signalFinalization: weakling]].
  	self emptyObjStack: weaklingStack!

Item was changed:
  ----- Method: SpurMemoryManager>>noCheckPush:onObjStack: (in category 'obj stacks') -----
  noCheckPush: objOop onObjStack: objStack
  	"Push an element on an objStack.  Split from push:onObjStack: for testing."
  	| topx |
+ 	self eassert: [self isValidObjStack: objStack].
- 	self eassert: (self isValidObjStack: objStack).
  	self cCode: [] "for debugging markAndTrace: set (MarkStackRecord := OrderedCollection new)"
  		inSmalltalk:
  			[(self fetchPointer: ObjStackMyx ofObject: objStack) = MarkStackRootIndex ifTrue:
  				[MarkStackRecord ifNotNil: [MarkStackRecord addLast: {#push. objOop}]]].
  	topx := self fetchPointer: ObjStackTopx ofObject: objStack.
  	topx >= ObjStackLimit
  		ifTrue:
  			[self noCheckPush: objOop
  				onObjStack: (self ensureRoomOnObjStackAt: (self fetchPointer: ObjStackMyx ofObject: objStack))]
  		ifFalse:
  			[self storePointer: ObjStackFixedSlots + topx ofObjStack: objStack withValue: objOop.
  			 self storePointer: ObjStackTopx ofObjStack: objStack withValue: topx + 1].
  	^objOop!

Item was changed:
  ----- Method: SpurMemoryManager>>objStack:from:do: (in category 'obj stacks') -----
  objStack: objStack from: start do: aBlock
  	"Evaluate aBlock with all elements from start (0-relative) in objStack.
  	 Answer the size of the stack *before* the enumeration commences.
  	 This evaluates in top-of-stack-to-bottom order.  N.B. this is also stable
  	 if aBlock causes new elements to be added to the objStack, but
  	 unstable if aBlock causes elements to be removed."
  	<inline: true>
  	| size objStackPage numToEnumerate |
+ 	self eassert: [self isValidObjStack: weaklingStack].
- 	self eassert: (self isValidObjStack: weaklingStack).
  	size := self fetchPointer: ObjStackTopx ofObject: objStack.
  	objStackPage := self fetchPointer: ObjStackNextx ofObject: objStack.
  	[objStackPage ~= 0] whileTrue:
  		[size := size + ObjStackLimit.
  		 self assert: (self fetchPointer: ObjStackTopx ofObject: objStackPage) = ObjStackLimit.
  		 objStackPage := self fetchPointer: ObjStackNextx ofObject: objStackPage].
  	numToEnumerate := size - start.
  	objStackPage := objStack.
  	[numToEnumerate > 0] whileTrue:
  		[| numOnThisPage numToEnumerateOnThisPage topIndex |
  		 numOnThisPage := self fetchPointer: ObjStackTopx ofObject: objStackPage.
  		 numToEnumerateOnThisPage := numToEnumerate min: numOnThisPage.
  		 topIndex := numOnThisPage + ObjStackFixedSlots - 1.
  		 topIndex
  			to: topIndex - numToEnumerateOnThisPage + 1
  			by: -1
  			do:	[:i|
  				self assert: (self isWeak: (self fetchPointer: i ofObject: objStackPage)).
  				aBlock value: (self fetchPointer: i ofObject: objStackPage)].
  		 numToEnumerate := numToEnumerate - numToEnumerateOnThisPage.
  		 objStackPage := self fetchPointer: ObjStackNextx ofObject: objStackPage].
  	^size!

Item was changed:
  ----- Method: SpurMemoryManager>>popObjStack: (in category 'obj stacks') -----
  popObjStack: objStack
  	| topx top nextPage myx |
+ 	self eassert: [self isValidObjStack: objStack].
- 	self eassert: (self isValidObjStack: objStack).
  	topx := self fetchPointer: ObjStackTopx ofObject: objStack.
  	topx = 0 ifTrue:
  		[self assert: (self fetchPointer: ObjStackNextx ofObject: objStack) = 0.
  		 self cCode: [] "for debugging markAndTrace: set (MarkStackRecord := OrderedCollection new)"
  			inSmalltalk:
  				[(self fetchPointer: ObjStackMyx ofObject: objStack) = MarkStackRootIndex ifTrue:
  					[MarkStackRecord ifNotNil:
  						[MarkStackRecord addLast: {#EMPTY. nil}]]].
  		^nil].
  	topx := topx - 1.
  	top := self fetchPointer: topx + ObjStackFixedSlots ofObject: objStack.
  	self cCode: [] "for debugging markAndTrace: set (MarkStackRecord := OrderedCollection new)"
  		inSmalltalk:
  			[(self fetchPointer: ObjStackMyx ofObject: objStack) = MarkStackRootIndex ifTrue:
  				[MarkStackRecord ifNotNil:
  					[(MarkStackRecord last first = #push and: [MarkStackRecord last last = top])
  						ifTrue: [MarkStackRecord removeLast]
  						ifFalse: [MarkStackRecord addLast: {#pop. top}]]]].
  	self storePointer: ObjStackTopx ofObjStack: objStack withValue: topx.
  	(topx = 0
  	 and: [(nextPage := self fetchPointer: ObjStackNextx ofObject: objStack) ~= 0])
  		ifTrue:
  			[self storePointer: ObjStackFreex ofObjStack: nextPage withValue: objStack.
  			 self storePointer: ObjStackNextx ofObjStack: objStack withValue: 0.
  			 myx := self fetchPointer: ObjStackMyx ofObject: objStack.
  			 self updateRootOfObjStackAt: myx with: nextPage.
+ 			 self eassert: [self isValidObjStack: nextPage]]
- 			 self eassert: (self isValidObjStack: nextPage)]
  		ifFalse:
+ 			[self eassert: [self isValidObjStack: objStack]].
- 			[self eassert: (self isValidObjStack: objStack)].
  	^top!



More information about the Vm-dev mailing list