[kaffe] WARNING Bad bytecode! Illegal exception table entry

Helmer Krämer hkraemer at freenet.de
Sat May 22 03:13:01 PDT 2004


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.

And once again thanks for the nice test cases you come
up with.

Regards,
Helmer




More information about the kaffe mailing list