8289004: investigate if SharedRuntime::get_java_tid parameter should be a JavaThread*

Reviewed-by: dholmes, jsjolen
This commit is contained in:
Robbin Ehn 2022-10-05 12:44:20 +00:00
parent b9eeec2b6b
commit 979efd4174
5 changed files with 23 additions and 23 deletions

View File

@ -56,11 +56,11 @@ class MemAllocator::Allocation: StackObj {
bool check_out_of_memory();
void verify_before();
void verify_after();
void notify_allocation();
void notify_allocation(JavaThread* thread);
void notify_allocation_jvmti_sampler();
void notify_allocation_low_memory_detector();
void notify_allocation_jfr_sampler();
void notify_allocation_dtrace_sampler();
void notify_allocation_dtrace_sampler(JavaThread* thread);
void check_for_bad_heap_word_value() const;
#ifdef ASSERT
void check_for_valid_allocation_state() const;
@ -84,7 +84,7 @@ public:
~Allocation() {
if (!check_out_of_memory()) {
verify_after();
notify_allocation();
notify_allocation(_thread);
}
}
@ -235,21 +235,21 @@ void MemAllocator::Allocation::notify_allocation_jfr_sampler() {
}
}
void MemAllocator::Allocation::notify_allocation_dtrace_sampler() {
void MemAllocator::Allocation::notify_allocation_dtrace_sampler(JavaThread* thread) {
if (DTraceAllocProbes) {
// support for Dtrace object alloc event (no-op most of the time)
Klass* klass = obj()->klass();
size_t word_size = _allocator._word_size;
if (klass != NULL && klass->name() != NULL) {
SharedRuntime::dtrace_object_alloc(Thread::current(), obj(), word_size);
SharedRuntime::dtrace_object_alloc(thread, obj(), word_size);
}
}
}
void MemAllocator::Allocation::notify_allocation() {
void MemAllocator::Allocation::notify_allocation(JavaThread* thread) {
notify_allocation_low_memory_detector();
notify_allocation_jfr_sampler();
notify_allocation_dtrace_sampler();
notify_allocation_dtrace_sampler(thread);
notify_allocation_jvmti_sampler();
}

View File

@ -1626,7 +1626,7 @@ void PhaseMacroExpand::expand_dtrace_alloc_probe(AllocateNode* alloc, Node* oop,
int size = TypeFunc::Parms + 2;
CallLeafNode *call = new CallLeafNode(OptoRuntime::dtrace_object_alloc_Type(),
CAST_FROM_FN_PTR(address,
static_cast<int (*)(Thread*, oopDesc*)>(SharedRuntime::dtrace_object_alloc)),
static_cast<int (*)(JavaThread*, oopDesc*)>(SharedRuntime::dtrace_object_alloc)),
"dtrace_object_alloc",
TypeRawPtr::BOTTOM);

View File

@ -996,15 +996,15 @@ JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* current,
InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
JRT_END
jlong SharedRuntime::get_java_tid(Thread* thread) {
if (thread != NULL && thread->is_Java_thread()) {
Thread* current = Thread::current();
guarantee(current != thread || JavaThread::cast(thread)->is_oop_safe(),
"current cannot touch oops after its GC barrier is detached.");
oop obj = JavaThread::cast(thread)->threadObj();
return (obj == NULL) ? 0 : java_lang_Thread::thread_id(obj);
jlong SharedRuntime::get_java_tid(JavaThread* thread) {
assert(thread != NULL, "No thread");
if (thread == NULL) {
return 0;
}
return 0;
guarantee(Thread::current() != thread || thread->is_oop_safe(),
"current cannot touch oops after its GC barrier is detached.");
oop obj = thread->threadObj();
return (obj == NULL) ? 0 : java_lang_Thread::thread_id(obj);
}
/**
@ -1013,14 +1013,14 @@ jlong SharedRuntime::get_java_tid(Thread* thread) {
* 6254741. Once that is fixed we can remove the dummy return value.
*/
int SharedRuntime::dtrace_object_alloc(oopDesc* o) {
return dtrace_object_alloc(Thread::current(), o, o->size());
return dtrace_object_alloc(JavaThread::current(), o, o->size());
}
int SharedRuntime::dtrace_object_alloc(Thread* thread, oopDesc* o) {
int SharedRuntime::dtrace_object_alloc(JavaThread* thread, oopDesc* o) {
return dtrace_object_alloc(thread, o, o->size());
}
int SharedRuntime::dtrace_object_alloc(Thread* thread, oopDesc* o, size_t size) {
int SharedRuntime::dtrace_object_alloc(JavaThread* thread, oopDesc* o, size_t size) {
assert(DTraceAllocProbes, "wrong call");
Klass* klass = o->klass();
Symbol* name = klass->name();

View File

@ -277,14 +277,14 @@ class SharedRuntime: AllStatic {
// dtrace notifications
static int dtrace_object_alloc(oopDesc* o);
static int dtrace_object_alloc(Thread* thread, oopDesc* o);
static int dtrace_object_alloc(Thread* thread, oopDesc* o, size_t size);
static int dtrace_object_alloc(JavaThread* thread, oopDesc* o);
static int dtrace_object_alloc(JavaThread* thread, oopDesc* o, size_t size);
static int dtrace_method_entry(JavaThread* thread, Method* m);
static int dtrace_method_exit(JavaThread* thread, Method* m);
// Utility method for retrieving the Java thread id, returns 0 if the
// thread is not a well formed Java thread.
static jlong get_java_tid(Thread* thread);
static jlong get_java_tid(JavaThread* thread);
// used by native wrappers to re-enable yellow if overflow happened in native code

View File

@ -240,7 +240,7 @@ ObjectMonitor* MonitorList::Iterator::next() {
#endif // ndef DTRACE_ENABLED
// This exists only as a workaround of dtrace bug 6254741
int dtrace_waited_probe(ObjectMonitor* monitor, Handle obj, Thread* thr) {
int dtrace_waited_probe(ObjectMonitor* monitor, Handle obj, JavaThread* thr) {
DTRACE_MONITOR_PROBE(waited, monitor, obj(), thr);
return 0;
}