summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-04-21 10:16:00 -0700
committerPaul Phillips <paulp@improving.org>2013-04-21 10:16:00 -0700
commit5cc2eb872432f5a00dd530f6a1e3f965c749162a (patch)
tree9a7489c8785ca296f8b0ac8022f51cd26e1999e1 /src/compiler
parent68c6ba7e59befa88b2f383dd7eca71a9329a8b6d (diff)
downloadscala-5cc2eb872432f5a00dd530f6a1e3f965c749162a.tar.gz
scala-5cc2eb872432f5a00dd530f6a1e3f965c749162a.tar.bz2
scala-5cc2eb872432f5a00dd530f6a1e3f965c749162a.zip
SI-7324 jvm not cool with 255+ parameters
Fail those monster methods rather than generating bad bytecode.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index 66a58870cc..1b183ddd3f 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -25,6 +25,10 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
import icodes.opcodes._
import definitions._
+ // Strangely I can't find this in the asm code
+ // 255, but reserving 1 for "this"
+ final val MaximumJvmParameters = 254
+
val phaseName = "jvm"
/** Create a new phase */
@@ -1480,6 +1484,11 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
if (m.symbol.isStaticConstructor || definitions.isGetClass(m.symbol)) return
+ if (m.params.size > MaximumJvmParameters) {
+ getCurrentCUnit().error(m.symbol.pos, s"Platform restriction: a parameter list's length cannot exceed $MaximumJvmParameters.")
+ return
+ }
+
debuglog("Generating method " + m.symbol.fullName)
method = m
computeLocalVarsIndex(m)