Improved Inspector for CompiledBlocks and BlockClosures
The inspectors for blocks are now a bit improved:
CompiledBlock. This now is more in sync with CompiledMethod and shows
- the homew method code with the block highlighted
- the AST of the block
- the IR if the block
Currently, we compile every non-optimized block to a full block that created by a bytecode from a CompiledBlock (which itself is stored as a literal).
Inspect “CompiledBlock allInstances” to see the new inspector:
In addition to the static compiled block, it makes sense to have a similar inspector for BlockClosure itself, e.g inspect some block in the workspace.
This gets more important as we soon will have pre-compiled subclasses of BlockClosure as method literals (and then just execute pushLiteral: to “create” the block).
A nice way to play with these is:
CompilationContext optionConstantBlockClosure: true. OpalCompiler recompileAll.
some 2500 of the blocks are now compiled statically.
The inspector shows the same (home method with highlight, IR, AST)
But we can do even better:
CompilationContext optionCleanBlockClosure: true. OpalCompiler recompileAll.
Another 7500 blocks can be statically compiled, inspect
These are not yet the default, as we have to carefully analyse the places where we now assume that blocks know the outerContext and receiver. (in the example above you see one of these: Announcements…).
You can follow these issues to see what still needs to be done:#Pharo #Blocks