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

commits at source.squeak.org commits at source.squeak.org
Mon Jul 6 18:46:28 UTC 2015


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

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

Name: VMMaker.oscog-eem.1405
Author: eem
Time: 6 July 2015, 11:43:50.069 am
UUID: 7aff388a-73ba-4202-bb5a-72b0759ff46b
Ancestors: VMMaker.oscog-eem.1404

Spur:
Make sure the post become action unforwards the
Process in the activeProcess inst var up to date.
Add some more asserts to check.  Also follow the
specialObjectsArray after a pin become.

Generically use storePointerUnchecked: when
storing nils into the process lists.

Nuke an unused method in the MT VM.

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

Item was removed:
- ----- Method: CoInterpreterMT>>removeLink:fromList: (in category 'process primitive support') -----
- removeLink: aLink fromList: aLinkedList
- 	| linksNextLink tempLink lastLink nextLink |
- 	linksNextLink := objectMemory fetchPointer: NextLinkIndex ofObject: aLink.
- 	tempLink := objectMemory fetchPointer: FirstLinkIndex ofObject: aLinkedList.
- 	lastLink := objectMemory fetchPointer: LastLinkIndex ofObject: aLinkedList.
- 	aLink = tempLink
- 		ifTrue:
- 			[objectMemory storePointer: FirstLinkIndex
- 				ofObject: aLinkedList
- 				withValue: linksNextLink.
- 			 aLink = lastLink ifTrue:
- 				[objectMemory storePointerUnchecked: LastLinkIndex
- 					ofObject: aLinkedList
- 					withValue: objectMemory nilObject]]
- 		ifFalse:
- 			[[tempLink = objectMemory nilObject ifTrue: [self error: 'link is not on list'].
- 			  nextLink := objectMemory fetchPointer: NextLinkIndex ofObject: tempLink.
- 			  nextLink = aLink] whileFalse:
- 				[tempLink := nextLink].
- 			 objectMemory storePointer: NextLinkIndex
- 				ofObject: tempLink
- 				withValue: linksNextLink.
- 			aLink = lastLink ifTrue:
- 				[objectMemory storePointer: LastLinkIndex
- 					ofObject: aLinkedList
- 					withValue: tempLink]].
- 	objectMemory storePointer: NextLinkIndex ofObject: aLink withValue: objectMemory nilObject.
- 	^aLink!

Item was removed:
- ----- Method: CogVMSimulator>>removeLink:fromList: (in category 'multi-threading simulation switch') -----
- removeLink: aLink fromList: aLinkedList
- 	"This method includes or excludes CoInterpreterMT methods as required.
- 	 Auto-generated by CogVMSimulator>>ensureMultiThreadingOverridesAreUpToDate"
- 
- 	^self perform: #removeLink:fromList:
- 		withArguments: {aLink. aLinkedList}
- 		inSuperclass: (cogThreadManager ifNil: [CoInterpreterPrimitives] ifNotNil: [CoInterpreterMT])!

Item was changed:
  ----- Method: SpurMemoryManager>>pinObject: (in category 'primitive support') -----
  pinObject: objOop
  	"Attempt to pin objOop, which must not be immediate.
  	 If the attempt succeeds answer objOop's (possibly moved) oop.
  	 If the attept fails, which can only occur if there is no memory, answer 0."
  	<inline: false>
  	| oldClone seg |
  	<var: #seg type: #'SpurSegmentInfo *'>
  	self assert: (self isNonImmediate: objOop).
  	self flag: 'policy decision here. if already old, do we clone in a segment containing pinned objects or merely pin?'.
  	"We choose to clone to keep pinned objects together to reduce fragmentation,
  	 assuming that pinning is rare and that fragmentation is a bad thing."
  	(self isOldObject: objOop) ifTrue:
  		[seg := segmentManager segmentContainingObj: objOop.
  		 seg containsPinned ifTrue:
  			[self setIsPinnedOf: objOop to: true.
  			 ^objOop].
  		 segmentManager someSegmentContainsPinned ifFalse:
  			[self setIsPinnedOf: objOop to: true.
  			 seg containsPinned: true.
  			 ^objOop]].
  	oldClone := self cloneInOldSpaceForPinning: objOop.
  	oldClone ~= 0 ifTrue:
  		[becomeEffectsFlags := self becomeEffectFlagsFor: objOop.
  		 self setIsPinnedOf: oldClone to: true.
  		 self forward: objOop to: oldClone.
+ 		 self followSpecialObjectsOop.
  		 coInterpreter postBecomeAction: becomeEffectsFlags.
  		 self postBecomeScanClassTable: becomeEffectsFlags.
  		 becomeEffectsFlags := 0].
  	^oldClone!

Item was changed:
  ----- Method: StackInterpreter>>addLastLink:toList: (in category 'process primitive support') -----
  addLastLink: proc toList: aList 
  	"Add the given process to the end of the given linked list
  	 and set the backpointer of process to its new list."
  	| lastLink |
