RFR: 8264004: Don't use TRAPS if no exceptions are thrown [v4]

Ioi Lam iklam at openjdk.java.net
Tue Mar 23 21:15:44 UTC 2021


On Tue, 23 Mar 2021 16:08:59 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Removed the TRAPS in function declarations in jvmtiRedefineClasses and in ConstantPool merging functions.
>> Tested with vmTestbase/nsk/jvmti and tier1 (in progress).
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix load_new_class_versions and remove more traps.

* THREAD = current; // for exception processing``` 

is used only when the current method does not declare TRAPS, which means it should never throw. As a convention, I think the above code should be accompanied with by 

 em(THREAD);``` 

to ensure that the exceptions are not unintentionally leaked.

src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 1389:

> 1387:     state->set_class_being_redefined(the_class, _class_load_kind);
> 1388: 
> 1389:     Thread* THREAD = current;  // for exception processing

Add `ExceptionMark em(THREAD);`

src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 2118:

> 2116:     methodHandle method(current, methods->at(i));
> 2117:     methodHandle new_method;
> 2118:     Thread* THREAD = current; // For exception handling

Add `ExceptionMark em(THREAD);`

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

Changes requested by iklam (Reviewer).

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


More information about the serviceability-dev mailing list