Skip to content
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

Fix #2766 sourceFile null causes NPE #2767

Merged
merged 11 commits into from
Oct 25, 2016
Merged

Conversation

avdv
Copy link
Contributor

@avdv avdv commented Oct 1, 2016

Fix #2766

dwijnand and others added 11 commits September 22, 2016 13:35
The compiler interface subclasses `scala.tools.nsc.Global`,
and loading this new subclass before each `compile` task forces
HotSpot JIT to deoptimize larges swathes of compiled code. It's
a bit like SBT has rigged the dice to always descend the longest
ladder in a game of Snakes and Ladders.

The slowdown seems to be larger with Scala 2.12. There are a number
of variables at play, but I think the main factor here is that
we now rely on JIT to devirtualize calls to final methods in traits
whereas we used to emit static calls. JIT does a good job at this,
so long as classloading doesn't undo that good work.

This commit extends the existing `ClassLoaderCache` to encompass
the classloader that includes the compiler interface JAR. I've
resorted to adding a var to `AnalyzingCompiler` to inject the
dependency to get the cache to the spot I need it without binary
incompatible changes to the intervening method signatures.
SD-232 Recycle classloaders to be anti-hostile to JIT
This changes the output to:

```
> show externalDependencyClasspath
[info] Updating {file:/xxx/hello/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] *
Attributed(/Users/xxx/.sbt/boot/scala-2.11.8/lib/scala-library.jar)
[info] *
Attributed(/Users/xxx/.ivy2/cache/commons-io/commons-io/jars/commons-io-
2.4.jar)
```
[0.13.13] Improve `show` when key returns a `Seq`
@eed3si9n eed3si9n added the ready label Oct 1, 2016
@eed3si9n eed3si9n changed the base branch from 0.13.13 to 0.13 October 25, 2016 17:35
@eed3si9n eed3si9n merged commit bbc7063 into sbt:0.13 Oct 25, 2016
@eed3si9n eed3si9n removed the ready label Oct 25, 2016
@eed3si9n
Copy link
Member

@avdv avdv deleted the fix-2766-sourceFile-null branch October 25, 2016 21:39
avdv added a commit to avdv/zinc that referenced this pull request Oct 25, 2016
This avoids an NPE when accessing position info in case `sourcePath` or `sourceFile` are `null`. See sbt/sbt#2766 for a stack trace.
@avdv
Copy link
Contributor Author

avdv commented Oct 25, 2016

Could you create a forward port for sbt 1.0?

Sure thing, done. Thanks for merging!

eed3si9n added a commit to sbt/zinc that referenced this pull request Oct 31, 2016
@eed3si9n eed3si9n added this to the 0.13.14 milestone Nov 22, 2016
eed3si9n pushed a commit to eed3si9n/scala that referenced this pull request May 14, 2019
This avoids an NPE when accessing position info in case `sourcePath` or `sourceFile` are `null`. See sbt/sbt#2766 for a stack trace.
lrytz pushed a commit to lrytz/scala that referenced this pull request Nov 5, 2019
This avoids an NPE when accessing position info in case `sourcePath` or `sourceFile` are `null`. See sbt/sbt#2766 for a stack trace.
Rewritten from sbt/zinc@e2a249a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants