8252526: Remove excessive inclusion of jvmti.h and jvmtiExport.hpp

Reviewed-by: ihse, kbarrett
This commit is contained in:
Ioi Lam 2020-11-12 01:45:27 +00:00
parent ccb48b7203
commit 2f06893a29
65 changed files with 197 additions and 106 deletions

@ -30,6 +30,7 @@
#include "memory/resourceArea.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/safepoint.hpp"
#define __ masm->

@ -29,6 +29,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "memory/allocation.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/flags/flagSetting.hpp"
#include "runtime/frame.inline.hpp"

@ -35,6 +35,7 @@
#include "oops/method.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/sharedRuntime.hpp"

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@
#include "memory/resourceArea.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/safepoint.hpp"
#define __ masm->

@ -34,6 +34,7 @@
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/frame.inline.hpp"
#include "utilities/preserveException.hpp"

@ -34,6 +34,7 @@
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/sharedRuntime.hpp"

@ -31,6 +31,7 @@
#include "interp_masm_ppc.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "oops/methodData.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/safepointMechanism.hpp"

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -30,6 +30,7 @@
#include "memory/resourceArea.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/safepoint.hpp"
#define __ masm->

@ -31,6 +31,7 @@
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/frame.inline.hpp"
#include "utilities/preserveException.hpp"

@ -36,6 +36,7 @@
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/safepointMechanism.hpp"

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -30,6 +30,7 @@
#include "memory/resourceArea.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/safepoint.hpp"
// TSO ensures that loads are blocking and ordered with respect to

@ -31,6 +31,7 @@
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/frame.inline.hpp"
#include "utilities/preserveException.hpp"

@ -34,6 +34,7 @@
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/safepointMechanism.hpp"

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@
#include "memory/resourceArea.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/safepoint.hpp"
#define __ masm->

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@
#include "memory/resourceArea.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/safepoint.hpp"
#define __ masm->

@ -32,6 +32,7 @@
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/flags/flagSetting.hpp"
#include "runtime/frame.inline.hpp"

@ -33,6 +33,7 @@
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/safepointMechanism.hpp"

@ -36,6 +36,7 @@
#include "code/vtableStubs.hpp"
#include "compiler/compileBroker.hpp"
#include "interpreter/interpreter.hpp"
#include "jvmtifiles/jvmti.h"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "libo4.hpp"

@ -32,6 +32,7 @@
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/interpreter.hpp"
#include "jvmtifiles/jvmti.h"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/allocation.inline.hpp"

@ -32,6 +32,7 @@
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/interpreter.hpp"
#include "jvmtifiles/jvmti.h"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/allocation.inline.hpp"

@ -37,6 +37,7 @@
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/interpreter.hpp"
#include "jvmtifiles/jvmti.h"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/allocation.inline.hpp"

@ -30,6 +30,7 @@
#include "memory/resourceArea.hpp"
#include "oops/compressedOops.hpp"
#include "oops/method.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/handles.inline.hpp"

@ -55,6 +55,7 @@
#include "oops/objArrayOop.inline.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/atomic.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/fieldDescriptor.inline.hpp"

@ -37,6 +37,7 @@
#include "oops/constantPool.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/handles.inline.hpp"

@ -33,6 +33,7 @@
#include "memory/metadataFactory.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/signature.hpp"

