RFR: 8312235: [JVMCI] ConstantPool should not force eager resolution [v2]

Doug Simon dnsimon at openjdk.org
Wed Jul 26 16:00:20 UTC 2023


On Wed, 26 Jul 2023 15:41:13 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

>> src/hotspot/share/jvmci/jvmciCompilerToVM.cpp line 707:
>> 
>>> 705:     obj = cp->find_cached_constant_at(index, found_it, CHECK_NULL);
>>> 706:     if (!found_it) {
>>> 707:       return nullptr;
>> 
>> Should there be some sort of exception or error checking here or in the caller? If the constant can't be found it either isn't resolved or the index is invalid, correct?
>
> The error checking is already done by the call to `getTagAt` in `HotSpotConstantPool.lookupConstant(int cpi, boolean resolve)`.
> I'll add more javadoc to clarify when a null is returned.

Note that the javadoc of `lookupConstantInPool` already states:

     * The behavior of this method is undefined if {@code cpi} does not denote one of the following
     * entry types: {@code JVM_CONSTANT_Dynamic}, {@code JVM_CONSTANT_String},
     * {@code JVM_CONSTANT_MethodHandle}, {@code JVM_CONSTANT_MethodHandleInError},
     * {@code JVM_CONSTANT_MethodType} and {@code JVM_CONSTANT_MethodTypeInError}.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14927#discussion_r1275176566


More information about the hotspot-compiler-dev mailing list