summaryrefslogtreecommitdiff
path: root/test/files/neg/inlineMaxSize.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-03-30 21:40:40 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2015-04-01 08:35:32 +0200
commit323d044f93242cb023042c37b64ce79c5810e612 (patch)
tree7a775b5cb8b84380fc239bc98f3d1f4c8419b5a9 /test/files/neg/inlineMaxSize.scala
parenta40ee59d4455c2bb45168844f50e9d15120bd7d8 (diff)
downloadscala-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/files/neg/inlineMaxSize.scala')
-rw-r--r--test/files/neg/inlineMaxSize.scala8
1 files changed, 8 insertions, 0 deletions
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
+}