Bytecode analyse

Parmelan, Edouard EP510777 at
Fri Oct 2 02:36:11 PDT 1998

Hi Tim,

Yesterday, I try JavaClass-2.3.0 a bytecode library and
a classe cause assertion fail in code-analyse.c

The offence bytecodes are:

  303 goto 317
  306 nop
  307 astore 8

307 is an Exception handler and
306 is an unreachable statement.

1/ Patched bug1
Your basic block computation don't start a new basic block after
goto, return or *switch.
After 306, the stack state of the exception handler is an empty stack,
and astore 8 failed with "sp out of range"

I add them in the following patch.  The good new is that unreachable
basic blocks aren't verified, and unverified basic blocks are unreachable
with your algorithm, so we could safely remove them at jit translation.

2/ Unpatched bug2
I see another bug in the verifier but I don't correct it:
if a target of any jump instruction is outside the bytecode range,
the verifier corrupt the memory with codeInfo->perPC[target].xxx = yyy.
I don't patch it because some codes are in #ifdef notyet #endif
especially if verifier fail :-(

  The bytecode verifier should protect the Virtual Machine for memory
  corruption, or corrupt the Virtual Machine itself ? :-)

Tim, could you review my patch1 and think about bug2 ?

Im a programar^H^H^H^H^H^H^H  |
Iam a programer^H^H^H^H^H^H^H |   The Computer Museum
I'm a programor^H^H^H^H^H^H^H |       Boston, AM
I write code                  | (c) 1995 ComputerGear Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: verify.patch
Type: application/octet-stream
Size: 3214 bytes
Desc: not available
Url : 

More information about the kaffe mailing list