Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[Perfs] x10 on method compiling with #deferFlushDuring: #5292
So that the code to reproduce the bug:
In the bootstrap, there is no decompiler so the sources cannot be retrieved from either the source code or the decompiler (through OpalCompiler>>decompileMethod:).
TaAbstratComposition>> #sourceCodeAt: should be implemented through another way to get the data from the other already existing method.
Hi @VincentBlondeau, I have checked the problem and the problem is that the source code of a method is not accessible until the stream is flushed.
If you check SourceFileArray >>#readStreamAtFileIndex: index atPosition: position ifPresent: presentBlock ifAbsent: absentBlock the code is read from the file directly (using a set of read-only streams directly). I can change this method to read using the w/r stream if they are dirty, although I don't know the impact in speed that will have (as the read-only streams allow Pharo to share the access to the underlying file).
I will try this modification.
Also, I have a doubt, to me, it is not important but maybe someone cares. As if there is an error in loading a metacello package the .changes file is not correctly saved.
Or you can force the flush of the stream since we not using the statefull traits often. However, I still think the compilation of the traits should not be based on the change files to retrieve the source code in case we have an image in read only mode.