The Trunk: Kernel-ul.516.mcz

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

The Trunk: Kernel-ul.516.mcz

commits-2
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.516.mcz

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

Name: Kernel-ul.516
Author: ul
Time: 15 November 2010, 11:23:57.645 am
UUID: 6faf4568-4121-8543-897b-a4aef9f01454
Ancestors: Kernel-ul.515

- reverted Object >> #inboundPointersExcluding: and added a comment with some explanation about the use of #==.

=============== Diff against Kernel-ul.515 ===============

Item was changed:
  ----- Method: Object>>inboundPointersExcluding: (in category 'tracing') -----
  inboundPointersExcluding: objectsToExclude
  "Answer a list of all objects in the system that point to me, excluding those in the collection of objectsToExclude. I do my best to avoid creating any temporary objects that point to myself, especially method and block contexts. Adapted from PointerFinder class >> #pointersTo:except:"
 
  | anObj pointers objectsToAlwaysExclude |
  Smalltalk garbageCollect.
  "big collection shouldn't grow, so it's contents array is always the same"
  pointers := OrderedCollection new: 1000.
 
  "#allObjectsDo: and #pointsTo: are expanded inline to keep spurious
  method and block contexts out of the results"
  anObj := self someObject.
+ [0 == anObj] whileFalse: [ "We must use #== here, to avoid leaving the loop when anObj is another number that's equal to 0 (e.g. 0.0)."
- [0 = anObj] whileFalse: [
  anObj isInMemory
  ifTrue: [((anObj instVarsInclude: self)
  or: [anObj class == self])
  ifTrue: [pointers add: anObj]].
  anObj := anObj nextObject].
 
  objectsToAlwaysExclude := {
  pointers collector.
  thisContext.
  thisContext sender.
  thisContext sender sender.
  objectsToExclude.
  }.
 
  ^ pointers removeAllSuchThat: [:ea |
  (objectsToAlwaysExclude identityIncludes: ea)
  or: [objectsToExclude identityIncludes: ea]]!