Wow - thats even neater... all done with our normal tools - on the fly. So 
cool. Not sure many environments/languages can reason about things in this way.

Worthy of a blog post for the wider world I would say - as this kind of stuff 
should be on more people's radars.

Thanks again for all this kind of work. It would be so easy to just continue to 
think the job was done 20 years ago, where in fact we've only scratched the 
surface as our understanding of effective software development has improved.

Tim

On Fri, 18 Nov 2022, at 10:19 AM, Marcus Denker wrote:
> 
> 
> > On 18 Nov 2022, at 08:15, Marcus Denker <marcus.den...@inria.fr> wrote:
> > 
> > We merged 18 PRs
> > 
> > Lots of improvements related to  BlockClosures this week. 
> > 
> > First some helper methods on the AST:
> > - #hasNonLocalReturn: check if there is a non-local return
> > - #isConstant: Blocks of the kind [#justSomeLiteral]
> > - #constantValue: return that literal (and nil for empty [] )
> > - #numArgs for RBBlockNode, as we have already for BlockClosure  "[:a | ] 
> > sourceNode numArgs”
> > 
> 
> Some numbers:
> 
> "there are lots of blocks"
> allBlocks := Smalltalk globals allMethods flatCollect: [:meth | meth ast 
> blockNodes ].
> allBlocks size. "100140"
> 
> "but many are compiled inline (eg argunments of #ifTrue:)"
> currentFullBlocks := allBlocks select: [:blockNode | blockNode isInlined not].
> currentFullBlocks size. "45193"
> 
> "What we could compile as CleanBlockClosure"
> cleanBlocks := currentFullBlocks select: [:blockNode | blockNode isClean].
> cleanBlocks size. "11090"
> 
> "many clean blocks are actually constant"
> constantBlocks := cleanBlocks select: [:blockNode | blockNode isConstant].
> constantBlocks size. "3200"
> 
> "FullBlocks that need the outerContext to return"
> fullBocksWithReturn := currentFullBlocks select: [ :each  | each 
> hasNonLocalReturn ].
> fullBocksWithReturn size “3816”
> 
> We can inspect the collections and then use the inspector to browse the code 
> (with the block
> that you look at hightlighted), to get a feel where these are used, e.g. for 
> constant:
> 
> 
> 
> 

Reply via email to