Aladdin - Scala Bugtracking
[#242] project: compiler priority: low category: bug
submitter assigned to status date submitted
Burak Michel fixed 2003-12-01 12:38:55.0
subject long patterns crash backend
code
object bugFJ_2 {

  def extract( cs:char* ):Unit = cs match {
    case Seq(_*,'\\',src @ _ *,'\\','e','n','d','{','l','s','t','l',rest @ _ *  )
      => 
  }
}
what happened
/home/buraq/src/scala/exciss> scalac exciss.scala
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -21657
	at ch.epfl.lamp.fjbg.JCode.computeMaxStackSize(JCode.java:814)
...
	at ch.epfl.lamp.fjbg.JCode.getMaxStackSize(JCode.java:86)
	at ch.epfl.lamp.fjbg.JCodeAttribute.writeContentsTo(JCodeAttribute.java:77)
	at ch.epfl.lamp.fjbg.JAttribute.writeTo(JAttribute.java:61)
	at ch.epfl.lamp.fjbg.JAttribute.writeTo(JAttribute.java:25)
	at ch.epfl.lamp.fjbg.JFieldOrMethod.writeTo(JFieldOrMethod.java:133)
	at ch.epfl.lamp.fjbg.JClass.writeTo(JClass.java:320)
	at ch.epfl.lamp.fjbg.JClass.writeTo(JClass.java:272)
	at ch.epfl.lamp.fjbg.JClass.writeTo(JClass.java:256)
	at scalac.backend.jvm.GenJVM.leaveClass(GenJVM.java:1563)
...
what expected no error
[back to overview]
Changes of this bug report
Michel  edited on  2003-12-02 09:27:29.0

This particular instance of the bug was fixed by adding support for wide jumps in the back-end. All methods are first compiled with short jumps, and if it happens that at least one jump needs a long offset, the compilation of the whole method is restarted with wide jumps all over the place.

The general problem, as discussed with Buraq, is that the pattern matcher generates huge code, which one day or another is bound to break the (small) limits of the JVM. We should find a solution for that, but I don't know yet whether we want to do it in the back-end or earlier.

Burak  edited on  2003-12-02 16:51:09.0
same as for bug 243, I changed the inefficient translation in the TransMatch phase.