RFR: 8260341: CDS dump VM init code does not check exceptions [v2]

Ioi Lam iklam at openjdk.java.net
Wed Feb 10 22:24:37 UTC 2021


On Wed, 10 Feb 2021 21:11:12 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> What Harold said. We use THREAD if the call is the last call in the function because I thought there was a tail call problem with one of the compilers once. I think this was the bug I was thinking about and it's only in the return statement:
> https://bugs.openjdk.java.net/browse/JDK-6889002
> If you verified that the HAS_PENDING_EXCEPTION check evaporates, that's fine then, and better to have CHECK. As you say, someone might add some code after it.

I think the problem in JDK-6889002 is only with using `CHECK` in a return statement like this that produces unreachable source code.

    return foobar(1, 2, 3, CHECK_0);

->

    return foobar(1, 2, 3, THREAD);
    if (HAS_PENDING_EXCEPTION) return 0;

The cases that I have changed in this PR are functions with `void` returns.

void f(TRAPS)  {
    g(1, 2, 3, CHECK);
}

would be expanded to

void f(TRAPS)  {
    g(1, 2, 3, THREAD);
    if (HAS_PENDING_EXCEPTION) return;
}

I suppose any C++ compiler that can compile HotSpot will elide the `if` line.

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

PR: https://git.openjdk.java.net/jdk/pull/2494


More information about the hotspot-dev mailing list