[squeak-dev] The Inbox: Collections-dtl.466.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Dec 22 21:20:00 UTC 2011


David T. Lewis uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-dtl.466.mcz

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

Name: Collections-dtl.466
Author: dtl
Time: 22 December 2011, 4:19:45.541 pm
UUID: d2b3b0e8-4ccb-40b5-b29c-17df6e5de3d1
Ancestors: Collections-ul.465

Fix weak finalization thrashing, root cause of user interrupt issues.

Move the check for VM support of new finalization out of the finalization process and perform the check once at image startUp time. This prevents the weak finalization process from creating new weak references that result in thrashing between VM and image as the VM signals the the image to clean up weak references, and the finalization process produces additional weak to be removed.

With this change the finalization process is much less active, and user interrupt handling works as intended such that any of the following can interrupted in the expected way:

  "[true] whileTrue"
  "[[true] whileTrue] forkAt: Processor userSchedulingPriority + 1"
  "Smalltalk createStackOverflow"
  "[Smalltalk createStackOverflow] forkAt: Processor userSchedulingPriority + 1"

=============== Diff against Collections-ul.465 ===============

Item was changed:
  ----- Method: WeakArray class>>finalizationProcess (in category 'private') -----
  finalizationProcess
  
+ 	[FinalizationSemaphore wait.
- 	[ WeakFinalizationList initTestPair.
- 	FinalizationSemaphore wait.
  	FinalizationLock critical:
+ 		[FinalizationDependents do:
+ 			[ :weakDependent |
- 		[
- 		WeakFinalizationList checkTestPair.
- 		FinalizationDependents do:
- 			[:weakDependent |
  			weakDependent ifNotNil:
  				[weakDependent finalizeValues]]]
  		ifError:
+ 		[:msg :rcvr | rcvr error: msg]] repeat!
- 		[:msg :rcvr | rcvr error: msg] ] repeat!

Item was changed:
  ----- Method: WeakArray class>>startUp: (in category 'system startup') -----
  startUp: resuming
  	resuming ifFalse: [ ^self ].
+ 	"Check if new finalization is supported by the VM"
+ 	WeakFinalizationList initTestPair.
+ 	WeakFinalizationList checkTestPair.
  	self restartFinalizationProcess.!




More information about the Squeak-dev mailing list