<div dir="ltr"><div><div>Ah, maybe it&#39;s time to use one of our dangerous superpowers...<br></div>What if you would start your script with:<br></div>    Compiler allInstances do: [:e | e becomeForward: (e as: Compiler copy)].<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/3 Frank Shearar <span dir="ltr">&lt;<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;m not sure how I&#39;d do that without making changes to Trunk (which<br>
creates a bootstrap problem in that the scripts start with an old<br>
image version), because I just throw the script at the image from the<br>
command line..<br>
<br>
frank<br>
<br>
On 2 October 2013 23:42, Nicolas Cellier<br>
<div class="HOEnZb"><div class="h5">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>&gt; wrote:<br>
&gt; Frank, could you retry to launch the script with Compiler copy evaluate:<br>
&gt; &#39;...&#39; instead of Compiler evaluate: ?<br>
&gt; I checked that<br>
&gt; Compiler copy methodDictionary ~~ Compiler methodDictionary<br>
&gt; so it might just work...<br>
&gt;<br>
&gt;<br>
&gt; 2013/9/25 Nicolas Cellier &lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; Nah, I&#39;m cheating.<br>
&gt;&gt; I just opened a recent artifact from CI server one or two days ago.<br>
&gt;&gt; It has the same kind of debugger opened<br>
&gt;&gt; <a href="http://build.squeak.org/job/SqueakTrunk/537/" target="_blank">http://build.squeak.org/job/SqueakTrunk/537/</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2013/9/25 Bob Arning &lt;<a href="mailto:arning315@comcast.net">arning315@comcast.net</a>&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Are you able to tell what&#39;s in the script he&#39;s running simply from the<br>
&gt;&gt;&gt; stack trace? Or some other way?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Cheers,<br>
&gt;&gt;&gt; Bob<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On 9/25/13 9:12 AM, Nicolas Cellier wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The problem is that the script you evaluate will update the Compiler...<br>
&gt;&gt;&gt; New updates will remove unused variables before the script is finished...<br>
&gt;&gt;&gt; I tried to solve the problem by introducing an intermediate step:<br>
&gt;&gt;&gt; - 1) publish the modified methods in an update.mcm (I reintroduced the<br>
&gt;&gt;&gt; missing vars)<br>
&gt;&gt;&gt; - 2) only then remove the inst. var.<br>
&gt;&gt;&gt; (See the recent serie of Compiler versions 270-&gt;274<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This did not solve anything because there are always cases when you<br>
&gt;&gt;&gt; launch the script from an older image (typically from Squeak 4.4, 4.3 or<br>
&gt;&gt;&gt; even older)<br>
&gt;&gt;&gt; The same old Compiler instance is used during all the process and it must<br>
&gt;&gt;&gt; be unmodified during the process, otherwise, undefined behavior (SEGV<br>
&gt;&gt;&gt; included)...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I see one way to workaround this:<br>
&gt;&gt;&gt; 1) clone the Compiler class<br>
&gt;&gt;&gt; 2) instantiate the clone<br>
&gt;&gt;&gt; 3) let the clone evaluate<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In fact, to be safer we should clone the whole hierarchy, but you could<br>
&gt;&gt;&gt; 1st try simply with Compiler...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 2013/9/25 Bob Arning &lt;<a href="mailto:arning315@comcast.net">arning315@comcast.net</a>&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Just type<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; PositionableStream&gt;&gt;#fileInAnnouncing:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; and explore it. Look for the literal pointing to the compiler (literal8<br>
&gt;&gt;&gt;&gt; here). Toggle that open and toggle open the value. Look at the<br>
&gt;&gt;&gt;&gt; instanceVariables - does it still have sourceStream?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; As to the explorer, did you open one? Is it still open? (The<br>
&gt;&gt;&gt;&gt; PointerFinder says it is) Could it have been open when the image was last<br>
&gt;&gt;&gt;&gt; saved?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Also, you could do<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Behavior allSubInstances select: [ :e | (e asString findString:<br>
&gt;&gt;&gt;&gt; &#39;Compiler&#39;) &gt; 0]<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Do you get: an OrderedCollection(ClosureCompilerTest CompilerTest<br>
&gt;&gt;&gt;&gt; CompilerExceptionsTest CompilerNotifyingTest<br>
&gt;&gt;&gt;&gt; CompilerSyntaxErrorNotifyingTest Compiler ClosureCompilerTest class<br>
&gt;&gt;&gt;&gt; CompilerTest class CompilerExceptionsTest class CompilerNotifyingTest class<br>
&gt;&gt;&gt;&gt; CompilerSyntaxErrorNotifyingTest class Compiler class)<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Cheers,<br>
&gt;&gt;&gt;&gt; Bob<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On 9/25/13 7:31 AM, Frank Shearar wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I don&#39;t know how I would do that. The bytecode just says pushLit:<br>
&gt;&gt;&gt;&gt; Compiler.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; But if I say Compiler allInstances collect: [:c | c instVarNamed:<br>
&gt;&gt;&gt;&gt; &#39;cue&#39;] I see {nil . a CompilationCue . a CompilationCue}. That first<br>
&gt;&gt;&gt;&gt; one&#39;s a problem! Further, my image has an ObjectExplorer (!) hanging<br>
&gt;&gt;&gt;&gt; onto that Compiler, coming from I don&#39;t know where.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; frank<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On 25 September 2013 11:53, Bob Arning &lt;<a href="mailto:arning315@comcast.net">arning315@comcast.net</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; If you inspect<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; PositionableStream&gt;&gt;#fileInAnnouncing:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; and look at the literal for Compiler, does it look to be pointing to the<br>
&gt;&gt;&gt;&gt; new<br>
&gt;&gt;&gt;&gt; or old Compiler?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Cheers,<br>
&gt;&gt;&gt;&gt; Bob<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On 9/25/13 6:12 AM, Frank Shearar wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I&#39;m running with Compiler-nice.274.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; What&#39;s weirder is in that top stack frame (Compiler &gt;&gt;<br>
&gt;&gt;&gt;&gt; #evaluate:in:to:notifying:ifFailed:logged: the following all show up<br>
&gt;&gt;&gt;&gt; as red, because they&#39;re references to instvars that don&#39;t exist:<br>
&gt;&gt;&gt;&gt; class, sourceStream, context, requestor.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; That&#39;s because the CompiledMethod that&#39;s running is not actually the<br>
&gt;&gt;&gt;&gt; right CompiledMethod! It&#39;s from some ancient pre-CompilationCue<br>
&gt;&gt;&gt;&gt; Compiler instance. Or at least so I suspect because that Compiler<br>
&gt;&gt;&gt;&gt; instance has a nil &#39;cue&#39; instvar.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; If it helps, the PointerFinder says this of the offending context:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; globals: Environment<br>
&gt;&gt;&gt;&gt; declarations: IdentityDictionary<br>
&gt;&gt;&gt;&gt; #World -&gt; PasteUpMorph<br>
&gt;&gt;&gt;&gt; submorphs: Array<br>
&gt;&gt;&gt;&gt; 1: SystemWindow<br>
&gt;&gt;&gt;&gt; model: ObjectExplorer<br>
&gt;&gt;&gt;&gt; currentSelection: ObjectExplorerWrapper<br>
&gt;&gt;&gt;&gt; item: CompiledMethod<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; In contrast, PointerFinder on: (Compiler &gt;&gt;<br>
&gt;&gt;&gt;&gt; #evaluate:in:to:notifying:ifFail:logged:) says:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; CLASS: SmalltalkImage class<br>
&gt;&gt;&gt;&gt; superclass: Object class<br>
&gt;&gt;&gt;&gt; subclasses: Array<br>
&gt;&gt;&gt;&gt; 445: Compiler class<br>
&gt;&gt;&gt;&gt; methodDict: MethodDictionary<br>
&gt;&gt;&gt;&gt; array: Array<br>
&gt;&gt;&gt;&gt; 39: CompiledMethod.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br></div>