[MVT] hotspot crash

forax at univ-mlv.fr forax at univ-mlv.fr
Wed Sep 20 08:42:17 UTC 2017



----- Mail original -----
> De: "Tobias Hartmann" <tobias.hartmann at oracle.com>
> À: forax at univ-mlv.fr
> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Mercredi 20 Septembre 2017 09:08:00
> Objet: Re: [MVT] hotspot crash

> Hi Remi,
> 
> On 20.09.2017 08:04, forax at univ-mlv.fr wrote:
>> i'm sure that the verifier was enabled (the err log [1] seems to confirm that,
>> no "-noverify" on the command line)
> 
> Yes, sure, but with -XX:+ValueTypePassFieldsAsArgs (which is the default), the
> VM crashes during adapter generation
> *before* the verifier catches the problem. I was just referring to the fact that
> there is a bytecode generation problem
> as well, that only shows up if ValueTypePassFieldsAsArgs is disabled (and the
> verifier is enabled).

ok, in fact your first mail was clear, i should not try to reply to a mail without my morning coffee.

> 
> I was talking about these 3 cases:
> (1) Verifier enabled and -XX:+ValueTypePassFieldsAsArgs: Crash in adapter
> generation before verifier catches the problem
> (2) Verifier enabled and -XX:-ValueTypePassFieldsAsArgs: VerifyError: Bad local
> variable type
> (3) Verifier disabled and -XX:-ValueTypePassFieldsAsArgs:
> java.lang.NoClassDefFoundError
> 
> I will fix (1) with JDK-8187679.
> 
>> You're right that the bytecode is not valid but it should not crash if the
>> verifier is enable.
> 
> Yes, I agree.
> 
>> It was before ValueCapableClass was renamed by Mandy, that why i think you have
>> not reproduce the bug,
>> i.e. in my test fr/umlv/valuetypify/test/InternalTest$Int$Value is a value type
>> generated from the fr/umlv/valuetypify/test/InternalTest$Int which is a VCC for
>> the VM so the class is found.
> 
> From looking at the stack trace, I'm pretty confident that the root cause is the
> same. We crash because we were unable
> to resolve a value type class. That's definitely a bug.
> 
> I can verify if you have a reproducer with the latest version.

I've just renamed all occurrences of ValueCapableClass in the jar,
here is the new one:
  http://www-igm.univ-mlv.fr/~forax/tmp/mvt/test-valuetypified-patched.jar

> 
> Thanks,
> Tobias

regards,
Rémi

