aboutsummaryrefslogtreecommitdiff
path: root/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
diff options
context:
space:
mode:
Diffstat (limited to 'agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java')
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
index a42d8be68..aa5f2bc21 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -54,6 +54,8 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
private static OopField threadNameField;
private static OopField threadGroupField;
private static LongField threadEETopField;
+ //tid field is new since 1.5
+ private static LongField threadTIDField;
// threadStatus field is new since 1.5
private static IntField threadStatusField;
// parkBlocker field is new since 1.6
@@ -220,6 +222,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
threadNameField = (OopField) k.findField("name", "[C");
threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;");
threadEETopField = (LongField) k.findField("eetop", "J");
+ threadTIDField = (LongField) k.findField("tid", "J");
threadStatusField = (IntField) k.findField("threadStatus", "I");
threadParkBlockerField = (OopField) k.findField("parkBlocker",
"Ljava/lang/Object;");
@@ -268,6 +271,15 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
return VM.getVM().getThreads().createJavaThreadWrapper(addr);
}
+ public static long threadOopGetTID(Oop threadOop) {
+ initThreadFields();
+ if (threadTIDField != null) {
+ return threadTIDField.getValue(threadOop);
+ } else {
+ return 0;
+ }
+ }
+
/** returns value of java.lang.Thread.threadStatus field */
public static int threadOopGetThreadStatus(Oop threadOop) {
initThreadFields();