The Inbox: Kernel-ael.700.mcz

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

The Inbox: Kernel-ael.700.mcz

commits-2
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ael.700.mcz

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

Name: Kernel-ael.700
Author: ael
Time: 10 July 2012, 2:35:54.223 pm
UUID: 8fff56ba-e690-46f1-aef9-d9b5fe3c9ed8
Ancestors: Kernel-fbs.699

Deliver 'objects pointing to this value' collection as an Array, to avoid the indirection of an OrderedCollection.

=============== Diff against Kernel-fbs.699 ===============

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)."
  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 |
- ^ pointers removeAllSuchThat: [:ea |
  (objectsToAlwaysExclude identityIncludes: ea)
+ or: [objectsToExclude identityIncludes: ea]]) asArray!
- or: [objectsToExclude identityIncludes: ea]]!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-ael.700.mcz

Balázs Kósi-2
Hi,

> Deliver 'objects pointing to this value' collection as an Array, to avoid the indirection of an OrderedCollection.
What's the benefit of this?

Cheers, Balázs

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-ael.700.mcz

Aran Lunzer-2
In reply to this post by commits-2
>> Deliver 'objects pointing to this value' collection as an Array, to avoid the indirection of an OrderedCollection.

> What's the benefit of this?

It just removes some hassle when you're trying to track down who is
pointing to an object (e.g., to understand why it isn't being GC'd).
With the change:

1. Each 'objects pointing...' query gives an inspector on a clean
Array of objects, rather than an OrderedCollection with its array,
firstIndex, lastIndex IVs

2. The mechanism for avoiding "chasing your own tail" (i.e., finding
references to the object that only exist because it's now being viewed
in the inspector; see objectReferencesToSelection) doesn't work if the
object is two levels down, as it is with an OrderedCollection.


Aran