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

Serguei Spitsyn sspitsyn at openjdk.java.net
Tue Mar 9 23:53:09 UTC 2021


On Tue, 9 Mar 2021 18:52:27 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> David Holmes has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Fix typo
>>  - Fixed up BiasedLocking code in ObjectSynchronizer::enter
>>  - iFixed alignment in macro
>
> JVMTI changes look good.

Hi David,

Nice unification, looks great.
A couple of comments.

src/hotspot/share/runtime/synchronizer.cpp

 638 int ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) {
 639   JavaThread* current = THREAD->as_Java_thread();
 . . .
 652   DTRACE_MONITOR_WAIT_PROBE(monitor, obj(), current, millis);
 653   monitor->wait(millis, true, THREAD); // Not CHECK as we need following code

Is it intentional to use `THREAD` instead of `current` at line 653?

1141 bool ObjectSynchronizer::request_deflate_idle_monitors() {
1142   Thread* current = Thread::current();
 . . .
1158     if (current->is_Java_thread()) {
1159       // JavaThread has to honor the blocking protocol.
1160       ThreadBlockInVM tbivm(current->as_Java_thread());
 . . .
 
 Would it better to define `current` as at the line 639?
 There can be similar cases, e.g. the `deflate_idle_monitors()`.
 
 -Serguei

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

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


More information about the hotspot-runtime-dev mailing list