RFR: 8303415: Add VM_Version::is_intrinsic_supported(id)

Vladimir Kozlov kvn at openjdk.org
Wed Mar 8 18:20:27 UTC 2023


On Wed, 8 Mar 2023 09:55:47 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> Currently we check VM flags, directives and JIT compiler support when we generate intrinsics. 
>> We have *product* VM flags for most intrinsics and set them in VM based on HW support. 
>> But not all intrinsics have such flags and it is not scalable to add new *product* flag for each new intrinsic. 
>> Also we have `-XX:DisableIntrinsic=<id>` and `-XX:ControlIntrinsic=<id>` flags to control intrinsics from command line. We don't need specific flags for that. 
>> 
>> I propose to add new `VM_Version::is_intrinsic_supported(id)` method to check platform support for intrinsic without adding new flag. I used it for `_floatToFloat16` intrinsic for my work on [JDK-8302976](https://bugs.openjdk.org/browse/JDK-8302976).
>> 
>> Additional fixes:
>> Fixed Interpreter to skip intrinsics if they are disabled with flag.
>> Moved Interpreter's `InlineIntrinsics` flag check into one place in shared code.
>> Added separate interpreter id for `_dsqrt_strict` so it could be disabled separately from regular `_dsqrt`.
>> Added missing `native` mark to `_currentThread`.
>> Removed unused `AbstractInterpreter::in_native_entry()`.
>> Cleanup C2 intrinsic checks code.
>> 
>> Tested tier1-4,xcomp,stress. Also ran tier1-3,xcomp with `-XX:-InlineIntrinsics`.
>
> src/hotspot/share/opto/c2compiler.hpp line 68:
> 
>> 66:   // Check if the compiler supports an intrinsic for 'method' given the
>> 67:   // the dispatch mode specified by the 'is_virtual' parameter.
>> 68:   bool is_virtual_intrinsic_supported(vmIntrinsics::ID id, bool is_virtual);
> 
> I find the new name of the method confusing because it suggests that the intrinsic is always virtual. Can we keep the old name?

We still have `is_intrinsic_supported()` declared at line 64. New `is_virtual_intrinsic_supported()` is added to handle only virtual intrinsics`_hashCode` and `_clone`.  I simply moved these intrinsics handling into separate method because it is used only by C2 in `library_call.cpp`.

-------------

PR: https://git.openjdk.org/jdk/pull/12858


More information about the hotspot-compiler-dev mailing list