JDK-8227387 : [lworld] TestLWorld fails with assert(!is_always_locked()) failed: invariant
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-07-08
  • Updated: 2019-08-09
  • Resolved: 2019-08-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaFixed
Related Reports
Relates :  
Description
When executed with -XX:-ScalarizeValueTypes, the test fails with:

#  Internal Error (/oracle/valhalla2/open/src/hotspot/share/oops/markOop.hpp:207), pid=20911, tid=20912
#  assert(!is_always_locked()) failed: invariant

Current thread (0x00007f8600028000):  JavaThread "main" [_thread_in_Java, id=20912, stack(0x00007f8608dff000,0x00007f8608f00000)]

Stack: [0x00007f8608dff000,0x00007f8608f00000],  sp=0x00007f8608efbf20,  free space=1011k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xaeadc6]  Deoptimization::relock_objects(GrowableArray<MonitorInfo*>*, JavaThread*, bool)+0x506
V  [libjvm.so+0xaf3b7a]  Deoptimization::fetch_unroll_info_helper(JavaThread*, int)+0xaaa

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
v  ~UncommonTrapBlob
J 206 c2 compiler.valhalla.valuetypes.TestLWorld.test58()V (16 bytes) @ 0x00007f85fd1f43d0 [0x00007f85fd1f42c0+0x0000000000000110]
j  compiler.valhalla.valuetypes.TestLWorld.test58_verifier(Z)V+1
j  jdk.internal.reflect.GeneratedMethodAccessor50.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+63
J 175% c2 compiler.valhalla.valuetypes.ValueTypeTest.run([Ljava/lang/Class;)V (699 bytes) @ 0x00007f85fd1d9ce0 [0x00007f85fd1d9400+0x00000000000008e0]
j  compiler.valhalla.valuetypes.ValueTypeTest.run([Ljava/lang/String;[Ljava/lang/Class;)V+41
j  compiler.valhalla.valuetypes.TestLWorld.main([Ljava/lang/String;)V+45
v  ~StubRoutines::call_stub
Register to memory mapping:

Different failure mode without lock elimination:

#  Internal Error (/oracle/valhalla1/open/src/hotspot/share/runtime/synchronizer.cpp:305), pid=2005, tid=2006
#  assert(!EnableValhalla || !object->klass()->is_value()) failed: monitor op on value type

Stack: [0x00007f8c8b636000,0x00007f8c8b737000],  sp=0x00007f8c8b735630,  free space=1021k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1842e09]  ObjectSynchronizer::fast_exit(oop, BasicLock*, Thread*)+0x329
V  [libjvm.so+0x184303a]  ObjectSynchronizer::slow_exit(oop, BasicLock*, Thread*)+0x2a
V  [libjvm.so+0xe49c7b]  InterpreterRuntime::monitorexit(JavaThread*, BasicObjectLock*)+0x25b
j  Test.test58_inline(Ljava/lang/Object;)V+14
j  Test.test58(I)V+6
j  Test.main([Ljava/lang/String;)V+9
v  ~StubRoutines::call_stub
V  [libjvm.so+0xe62fbd]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x86d
V  [libjvm.so+0xf322fb]  jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.150] [clone .constprop.234]+0x19b
V  [libjvm.so+0xf40cce]  jni_CallStaticVoidMethod+0x1ee
C  [libjli.so+0x4d33]  JavaMain+0xbd3
C  [libjli.so+0x8239]  ThreadJavaMain+0x9
Comments
http://hg.openjdk.java.net/valhalla/valhalla/rev/7bddf30fe530
09-08-2019

We should disable lock elimination for value types: http://cr.openjdk.java.net/~thartmann/8227387/webrev.00/
08-07-2019