+ 	self deny: (objectMemory isForwarded: proc).
+ 	self deny: (objectMemory isForwarded: aList).
- 	self assert: (objectMemory isForwarded: aList) not.
  	self assert: (objectMemory fetchPointer: NextLinkIndex ofObject: proc) = objectMemory nilObject.
  	(self isEmptyList: aList)
  		ifTrue: [objectMemory storePointer: FirstLinkIndex ofObject: aList withValue: proc]
  		ifFalse:
  			[lastLink := objectMemory fetchPointer: LastLinkIndex ofObject: aList.
  			 self assert: lastLink ~= proc.
  			 objectMemory storePointer: NextLinkIndex ofObject: lastLink withValue: proc].
  	objectMemory storePointer: LastLinkIndex ofObject: aList withValue: proc.
  	objectMemory storePointer: MyListIndex ofObject: proc withValue: aList!

Item was changed:
  ----- Method: StackInterpreter>>followForwardingPointersInScheduler (in category 'object memory support') -----
  followForwardingPointersInScheduler
  	| schedAssoc sched procLists |
  	schedAssoc := objectMemory splObj: SchedulerAssociation.
  	"the GC follows pointers in the special objects array for us."
  	self assert: (objectMemory isForwarded: schedAssoc) not.
  
+ 	"Make sure the active process has been followed."
+ 	self followForwardedObjectFields: schedAssoc toDepth: 1.
- 	sched := objectMemory followObjField: ValueIndex ofObject: schedAssoc.
  
+ 	sched := objectMemory fetchPointer: ValueIndex ofObject: schedAssoc.
+ 
  	procLists := objectMemory followObjField: ProcessListsIndex ofObject: sched.
  
+ 	"Follow all links in the process list to ensure the lists are valid."
  	0 to: (objectMemory numSlotsOf: procLists) - 1 do:
  		[:i| | list first last next |
  		list := objectMemory followObjField: i ofObject: procLists.
  		first := objectMemory followObjField: FirstLinkIndex ofObject: list.
  		last := objectMemory followObjField: LastLinkIndex ofObject: list.
  		[first ~= last] whileTrue:
  			[next := objectMemory followObjField: NextLinkIndex ofObject: first.
  			 first := next]]
  !

Item was changed:
  ----- Method: StackInterpreter>>removeFirstLinkOfList: (in category 'process primitive support') -----
  removeFirstLinkOfList: aList 
  	"Remove the first process from the given linked list."
  	| first last next |
+ 	self deny: (objectMemory isForwarded: aList).
- 	self assert: (objectMemory isForwarded: aList) not.
  	first := objectMemory fetchPointer: FirstLinkIndex ofObject: aList.
  	last := objectMemory fetchPointer: LastLinkIndex ofObject: aList.
+ 	self deny: (objectMemory isForwarded: first).
+ 	self deny: (objectMemory isForwarded: last).
  	first = last
+ 		ifTrue:
+ 			[objectMemory
+ 				storePointerUnchecked: FirstLinkIndex ofObject: aList withValue: objectMemory nilObject;
+ 				storePointerUnchecked: LastLinkIndex ofObject: aList withValue: objectMemory nilObject]
+ 		ifFalse:
+ 			[next := objectMemory fetchPointer: NextLinkIndex ofObject: first.
+ 			 objectMemory storePointer: FirstLinkIndex ofObject: aList withValue: next].
+ 	objectMemory storePointerUnchecked: NextLinkIndex ofObject: first withValue: objectMemory nilObject.
+ 	^first!
- 		ifTrue: [objectMemory storePointer: FirstLinkIndex ofObject: aList withValue: objectMemory nilObject.
- 			objectMemory storePointer: LastLinkIndex ofObject: aList withValue: objectMemory nilObject]
- 		ifFalse: [next := objectMemory fetchPointer: NextLinkIndex ofObject: first.
- 			objectMemory storePointer: FirstLinkIndex ofObject: aList withValue: next].
- 	objectMemory storePointer: NextLinkIndex ofObject: first withValue: objectMemory nilObject.
- 	^ first!

Item was changed:
  ----- Method: StackInterpreter>>removeProcess:fromList: (in category 'process primitive support') -----
  removeProcess: aProcess fromList: aList 
  	"Remove a given process from a linked list. May fail if aProcess is not on the list."
  	| firstLink lastLink nextLink tempLink |
+ 	self deny: (objectMemory isForwarded: aProcess).
+ 	self deny: (objectMemory isForwarded: aList).
- 	self assert: (objectMemory isForwarded: aList) not.
  	firstLink := objectMemory fetchPointer: FirstLinkIndex ofObject: aList.
  	lastLink := objectMemory fetchPointer: LastLinkIndex ofObject: aList.
