[15] RFR(T) 8242357: [JVMCI] Incorrect use of JVMCI_CHECK_ on return statement

Liu, Xin xxinliu at amazon.com
Sat Apr 18 00:36:43 UTC 2020


LGTM. I used to backport a similar change (exceptions.hpp) to jdk8u. 
I also use regex to scan the whole source code, I think it’s the only place in hotspot. 

Thanks,
--lx

On 4/17/20, 5:02 PM, "hotspot-compiler-dev on behalf of Vladimir Kozlov" <hotspot-compiler-dev-bounces at openjdk.java.net on behalf of vladimir.kozlov at oracle.com> wrote:

    CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.



    https://bugs.openjdk.java.net/browse/JDK-8242357

    CHECK macros can't be used on a return statement - they expand to include code after the return [2] and so have no affect.

    Fix:

    src/hotspot/share/jvmci/jvmciEnv.hpp
    @@ -262,7 +262,8 @@
        char* as_utf8_string(JVMCIObject str, char* buf, int buflen);

        JVMCIObject create_string(Symbol* str, JVMCI_TRAPS) {
    -    return create_string(str->as_C_string(), JVMCI_CHECK_(JVMCIObject()));
    +    JVMCIObject s = create_string(str->as_C_string(), JVMCI_CHECK_(JVMCIObject()));
    +    return s;
        }

    I tried to find similar cases but it was the only one.
    Clang -Wunreachable-code-aggressive does not catch this case.

    Tested hs-tier1,hs-tier3-graal

    Thanks,
    Vladimir

    [1] http://hg.openjdk.java.net/jdk/jdk/file/90882ba9f488/src/hotspot/share/jvmci/jvmciExceptions.hpp#l48



More information about the hotspot-compiler-dev mailing list