<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 1:27 PM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
<br>
On 11.01.2013, at 12:37, Nicolas Cellier &lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Having to spread these cacheDuring: all around client code does not<br>
&gt; sound bright to my personal taste...<br>
&gt;<br>
&gt; Nicolas<br>
<br>
</div>Agreed, but it&#39;s all we have for now.  Got a better idea?<br></blockquote><div><br></div><div>Yes.  In an older Newspeak image I added readOnlyCopy: to SourceFilesArray so that SourceFIlesArray holds precisely one read-only copy of each source/changes file instead of creating new ones whenever needed (which can run out of file handles in error cases, as happened in a Newspeak image just yesterday). Then clients (essentially getSourceFromFile) that want to read the source use (SourceFilesArray readOnlyCopyAt: fileIndex).  The read-only files are flushed at start-up.  That completely replaces the (IMO rather clunky) <span class="" style="font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)">CurrentReadOnlySourceFiles approach.  If this sounds good I could integrate it into 4.4, except that I&#39; prefer to shirk the effort and give the code to someone who&#39;d review it/polish it.</span></div>
<div><span class="" style="font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)"><br></span></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<span class=""><font color="#888888"><br>
- Bert -<br>
</font></span><div class=""><div class="h5"><br>
&gt;<br>
&gt; 2013/1/11  &lt;<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt;:<br>
&gt;&gt; Bert Freudenberg uploaded a new version of Kernel to project The Trunk:<br>
&gt;&gt; <a href="http://source.squeak.org/trunk/Kernel-bf.730.mcz" target="_blank">http://source.squeak.org/trunk/Kernel-bf.730.mcz</a><br>
&gt;&gt;<br>
&gt;&gt; ==================== Summary ====================<br>
&gt;&gt;<br>
&gt;&gt; Name: Kernel-bf.730<br>
&gt;&gt; Author: bf<br>
&gt;&gt; Time: 11 January 2013, 12:10:54.539 pm<br>
&gt;&gt; UUID: 287d829c-b04d-4165-abc5-e045d037bd6d<br>
&gt;&gt; Ancestors: Kernel-nice.729<br>
&gt;&gt;<br>
&gt;&gt; Cache source files during class mutation for noticeable speedup with larger hierarchies.<br>
&gt;&gt;<br>
&gt;&gt; =============== Diff against Kernel-nice.729 ===============<br>
&gt;&gt;<br>
&gt;&gt; Item was changed:<br>
&gt;&gt;  ----- Method: ClassBuilder&gt;&gt;recompile:from:to:mutate: (in category &#39;class definition&#39;) -----<br>
&gt;&gt;  recompile: force from: oldClass to: newClass mutate: forceMutation<br>
&gt;&gt;        &quot;Do the necessary recompilation after changine oldClass to newClass.<br>
&gt;&gt;        If required (e.g., when oldClass ~~ newClass) mutate oldClass to newClass<br>
&gt;&gt;        and all its subclasses. If forceMutation is true force a mutation even<br>
&gt;&gt;        if oldClass and newClass are the same.&quot;<br>
&gt;&gt;<br>
&gt;&gt;        oldClass == nil ifTrue:[^ newClass].<br>
&gt;&gt;<br>
&gt;&gt;        (newClass == oldClass and:[force not and:[forceMutation not]]) ifTrue:[<br>
&gt;&gt;                ^newClass].<br>
&gt;&gt;<br>
&gt;&gt;        currentClassIndex := 0.<br>
&gt;&gt;        maxClassIndex := oldClass withAllSubclasses size.<br>
&gt;&gt;<br>
&gt;&gt;        (oldClass == newClass and:[forceMutation not]) ifTrue:[<br>
&gt;&gt;                &quot;Recompile from newClass without mutating&quot;<br>
&gt;&gt;                self informUserDuring:[<br>
&gt;&gt;                        newClass isSystemDefined ifFalse:[progress := nil].<br>
&gt;&gt; +                       CurrentReadOnlySourceFiles cacheDuring: [<br>
&gt;&gt; +                               newClass withAllSubclassesDo:[:cl|<br>
&gt;&gt; +                                       self showProgressFor: cl.<br>
&gt;&gt; +                                       cl compileAll]]].<br>
&gt;&gt; -                       newClass withAllSubclassesDo:[:cl|<br>
&gt;&gt; -                               self showProgressFor: cl.<br>
&gt;&gt; -                               cl compileAll]].<br>
&gt;&gt;                ^newClass].<br>
&gt;&gt;        &quot;Recompile and mutate oldClass to newClass&quot;<br>
&gt;&gt;        self informUserDuring:[<br>
&gt;&gt;                newClass isSystemDefined ifFalse:[progress := nil].<br>
&gt;&gt; +               CurrentReadOnlySourceFiles cacheDuring: [<br>
&gt;&gt; +                       self mutate: oldClass to: newClass].<br>
&gt;&gt; -               self mutate: oldClass to: newClass.<br>
&gt;&gt;        ].<br>
&gt;&gt;        ^oldClass &quot;now mutated to newClass&quot;!<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>