RFR: 8263434: Dangling references after MethodComparator::methods_EMCP [v2]
Serguei Spitsyn
sspitsyn at openjdk.java.net
Wed Mar 17 01:44:07 UTC 2021
On Thu, 11 Mar 2021 13:50:24 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> SonarCloud reports the following problem in MethodComparator::methods_EMCP:
>> "Address of stack memory associated with local variable 's_new' is still referred to by the global variable '_s_new' upon returning to the caller. This will be a dangling reference"
>>
>> Code inspection reveals the assignment to static variables is only needed to pass them to helper methods. So, while this is not a detectable bug (yet), it is still cleaner not to expose stack variables in globals.
>>
>> Additional testing:
>> - [x] Linux x86_64 fastdebug `tier1`
>> - [x] Linux x86_64 fastdebug, `vmTestbase_nsk_jvmti`
>
> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>
> Sprinkling consts
Aleksey,
Sorry for being late to the party.
This looks good to me.
One nit: unneeded extra '()' what came from the original code:
` if ((old_cp->klass_at_noresolve(cpi_old) != new_cp->klass_at_noresolve(cpi_new)))`
Thanks,
Serguei
-------------
Changes requested by sspitsyn (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2937
More information about the hotspot-dev
mailing list