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

commits at source.squeak.org commits at source.squeak.org
Fri Oct 31 00:06:51 UTC 2014


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

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

Name: VMMaker.oscog-eem.915
Author: eem
Time: 30 October 2014, 5:02:22.109 pm
UUID: 4159cf52-4807-4416-9da6-1c46ec5b9f10
Ancestors: VMMaker.oscog-eem.914

Fix processWeakSurvivor: so that it answers
whether a weak object refers to a young object. 
The old version only scanned weak fields, igoring
refs to young objs from strong fields.

Move check for valid classes from findClassOfMethod:
forReceiver: into  findClassContainingMethod:startingAt:,
hence making findClassOfMethod:forReceiver: et al more
robust.

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

Item was changed:
  ----- Method: SpurGenerationScavenger>>processWeakSurvivor: (in category 'weakness and ephemerality') -----
  processWeakSurvivor: weakObj
  	"Process a weak survivor on the weakList.  Those of its fields
  	 which have not survived the scavenge should be nilled, and if any
  	 are, the coInterpreter should be informed via signalFinalization:..
  	 Answer if the weakObj has any young referents."
+ 	| weakObjShouldMourn hasYoungReferents numStrongSlots  |
- 	| weakObjShouldMourn hasYoungReferents |
  	weakObjShouldMourn := hasYoungReferents := false.
  	"N.B. generateToByDoLimitExpression:negative:on: guards against (unsigned)0 - 1 going +ve"
+ 	numStrongSlots := manager numFixedSlotsOf: weakObj.
+ 	0 to: numStrongSlots - 1 do:
+ 		[:i| | referent |
+ 		 referent := manager fetchPointer: i ofObject: weakObj.
+ 		 ((manager isNonImmediate: referent)
+ 		  and: [manager isYoungObject: referent]) ifTrue:
+ 			[hasYoungReferents := true]].
+ 	numStrongSlots
- 	(manager numFixedSlotsOf: weakObj)
  		to: (manager numSlotsOf: weakObj) - 1
  		do: [:i| | referent |
  			referent := manager fetchPointer: i ofObject: weakObj.
  			"Referent could be forwarded due to scavenging or a become:, don't assume."
  			(manager isNonImmediate: referent) ifTrue:
  				[(manager isForwarded: referent) ifTrue:
  					[referent := manager followForwarded: referent.
  					 "weakObj is either young or already in remembered table; no need to check"
  					 self assert: ((manager isReallyYoungObject: weakObj)
  								or: [manager isRemembered: weakObj])..
  					 manager storePointerUnchecked: i ofObject: weakObj withValue: referent].
  				(self isMaybeOldScavengeSurvivor: referent)
  					ifTrue:
  						[(manager isYoungObject: referent) ifTrue:
  							[hasYoungReferents := true]]
  					ifFalse:
  						[weakObjShouldMourn := true.
  						 manager
  							storePointerUnchecked: i
  							ofObject: weakObj
  							withValue: manager nilObject]]].
  	weakObjShouldMourn ifTrue:
  		[coInterpreter signalFinalization: weakObj].
  	^hasYoungReferents!

Item was changed:
  ----- Method: StackInterpreter>>findClassContainingMethod:startingAt: (in category 'debug support') -----
  findClassContainingMethod: meth startingAt: classObj
  	| currClass classDict classDictSize methodArray i |
  	(objectMemory isOopForwarded: classObj)
  		ifTrue: [currClass := objectMemory followForwarded: classObj]
  		ifFalse: [currClass := classObj].
  	[self assert: (objectMemory isForwarded: currClass) not.
+ 	 (self addressCouldBeClassObj: currClass) ifFalse:
+ 		[^objectMemory nilObject].
  	 classDict := objectMemory noFixupFollowField: MethodDictionaryIndex ofObject: currClass.
  	 self assert: (objectMemory isForwarded: classDict) not.
  	 classDictSize := objectMemory numSlotsOf: classDict.
  	 classDictSize > MethodArrayIndex ifTrue:
  		[methodArray := objectMemory noFixupFollowField: MethodArrayIndex ofObject: classDict.
  		 self assert: (objectMemory isForwarded: methodArray) not.
  		 i := 0.
  		 [i < (classDictSize - SelectorStart)] whileTrue:
  			[meth = (objectMemory noFixupFollowField: i ofObject: methodArray) ifTrue:
  				[^currClass].
  			 i := i + 1]].
  	 currClass := self noFixupSuperclassOf: currClass.
  	 currClass = objectMemory nilObject] whileFalse.
  	^currClass		"method not found in superclass chain"!

Item was changed:
  ----- Method: StackInterpreter>>findClassOfMethod:forReceiver: (in category 'debug support') -----
  findClassOfMethod: meth forReceiver: rcvr
- 	| rclass mclass |
  	((objectMemory addressCouldBeOop: rcvr)
  	and: [(objectMemory isOopForwarded: rcvr) not]) ifTrue:
+ 		[| rclass |
+ 		 rclass := self
+ 					findClassContainingMethod: meth
+ 					startingAt: (objectMemory fetchClassOf: rcvr).
+ 		 rclass ~= objectMemory nilObject ifTrue:
+ 			[^rclass]].
- 		[rclass := objectMemory fetchClassOf: rcvr.
- 		 (self addressCouldBeClassObj: rclass) ifTrue:
- 			[rclass := self findClassContainingMethod: meth startingAt: rclass.
- 			rclass ~= objectMemory nilObject ifTrue:
- 				[^rclass]]].
  	((objectMemory addressCouldBeObj: meth)
  	 and: [objectMemory isCompiledMethod: meth]) ifFalse:
  		[^objectMemory nilObject].
+ 	^self
+ 		findClassContainingMethod: meth
+ 		startingAt: (self safeMethodClassOf: meth)!
- 	mclass := self safeMethodClassOf: meth.
- 	(self addressCouldBeClassObj: mclass) ifTrue:
- 		[^objectMemory nilObject].
- 	^self findClassContainingMethod: meth startingAt: (self safeMethodClassOf: meth)!



More information about the Vm-dev mailing list