The Trunk: Collections-dtl.469.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-dtl.469.mcz

commits-2
David T. Lewis uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-dtl.469.mcz

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

Name: Collections-dtl.469
Author: dtl
Time: 30 December 2011, 12:57:50.064 am
UUID: f8d7d7a5-e127-4108-95ae-6ef48ac43d86
Ancestors: Collections-cmm.468

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

Perform the check for VM support of new finalization 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-cmm.468 ===============

Item was changed:
  ----- Method: WeakArray class>>finalizationProcess (in category 'private') -----
  finalizationProcess
 
+ | initialized |
+ initialized := false.
+ [FinalizationSemaphore wait.
+ initialized ifFalse: ["check VM capability once at image startup time"
+ WeakFinalizationList initTestPair.
+ Smalltalk garbageCollect.
- [ WeakFinalizationList initTestPair.
- FinalizationSemaphore wait.
- FinalizationLock critical:
- [
  WeakFinalizationList checkTestPair.
+ initialized := true].
+ FinalizationLock critical:
+ [FinalizationDependents do:
+ [ :weakDependent |
- FinalizationDependents do:
- [:weakDependent |
  weakDependent ifNotNil:
  [weakDependent finalizeValues]]]
  ifError:
+ [:msg :rcvr | rcvr error: msg]] repeat!
- [:msg :rcvr | rcvr error: msg] ] repeat!