PointerFinder

Bob Arning arning at charm.net
Tue Dec 3 03:15:26 UTC 2002


On Mon, 02 Dec 2002 23:19:51 +0100 Markus Fritsche <Fritsche.Markus at gmx.net> wrote:
>After trying "Smalltalk discardFlash", I have obsolete classes in my 
>image. I managed to get rid of the FlashCharacterMorph by sending delete 
>to it. Now Smalltalk obsoleteClasses evaluates to:
>#(AnObsoleteFlashFileReader AnObsoleteFlashMorphReader 
>AnObsoleteFlashMorph AnObsoleteFlashProgressMorph)
>
>Smalltalk obsoleteClasses do: [ :c |
>	PointerFinder on: c
>]
>give me four empty PointerFinder windows. Long story, short questions: 
>In which cases is the PointerFinder window empty?

Markus,

There is a bug in PointerFinder in that it does not chase references from CompiledMethods. In PointerFinder>>follow:from:
...
	anObject class isPointers ifFalse: [^ false].
...

For CompiledMethod, #isPointers answers false, but there may well be references in the literals. This inconsistency is due to the unusual part-bits/part-pointers nature of CM. PointerFinder doesn't handle it well.

A hack that seems to fix the problem for me is enclosed. See if it solves your problem.

Cheers,
Bob

'From Squeak3.2gamma of 15 January 2002 [latest update: #4743] on 2 December 2002 at 6:04:02 pm'!
"Change Set:		finderHack
Date:			2 December 2002
Author:			Bob Arning

A rude hack to let the pointerFinder chase references through CompiledMethods."!


!PointerFinder methodsFor: 'application' stamp: 'RAA 12/2/2002 18:03'!
follow: anObject from: parentObject

	anObject == goal
		ifTrue: 
			[parents at: anObject put: parentObject.
			^ true].
	anObject isLiteral ifTrue: [^ false].
	anObject class isPointers ifFalse: [anObject class == CompiledMethod ifFalse: [^ false]].
	anObject class isWeak ifTrue: [^ false].
	(parents includesKey: anObject)
		ifTrue: [^ false].
	parents at: anObject put: parentObject.
	toDoNext add: anObject.
	^ false! !

!PointerFinder methodsFor: 'application' stamp: 'RAA 12/2/2002 18:03'!
followObject: anObject
	(self follow: anObject class from: anObject)
		ifTrue: [^ true].
	anObject class == CompiledMethod ifTrue: [
		anObject literals do: [ :each |
			(self follow: each from: anObject) ifTrue: [^ true]
		].
		^false.
	].

	1 to: anObject class instSize do:
		[:i |
		(self follow: (anObject instVarAt: i) from: anObject)
			ifTrue: [^ true]].
	1 to: anObject basicSize do:
		[:i |
		(self follow: (anObject basicAt: i) from: anObject)
			ifTrue: [^ true]].
	^ false! !





More information about the Squeak-dev mailing list