MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / isJavaThread

Method isJavaThread

src/vmStructs.h:401–406  ·  view source on GitHub ↗

This thread is considered a JavaThread if at least 2 of the selected 3 vtable entries match those of a known JavaThread (which is either application thread or AttachListener). Indexes were carefully chosen to work on OpenJDK 8 to 25, both product an debug builds.

Source from the content-addressed store, hash-verified

399 // match those of a known JavaThread (which is either application thread or AttachListener).
400 // Indexes were carefully chosen to work on OpenJDK 8 to 25, both product an debug builds.
401 bool isJavaThread() {
402 const void** vtbl = vtable();
403 return (vtbl[1] == _java_thread_vtbl[1]) +
404 (vtbl[3] == _java_thread_vtbl[3]) +
405 (vtbl[5] == _java_thread_vtbl[5]) >= 2;
406 }
407
408 int state() {
409 return _thread_state_offset >= 0 ? *(int*) at(_thread_state_offset) : 0;

Callers 1

walkVMMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected