RFR: 8263434: Dangling references after MethodComparator::methods_EMCP

Aleksey Shipilev shade at openjdk.java.net
Thu Mar 11 11:12:26 UTC 2021


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`

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

Commit messages:
 - 8263434: Dangling references after MethodComparator::methods_EMCP

Changes: https://git.openjdk.java.net/jdk/pull/2937/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2937&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263434
  Stats: 89 lines in 2 files changed: 2 ins; 8 del; 79 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2937.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2937/head:pull/2937

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


More information about the hotspot-dev mailing list