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)?