+ 	self deny: (objectMemory isForwarded: firstLink).
+ 	self deny: (objectMemory isForwarded: lastLink).
+ 	aProcess  = firstLink
+ 		ifTrue:
+ 			[nextLink := objectMemory fetchPointer: NextLinkIndex ofObject: aProcess.
+ 			 self deny: (objectMemory isForwarded: nextLink).
+ 			 objectMemory storePointer: FirstLinkIndex ofObject: aList withValue: nextLink.
+ 			 aProcess  = lastLink ifTrue:
+ 				[objectMemory storePointerUnchecked: LastLinkIndex ofObject: aList withValue: objectMemory nilObject]]
+ 		ifFalse:
+ 			[tempLink := firstLink.
+ 			 [self deny: (objectMemory isForwarded: tempLink).
+ 			  tempLink = objectMemory nilObject ifTrue:
+ 				[self primitiveFail. ^self].
+ 			  nextLink := objectMemory fetchPointer: NextLinkIndex ofObject: tempLink.
+ 			  nextLink = aProcess] whileFalse:
+ 				[tempLink := objectMemory fetchPointer: NextLinkIndex ofObject: tempLink].
+ 			 nextLink := objectMemory fetchPointer: NextLinkIndex ofObject: aProcess.
+ 			 objectMemory storePointer: NextLinkIndex ofObject: tempLink withValue: nextLink.
+ 			 aProcess  = lastLink ifTrue:
+ 				[objectMemory storePointer: LastLinkIndex ofObject: aList withValue: tempLink]].
- 	aProcess  = firstLink ifTrue:[
- 		nextLink := objectMemory fetchPointer: NextLinkIndex ofObject: aProcess .
- 		objectMemory storePointer: FirstLinkIndex ofObject: aList withValue: nextLink.
- 		aProcess  = lastLink ifTrue:[
- 			objectMemory storePointer: LastLinkIndex ofObject: aList withValue: objectMemory nilObject.
- 		].
- 	] ifFalse:[
- 		tempLink := firstLink.
- 		[tempLink = objectMemory nilObject ifTrue:[^self success: false]. "fail"
- 		nextLink := objectMemory fetchPointer: NextLinkIndex ofObject: tempLink.
- 		nextLink = aProcess] whileFalse:[
- 			tempLink := objectMemory fetchPointer: NextLinkIndex ofObject: tempLink.
- 		].
- 		nextLink := objectMemory fetchPointer: NextLinkIndex ofObject: aProcess.
- 		objectMemory storePointer: NextLinkIndex ofObject: tempLink withValue: nextLink.
- 		aProcess  = lastLink ifTrue:[
- 			objectMemory storePointer: LastLinkIndex ofObject: aList withValue: tempLink.
- 		].
- 	].
  	objectMemory storePointer: NextLinkIndex ofObject: aProcess withValue: objectMemory nilObject!

Item was changed:
  ----- Method: StackInterpreter>>spurPostBecomeAction: (in category 'object memory support') -----
  spurPostBecomeAction: theBecomeEffectsFlags
  	"Insulate the stack zone from the effects of a become.
  	 All receivers must be unfollowed for two reasons:
  		1. inst var access is direct with no read barrier
  		2. super sends (always to the receiver) have no class check and so don't trap
  		   for forwarded receivers.  This is an issue for primitives that assume their receiver
  		   is valid and don't validate.
  	 Super sends require an explicit check to ensure receivers in super sends are unforwarded.
  	 e.g. super doSomethingWith: (self become: other) forwards the receiver self pushed on the
  	 stack.  So we could avoid following non-pointer receivers.  But this is too tricky,  Instead, we
  	 always follow receivers.
  	 Methods must be unfollowed since bytecode access is direct with no read barrier.
  	 But this only needs to be done if the becomeEffectsFlags indicate that a
  	 CompiledMethod was becommed.
  	 The scheduler state must be followed, but only if the becomeEffectsFlags indicate
  	 that a pointer object was becommed."
  	<option: #SpurObjectMemory>
  	<inline: false> "For VM profiling"
  	self flushAtCache.
  	theBecomeEffectsFlags ~= 0 ifTrue:
  		[(theBecomeEffectsFlags anyMask: BecameCompiledMethodFlag) ifTrue:
  			[self followForwardedMethodsInMethodCache.
  			 self followForwardedMethodsInMethodZone]. "for CoInterpreter; must preceed followForwardingPointersInStackZone:"
  		 (theBecomeEffectsFlags anyMask: BecameActiveClassFlag) ifTrue:
  			[self flushBecommedClassesInMethodCache.
  			 self flushBecommedClassesInMethodZone]. "for CoInterpreter"
+ 		 (theBecomeEffectsFlags anyMask: BecamePointerObjectFlag) ifTrue:
+ 			[self followForwardingPointersInScheduler.
+ 			 self followForwardingPointersInSpecialObjectsArray].
+ 		 (theBecomeEffectsFlags anyMask: BecamePointerObjectFlag + BecameCompiledMethodFlag) ifTrue:
+ 			[self followForwardingPointersInProfileState]].
- 		 self followForwardingPointersInScheduler.
- 		 self followForwardingPointersInSpecialObjectsArray.
- 		 self followForwardingPointersInProfileState].
  	self followForwardingPointersInStackZone: theBecomeEffectsFlags!



More information about the Vm-dev mailing list