[kaffe] WARNING Bad bytecode! Illegal exception table entry

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


Helmer Kr=E4mer wrote:
> On Sat, 22 May 2004 11:44:27 +0900
> Ito Kazumitsu <kaz@maczuka.gcd.org> wrote:
>=20
> Hi,
>=20
>=20
>>The following program, when compiled with kjc, prints the
>>strange message, but runs normally when compiled with Sun's javac.
>=20
>=20
> Compilers are fun, aren't they ?
>=20
>=20
>>[ start of example skipped ]=20
>>  private static int foo() {
>>    int n =3D 0;
>>    try {
>>      if (true) {
>>	  throw new Exception("Test");
>>      }
>>      n =3D 1;
>>    }
>>    catch (Exception e) {
>>      n =3D 2;
>>    }
>>    return n;
>>  }
>>[ rest of example skipped ]
>=20
>=20
> 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=3D1"
> from the bytecode, as javac does. This means that the end
> pc of the exception table entry is an unreachable instruction.
>=20
> 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.
>=20
> So I'll have a look at the jitter and someone else might
> want to have a look at kjc.
>=20

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

Cheers,

Guilhem.