1 /*
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
46 private static OopField threadGroupNameField;
47 private static IntField threadGroupNThreadsField;
48 private static OopField threadGroupThreadsField;
49 private static IntField threadGroupNGroupsField;
50 private static OopField threadGroupGroupsField;
51 // Thread fields
52 private static OopField threadNameField;
53 private static OopField threadGroupField;
54 private static LongField threadEETopField;
55 //tid field is new since 1.5
56 private static LongField threadTIDField;
57 // threadStatus field is new since 1.5
58 private static IntField threadStatusField;
59 // parkBlocker field is new since 1.6
60 private static OopField threadParkBlockerField;
61
62 private static IntField threadPriorityField;
63 private static BooleanField threadDaemonField;
64
65 // possible values of java_lang_Thread::ThreadStatus
66 private static int THREAD_STATUS_NEW;
67
68 private static int THREAD_STATUS_RUNNABLE;
69 private static int THREAD_STATUS_SLEEPING;
70 private static int THREAD_STATUS_IN_OBJECT_WAIT;
71 private static int THREAD_STATUS_IN_OBJECT_WAIT_TIMED;
72 private static int THREAD_STATUS_PARKED;
73 private static int THREAD_STATUS_PARKED_TIMED;
74 private static int THREAD_STATUS_BLOCKED_ON_MONITOR_ENTER;
75 private static int THREAD_STATUS_TERMINATED;
76
77 // java.util.concurrent.locks.AbstractOwnableSynchronizer fields
78 private static OopField absOwnSyncOwnerThreadField;
79
80 private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
81
82 static {
83 VM.registerVMInitializedObserver(new Observer() {
84 public void update(Observable o, Object data) {
85 initialize(VM.getVM().getTypeDataBase());
86 }
87 });
88 }
89
90 private static synchronized void initialize(TypeDataBase db) {
91 // FIXME: don't need this observer; however, do need a VM resumed
92 // and suspended observer to refetch fields
93 }
94
95 public static String charArrayToString(TypeArray charArray) {
|
1 /*
2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
46 private static OopField threadGroupNameField;
47 private static IntField threadGroupNThreadsField;
48 private static OopField threadGroupThreadsField;
49 private static IntField threadGroupNGroupsField;
50 private static OopField threadGroupGroupsField;
51 // Thread fields
52 private static OopField threadNameField;
53 private static OopField threadGroupField;
54 private static LongField threadEETopField;
55 //tid field is new since 1.5
56 private static LongField threadTIDField;
57 // threadStatus field is new since 1.5
58 private static IntField threadStatusField;
59 // parkBlocker field is new since 1.6
60 private static OopField threadParkBlockerField;
61
62 private static IntField threadPriorityField;
63 private static BooleanField threadDaemonField;
64
65 // possible values of java_lang_Thread::ThreadStatus
66 public static int THREAD_STATUS_NEW;
67
68 public static int THREAD_STATUS_RUNNABLE;
69 public static int THREAD_STATUS_SLEEPING;
70 public static int THREAD_STATUS_IN_OBJECT_WAIT;
71 public static int THREAD_STATUS_IN_OBJECT_WAIT_TIMED;
72 public static int THREAD_STATUS_PARKED;
73 public static int THREAD_STATUS_PARKED_TIMED;
74 public static int THREAD_STATUS_BLOCKED_ON_MONITOR_ENTER;
75 public static int THREAD_STATUS_TERMINATED;
76
77 // java.util.concurrent.locks.AbstractOwnableSynchronizer fields
78 private static OopField absOwnSyncOwnerThreadField;
79
80 private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
81
82 static {
83 VM.registerVMInitializedObserver(new Observer() {
84 public void update(Observable o, Object data) {
85 initialize(VM.getVM().getTypeDataBase());
86 }
87 });
88 }
89
90 private static synchronized void initialize(TypeDataBase db) {
91 // FIXME: don't need this observer; however, do need a VM resumed
92 // and suspended observer to refetch fields
93 }
94
95 public static String charArrayToString(TypeArray charArray) {
|