RFR: 8265484: Fix up TRAPS usage in GenerateOopMap::compute_map and callers [v2]

Coleen Phillimore coleenp at openjdk.java.net
Wed Apr 21 14:19:44 UTC 2021

On Tue, 20 Apr 2021 22:04:35 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> If compute_map encounters malformed bytecode, or an OOM condition then it can raise a LinkageError to be thrown in regular JavaThreads, and this is reflected in the use of TRAPS in a couple of methods. But for non-JavaThreads, and compiler threads, the occurrence of such an error is treated as a fatal error and we abort the VM.
>> In addition, most of the callers of compute_map actually use the CATCH macro, which just clears the exception and will abort a non-product VM.
>> This use of TRAPS is a problem for the change to convert TRAPS to JavaThread, because these methods are called by non-JavaThreads. To address this we change compute_map to create, but not throw, the exception and return a bool indicating whether an error occurred, and the caller can then choose to throw the exception itself. 
>> Testing: tiers 1-3
>> Thanks,
>> David
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>   Additional comments on failure modes

This looks good to me other than changing asserts to fatals.

src/hotspot/share/ci/ciMethod.cpp line 307:

> 305:       // Failure is only possible for a resource-area OOM, or malformed bytecode
> 306:       // with verification disabled.
> 307:       assert(false, "Unexpected exception from compute_map");

Since CATCH was only recently changed from fatal to assert, making these fatal() wouldn't be a change in behavior and that's what this should do.

src/hotspot/share/interpreter/oopMapCache.cpp line 115:

> 113:       // Failure is only possible for a resource-area OOM, or malformed bytecode
> 114:       // with verification disabled.
> 115:       assert(false, "Unexpected exception from compute_map");

same here, and below, should be fatal.


Marked as reviewed by coleenp (Reviewer).

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

More information about the hotspot-compiler-dev mailing list