diff --git a/src/hotspot/share/runtime/threadLocalStorage.hpp b/src/hotspot/share/runtime/threadLocalStorage.hpp index 604b624757e6f..d7c4a68929396 100644 --- a/src/hotspot/share/runtime/threadLocalStorage.hpp +++ b/src/hotspot/share/runtime/threadLocalStorage.hpp @@ -26,6 +26,7 @@ #define SHARE_RUNTIME_THREADLOCALSTORAGE_HPP #include "memory/allStatic.hpp" +#include "utilities/globalDefinitions.hpp" // forward-decl as we can't have an include cycle class Thread; diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index a374b9cdc932b..922eb44293a7c 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -1023,6 +1023,10 @@ enum JavaThreadState { _thread_max_state = 12 // maximum thread state+1 - used for statistics allocation }; +// Redefine Thread as BaseThread to avoid duplicate symbol issues for +// JDK static builds. See runtime/thread.hpp for Thread class. +#define Thread HotspotBaseThread + enum LockingMode { // Use only heavy monitors for locking LM_MONITOR = 0, diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java index 8267f12a9e9ac..7e767d184e953 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java @@ -49,7 +49,7 @@ public void update(Observable o, Object data) { } private static synchronized void initialize(TypeDataBase db) { - Type typeThread = db.lookupType("Thread"); + Type typeThread = db.lookupType("HotspotBaseThread"); Type typeJavaThread = db.lookupType("JavaThread"); suspendFlagsField = typeJavaThread.getCIntegerField("_suspend_flags");