> 
>> ----- Mail original -----
>>> De: "Tobias Hartmann" <tobias.hartmann at oracle.com>
>>> À: "Remi Forax" <forax at univ-mlv.fr>, "valhalla-dev"
>>> <valhalla-dev at openjdk.java.net>
>>> Envoyé: Mardi 19 Septembre 2017 17:04:21
>>> Objet: Re: [MVT] hotspot crash
>> 
>>> Hi Remi,
>>>
>>> thanks for reporting this crash!
>>>
>>> With a debug build, this fails with an assert [1] suggesting that we failed to
>>> resolve a class. It turns out we are
>>> about to create c2i and i2c adapters for the method 'plus' from
>>> 'fr/umlv/valuetypify/test/InternalTest' but fail because
>>> the class 'fr/umlv/valuetypify/test/InternalTest$Int$Value' is not found.
>>>
>>> Running with -XX:-ValueTypePassFieldsAsArgs -noverify correctly fails with a
>>> NoClassDefFoundError:
>>>   Exception in thread "main" java.lang.NoClassDefFoundError:
>>>   fr/umlv/valuetypify/test/InternalTest$Int$Value
>>> 	at fr.umlv.valuetypify.test.InternalTest.main(InternalTest.java:33)
>>>
>>> You are right that we should not crash in this case. I filed:
>>> https://bugs.openjdk.java.net/browse/JDK-8187679
>>>
>>> Running with the verifier enabled fails with [2]. I guess this is a problem with
>>> your bytecode generation.
>>>
>>> Thanks,
>>> Tobias
>>>
>>> [1]
>>> #  Internal Error
>>> (/oracle/valhalla/hotspot/src/share/vm/runtime/sharedRuntime.cpp:2733),
>>> pid=31260, tid=31264
>>> #  assert(k != __null &&
>>> !(((ThreadShadow*)__the_thread__)->has_pending_exception())) failed: can
>>> resolve klass?
>>>
>>> [2]
>>> Exception in thread "main" java.lang.VerifyError: Bad local variable type
>>> Exception Details:
>>>    Location:
>>>
>>> fr/umlv/valuetypify/test/InternalTest$Int.add(Qfr/umlv/valuetypify/test/InternalTest$Int$Value;)Qfr/umlv/valuetypify/test/InternalTest$Int$Value;
>>> @4: vload
>>>    Reason:
>>>      Type 'fr/umlv/valuetypify/test/InternalTest$Int' (current frame, locals[0]) is
>>>      not assignable to value type
>>>    Current Frame:
>>>      bci: @4
>>>      flags: { }
>>>      locals: { 'fr/umlv/valuetypify/test/InternalTest$Int',
>>>      'fr/umlv/valuetypify/test/InternalTest$Int$Value' }
>>>      stack: { uninitialized 0, uninitialized 0 }
>>>    Bytecode:
>>>      0000000: bb00 0359 cb00 b400 2fcb 01b4 002f 60b7
>>>      0000010: 0004 d300 2ecf
>>>
>>> 	at fr.umlv.valuetypify.test.InternalTest.main(InternalTest.java:33)
>>>
>>>
>>> On 15.09.2017 22:33, Remi Forax wrote:
>>>> oops,
>>>> i'm doing some modifications to my bytecode rewriter, so the generated code has
>>>> a good chance to be generate an invalid class, but the VM should not crash.
>>>>
>>>> To reproduce download the jar here:
>>>>     http://www-igm.univ-mlv.fr/~forax/tmp/mvt/
>>>>
>>>> and run
>>>>     java -XX:+EnableMVT -cp test-valuetypified.jar
>>>>     fr.umlv.valuetypify.test.InternalTest
>>>>
>>>> cheers,
>>>> Rémi
>>>>
>>>> ---
>>>>
>>>> ~/java/workspace/mvt/valhalla/build/linux-x86_64-normal-server-release/jdk/bin/java
>>>> -XX:+EnableMVT -cp test-valuetypified.jar fr.umlv.valuetypify.test.InternalTest
>>>> #
>>>> # A fatal error has been detected by the Java Runtime Environment:
>>>> #
>>>> #  SIGSEGV (0xb) at pc=0x00007f17dd170907, pid=17320, tid=17321
>>>> #
>>>> # JRE version: OpenJDK Runtime Environment (10.0) (build
>>>> 10-internal+0-adhoc.forax.valhalla)
>>>> # Java VM: OpenJDK 64-Bit Server VM (10-internal+0-adhoc.forax.valhalla, mixed
>>>> mode, compressed oops, g1 gc, linux-amd64)
>>>> # Problematic frame:
>>>> # V  [libjvm.so+0xbd4907]  ValueKlass::adr_extended_sig() const [clone
>>>> .constprop.129]+0x7
>>>> #
>>>> # Core dump will be written. Default location: Core dumps may be processed with
>>>> "/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t %P %I" (or dumping to
>>>> /home/forax/git/valuetypify/core.17320)
>>>> #
>>>> # An error report file with more information is saved as:
>>>> # /home/forax/git/valuetypify/hs_err_pid17320.log
>>>> #
>>>> # If you would like to submit a bug report, please visit:
>>>> #   http://bugreport.java.com/bugreport/crash.jsp
>>>> #
> >>> Aborted (core dumped)


More information about the valhalla-dev mailing list