[kaffe] WARNING Bad bytecode! Illegal exception table entry

Guilhem Lavaux guilhem.lavaux at free.fr
Sat May 22 03:24:01 PDT 2004


Helmer Krämer wrote:
> On Sat, 22 May 2004 11:44:27 +0900
> Ito Kazumitsu <kaz at maczuka.gcd.org> wrote:
> 
> Hi,
> 
> 
>>The following program, when compiled with kjc, prints the
>>strange message, but runs normally when compiled with Sun's javac.
> 
> 
> Compilers are fun, aren't they ?
> 
> 
>>[ start of example skipped ] 
>>  private static int foo() {
>>    int n = 0;
>>    try {
>>      if (true) {
>>	  throw new Exception("Test");
>>      }
>>      n = 1;
>>    }
>>    catch (Exception e) {
>>      n = 2;
>>    }
>>    return n;
>>  }
>>[ rest of example skipped ]
> 
> 
> On the one hand, KJC is clever enough to detect that the
> condition of the if will always be true, and thus removes
> it from the bytecode. On the other hand, KJC is not clever
> enough to detect and remove the unreachable statement "n=1"
> from the bytecode, as javac does. This means that the end
> pc of the exception table entry is an unreachable instruction.
> 
> The jitter in turn doesn't translate the exception table of
> a method correctly when the end pc is an unreachable insn,
> which in turn yields the message you've got.
> 
> So I'll have a look at the jitter and someone else might
> want to have a look at kjc.
> 

I'll have a look at kjc. I already have to fix some other things in it 
(like the IllegalAccessException for private inner classes with default 
constructors).

Cheers,

Guilhem.




More information about the kaffe mailing list