0

So I just debugged a segfault (C2 compiler crashing for certain methods).

The error message was

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f478a832e6c, pid=7673, tid=139944974104320
#
# JRE version: Java(TM) SE Runtime Environment (7.0_65-b17) (build 1.7.0_65-b17)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x75fe6c]  PhaseIdealLoop::build_loop_late_post(Node*)+0x13c

Which sounds a lot more complicated than it should, given that the cause eventually turned out to be that the auxiliary method used to generate a specific access

aload 9
getfield #166                // Field my/somewhere/Some.thing:J

Had received the wrong index, 9, and thus loaded a completely wrong object.

It would've been convenient had the JVM just protested that the object on top of the stack was not of type my/somewhere/Some at the time getfield was called.

Is there a way to force the JVM to do such typechecks and report a meaningful error (just for debugging, of course)?

User1291
  • 7,664
  • 8
  • 51
  • 108
  • As I know there is no way to report a meaningful error. – hellzone Jan 11 '18 at 14:52
  • The JVM already does typecheck bytecode when loaded, unless you specifically disable it with the noverify option. Were you using noverify? – Antimony Jan 11 '18 at 15:15
  • There are exactly two possibilities. a) The checks were disabled, e.g using `-noverify` or b) there’s a bug in the verifier. In the first case, well you get what you ask for, the solution is not to disable the checks, in there latter case, well, it would be great if there was a `-nobugs` option. I would apply it to all of my programs… – Holger Jan 11 '18 at 17:49
  • @Holger or ever better `-XX:+Please` – Eugene Jan 11 '18 at 19:51

0 Answers0