RFR: 8262910: Cleanup THREAD/TRAPS/naming and typing issues in ObjectMonitor and related code [v5]

David Holmes dholmes at openjdk.java.net
Wed Mar 10 00:57:40 UTC 2021


> ObjectMonitors can only be used by JavaThreads (modulo some interactions with hashcodes and deflation) but we use "Thread*" almost everywhere mainly due to use of TRAPS (and TRAPS will itself use JavaThread once JDK-8252685 is done). Also some uses of TRAPS in the API's are wrong as, for example, monitor entry can never throw an exception.
> 
> So this cleanup tackles:
> - remove incorrect use of TRAPS
> - change "Thread*" to "JavaThread*" where applicable
> - don't use THREAD for things not related to exception processing
> - standardise the naming so that we have "JavaThread* current" rather a mix if Self/THREAD/jt etc.
> - remove unnecessary as_Java_thread() conversions
> - other misc cleanup I noticed in some functions
> 
> The cleanup is predominantly in objectMonitor.* and synchronizer.* but with a fan out to the users of those APIs. No attempt is made to cleanup the callers beyond ensuring we have a suitable JavaThread reference for the calls. 
> 
> Thanks,
> David

David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:

 - Merge branch 'master' into 8262910-sync-traps
 - Updated request_deflate_idle_monitors as it can only be called by a JavaThread via WhiteBox API
 - Fix typo
 - Fixed up BiasedLocking code in ObjectSynchronizer::enter
 - iFixed alignment in macro
 - More pointer declaration style fixups
 - ObjectMonitor::exit can't actually throw IMSE so replaced TRAPS with JavaThread* current
 - Style fix: Thread *  -> Thread* in type declarations
 - Forgot to updated Graal config for JVMCI structs change
 - 8262910: Cleanup THREAD/TRAPS/naming and typing issues in ObjectMonitor and related code

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2802/files
  - new: https://git.openjdk.java.net/jdk/pull/2802/files/e8e7674b..b493c2e9

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2802&range=04
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2802&range=03-04

  Stats: 8483 lines in 272 files changed: 4864 ins; 2218 del; 1401 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2802.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2802/head:pull/2802

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


More information about the hotspot-runtime-dev mailing list