[squeak-dev] The Trunk: Kernel-bf.730.mcz

Eliot Miranda eliot.miranda at gmail.com
Fri Jan 11 21:56:23 UTC 2013


On Fri, Jan 11, 2013 at 1:27 PM, Bert Freudenberg <bert at freudenbergs.de>wrote:

>
> On 11.01.2013, at 12:37, Nicolas Cellier <
> nicolas.cellier.aka.nice at gmail.com> wrote:
>
> > Having to spread these cacheDuring: all around client code does not
> > sound bright to my personal taste...
> >
> > Nicolas
>
> Agreed, but it's all we have for now.  Got a better idea?
>

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) CurrentReadOnlySourceFiles approach.  If this sounds good I
could integrate it into 4.4, except that I' prefer to shirk the effort and
give the code to someone who'd review it/polish it.


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


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130111/601030ea/attachment-0001.htm


More information about the Squeak-dev mailing list