RFR: 8206144: [lworld] Adapt and add C2 intrinsics for value types Unsafe API

Tobias Hartmann tobias.hartmann at oracle.com
Thu Jan 3 13:14:04 UTC 2019

Hi Roland,

I've quickly submitted some testing for this before going on vacation (haven't reviewed it yet) and
now had a look at the results. Many tests fail with:

#  assert(bt == alias_type->basic_type() || bt == T_VALUETYPE) failed: should match

Current CompileTask:
C2:   2887  164    b        java.lang.invoke.TestBoolean__f=8__s=false__d=false::testUnsafe (16 bytes)

Stack: [0x00007f076e06c000,0x00007f076e16d000],  sp=0x00007f076e1691b0,  free space=1012k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native
V  [libjvm.so+0x18f2d43]  VMError::report_and_die(int, char const*, char const*, __va_list_tag*,
Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x2c3
V  [libjvm.so+0x18f3b0f]  VMError::report_and_die(Thread*, void*, char const*, int, char const*,
char const*, __va_list_tag*)+0x2f
V  [libjvm.so+0xafb740]  report_vm_error(char const*, int, char const*, char const*, ...)+0x100
V  [libjvm.so+0x121c6e9]  LibraryCallKit::inline_unsafe_access(bool, BasicType,
LibraryCallKit::AccessKind, bool)+0x15e9
V  [libjvm.so+0x12208bf]  LibraryIntrinsic::generate(JVMState*)+0xaf
V  [libjvm.so+0xbef277]  Parse::do_call()+0x527
V  [libjvm.so+0x154063c]  Parse::do_one_bytecode()+0x2c9c
V  [libjvm.so+0x152ab1a]  Parse::do_one_block()+0x44a
V  [libjvm.so+0x152bf21]  Parse::do_all_blocks()+0xe1
V  [libjvm.so+0x152fd4f]  Parse::Parse(JVMState*, ciMethod*, float)+0xe4f
V  [libjvm.so+0x80869c]  ParseGenerator::generate(JVMState*)+0x8c
V  [libjvm.so+0xa15b0b]  Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool,
V  [libjvm.so+0x8066f1]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0xd1
V  [libjvm.so+0xa23669]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x409
V  [libjvm.so+0xa24788]  CompileBroker::compiler_thread_loop()+0x458
V  [libjvm.so+0x18018a7]  JavaThread::thread_main_inner()+0x2c7
V  [libjvm.so+0x1801b7c]  JavaThread::run()+0x1cc
V  [libjvm.so+0x17fd5a5]  Thread::call_run()+0x75
V  [libjvm.so+0x14d11c6]  thread_native_entry(Thread*)+0x106

For example, compiler/unsafe/UnsafeGetConstantField.java.

I also see failures with the compiler/valhalla/valuetypes/TestIntrinsics.java test:

Caused by: java.lang.RuntimeException: assertEquals: expected 0 to equal 768
	at jdk.test.lib.Asserts.fail(Asserts.java:594)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:205)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:189)
	at jdk.test.lib.Asserts.assertEQ(Asserts.java:166)
	at compiler.valhalla.valuetypes.TestIntrinsics.test29_verifier(TestIntrinsics.java:508)
	... 6 more

Best regards,

On 18.12.18 15:12, Roland Westrelin wrote:
> http://cr.openjdk.java.net/~roland/8206144/webrev.00/
> This change:
> - improves robustness of getX intrinsics when reading from a value type
>   (mismatched accesses should now be correctly handled).
> - implements intrinsics for getValue and putValue
> - implements intrinsics for makePrivateBuffer/finishPrivateBuffer. I
>   added a larval bit to TypeValueType. I'm not entirely convince it's
>   the right approach but that could be revisited later.
> Roland.

More information about the valhalla-dev mailing list