summaryrefslogtreecommitdiff
path: root/openjdkjvmti/ti_thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'openjdkjvmti/ti_thread.h')
-rw-r--r--openjdkjvmti/ti_thread.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/openjdkjvmti/ti_thread.h b/openjdkjvmti/ti_thread.h
index c6b6af1035..39f1f0725c 100644
--- a/openjdkjvmti/ti_thread.h
+++ b/openjdkjvmti/ti_thread.h
@@ -32,11 +32,14 @@
#ifndef ART_OPENJDKJVMTI_TI_THREAD_H_
#define ART_OPENJDKJVMTI_TI_THREAD_H_
+#include <unordered_map>
+
#include "jni.h"
#include "jvmti.h"
#include "base/macros.h"
#include "base/mutex.h"
+#include "thread.h"
namespace art {
class ArtField;
@@ -49,6 +52,18 @@ namespace openjdkjvmti {
class EventHandler;
+// The struct that we store in the art::Thread::custom_tls_ that maps the jvmtiEnvs to the data
+// stored with that thread. This is needed since different jvmtiEnvs are not supposed to share TLS
+// data but we only have a single slot in Thread objects to store data.
+struct JvmtiGlobalTLSData : public art::TLSData {
+ std::unordered_map<jvmtiEnv*, const void*> data GUARDED_BY(art::Locks::thread_list_lock_);
+
+ // The depth of the last frame where popping using PopFrame it is not allowed. It is set to
+ // kNoDisallowedPopFrame if all frames can be popped. See b/117615146 for more information.
+ static constexpr size_t kNoDisallowedPopFrame = -1;
+ size_t disable_pop_frame_depth = kNoDisallowedPopFrame;
+};
+
class ThreadUtil {
public:
static void Register(EventHandler* event_handler);
@@ -134,6 +149,11 @@ class ThreadUtil {
REQUIRES(!art::Locks::user_code_suspension_lock_,
!art::Locks::thread_suspend_count_lock_);
+ static JvmtiGlobalTLSData* GetGlobalTLSData(art::Thread* thread)
+ REQUIRES(art::Locks::thread_list_lock_);
+ static JvmtiGlobalTLSData* GetOrCreateGlobalTLSData(art::Thread* thread)
+ REQUIRES(art::Locks::thread_list_lock_);
+
private:
// We need to make sure only one thread tries to suspend threads at a time so we can get the
// 'suspend-only-once' behavior the spec requires. Internally, ART considers suspension to be a