C2 support for reference fields in value types

Tobias Hartmann tobias.hartmann at oracle.com
Tue Apr 18 19:35:06 UTC 2017


Hi,

here's my prototype for C2 support for reference fields in value types:
http://cr.openjdk.java.net/~thartmann/valhalla/vt_prototype/webrev.14/

Changes:
- Changed the C2 code and the C2I/I2C adapters to correctly read/write oop fields of value types. After initializing fields of newly allocated values types in the C2I adapter, we call into the runtime to apply the GC post barriers to oop fields.
- Adapted escape analysis and C2's type system to correctly handle oop fields.
- Extended nmethod::preserve_callee_argument_oops() to correctly iterate over reference fields that are passed as arguments if ValueTypePassFieldsAsArgs is enabled
- I had to change the match rule for ALLOC to distinguish between value type allocations and the new Integer() allocations.
- Added tests

Open issues:
- Disabling the call to SharedRuntime::apply_post_barriers() does not trigger any problems. Either post-barriers are not required for some reason or we are missing the corresponding test case. I'm also seeing some crashes in apply_post_barriers() on JPRT but I was not yet able to reproduce those locally.
- I had to disable the assert in ConstantPool::klass_at_impl() if ValueTypePassFieldsAsArgs is enabled because we need to resolve call sites from the GC thread. We should find a better solution and re-enable the assert. Also, the resolve_invoke() call in nmethod.cpp very rarely fails with "Should not have any exceptions pending". 
- The ValueOops.java test fails with "RuntimeException: Number of frame oops incorrect" if executed with -Xcomp. I'm not sure if it is a test bug or an issue with C2.
- We need tests for value types with array fields

I'll be very busy with preparing a presentation for Oracle Code until mid next week. Roland, Zoltan, feel free to have a look!

Thanks,
Tobias


More information about the valhalla-dev mailing list