Loading ...
Sorry, an error occurred while loading the content.

Re: java compile limitation?

Expand Messages
  • stalnaker@acm.org
    Using jdk 1.3.0_01 did not clear the compiler error. However, the statements parser rule seemed to be the code in question and there are many alternative
    Message 1 of 3 , Dec 31, 2000
    • 0 Attachment
      Using jdk 1.3.0_01 did not clear the compiler error. However, the
      statements parser rule seemed to be the code in question and there
      are many alternative statements. I broke this up into three rules
      and that cleared the problem. Thank you for your information.

      --- In antlr-interest@egroups.com, Robert Colquhoun <rjc@t...> wrote:
      > Hi,
      >
      > At 11:14 PM 12/30/00 +0000, stalnaker@a... wrote:
      > >My grammar is now 39K and it has many key words. I now get a java
      > >compiler error:
      > >
      > >code too large for try
      > >
      > >on catch recognition exception ex
      >
      > I think you've struck the 64kbytes method limit within the java
      virtual
      > machine. A single method cannot be more than 65535 bytes in size.
      >
      > There are some structures - the exception table, line number table
      plus
      > others which i forget, only have 16bit(= max range of 65535 bytes)
      > addresses. If your method had no try/catch blocks that span the
      whole
      > method you might be able to get it to compile, but there is a
      reasonable
      > likelihood the class file will not run on at least some VM's.
      >
      > You can use 'javap' to look at the raw bytecode to see the various
      method
      > sizes if you can get the thing to compile.
      >
      >
      > >which seems to be at the end of a very large case statement in the
      > >parser class.
      >
      > big case statements with lots of alternatives normally compile to
      either a
      > 'tableswitch' or 'lookupswitch' opcode, interestingly both opcodes
      use 32
      > bit addresses which would allow much bigger methods, but occupy
      quite alot
      > of real estate within the method itself.
      >
      >
      > >This does not seem to be a computer RAM limitation in that closing
      > >many open programs does not clear this problem.
      >
      > No i don't think it is a memory problem.
      >
      >
      > >Please advise if this is a java limitation (sun 1.3 on win2k) such
      > >that I need to consider changing the hosting language.
      >
      > I heard a rumor the latest jvm for windows 1.3.01 will execute at
      least
      > some large methods.
      >
      > Other than that i think the only way to fix it is to break up your
      parser,
      > is it possible to use different kind of tokens(ie less token
      types)? or
      > perhaps use some token streams to process your tokens or a smarter
      lexer
      > perhaps?
      >
      > PS I have been writing a basic to java bytecode compiler and the
      64k limit
      > is a complete curse when trying to compile basic programs which are
      > thousands of lines long and jump all over the place with gotos and
      > gosubs. It seems to be only things which they added later to the
      jvm that
      > cause the 64k limit rather than anything intrinsic to the machine
      (perhaps
      > they were in a hurry at the end of the project and really wanted
      some sleep
      > or food or something... ;-).
      >
      > - Robert
    Your message has been successfully submitted and would be delivered to recipients shortly.