SystemTracer issue

Yoshiki Ohshima ohshima at is.titech.ac.jp
Thu Feb 22 20:56:59 UTC 2001


  Hi,

> > I'm not sure, but there may be an interaction between the
> > new symbol hashing mechanism and the expectations of
> > the tracer. Has anyone attempted a trace since the new
> > symbol hash has been introduced???
> Eek, I hope nothing too tricky. I need to get the Tracer working to redo
> the new CompiledMethod format transition.

  Now, I understand what was going on.  It isn't too tricky,
but I could say it is fairly trickey.

  Suppose there is a Dictionary whose keys are Symbols.
When it is traced, the array should be permuted according to
the new #hash values of keys.  But because "aSymbol hash" is
a function of the result of "String hash" in new image,
which is not known when tracing, there is no obvious way to
calculate it in old image.  (If the problem is only related
to Symbols, we could record the new value of "String hash."
But...)

  MethodDictionary is ok it implements its own #scanFor: and
uses #identityHash.

  I ended up with a #writeClone looks like:

--------------
writeClone  "SystemTracer writeClone"
	| tracer s |
	tracer _ self new.
	"Delay shutDown."  "part of Smalltalk processShutDownList."
	Symbol useHardSymbolTable.
	tracer doit.   " <-- execution in clone resumes after this send"
	tracer == nil "will be nil in clone, since it is clamped"
		ifTrue: [Smalltalk processStartUpList: true.
				Symbol useWeakSymbolTable.
				s _ Set allSubclasses asOrderedCollection.
				s removeAllSuchThat: [:e | (e inheritsFrom: MethodDictionary)
										| (e  = MethodDictionary)].
				s removeAllSuchThat: [:e | (e inheritsFrom: IdentitySet) | (e = IdentitySet)].
				s removeAllSuchThat: [:e | (e inheritsFrom: IdentityDictionary)
										| (e = IdentityDictionary)].
				s do: [:e | e allInstances do: [:i | i rehash]]
		].
	"Delay startUp."
	^ tracer
--------------

No-brainer style solution, but it works.

  The another mystery is that occasionary a MethodContext
which is an invocation of Semaphore>>waitTimeoutMSecs: cause
out-of-bounds error.  Calliing "Delay shutDown" seems
prevent it, but it has another side-effect...

  -- Yoshiki





More information about the Squeak-dev mailing list