@ -26,6 +26,7 @@
#include "classfile/altHashing.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/javaThreadStatus.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
@ -1815,18 +1816,18 @@ jlong java_lang_Thread::stackSize(oop java_thread) {
// Write the thread status value to threadStatus field in java.lang.Thread java class.
void java_lang_Thread::set_thread_status(oop java_thread,
java_lang_Thread::ThreadStatus status) {
java_thread->int_field_put(_thread_status_offset, status);
JavaThreadStatus status) {
java_thread->int_field_put(_thread_status_offset, static_cast<int>(status));
}
// Read thread status value from threadStatus field in java.lang.Thread java class.
java_lang_Thread::ThreadStatus java_lang_Thread::get_thread_status(oop java_thread) {
JavaThreadStatus java_lang_Thread::get_thread_status(oop java_thread) {
// Make sure the caller is operating on behalf of the VM or is
// running VM code (state == _thread_in_vm).
assert(Threads_lock->owned_by_self() || Thread::current()->is_VM_thread() ||
JavaThread::current()->thread_state() == _thread_in_vm,
"Java Thread is not running in vm");
return (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
return static_cast<JavaThreadStatus>(java_thread->int_field(_thread_status_offset));
}
@ -1839,17 +1840,17 @@ oop java_lang_Thread::park_blocker(oop java_thread) {
}
const char* java_lang_Thread::thread_status_name(oop java_thread) {
ThreadStatus status = (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
JavaThreadStatus status = static_cast<JavaThreadStatus>(java_thread->int_field(_thread_status_offset));
switch (status) {
case NEW : return "NEW";
case RUNNABLE : return "RUNNABLE";
case SLEEPING : return "TIMED_WAITING (sleeping)";
case IN_OBJECT_WAIT : return "WAITING (on object monitor)";
case IN_OBJECT_WAIT_TIMED : return "TIMED_WAITING (on object monitor)";
case PARKED : return "WAITING (parking)";
case PARKED_TIMED : return "TIMED_WAITING (parking)";
case BLOCKED_ON_MONITOR_ENTER : return "BLOCKED (on object monitor)";
case TERMINATED : return "TERMINATED";
case JavaThreadStatus::NEW : return "NEW";
case JavaThreadStatus::RUNNABLE : return "RUNNABLE";
case JavaThreadStatus::SLEEPING : return "TIMED_WAITING (sleeping)";
case JavaThreadStatus::IN_OBJECT_WAIT : return "WAITING (on object monitor)";
case JavaThreadStatus::IN_OBJECT_WAIT_TIMED : return "TIMED_WAITING (on object monitor)";
case JavaThreadStatus::PARKED : return "WAITING (parking)";
case JavaThreadStatus::PARKED_TIMED : return "TIMED_WAITING (parking)";
case JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER : return "BLOCKED (on object monitor)";
case JavaThreadStatus::TERMINATED : return "TERMINATED";
default : return "UNKNOWN";
};
}

@ -26,7 +26,6 @@
#define SHARE_CLASSFILE_JAVACLASSES_HPP
#include "classfile/systemDictionary.hpp"
#include "jvmtifiles/jvmti.h"
#include "oops/oop.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/symbol.hpp"
@ -421,41 +420,10 @@ class java_lang_Thread : AllStatic {
// Blocker object responsible for thread parking
static oop park_blocker(oop java_thread);
// Java Thread Status for JVMTI and M&M use.
// This thread status info is saved in threadStatus field of
// java.lang.Thread java class.
enum ThreadStatus {
NEW = 0,
RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running
JVMTI_THREAD_STATE_RUNNABLE,
SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep()
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
JVMTI_THREAD_STATE_SLEEPING,
IN_OBJECT_WAIT = JVMTI_THREAD_STATE_ALIVE + // Object.wait()
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
IN_OBJECT_WAIT_TIMED = JVMTI_THREAD_STATE_ALIVE + // Object.wait(long)
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
PARKED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park()
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
JVMTI_THREAD_STATE_PARKED,
PARKED_TIMED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park(long)
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
JVMTI_THREAD_STATE_PARKED,
BLOCKED_ON_MONITOR_ENTER = JVMTI_THREAD_STATE_ALIVE + // (re-)entering a synchronization block
JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER,
TERMINATED = JVMTI_THREAD_STATE_TERMINATED
};
// Write thread status info to threadStatus field of java.lang.Thread.
static void set_thread_status(oop java_thread_oop, ThreadStatus status);
static void set_thread_status(oop java_thread_oop, JavaThreadStatus status);
// Read thread status info from threadStatus field of java.lang.Thread.
static ThreadStatus get_thread_status(oop java_thread_oop);
static JavaThreadStatus get_thread_status(oop java_thread_oop);
static const char* thread_status_name(oop java_thread_oop);

@ -0,0 +1,62 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_CLASSFILE_JAVATHREADSTATUS_HPP
#define SHARE_CLASSFILE_JAVATHREADSTATUS_HPP
#include "jvmtifiles/jvmti.h"
// Java Thread Status for JVMTI and M&M use.
// This thread status info is saved in threadStatus field of
// java.lang.Thread java class.
enum class JavaThreadStatus : int {
NEW = 0,
RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running
JVMTI_THREAD_STATE_RUNNABLE,
SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep()
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
JVMTI_THREAD_STATE_SLEEPING,
IN_OBJECT_WAIT = JVMTI_THREAD_STATE_ALIVE + // Object.wait()
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
IN_OBJECT_WAIT_TIMED = JVMTI_THREAD_STATE_ALIVE + // Object.wait(long)
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
PARKED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park()
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
JVMTI_THREAD_STATE_PARKED,
PARKED_TIMED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park(long)
JVMTI_THREAD_STATE_WAITING +
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
JVMTI_THREAD_STATE_PARKED,
BLOCKED_ON_MONITOR_ENTER = JVMTI_THREAD_STATE_ALIVE + // (re-)entering a synchronization block
JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER,
TERMINATED = JVMTI_THREAD_STATE_TERMINATED
};
#endif // SHARE_CLASSFILE_JAVATHREADSTATUS_HPP

@ -57,6 +57,7 @@
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,7 @@
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
#include "prims/forte.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/mutexLocker.hpp"

@ -34,6 +34,7 @@
#include "oops/methodData.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/nativeLookup.hpp"
#include "runtime/frame.hpp"
#include "runtime/globals_extension.hpp"

@ -46,6 +46,7 @@
#include "oops/methodData.hpp"
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/nativeLookup.hpp"
#include "prims/whitebox.hpp"
#include "runtime/arguments.hpp"

@ -27,6 +27,7 @@
#include "compiler/compilerOracle.hpp"
#include "compiler/tieredThresholdPolicy.hpp"
#include "memory/resourceArea.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/globals_extension.hpp"

@ -34,6 +34,7 @@
#include "gc/shenandoah/shenandoahStringDedup.hpp"
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/thread.hpp"
ShenandoahWeakSerialRoot::ShenandoahWeakSerialRoot(ShenandoahWeakSerialRoot::WeakOopsDo weak_oops_do,

@ -31,6 +31,7 @@
#include "interpreter/templateTable.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/timerTrace.hpp"
#include "utilities/copy.hpp"

@ -32,6 +32,7 @@
#include "jfr/support/jfrThreadId.hpp"
#include "jfr/support/jfrThreadLocal.hpp"
#include "jfr/utilities/jfrTime.hpp"
#include "jfrfiles/jfrEventClasses.hpp"
#include "logging/log.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/os.hpp"
@ -192,7 +193,7 @@ void OSThreadSampler::protected_task(const os::SuspendedThreadTaskContext& conte
ev->set_starttime(_suspend_time);
ev->set_endtime(_suspend_time); // fake to not take an end time
ev->set_sampledThread(JFR_THREAD_ID(jth));
ev->set_state(java_lang_Thread::get_thread_status(_thread_oop));
ev->set_state(static_cast<u8>(java_lang_Thread::get_thread_status(_thread_oop)));
}
}
}
@ -222,7 +223,7 @@ static void write_native_event(JfrThreadSampleClosure& closure, JavaThread* jt,
EventNativeMethodSample *ev = closure.next_event_native();
ev->set_starttime(JfrTicks::now());
ev->set_sampledThread(JFR_THREAD_ID(jt));
ev->set_state(java_lang_Thread::get_thread_status(thread_oop));
ev->set_state(static_cast<u8>(java_lang_Thread::get_thread_status(thread_oop)));
}
void JfrNativeSamplerCallback::call() {

@ -30,6 +30,7 @@
#include "jvmci/jvmciRuntime.hpp"
#include "memory/universe.hpp"
#include "oops/compressedOops.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/jniHandles.inline.hpp"

@ -43,6 +43,7 @@
#include "oops/constantPool.inline.hpp"
#include "oops/method.inline.hpp"
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "prims/nativeLookup.hpp"
#include "runtime/atomic.hpp"

@ -32,6 +32,7 @@
#include "memory/universe.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/jniHandles.inline.hpp"
#include "runtime/javaCalls.hpp"

@ -38,6 +38,7 @@
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/atomic.hpp"
#include "runtime/biasedLocking.hpp"

@ -45,6 +45,7 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/compressedOops.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/globals_extension.hpp"

@ -57,6 +57,7 @@
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oopHandle.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/safepointVerifiers.hpp"

@ -50,6 +50,7 @@
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/atomic.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/init.hpp"

@ -45,6 +45,7 @@
#include "oops/klass.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oopHandle.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/handles.inline.hpp"

@ -49,6 +49,7 @@
#include "opto/subnode.hpp"
#include "opto/subtypenode.hpp"
#include "opto/type.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/sharedRuntime.hpp"
#include "utilities/macros.hpp"
#include "utilities/powerOfTwo.hpp"

@ -61,6 +61,7 @@
#include "opto/output.hpp"
#include "opto/runtime.hpp"
#include "opto/subnode.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/atomic.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
#include "prims/forte.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/thread.inline.hpp"

@ -32,6 +32,7 @@
#include "classfile/classLoader.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/javaThreadStatus.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/modules.hpp"
#include "classfile/symbolTable.hpp"
@ -4014,7 +4015,7 @@ static jint attach_current_thread(JavaVM *vm, void **penv, void *_args, bool dae
// Set java thread status.
java_lang_Thread::set_thread_status(thread->threadObj(),
java_lang_Thread::RUNNABLE);
JavaThreadStatus::RUNNABLE);
// Notify the debugger
if (JvmtiExport::should_post_thread_life()) {

@ -28,6 +28,7 @@
#include "jvmtifiles/jvmti.h"
#include "memory/allocation.hpp"
#include "prims/jvmtiEventController.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/thread.hpp"
#include "utilities/growableArray.hpp"

@ -36,6 +36,7 @@
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/nativeLookup.hpp"
#include "prims/unsafe.hpp"
#include "runtime/arguments.hpp"

@ -49,6 +49,7 @@
#include "oops/typeArrayOop.inline.hpp"
#include "oops/verifyOopClosure.hpp"
#include "prims/jvmtiDeferredUpdates.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
#include "prims/vectorSupport.hpp"
#include "prims/methodHandles.hpp"

@ -37,6 +37,7 @@
#include "oops/method.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jniCheck.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/javaCalls.hpp"

@ -35,6 +35,7 @@
#include "oops/markWord.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiDeferredUpdates.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/atomic.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"

@ -26,7 +26,6 @@
#define SHARE_RUNTIME_OS_HPP
#include "jvm.h"
#include "jvmtifiles/jvmti.h"
#include "metaprogramming/integralConstant.hpp"
#include "utilities/exceptions.hpp"
#include "utilities/ostream.hpp"
@ -52,6 +51,8 @@ class methodHandle;
class OSThread;
class Mutex;
struct jvmtiTimerInfo;
template<class E> class GrowableArray;
// %%%%% Moved ThreadState, START_FN, OSThread to new osThread.hpp. -- Rose

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@
#include "compiler/disassembler.hpp"
#include "oops/oop.inline.hpp"
#include "prims/forte.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/stubCodeGenerator.hpp"

@ -27,6 +27,7 @@
#include "aot/aotLoader.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/javaThreadStatus.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
@ -499,7 +500,7 @@ void Thread::start(Thread* thread) {
// exact thread state at that time. It could be in MONITOR_WAIT or
// in SLEEPING or some other state.
java_lang_Thread::set_thread_status(thread->as_Java_thread()->threadObj(),
java_lang_Thread::RUNNABLE);
JavaThreadStatus::RUNNABLE);
}
os::start_thread(thread);
}
@ -887,7 +888,7 @@ static void create_initial_thread(Handle thread_group, JavaThread* thread,
// Set thread status to running since main thread has
// been started and running.
java_lang_Thread::set_thread_status(thread_oop(),
java_lang_Thread::RUNNABLE);
JavaThreadStatus::RUNNABLE);
}
char java_version[64] = "";
@ -1818,7 +1819,7 @@ static void ensure_join(JavaThread* thread) {
// Ignore pending exception (ThreadDeath), since we are exiting anyway
thread->clear_pending_exception();
// Thread is exiting. So set thread_status field in java.lang.Thread class to TERMINATED.
java_lang_Thread::set_thread_status(threadObj(), java_lang_Thread::TERMINATED);
java_lang_Thread::set_thread_status(threadObj(), JavaThreadStatus::TERMINATED);
// Clear the native thread instance - this makes isAlive return false and allows the join()
// to complete once we've done the notify_all below
java_lang_Thread::set_thread(threadObj(), NULL);

@ -30,7 +30,6 @@
#include "gc/shared/threadLocalAllocBuffer.hpp"
#include "memory/allocation.hpp"
#include "oops/oop.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/frame.hpp"
#include "runtime/globals.hpp"
#include "runtime/handshake.hpp"
@ -63,7 +62,9 @@ class ThreadsList;
class ThreadsSMRSupport;
class JvmtiRawMonitor;
class JvmtiSampledObjectAllocEventCollector;
class JvmtiThreadState;
class JvmtiVMObjectAllocEventCollector;
class ThreadStatistics;
class ConcurrentLocksDump;
class ParkEvent;

@ -26,6 +26,7 @@
#include "precompiled.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/atomic.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/sharedRuntime.hpp"

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/javaThreadStatus.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
@ -36,6 +37,7 @@
#include "memory/resourceArea.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/objectMonitor.hpp"
@ -190,7 +192,7 @@ void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) {
if (sv->type() == T_OBJECT) {
Handle o = locs->at(0)->get_obj();
if (java_lang_Thread::get_thread_status(thread()->threadObj()) ==
java_lang_Thread::BLOCKED_ON_MONITOR_ENTER) {
JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER) {
wait_state = "waiting to re-lock in wait()";
}
print_locked_object_class_name(st, o, wait_state);

@ -32,6 +32,7 @@
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/dictionary.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/javaThreadStatus.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
@ -2331,18 +2332,18 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
declare_constant(ConstantPoolCacheEntry::tos_state_shift) \
\
/***************************************/ \
/* java_lang_Thread::ThreadStatus enum */ \
/* JavaThreadStatus enum */ \
/***************************************/ \
\
declare_constant(java_lang_Thread::NEW) \
declare_constant(java_lang_Thread::RUNNABLE) \
declare_constant(java_lang_Thread::SLEEPING) \
declare_constant(java_lang_Thread::IN_OBJECT_WAIT) \
declare_constant(java_lang_Thread::IN_OBJECT_WAIT_TIMED) \
declare_constant(java_lang_Thread::PARKED) \
declare_constant(java_lang_Thread::PARKED_TIMED) \
declare_constant(java_lang_Thread::BLOCKED_ON_MONITOR_ENTER) \
declare_constant(java_lang_Thread::TERMINATED) \
declare_constant(JavaThreadStatus::NEW) \
declare_constant(JavaThreadStatus::RUNNABLE) \
declare_constant(JavaThreadStatus::SLEEPING) \
declare_constant(JavaThreadStatus::IN_OBJECT_WAIT) \
declare_constant(JavaThreadStatus::IN_OBJECT_WAIT_TIMED) \
declare_constant(JavaThreadStatus::PARKED) \
declare_constant(JavaThreadStatus::PARKED_TIMED) \
declare_constant(JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER) \
declare_constant(JavaThreadStatus::TERMINATED) \
\
/******************************/ \
/* Debug info */ \

@ -303,7 +303,7 @@ static void initialize_ThreadInfo_constructor_arguments(JavaCallArguments* args,
waited_time = max_julong;
}
int thread_status = snapshot->thread_status();
int thread_status = static_cast<int>(snapshot->thread_status());
assert((thread_status & JMM_THREAD_STATE_FLAG_MASK) == 0, "Flags already set in thread_status in Thread object");
if (snapshot->is_ext_suspended()) {
thread_status |= JMM_THREAD_STATE_FLAG_SUSPENDED;

@ -882,17 +882,17 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
oop blocker_object = NULL;
oop blocker_object_owner = NULL;
if (_thread_status == java_lang_Thread::BLOCKED_ON_MONITOR_ENTER ||
_thread_status == java_lang_Thread::IN_OBJECT_WAIT ||
_thread_status == java_lang_Thread::IN_OBJECT_WAIT_TIMED) {
if (_thread_status == JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER ||
_thread_status == JavaThreadStatus::IN_OBJECT_WAIT ||
_thread_status == JavaThreadStatus::IN_OBJECT_WAIT_TIMED) {
if (obj() == NULL) {
// monitor no longer exists; thread is not blocked
_thread_status = java_lang_Thread::RUNNABLE;
_thread_status = JavaThreadStatus::RUNNABLE;
} else {
blocker_object = obj();
JavaThread* owner = ObjectSynchronizer::get_lock_owner(t_list, obj);
if ((owner == NULL && _thread_status == java_lang_Thread::BLOCKED_ON_MONITOR_ENTER)
if ((owner == NULL && _thread_status == JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER)
|| (owner != NULL && owner->is_attaching_via_jni())) {
// ownership information of the monitor is not available
// (may no longer be owned or releasing to some other thread)
@ -900,7 +900,7 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
// And when the owner thread is in attaching state, the java thread
// is not completely initialized. For example thread name and id
// and may not be set, so hide the attaching thread.
_thread_status = java_lang_Thread::RUNNABLE;
_thread_status = JavaThreadStatus::RUNNABLE;
blocker_object = NULL;
} else if (owner != NULL) {
blocker_object_owner = owner->threadObj();
@ -909,7 +909,7 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
}
// Support for JSR-166 locks
if (_thread_status == java_lang_Thread::PARKED || _thread_status == java_lang_Thread::PARKED_TIMED) {
if (_thread_status == JavaThreadStatus::PARKED || _thread_status == JavaThreadStatus::PARKED_TIMED) {
blocker_object = thread->current_park_blocker();
if (blocker_object != NULL && blocker_object->is_a(SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass())) {
blocker_object_owner = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(blocker_object);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@
#include "classfile/classLoader.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/javaThreadStatus.hpp"
#include "runtime/handles.hpp"
#include "runtime/init.hpp"
#include "runtime/jniHandles.hpp"
@ -194,7 +195,7 @@ private:
// protected by a ThreadsListSetter (ThreadDumpResult).
JavaThread* _thread;
OopHandle _threadObj;
java_lang_Thread::ThreadStatus _thread_status;
JavaThreadStatus _thread_status;
bool _is_ext_suspended;
bool _is_in_native;
@ -223,7 +224,7 @@ private:
public:
~ThreadSnapshot();
java_lang_Thread::ThreadStatus thread_status() { return _thread_status; }
JavaThreadStatus thread_status() { return _thread_status; }
oop threadObj() const;
@ -418,7 +419,7 @@ public:
// abstract utility class to set new thread states, and restore previous after the block exits
class JavaThreadStatusChanger : public StackObj {
private:
java_lang_Thread::ThreadStatus _old_state;
JavaThreadStatus _old_state;
JavaThread* _java_thread;
bool _is_alive;
@ -432,23 +433,23 @@ class JavaThreadStatusChanger : public StackObj {
public:
static void set_thread_status(JavaThread* java_thread,
java_lang_Thread::ThreadStatus state) {
JavaThreadStatus state) {
java_lang_Thread::set_thread_status(java_thread->threadObj(), state);
}
void set_thread_status(java_lang_Thread::ThreadStatus state) {
void set_thread_status(JavaThreadStatus state) {
if (is_alive()) {
set_thread_status(_java_thread, state);
}
}
JavaThreadStatusChanger(JavaThread* java_thread,
java_lang_Thread::ThreadStatus state) : _old_state(java_lang_Thread::NEW) {
JavaThreadStatus state) : _old_state(JavaThreadStatus::NEW) {
save_old_state(java_thread);
set_thread_status(state);
}
JavaThreadStatusChanger(JavaThread* java_thread) : _old_state(java_lang_Thread::NEW) {
JavaThreadStatusChanger(JavaThread* java_thread) : _old_state(JavaThreadStatus::NEW) {
save_old_state(java_thread);
}
@ -474,7 +475,7 @@ class JavaThreadInObjectWaitState : public JavaThreadStatusChanger {
public:
JavaThreadInObjectWaitState(JavaThread *java_thread, bool timed) :
JavaThreadStatusChanger(java_thread,
timed ? java_lang_Thread::IN_OBJECT_WAIT_TIMED : java_lang_Thread::IN_OBJECT_WAIT) {
timed ? JavaThreadStatus::IN_OBJECT_WAIT_TIMED : JavaThreadStatus::IN_OBJECT_WAIT) {
if (is_alive()) {
_stat = java_thread->get_thread_stat();
_active = ThreadService::is_thread_monitoring_contention();
@ -503,7 +504,7 @@ class JavaThreadParkedState : public JavaThreadStatusChanger {
public:
JavaThreadParkedState(JavaThread *java_thread, bool timed) :
JavaThreadStatusChanger(java_thread,
timed ? java_lang_Thread::PARKED_TIMED : java_lang_Thread::PARKED) {
timed ? JavaThreadStatus::PARKED_TIMED : JavaThreadStatus::PARKED) {
if (is_alive()) {
_stat = java_thread->get_thread_stat();
_active = ThreadService::is_thread_monitoring_contention();
@ -530,7 +531,7 @@ class JavaThreadBlockedOnMonitorEnterState : public JavaThreadStatusChanger {
bool _active;
static bool contended_enter_begin(JavaThread *java_thread) {
set_thread_status(java_thread, java_lang_Thread::BLOCKED_ON_MONITOR_ENTER);
set_thread_status(java_thread, JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER);
ThreadStatistics* stat = java_thread->get_thread_stat();
stat->contended_enter();
bool active = ThreadService::is_thread_monitoring_contention();
@ -556,7 +557,7 @@ class JavaThreadBlockedOnMonitorEnterState : public JavaThreadStatusChanger {
if (active) {
java_thread->get_thread_stat()->contended_enter_end();
}
set_thread_status(java_thread, java_lang_Thread::RUNNABLE);
set_thread_status(java_thread, JavaThreadStatus::RUNNABLE);
}
JavaThreadBlockedOnMonitorEnterState(JavaThread *java_thread, ObjectMonitor *obj_m) :
@ -587,7 +588,7 @@ class JavaThreadSleepState : public JavaThreadStatusChanger {
bool _active;
public:
JavaThreadSleepState(JavaThread *java_thread) :
JavaThreadStatusChanger(java_thread, java_lang_Thread::SLEEPING) {
JavaThreadStatusChanger(java_thread, JavaThreadStatus::SLEEPING) {
if (is_alive()) {
_stat = java_thread->get_thread_stat();
_active = ThreadService::is_thread_monitoring_contention();

@ -29,6 +29,7 @@
// you don't use their members directly. This way you don't need to include the
// complex header files that have the full definitions of these enums.
enum class JavaThreadStatus : int;
enum class JVMFlagOrigin : int;
enum JVMFlagsEnum : int;
enum class vmSymbolID : int;

@ -64,7 +64,7 @@ public class OopUtilities {
private static IntField threadPriorityField;
private static BooleanField threadDaemonField;
// possible values of java_lang_Thread::ThreadStatus
// possible values of JavaThreadStatus
public static int THREAD_STATUS_NEW;
public static int THREAD_STATUS_RUNNABLE;
@ -234,16 +234,16 @@ public class OopUtilities {
threadPriorityField = (IntField) k.findField("priority", "I");
threadDaemonField = (BooleanField) k.findField("daemon", "Z");
TypeDataBase db = VM.getVM().getTypeDataBase();
THREAD_STATUS_NEW = db.lookupIntConstant("java_lang_Thread::NEW").intValue();
THREAD_STATUS_NEW = db.lookupIntConstant("JavaThreadStatus::NEW").intValue();
THREAD_STATUS_RUNNABLE = db.lookupIntConstant("java_lang_Thread::RUNNABLE").intValue();
THREAD_STATUS_SLEEPING = db.lookupIntConstant("java_lang_Thread::SLEEPING").intValue();
THREAD_STATUS_IN_OBJECT_WAIT = db.lookupIntConstant("java_lang_Thread::IN_OBJECT_WAIT").intValue();
THREAD_STATUS_IN_OBJECT_WAIT_TIMED = db.lookupIntConstant("java_lang_Thread::IN_OBJECT_WAIT_TIMED").intValue();
THREAD_STATUS_PARKED = db.lookupIntConstant("java_lang_Thread::PARKED").intValue();
THREAD_STATUS_PARKED_TIMED = db.lookupIntConstant("java_lang_Thread::PARKED_TIMED").intValue();
THREAD_STATUS_BLOCKED_ON_MONITOR_ENTER = db.lookupIntConstant("java_lang_Thread::BLOCKED_ON_MONITOR_ENTER").intValue();
THREAD_STATUS_TERMINATED = db.lookupIntConstant("java_lang_Thread::TERMINATED").intValue();
THREAD_STATUS_RUNNABLE = db.lookupIntConstant("JavaThreadStatus::RUNNABLE").intValue();
THREAD_STATUS_SLEEPING = db.lookupIntConstant("JavaThreadStatus::SLEEPING").intValue();
THREAD_STATUS_IN_OBJECT_WAIT = db.lookupIntConstant("JavaThreadStatus::IN_OBJECT_WAIT").intValue();
THREAD_STATUS_IN_OBJECT_WAIT_TIMED = db.lookupIntConstant("JavaThreadStatus::IN_OBJECT_WAIT_TIMED").intValue();
THREAD_STATUS_PARKED = db.lookupIntConstant("JavaThreadStatus::PARKED").intValue();
THREAD_STATUS_PARKED_TIMED = db.lookupIntConstant("JavaThreadStatus::PARKED_TIMED").intValue();
THREAD_STATUS_BLOCKED_ON_MONITOR_ENTER = db.lookupIntConstant("JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER").intValue();
THREAD_STATUS_TERMINATED = db.lookupIntConstant("JavaThreadStatus::TERMINATED").intValue();
if (Assert.ASSERTS_ENABLED) {
// it is okay to miss threadStatusField, because this was