[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Parser methods larger than 64K



Hello,

Running SableCC using JDK 1.2, I get an error concerning methods that are
larger than 64K.

-------------------------------------------------------------------
> d:\jdk\bin\java -mx1024m -classpath 
  d:\jdk\lib\classes.zip;q:\sablecc\sablecc-2.6.jar;
  q:\sablecc\sableutil-1.8.jar SableCC unicode.txt

SableCC version 2.6
Copyright (C) 1997, 1998 Etienne Gagnon (gagnon@sable.mcgill.ca).  All
rights reserved.

This software comes with ABSOLUTELY NO WARRANTY.  This is free software,
and you are welcome to redistribute it under certain conditions.

Type 'java SableCC -license' to view the complete copyright notice and
license.

java.lang.ClassFormatError: ca/mcgill/sable/sablecc/parser/Parser (Code of a
method longer than 65535 bytes)
-------------------------------------------------------------------

ca.mcgill.sable.sablecc.parser.Parser is indeed rather largish, and violates
the Java VM specifications:

-------------------------------------------------------------------
4.10 Limitations of the Java Virtual Machine and class File Format
* The amount of code per method is limited to 65535 bytes by the sizes 
  of the indices in the exception_table of the Code attribute (4.7.4), 
  in the LineNumberTable attribute (4.7.6), and in the 
  LocalVariableTable attribute (4.7.7). 
-------------------------------------------------------------------
  (http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html#6253)

The same happens with parsers generated by SableCC for large grammars, such as
Java. Similar issues have been reported on Usenet for other compiler tools,
such as JCUP/JLEX.

This problem is new with JDK 1.2, which has stricter classfile verification.
AFAIK, the check cannot be disabled. I believe this issue is highly critical.

  Regards,
    Eran Tromer