diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-03-30 21:40:40 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-04-01 08:35:32 +0200 |
commit | 323d044f93242cb023042c37b64ce79c5810e612 (patch) | |
tree | 7a775b5cb8b84380fc239bc98f3d1f4c8419b5a9 /test | |
parent | a40ee59d4455c2bb45168844f50e9d15120bd7d8 (diff) | |
download | scala-323d044f93242cb023042c37b64ce79c5810e612.tar.gz scala-323d044f93242cb023042c37b64ce79c5810e612.tar.bz2 scala-323d044f93242cb023042c37b64ce79c5810e612.zip |
Don't inlinie if the resulting method becomes too large for the JVM
This threshold is really the last resort and should never be reached.
An inlining heuristic that blows up methods to the maximum size
allowed by the JVM is broken.
In the future we need to include some heuristic about code size when
making an inlining decision, see github.com/scala-opt/scala/issues/2
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/inlineMaxSize.check | 9 | ||||
-rw-r--r-- | test/files/neg/inlineMaxSize.flags | 1 | ||||
-rw-r--r-- | test/files/neg/inlineMaxSize.scala | 8 |
3 files changed, 18 insertions, 0 deletions
diff --git a/test/files/neg/inlineMaxSize.check b/test/files/neg/inlineMaxSize.check new file mode 100644 index 0000000000..d218a8b6e2 --- /dev/null +++ b/test/files/neg/inlineMaxSize.check @@ -0,0 +1,9 @@ +inlineMaxSize.scala:7: warning: C::i()I is annotated @inline but could not be inlined: +The size of the callsite method C::j()I +would exceed the JVM method size limit after inlining C::i()I. + + @inline final def j = i + i + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/inlineMaxSize.flags b/test/files/neg/inlineMaxSize.flags new file mode 100644 index 0000000000..9c6b811622 --- /dev/null +++ b/test/files/neg/inlineMaxSize.flags @@ -0,0 +1 @@ +-Ybackend:GenBCode -Ydelambdafy:method -Yopt:l:classpath -Yopt-warnings -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/inlineMaxSize.scala b/test/files/neg/inlineMaxSize.scala new file mode 100644 index 0000000000..16dc0d9538 --- /dev/null +++ b/test/files/neg/inlineMaxSize.scala @@ -0,0 +1,8 @@ +// not a JUnit test because of https://github.com/scala-opt/scala/issues/23 +class C { + @inline final def f = 0 + @inline final def g = f + f + f + f + f + f + f + f + f + f + @inline final def h = g + g + g + g + g + g + g + g + g + g + @inline final def i = h + h + h + h + h + h + h + h + h + h + @inline final def j = i + i +} |