Mercurial > hg > graal-jvmci-8
annotate src/share/vm/prims/jvmtiEnvThreadState.hpp @ 1602:136b78722a08
6939203: JSR 292 needs method handle constants
Summary: Add new CP types CONSTANT_MethodHandle, CONSTANT_MethodType; extend 'ldc' bytecode.
Reviewed-by: twisti, never
author | jrose |
---|---|
date | Wed, 09 Jun 2010 18:50:45 -0700 |
parents | c18cbe5936b8 |
children | 126ea7725993 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 #ifndef _JAVA_JVMTIENVTHREADSTATE_H_ | |
25 #define _JAVA_JVMTIENVTHREADSTATE_H_ | |
26 | |
27 /////////////////////////////////////////////////////////////// | |
28 // | |
29 // class JvmtiFramePop | |
30 // Used by : JvmtiFramePops | |
31 // Used by JVMTI methods: none directly. | |
32 // | |
33 // Wrapper class for FramePop, used in the JvmtiFramePops class. | |
34 // | |
35 // Two problems: 1) this isn't being used as a ValueObj class, in | |
36 // several places there are constructors for it. 2) It seems like | |
37 // overkill as a means to get an assert and name the geater than | |
38 // operator. I'm trying to to rewrite everything. | |
39 | |
40 class JvmtiFramePop VALUE_OBJ_CLASS_SPEC { | |
41 private: | |
42 // Frame number counting from BOTTOM (oldest) frame; | |
43 // bottom frame == #0 | |
44 int _frame_number; | |
45 public: | |
46 JvmtiFramePop() {} | |
47 JvmtiFramePop(int frame_number) { | |
48 assert(frame_number >= 0, "invalid frame number"); | |
49 _frame_number = frame_number; | |
50 } | |
51 | |
52 int frame_number() { return _frame_number; } | |
53 int above_on_stack(JvmtiFramePop& other) { return _frame_number > other._frame_number; } | |
54 void print() PRODUCT_RETURN; | |
55 }; | |
56 | |
57 | |
58 /////////////////////////////////////////////////////////////// | |
59 // | |
60 // class JvmtiFramePops | |
61 // Used by : JvmtiThreadState | |
62 // Used by JVMTI methods: none directly. | |
63 // | |
64 // A collection of JvmtiFramePop. | |
65 // It records what frames on a threads stack should post frame_pop events when they're exited. | |
66 // | |
67 | |
68 class JvmtiFramePops : public CHeapObj { | |
69 private: | |
70 GrowableArray<int>* _pops; | |
71 | |
72 // should only be used by JvmtiEventControllerPrivate | |
73 // to insure they only occur at safepoints. | |
74 // Todo: add checks for safepoint | |
75 friend class JvmtiEventControllerPrivate; | |
76 void set(JvmtiFramePop& fp); | |
77 void clear(JvmtiFramePop& fp); | |
78 int clear_to(JvmtiFramePop& fp); | |
79 | |
80 public: | |
81 JvmtiFramePops(); | |
82 ~JvmtiFramePops(); | |
83 | |
84 bool contains(JvmtiFramePop& fp) { return _pops->contains(fp.frame_number()); } | |
85 int length() { return _pops->length(); } | |
86 void print() PRODUCT_RETURN; | |
87 }; | |
88 | |
89 | |
90 /////////////////////////////////////////////////////////////// | |
91 // | |
92 // class JvmtiEnvThreadState | |
93 // | |
94 // 2. Cache of pending frame_pop_events, created by NotifyFramePop | |
95 // and lazily initialized. | |
96 // 3: Location of last executed instruction, used to filter out duplicate | |
97 // events due to instruction rewriting. | |
98 | |
99 class JvmtiEnvThreadState : public CHeapObj { | |
100 private: | |
101 friend class JvmtiEnv; | |
102 JavaThread *_thread; | |
103 JvmtiEnv *_env; | |
104 JvmtiEnvThreadState *_next; | |
105 jmethodID _current_method_id; | |
106 int _current_bci; | |
107 bool _breakpoint_posted; | |
108 bool _single_stepping_posted; | |
109 JvmtiEnvThreadEventEnable _event_enable; | |
110 void *_agent_thread_local_storage_data; // per env and per thread agent allocated data. | |
111 | |
112 // Class used to store pending framepops. | |
113 // lazily initialized by get_frame_pops(); | |
114 JvmtiFramePops *_frame_pops; | |
115 | |
116 inline void set_current_location(jmethodID method_id, int bci) { | |
117 _current_method_id = method_id; | |
118 _current_bci = bci; | |
119 } | |
120 | |
121 friend class JvmtiEnvThreadStateIterator; | |
122 JvmtiEnvThreadState* next() { return _next; } | |
123 | |
124 friend class JvmtiThreadState; | |
125 void set_next(JvmtiEnvThreadState* link) { _next = link; } | |
126 | |
127 public: | |
128 JvmtiEnvThreadState(JavaThread *thread, JvmtiEnvBase *env); | |
129 ~JvmtiEnvThreadState(); | |
130 | |
131 bool is_enabled(jvmtiEvent event_type) { return _event_enable.is_enabled(event_type); } | |
132 | |
133 JvmtiEnvThreadEventEnable *event_enable() { return &_event_enable; } | |
134 void *get_agent_thread_local_storage_data() { return _agent_thread_local_storage_data; } | |
135 void set_agent_thread_local_storage_data (void *data) { _agent_thread_local_storage_data = data; } | |
136 | |
137 | |
138 // If the thread is in the given method at the given | |
139 // location just return. Otherwise, reset the current location | |
140 // and reset _breakpoint_posted and _single_stepping_posted. | |
141 // _breakpoint_posted and _single_stepping_posted are only cleared | |
142 // here. | |
143 void compare_and_set_current_location(methodOop method, address location, jvmtiEvent event); | |
144 | |
145 void clear_current_location() { set_current_location((jmethodID)NULL, 0); } | |
146 | |
147 void reset_current_location(jvmtiEvent event, bool enabled); | |
148 | |
149 inline void set_breakpoint_posted() { _breakpoint_posted = true; } | |
150 inline void set_single_stepping_posted() { | |
151 _single_stepping_posted = true; | |
152 } | |
153 inline bool breakpoint_posted() { return _breakpoint_posted; } | |
154 inline bool single_stepping_posted() { | |
155 return _single_stepping_posted; | |
156 } | |
157 | |
158 inline JavaThread *get_thread() { return _thread; } | |
159 inline JvmtiEnv *get_env() { return _env; } | |
160 | |
161 // lazily initialize _frame_pops | |
162 JvmtiFramePops* get_frame_pops(); | |
163 | |
164 bool has_frame_pops(); | |
165 | |
166 // quickly test whether we should deliver a frame pop event on return from sp | |
167 bool is_frame_pop(int cur_stack_depth); | |
168 | |
169 void set_frame_pop(int frame_number); | |
170 void clear_frame_pop(int frame_number); | |
171 void clear_to_frame_pop(int frame_number); | |
172 | |
173 }; | |
174 | |
175 #endif /* _JAVA_JVMTIENVTHREADSTATE_H_ */ |