-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Disable macro/plugin class loader caching, by default #6412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
And change the relevant settings to be evolvable into a policy selection rather than just a on/off toggle.
The main rationale here is that when we merged #6314 we didn't consider the risk of exposing concurrency bugs or memory leaks due to the sharing of state in top level objects (aka Java statics) across a cached classloader, which could be used in parallel or held onto for a long time. We should enable caching by default in 2.13.x, but do so with a good release note for macro and plugin authors showing how to avoid problems, and perhaps incorporating with a time-based invalidation of cached classloaders. The UI change is trying to incorporate #6381. |
object None extends CachePolicy("none", "Don't cache class loader") | ||
object LastModified extends CachePolicy("last-modified", "Cache class loader, using file last-modified time to invalidate") | ||
// TODO Jorge to add new policy. Think about whether there is a benefit to the user on offering this as a separate policy or unifying with the previous one. | ||
// object ZipMetadata extends CachePolicy("zip-metadata", "Cache classloade, using file last-modified time, then ZIP file metadata to invalidate") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Sounds good to me!
…(however, this supposedly breaks macros with global mutable state...) scala/scala#6412 https://twitter.com/olafurpg/status/1191299377064824832 > The caching logic for compiler plugins is enabled by default in Bloop and that one does make a difference, around 20/30%, see scala/scala-dev#458
* renames for Project fields * Disable eta-sam lint scala/bug#11644 * Enable compiler plugin & macro classloader caching for faster builds (however, this supposedly breaks macros with global mutable state...) scala/scala#6412 https://twitter.com/olafurpg/status/1191299377064824832 > The caching logic for compiler plugins is enabled by default in Bloop and that one does make a difference, around 20/30%, see scala/scala-dev#458 * Don't use -Xsource: since it's not recommended scala/bug#11661 * fix Ybackend-parallelism option * empty `enabled` default parameter for Plugins
#6314 introduced classpath caching for compiler plugins and macros, and enabled it by default. This PR switches the default in order to be conservative in a 2.12 minor release.
Currently, the only caching strategy is
last-modified
, which checks the last modified date of the JAR file. Caching can be enabled using-Ycache-plugin-class-loader:last-modified
/-Ycache-macro-class-loader:last-modified
Change the relevant settings to be evolvable into a policy selection rather than just a on/off toggle.