1 <?xml version="1.0" encoding="UTF-8"?>
2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>
3 <!--
4 Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved.
5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
7 This code is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License version 2 only, as
9 published by the Free Software Foundation.
10
11 This code is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 version 2 for more details (a copy is included in the LICENSE file that
15 accompanied this code).
16
17 You should have received a copy of the GNU General Public License version
18 2 along with this work; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 or visit www.oracle.com if you need additional information or have any
23 questions.
24 -->
25
26 <!DOCTYPE specification [
27 <!ELEMENT specification (title, intro*, functionsection, errorsection,
28 eventsection, datasection, issuessection, changehistory)>
29 <!ATTLIST specification label CDATA #REQUIRED>
30
31 <!ELEMENT title (#PCDATA|jvmti|tm)*>
32 <!ATTLIST title subtitle CDATA #REQUIRED>
33
34 <!ELEMENT intro ANY>
35 <!ATTLIST intro id CDATA #IMPLIED
36 label CDATA "">
37
38 <!ELEMENT functionsection (intro*, category*)>
39 <!ATTLIST functionsection label CDATA #REQUIRED>
40
41 <!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*,
42 (function|callback|elide)*)>
43 <!ATTLIST category id CDATA #REQUIRED
44 label CDATA #REQUIRED>
45
46 <!ELEMENT function (synopsis, typedef*, description?, origin,
47 (capabilities|eventcapabilities),
48 parameters, errors)>
49 <!ATTLIST function id CDATA #REQUIRED
50 num CDATA #REQUIRED
51 phase (onload|onloadOnly|start|live|any) #IMPLIED
52 callbacksafe (safe|unsafe) #IMPLIED
53 impl CDATA #IMPLIED
54 hide CDATA #IMPLIED
55 jkernel (yes|no) #IMPLIED
56 since CDATA "1.0">
57
58 <!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|
59 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void),
60 synopsis, description?, parameters)>
61 <!ATTLIST callback id CDATA #REQUIRED
62 since CDATA "1.0">
63
64 <!ELEMENT synopsis (#PCDATA|jvmti)*>
65
66 <!ELEMENT typedef (description?, field*)>
67 <!ATTLIST typedef id CDATA #REQUIRED
68 label CDATA #REQUIRED
69 since CDATA "1.0">
70
71 <!ELEMENT uniontypedef (description?, field*)>
72 <!ATTLIST uniontypedef id CDATA #REQUIRED
73 label CDATA #REQUIRED
74 since CDATA "1.0">
75
76 <!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|
77 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct),
78 description)>
79 <!ATTLIST field id CDATA #REQUIRED>
80
81 <!ELEMENT capabilitiestypedef (description?, capabilityfield*)>
82 <!ATTLIST capabilitiestypedef id CDATA #REQUIRED
83 label CDATA #REQUIRED>
84
85 <!ELEMENT capabilityfield (description)>
86 <!ATTLIST capabilityfield id CDATA #REQUIRED
87 disp1 CDATA ""
88 disp2 CDATA ""
89 since CDATA "1.0">
90
91 <!ELEMENT description ANY>
92
93 <!ELEMENT capabilities (required*, capability*)>
94
95 <!ELEMENT eventcapabilities EMPTY>
96
97 <!ELEMENT required ANY>
98 <!ATTLIST required id CDATA #REQUIRED>
99
100 <!ELEMENT capability ANY>
101 <!ATTLIST capability id CDATA #REQUIRED>
102
103 <!ELEMENT parameters (param*)>
104
105 <!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|
106 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype|
107 outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf),
108 description)>
109 <!ATTLIST param id CDATA #REQUIRED>
110
111 <!ELEMENT jmethodID EMPTY>
112 <!ATTLIST jmethodID class CDATA #IMPLIED
113 native CDATA #IMPLIED>
114
115 <!ELEMENT jfieldID EMPTY>
116 <!ATTLIST jfieldID class CDATA #IMPLIED>
117
118 <!ELEMENT jclass EMPTY>
119 <!ATTLIST jclass method CDATA #IMPLIED
120 field CDATA #IMPLIED>
121
122 <!ELEMENT jframeID EMPTY>
123 <!ATTLIST jframeID thread CDATA #IMPLIED>
124
125 <!ELEMENT jrawMonitorID EMPTY>
126
127 <!ELEMENT jthread EMPTY>
128 <!ATTLIST jthread started CDATA #IMPLIED
129 null CDATA #IMPLIED
130 frame CDATA #IMPLIED
131 impl CDATA #IMPLIED>
132
133 <!ELEMENT varargs EMPTY>
134
135 <!ELEMENT jthreadGroup EMPTY>
136 <!ELEMENT jobject EMPTY>
137 <!ATTLIST jobject frame CDATA #IMPLIED>
138
139 <!ELEMENT jvalue EMPTY>
140 <!ELEMENT jchar EMPTY>
141 <!ELEMENT jint EMPTY>
142 <!ATTLIST jint min CDATA #IMPLIED>
143 <!ELEMENT jlong EMPTY>
144 <!ELEMENT jfloat EMPTY>
145 <!ELEMENT jdouble EMPTY>
146 <!ELEMENT jlocation EMPTY>
147 <!ELEMENT jboolean EMPTY>
148 <!ELEMENT char EMPTY>
149 <!ELEMENT uchar EMPTY>
150 <!ELEMENT size_t EMPTY>
151 <!ELEMENT void EMPTY>
152 <!ELEMENT enum (#PCDATA)*>
153 <!ELEMENT struct (#PCDATA)*>
154
155 <!ELEMENT nullok ANY>
156
157 <!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
158 jthreadGroup|jobject|jvalue), nullok?)>
159
160 <!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
161 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|
162 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
163 <!ATTLIST outptr impl CDATA #IMPLIED>
164
165 <!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
166 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
167 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
168 <!ATTLIST allocbuf incount CDATA #IMPLIED
169 outcount CDATA #IMPLIED>
170
171 <!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
172 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
173 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
174 <!ATTLIST allocallocbuf incount CDATA #IMPLIED
175 outcount CDATA #IMPLIED>
176
177 <!ELEMENT inptr (struct, nullok?)>
178
179 <!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
180 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
181 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
182 <!ATTLIST inbuf incount CDATA #IMPLIED>
183
184 <!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
185 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
186 jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)>
187 <!ATTLIST outbuf incount CDATA #IMPLIED
188 outcount CDATA #IMPLIED>
189
190 <!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
191 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|
192 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
193 <!ATTLIST vmbuf incount CDATA #IMPLIED
194 outcount CDATA #IMPLIED>
195
196 <!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
197 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
198 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
199 <!ATTLIST agentbuf incount CDATA #IMPLIED
200 outcount CDATA #IMPLIED>
201
202 <!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
203 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
204 jlocation|jboolean|char|uchar|size_t|void))>
205 <!ATTLIST allocfieldbuf outcount CDATA #IMPLIED>
206
207 <!ELEMENT errors (error*)>
208
209 <!ELEMENT error ANY>
210 <!ATTLIST error id CDATA #REQUIRED>
211
212 <!ELEMENT errorsection (intro*, errorcategory*)>
213 <!ATTLIST errorsection label CDATA #REQUIRED>
214
215 <!ELEMENT errorcategory (intro*, errorid*)>
216 <!ATTLIST errorcategory id CDATA #REQUIRED
217 label CDATA #REQUIRED>
218
219 <!ELEMENT errorid ANY>
220 <!ATTLIST errorid id CDATA #REQUIRED
221 num CDATA #REQUIRED>
222
223 <!ELEMENT datasection (intro*, basetypes*)>
224
225 <!ELEMENT basetypes (intro*, basetype*)>
226 <!ATTLIST basetypes id CDATA #REQUIRED
227 label CDATA #REQUIRED>
228
229 <!ELEMENT basetype (definition?,description)>
230 <!ATTLIST basetype id CDATA #REQUIRED
231 name CDATA #IMPLIED>
232
233 <!ELEMENT definition (#PCDATA|jvmti)*>
234
235 <!ELEMENT eventsection (intro*, (event|elide)*)>
236 <!ATTLIST eventsection label CDATA #REQUIRED>
237
238 <!ELEMENT event (description, origin, typedef*, capabilities, parameters)>
239 <!ATTLIST event id CDATA #REQUIRED
240 label CDATA #REQUIRED
241 const CDATA #REQUIRED
242 num CDATA #REQUIRED
243 phase (onload|start|live|any) #IMPLIED
244 filtered (thread|global) #IMPLIED
245 since CDATA "1.0">
246
247 <!ELEMENT issuessection (intro*)>
248 <!ATTLIST issuessection label CDATA #REQUIRED>
249
250 <!ELEMENT changehistory (intro*, change*)>
251 <!ATTLIST changehistory update CDATA #REQUIRED
252 id CDATA #REQUIRED>
253
254 <!ELEMENT change ANY>
255 <!ATTLIST change date CDATA #REQUIRED
256 version CDATA #IMPLIED>
257
258 <!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*>
259 <!ATTLIST functionlink id CDATA #REQUIRED>
260
261 <!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*>
262 <!ATTLIST datalink id CDATA #REQUIRED>
263
264 <!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*>
265 <!ATTLIST typelink id CDATA #REQUIRED>
266
267 <!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*>
268 <!ATTLIST fieldlink id CDATA #REQUIRED
269 struct CDATA #REQUIRED>
270
271 <!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*>
272 <!ATTLIST paramlink id CDATA #REQUIRED>
273
274 <!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*>
275 <!ATTLIST eventlink id CDATA #REQUIRED>
276
277 <!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*>
278 <!ATTLIST errorlink id CDATA #REQUIRED>
279
280 <!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*>
281 <!ATTLIST externallink id CDATA #REQUIRED>
282
283 <!ELEMENT vmspec EMPTY>
284 <!ATTLIST vmspec chapter CDATA #IMPLIED>
285
286 <!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*>
287 <!ATTLIST internallink id CDATA #REQUIRED>
288
289 <!ELEMENT functionphaselist EMPTY>
290 <!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED>
291
292 <!ELEMENT eventphaselist EMPTY>
293 <!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED>
294
295 <!ELEMENT issue ANY>
296
297 <!ELEMENT rationale ANY>
298
299 <!ELEMENT todo ANY>
300
301 <!ELEMENT origin (#PCDATA)*>
302
303 <!ELEMENT elide (intro|function|callback|event)*>
304 <!ATTLIST elide why CDATA #IMPLIED>
305
306 <!ELEMENT constants (constant*)>
307 <!ATTLIST constants id CDATA #REQUIRED
308 label CDATA #REQUIRED
309 kind (enum|bits|const) #REQUIRED
310 since CDATA "1.0">
311
312 <!ELEMENT constant ANY>
313 <!ATTLIST constant id CDATA #REQUIRED
314 num CDATA #REQUIRED>
315
316 <!ELEMENT tm (#PCDATA)>
317
318 <!ELEMENT i (#PCDATA|jvmti|tm)*>
319
320 <!ELEMENT b (#PCDATA|jvmti|code)*>
321
322 <!ELEMENT code (#PCDATA|space)*>
323
324 <!ELEMENT pre ANY>
325
326 <!ELEMENT space EMPTY>
327
328 <!ELEMENT jvmti EMPTY>
329
330 <!ELEMENT example (#PCDATA|i)*>
331
332 <!ELEMENT br EMPTY>
333
334 <!ELEMENT p EMPTY>
335
336 <!ELEMENT blockquote ANY>
337
338 <!ELEMENT dl (dt|dd)+>
339
340 <!ELEMENT dd ANY>
341
342 <!ELEMENT dt (#PCDATA|jvmti|code|i|b)*>
343
344 <!ELEMENT table (tr)+>
345
346 <!ELEMENT tr (td|th)*>
347 <!ATTLIST tr class CDATA #IMPLIED>
348
349 <!ELEMENT td ANY>
350 <!ATTLIST td class CDATA #IMPLIED>
351
352 <!ELEMENT th ANY>
353 <!ATTLIST th class CDATA #IMPLIED
354 scope (col|row) #IMPLIED>
355
356 <!ELEMENT ul (li)+>
357 <!ATTLIST ul type (disc|circle|square) "disc">
358
359 <!ELEMENT li ANY>
360 ]>
361
362 <specification label="JVM(TM) Tool Interface">
363 <title subtitle="Version">
364 <tm>JVM</tm> Tool Interface
365 </title>
366
367 <intro id="whatIs" label="What is the JVM Tool Interface?">
368 The <tm>JVM</tm> Tool Interface (<jvmti/>)
369 is a programming interface used by development and monitoring tools.
370 It provides both a way to inspect the state and
371 to control the execution of applications running in the
372 <tm>Java</tm> virtual machine (VM).
373 <p/>
374 <jvmti/> is intended to provide a VM interface for the full breadth of tools
375 that need access to VM state, including but not limited to: profiling,
376 debugging, monitoring, thread analysis, and coverage analysis tools.
377 <p/>
378 <jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual
379 machine.
380 <p/>
381 <jvmti/> is a two-way interface.
382 A client of <jvmti/>, hereafter called an <i>agent</i>,
383 can be notified of
384 interesting occurrences through <internallink id="EventSection">events</internallink>.
385 <jvmti/>
386 can query and control the application through many
387 <internallink id="FunctionSection">functions</internallink>,
388 either in response to events or
389 independent of them.
390 <p/>
391 Agents run in the same process with and communicate directly with
392 the virtual machine executing
393 the application being examined. This communication is
394 through a native interface (<jvmti/>). The native in-process interface allows
395 maximal control with minimal intrusion on the part of a tool.
396 Typically, agents are relatively compact. They can be controlled
397 by a separate process which implements the bulk of a tool's
398 function without interfering with the target application's normal execution.
399 </intro>
400
401 <intro id="architecture" label="Architecture">
402 Tools can be written directly to <jvmti/> or indirectly
403 through higher level interfaces.
404 The Java Platform Debugger Architecture includes <jvmti/>, but also
405 contains higher-level, out-of-process debugger interfaces. The higher-level
406 interfaces are more appropriate than <jvmti/> for many tools.
407 For more information on the Java Platform Debugger Architecture,
408 see the
409 <externallink id="jpda/architecture.html">Java
410 Platform Debugger Architecture website</externallink>.
411 </intro>
412
413 <intro id="writingAgents" label="Writing Agents">
414 Agents can be written in any native language that supports C
415 language calling conventions and C or C++
416 definitions.
417 <p/>
418 The function, event, data type, and constant definitions needed for
419 using <jvmti/> are defined in the include file <code>jvmti.h</code>.
420 To use these definitions add the <tm>J2SE</tm> include directory
421 to your include path and add
422 <example>
423 #include <jvmti.h>
424 </example>
425 to your source code.
426 </intro>
427
428 <intro id="deployingAgents" label="Deploying Agents">
429 An agent is deployed in a platform specific manner but is typically the
430 platform equivalent of a dynamic library. On the <tm>Windows</tm> operating
431 system, for example, an agent library is a "Dynamic Linked Library" (DLL).
432 On <tm>Linux</tm> Operating Environment, an agent library is a shared object
433 (<code>.so</code> file).
434 <p/>
435
436 An agent may be started at VM startup by specifying the agent library
437 name using a <internallink id="starting">command line option</internallink>.
438 Some implementations may support a mechanism to <internallink id="onattach">
439 start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>.
440 The details of how this is initiated are implementation specific.
441 </intro>
442
443 <intro id="entryPoint" label="Statically Linked Agents (since version 1.2.3)">
444
445 A native JVMTI Agent may be <i>statically linked</i> with the VM.
446 The manner in which the library and VM image are combined is
447 implementation-dependent.
448 An agent L whose image has been combined with the VM is defined as
449 <i>statically linked</i> if and only if the agent exports a function
450 called Agent_OnLoad_L.
451 <p/>
452 If a <i>statically linked</i> agent L exports a function called
453 Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad
454 function will be ignored.
455 If an agent L is <i>statically linked</i>, an Agent_OnLoad_L
456 function will be invoked with the same arguments and expected return
457 value as specified for the Agent_OnLoad function.
458 An agent L that is <i>statically linked</i> will prohibit an agent of
459 the same name from being loaded dynamically.
460 <p/>
461 The VM will invoke the Agent_OnUnload_L function of the agent, if such
462 a function is exported, at the same point during VM execution as it would
463 have called the dynamic entry point Agent_OnUnLoad. A statically loaded
464 agent cannot be unloaded. The Agent_OnUnload_L function will still be
465 called to do any other agent shutdown related tasks.
466 If a <i>statically linked</i> agent L exports a function called
467 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad
468 function will be ignored.
469 <p/>
470 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function
471 will be invoked with the same arguments and expected return value as
472 specified for the Agent_OnAttach function.
473 If a <i>statically linked</i> agent L exports a function called
474 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach
475 function will be ignored.
476 </intro>
477
478 <intro id="starting" label="Agent Command Line Options">
479 The term "command-line option" is used below to
480 mean options supplied in the <code>JavaVMInitArgs</code> argument
481 to the <code>JNI_CreateJavaVM</code> function of the JNI
482 Invocation API.
483 <p/>
484 One of the two following
485 command-line options is used on VM startup to
486 properly load and run agents.
487 These arguments identify the library containing
488 the agent as well as an options
489 string to be passed in at startup.
490 <dl>
491 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt>
492 <dd>
493 The name following <code>-agentlib:</code> is the name of the
494 library to load. Lookup of the library, both its full name and location,
495 proceeds in a platform-specific manner.
496 Typically, the <i><agent-lib-name></i> is expanded to an
497 operating system specific file name.
498 The <i><options></i> will be passed to the agent on start-up.
499 For example, if the option
500 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to
501 load the shared library <code>foo.dll</code> from the system <code>PATH</code>
502 under <tm>Windows</tm> or <code>libfoo.so</code> from the
503 <code>LD_LIBRARY_PATH</code> under <tm>Linux</tm>.
504 If the agent library is statically linked into the executable
505 then no actual loading takes place.
506 <p/>
507 </dd>
508 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt>
509 <dd>
510 The path following <code>-agentpath:</code> is the absolute path from which
511 to load the library.
512 No library name expansion will occur.
513 The <i><options></i> will be passed to the agent on start-up.
514 For example, if the option
515 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to
516 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent
517 library is statically linked into the executable
518 then no actual loading takes place.
519 <p/>
520 </dd>
521 </dl>
522 For a dynamic shared library agent, the start-up routine
523 <internallink id="onload"><code>Agent_OnLoad</code></internallink>
524 in the library will be invoked. If the agent library is statically linked
525 into the executable then the system will attempt to invoke the
526 <code>Agent_OnLoad_<agent-lib-name></code> entry point where
527 <agent-lib-name> is the basename of the
528 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>,
529 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine.
530 <p/>
531 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code>
532 will be searched for JNI native method implementations to facilitate the
533 use of Java programming language code in tools, as is needed for
534 <internallink id="bci">bytecode instrumentation</internallink>.
535 <p/>
536 The agent libraries will be searched after all other libraries have been
537 searched (agents wishing to override or intercept the native method
538 implementations of non-agent methods can use the
539 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>).
540 <p/>
541 These switches do the above and nothing more - they do not change the
542 state of the VM or <jvmti/>. No command line options are needed
543 to enable <jvmti/>
544 or aspects of <jvmti/>, this is handled programmatically
545 by the use of
546 <internallink id="capability">capabilities</internallink>.
547 </intro>
548
549 <intro id="startup" label="Agent Start-Up">
550 The VM starts each agent by invoking a start-up function.
551 If the agent is started in the <code>OnLoad</code>
552 <functionlink id="GetPhase">phase</functionlink> the function
553 <internallink id="onload"><code>Agent_OnLoad</code></internallink>
554 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink>
555 for statically linked agents will be invoked.
556 If the agent is started in the live
557 <functionlink id="GetPhase">phase</functionlink> the function
558 <internallink id="onattach"><code>Agent_OnAttach</code></internallink>
559 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink>
560 for statically linked agents will be invoked.
561 Exactly one call to a start-up function is made per agent.
562 </intro>
563
564 <intro id="onload" label="Agent Start-Up (OnLoad phase)">
565 If an agent is started during the <code>OnLoad</code> phase then its
566 agent library must export a start-up function with the following prototype:
567 <example>
568 JNIEXPORT jint JNICALL
569 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
570 Or for a statically linked agent named 'L':
571 <example>
572 JNIEXPORT jint JNICALL
573 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example>
574
575 The VM will start the agent by calling this function.
576 It will be called early enough in VM initialization that:
577 <ul>
578 <li><functionlink id="SetSystemProperty">system properties</functionlink>
579 may be set before they have been used in the start-up of the VM</li>
580 <li>the full set of
581 <internallink id="capability">capabilities</internallink>
582 is still available (note that capabilities that configure the VM
583 may only be available at this time--see the
584 <internallink id="capability">Capability function section</internallink>)</li>
585 <li>no bytecodes have executed</li>
586 <li>no classes have been loaded</li>
587 <li>no objects have been created</li>
588 </ul>
589 <p/>
590 The VM will call the <code>Agent_OnLoad</code> or
591 <code>Agent_OnLoad_<agent-lib-name></code> function with
592 <i><options></i> as the second argument -
593 that is, using the command-line option examples,
594 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code>
595 argument of <code>Agent_OnLoad</code>.
596 The <code>options</code> argument is encoded as a
597 <internallink id="mUTF">modified UTF-8</internallink> string.
598 If <i>=<options></i> is not specified,
599 a zero length string is passed to <code>options</code>.
600 The lifespan of the <code>options</code> string is the
601 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code>
602 call. If needed beyond this time the string or parts of the string must
603 be copied.
604 The period between when <code>Agent_OnLoad</code> is called and when it
605 returns is called the <i>OnLoad phase</i>.
606 Since the VM is not initialized during the OnLoad
607 <functionlink id="GetPhase">phase</functionlink>,
608 the set of allowed operations
609 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the
610 functionality available at this time).
611 The agent can safely process the options and set
612 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once
613 the VM initialization event is received
614 (that is, the <eventlink id="VMInit">VMInit</eventlink>
615 callback is invoked), the agent
616 can complete its initialization.
617 <rationale>
618 Early startup is required so that agents can set the desired capabilities,
619 many of which must be set before the VM is initialized.
620 In JVMDI, the -Xdebug command-line option provided
621 very coarse-grain control of capabilities.
622 JVMPI implementations use various tricks to provide a single "JVMPI on" switch.
623 No reasonable command-line
624 option could provide the fine-grain of control required to balance needed capabilities vs
625 performance impact.
626 Early startup is also needed so that agents can control the execution
627 environment - modifying the file system and system properties to install
628 their functionality.
629 </rationale>
630 <p/>
631 The return value from <code>Agent_OnLoad</code> or
632 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error.
633 Any value other than zero indicates an error and causes termination of the VM.
634 </intro>
635
636 <intro id="onattach" label="Agent Start-Up (Live phase)">
637 A VM may support a mechanism that allows agents to be started in the VM during the live
638 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported,
639 are implementation specific. For example, a tool may use some platform specific mechanism,
640 or implementation specific API, to attach to the running VM, and request it start a given
641 agent.
642 <p/>
643 The VM prints a warning on the standard error stream for each agent that it attempts
644 to start in the live phase. If an agent was previously started (in the <code>OnLoad</code>
645 phase or in the live phase), then it is implementation specific as to whether a
646 warning is printed when attempting to start the same agent a second or subsequent time.
647 Warnings can be disabled by means of an implementation-specific command line option.
648 <p/>
649 <b>Implementation Note:</b> For the HotSpot VM, the VM option
650 <code>-XX:+EnableDynamicAgentLoading</code> is used to opt-in to allow dynamic loading
651 of agents in the live phase. This option suppresses the warning to standard error when
652 starting an agent in the live phase.
653 <p/>
654 If an agent is started during the live phase then its agent library
655 must export a start-up function
656 with the following prototype:
657 <example>
658 JNIEXPORT jint JNICALL
659 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>
660 Or for a statically linked agent named 'L':
661 <example>
662 JNIEXPORT jint JNICALL
663 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example>
664
665 <p/>
666 The VM will start the agent by calling this function.
667 It will be called in the context of a thread
668 that is attached to the VM. The first argument <i><vm></i> is the Java VM.
669 The <i><options></i> argument is the startup options provided to the agent.
670 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8
671 </internallink> string.
672 If startup options were not provided, a zero length string is passed to
673 <code>options</code>. The lifespan of the <code>options</code> string is the
674 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call.
675 If needed beyond this time the string or parts of the string must be copied.
676 <p/>
677 Note that some <internallink id="capability">capabilities</internallink>
678 may not be available in the live phase.
679 <p/>
680 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name
681 ></code> function initializes the agent and returns a value
682 to the VM to indicate if an error occurred. Any value other than zero indicates an error.
683 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes
684 some implementation specific action -- for example it might print an error to standard error,
685 or record the error in a system log.
686 </intro>
687
688 <intro id="onunload" label="Agent Shutdown">
689 The library may optionally export a
690 shutdown function with the following prototype:
691 <example>
692 JNIEXPORT void JNICALL
693 Agent_OnUnload(JavaVM *vm)</example>
694 Or for a statically linked agent named 'L':
695 <example>
696 JNIEXPORT void JNICALL
697 Agent_OnUnload_L(JavaVM *vm)</example>
698
699 This function will be called by the VM when the library is about to be unloaded.
700 The library will be unloaded (unless it is statically linked into the
701 executable) and this function will be called if some platform specific
702 mechanism causes the unload (an unload mechanism is not specified in this document)
703 or the library is (in effect) unloaded by the termination of the VM.
704 VM termination includes normal termination and VM failure, including start-up failure,
705 but not, of course, uncontrolled shutdown. An implementation may also
706 choose to not call this function if the <code>Agent_OnAttach</code>/
707 <code>Agent_OnAttach_L</code> function reported an error (returned a non-zero value).
708 Note the distinction between this function and the
709 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event
710 to be sent, the VM must have run at least to the point of initialization and a valid
711 <jvmti/> environment must exist which has set a callback for VMDeath
712 and enabled the event.
713 None of these are required for <code>Agent_OnUnload</code> or
714 <code>Agent_OnUnload_<agent-lib-name></code> and this function
715 is also called if the library is unloaded for other reasons.
716 In the case that a VM Death event is sent, it will be sent before this
717 function is called (assuming this function is called due to VM termination).
718 This function can be used to clean-up resources allocated by the agent.
719 </intro>
720
721 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS">
722 Since the command-line cannot always be accessed or modified, for example in embedded VMs
723 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is
724 provided so that agents may be launched in these cases.
725 <p/>
726 Platforms which support environment variables or other named strings, may support the
727 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space
728 boundaries. White-space characters include space, tab, carriage-return, new-line,
729 vertical-tab, and form-feed. Sequences of white-space characters are considered
730 equivalent to a single white-space character. No white-space is included in the options
731 unless quoted. Quoting is as follows:
732 <ul>
733 <li>All characters enclosed between a pair of single quote marks (''), except a single
734 quote, are quoted.</li>
735 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li>
736 <li>All characters enclosed between a pair of double quote marks (""), except a double
737 quote, are quoted.</li>
738 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li>
739 <li>A quoted part can start or end anywhere in the variable.</li>
740 <li>White-space characters have no special meaning when quoted -- they are included in
741 the option like any other character and do not mark white-space boundaries.</li>
742 <li>The pair of quote marks is not included in the option.</li>
743 </ul>
744 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied
745 in its <code>JavaVMInitArgs</code> argument. Note that module related options must be expressed in their
746 "option=value" format (note the required '=' between "option" and "value") for <code>JNI_CreateJavaVM</code>
747 to process them correctly.
748 <p/>
749 Platforms may disable this feature in cases where security is
750 a concern; for example, the Reference Implementation disables this feature on Unix systems when
751 the effective user or group ID differs from the real ID.
752 This feature is intended to support the initialization of tools -- specifically including the
753 launching of native or Java programming language agents. Multiple tools may wish to use this
754 feature, so the variable should not be overwritten, instead, options should be appended to
755 the variable. Note that since the variable is processed at the time of the JNI Invocation
756 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled.
757 </intro>
758
759 <intro id="environments" label="Environments">
760 The <jvmti/> specification supports the use of multiple simultaneous
761 <jvmti/> agents.
762 Each agent has its own <jvmti/> environment.
763 That is, the <jvmti/> state is
764 separate for each agent - changes to one environment do not affect the
765 others. The state of a <jvmti/>
766 environment includes:
767 <ul>
768 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li>
769 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li>
770 <li><internallink id="capability">the capabilities</internallink></li>
771 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li>
772 </ul>
773 Although their <jvmti/> state
774 is separate, agents inspect and modify the shared state
775 of the VM, they also share the native environment in which they execute.
776 As such, an agent can perturb the results of other agents or cause them
777 to fail. It is the responsibility of the agent writer to specify the level
778 of compatibility with other agents. <jvmti/> implementations are not capable
779 of preventing destructive interactions between agents. Techniques to reduce
780 the likelihood of these occurrences are beyond the scope of this document.
781 <p/>
782 An agent creates a <jvmti/> environment
783 by passing a <jvmti/> version
784 as the interface ID to the JNI Invocation API function
785 <externallink id="jni/invocation.html#getenv">
786 <code>GetEnv</code></externallink>.
787 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink>
788 for more details on the creation and use of
789 <jvmti/> environments.
790 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from
791 <internallink id="onload"><code>Agent_OnLoad</code></internallink>.
792 </intro>
793
794 <intro id="bci" label="Bytecode Instrumentation">
795 This interface does not include some events that one might expect in an interface with
796 profiling support. Some examples include full speed
797 method enter and exit events. The interface instead provides support for
798 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine
799 bytecode instructions which comprise the target program. Typically, these alterations
800 are to add "events" to the code of a method - for example, to add, at the beginning of a method,
801 a call to <code>MyProfiler.methodEntered()</code>.
802 Since the changes are purely additive, they do not modify application
803 state or behavior.
804 Because the inserted agent code is standard bytecodes, the VM can run at full speed,
805 optimizing not only the target program but also the instrumentation. If the
806 instrumentation does not involve switching from bytecode execution, no expensive
807 state transitions are needed. The result is high performance events.
808 This approach also provides complete control to the agent: instrumentation can be
809 restricted to "interesting" portions of the code (e.g., the end user's code) and
810 can be conditional. Instrumentation can run entirely in Java programming language
811 code or can call into the native agent. Instrumentation can simply maintain
812 counters or can statistically sample events.
813 <p/>
814 Instrumentation can be inserted in one of three ways:
815 <ul>
816 <li>
817 Static Instrumentation: The class file is instrumented before it
818 is loaded into the VM - for example, by creating a duplicate directory of
819 <code>*.class</code> files which have been modified to add the instrumentation.
820 This method is extremely awkward and, in general, an agent cannot know
821 the origin of the class files which will be loaded.
822 </li>
823 <li>
824 Load-Time Instrumentation: When a class file is loaded by the VM, the raw
825 bytes of the class file are sent for instrumentation to the agent.
826 The <eventlink id="ClassFileLoadHook"/>
827 event, triggered by the class load,
828 provides this functionality. This mechanism provides efficient
829 and complete access to one-time instrumentation.
830 </li>
831 <li>
832 Dynamic Instrumentation: A class which is already loaded (and possibly
833 even running) is modified. This optional feature is provided by the
834 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the
835 <functionlink id="RetransformClasses"/> function.
836 Classes can be modified multiple times and can be returned to their
837 original state.
838 The mechanism allows instrumentation which changes during the
839 course of execution.
840 </li>
841 </ul>
842 <p/>
843 The class modification functionality provided in this interface
844 is intended to provide a mechanism for instrumentation
845 (the <eventlink id="ClassFileLoadHook"/> event
846 and the <functionlink id="RetransformClasses"/> function)
847 and, during development, for fix-and-continue debugging
848 (the <functionlink id="RedefineClasses"/> function).
849 <p/>
850 Care must be taken to avoid perturbing dependencies, especially when
851 instrumenting core classes. For example, an approach to getting notification
852 of every object allocation is to instrument the constructor on
853 <code>Object</code>. Assuming that the constructor is initially
854 empty, the constructor could be changed to:
855 <example>
856 public Object() {
857 MyProfiler.allocationTracker(this);
858 }
859 </example>
860 However, if this change was made using the
861 <eventlink id="ClassFileLoadHook"/>
862 event then this might impact a typical VM as follows:
863 the first created object will call the constructor causing a class load of
864 <code>MyProfiler</code>; which will then cause
865 object creation, and since <code>MyProfiler</code> isn't loaded yet,
866 infinite recursion; resulting in a stack overflow. A refinement of this
867 would be to delay invoking the tracking method until a safe time. For
868 example, <code>trackAllocations</code> could be set in the
869 handler for the <code>VMInit</code> event.
870 <example>
871 static boolean trackAllocations = false;
872
873 public Object() {
874 if (trackAllocations) {
875 MyProfiler.allocationTracker(this);
876 }
877 }
878 </example>
879 <p/>
880 The <functionlink id="SetNativeMethodPrefix"/> allows native methods
881 to be instrumented by the use of wrapper methods.
882 </intro>
883
884 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules">
885 Agents can use the functions <functionlink id="AddModuleReads"/>,
886 <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>,
887 <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/>
888 to update a module to expand the set of modules that it reads, the set of
889 packages that it exports or opens to other modules, or the services that it
890 uses and provides.
891 <p/>
892 As an aid to agents that deploy supporting classes on the search path of
893 the bootstrap class loader, or the search path of the class loader that
894 loads the main class, the Java virtual machine arranges for the module
895 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to
896 read the unnamed module of both class loaders.
897 </intro>
898
899 <intro id="mUTF" label="Modified UTF-8 String Encoding">
900 <jvmti/> uses modified UTF-8 to encode character strings.
901 This is the same encoding used by JNI.
902 Modified UTF-8 differs
903 from standard UTF-8 in the representation of supplementary characters
904 and of the null character. See the
905 <externallink id="jni/types.html#modified-utf-8-strings">
906 Modified UTF-8 Strings</externallink>
907 section of the JNI specification for details.
908 </intro>
909
910 <intro id="context" label="Specification Context">
911 Since this interface provides access to the state of applications running in the
912 Java virtual machine;
913 terminology refers to the Java platform and not the native
914 platform (unless stated otherwise). For example:
915 <ul>
916 <li>"thread" means Java programming language thread.</li>
917 <li>"stack frame" means Java virtual machine stack frame.</li>
918 <li>"class" means Java programming language class.</li>
919 <li>"heap" means Java virtual machine heap.</li>
920 <li>"monitor" means Java programming language object monitor.</li>
921 </ul>
922 <p/>
923 Sun, Sun Microsystems, the Sun logo, Java, and JVM
924 are trademarks or registered trademarks of Oracle
925 and/or its affiliates, in the U.S. and other countries.
926 </intro>
927
928 <intro id="identityAndValueObjects" label="Identity and Value Objects">
929 If preview features are enabled then some Java objects will have identity and others
930 (instances of value classes) will not. <jvmti/> makes no distinction between these cases
931 in general, but some specific functions will behave differently if invoked upon
932 a Java object that does not have identity. Such differences in behavior are described
933 by the individual functions and events where they apply.
934 <p/>
935 In summary, tags for value objects use value equality semantics, and
936 the <eventlink id="ObjectFree"/> event is not sent for tagged value objects.
937 The <eventlink id="VMObjectAlloc"/> and <eventlink id="SampledObjectAlloc"/> events
938 are only sent for value objects if the
939 <fieldlink id="can_support_value_objects" struct="jvmtiCapabilities"/>
940 capability is possessed.
941 <p/>
942 Value objects can also affect class and interface property queries, monitor information,
943 and <jvmti/> functions that operate on value class constructor frames.
944 </intro>
945
946 <functionsection label="Functions">
947 <intro id="jvmtiEnvAccess" label="Accessing Functions">
948 Native code accesses <jvmti/> features
949 by calling <jvmti/> functions.
950 Access to <jvmti/> functions is by use of an interface pointer
951 in the same manner as
952 <externallink id="jni/design.html">Java
953 Native Interface (JNI) functions</externallink> are accessed.
954 The <jvmti/> interface pointer is called the
955 <i>environment pointer</i>.
956 <p/>
957 An environment pointer is a pointer to an environment and has
958 the type <code>jvmtiEnv*</code>.
959 An environment has information about its <jvmti/> connection.
960 The first value in the environment is a pointer to the function table.
961 The function table is an array of pointers to <jvmti/> functions.
962 Every function pointer is at a predefined offset inside the
963 array.
964 <p/>
965 When used from the C language:
966 double indirection is used to access the functions;
967 the environment pointer provides context and is the first
968 parameter of each function call; for example:
969 <example>
970 jvmtiEnv *jvmti;
971 ...
972 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes);
973 </example>
974 <p/>
975 When used from the C++ language:
976 functions are accessed as member functions of <code>jvmtiEnv</code>;
977 the environment pointer is not passed to the function call; for example:
978 <example>
979 jvmtiEnv *jvmti;
980 ...
981 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes);
982 </example>
983 Unless otherwise stated, all examples and declarations in this
984 specification use the C language.
985 <p/>
986 A <jvmti/> environment can be obtained through the JNI Invocation API
987 <code>GetEnv</code> function:
988 <example>
989 jvmtiEnv *jvmti;
990 ...
991 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0);
992 </example>
993 Each call to <code>GetEnv</code>
994 creates a new <jvmti/> connection and thus
995 a new <jvmti/> environment.
996 The <code>version</code> argument of <code>GetEnv</code> must be
997 a <jvmti/> version.
998 The returned environment may have a different version than the
999 requested version but the returned environment must be compatible.
1000 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a
1001 compatible version is not available, if <jvmti/> is not supported or
1002 <jvmti/> is not supported in the current VM configuration.
1003 Other interfaces may be added for creating <jvmti/> environments
1004 in specific contexts.
1005 Each environment has its own state (for example,
1006 <functionlink id="SetEventNotificationMode">desired events</functionlink>,
1007 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and
1008 <functionlink id="AddCapabilities">capabilities</functionlink>).
1009 An environment is released with
1010 <functionlink id="DisposeEnvironment"></functionlink>.
1011 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work
1012 across threads and are created dynamically.
1013 </intro>
1014
1015 <intro id="nullPointers" label="Null Pointers">
1016 Parts of this specification refer to a "null pointer" as a possible function parameter
1017 or return value. A "null pointer" is C <code>NULL</code> or C++ <code>nullptr</code>.
1018 </intro>
1019
1020 <intro id="functionReturn" label="Function Return Values">
1021 <jvmti/> functions always return an
1022 <internallink id="ErrorSection">error code</internallink> via the
1023 <datalink id="jvmtiError"/> function return value.
1024 Some functions can return additional
1025 values through pointers provided by the calling function.
1026 In some cases, <jvmti/> functions allocate memory that your program must
1027 explicitly deallocate. This is indicated in the individual <jvmti/>
1028 function descriptions. Empty lists, arrays, sequences, etc are
1029 returned as a null pointer.
1030 <p/>
1031 In the event that the <jvmti/> function encounters
1032 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values
1033 of memory referenced by argument pointers is undefined, but no memory
1034 will have been allocated and no global references will have been allocated.
1035 If the error occurs because of invalid input, no action will have occurred.
1036 </intro>
1037
1038 <intro id="refs" label="Managing JNI Object References">
1039 <jvmti/> functions identify objects with JNI references
1040 (<datalink id="jobject"/> and <datalink id="jclass"/>)
1041 and their derivatives
1042 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>).
1043 References passed to
1044 <jvmti/> functions can be either global or local, but they must be
1045 strong references. All references returned by <jvmti/> functions are
1046 local references--these local references are created
1047 during the <jvmti/> call.
1048 Local references are a resource that must be managed (see the
1049 <externallink id="jni/functions.html#local-references">
1050 JNI Documentation</externallink>).
1051 When threads return from native code all local references
1052 are freed. Note that some threads, including typical
1053 agent threads, will never return from native code.
1054 A thread is ensured the ability to create sixteen local
1055 references without the need for any explicit management.
1056 For threads executing a limited number of <jvmti/> calls before
1057 returning from native code
1058 (for example, threads processing events),
1059 it may be determined that no explicit management
1060 is needed.
1061 However, long running agent threads will need explicit
1062 local reference management--usually with the JNI functions
1063 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>.
1064 Conversely, to preserve references beyond the
1065 return from native code, they must be converted to global references.
1066 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/>
1067 as they are not <datalink id="jobject"/>s.
1068 </intro>
1069
1070 <intro id="prereqState" label="Prerequisite State for Calling Functions">
1071 Unless the function explicitly states that the agent must bring
1072 a thread or the VM to a particular state (for example, suspended),
1073 the <jvmti/> implementation is responsible for bringing the VM to a
1074 safe and consistent state for performing the function.
1075 </intro>
1076
1077 <intro id="functionsExceptions" label="Exceptions and Functions">
1078 <jvmti/> functions never throw exceptions; error conditions are
1079 communicated via the
1080 <internallink id="functionReturn">function return value</internallink>.
1081 Any existing exception state is preserved across a call to a
1082 <jvmti/> function.
1083 See the
1084 <externallink
1085 id="jni/design.html#java-exceptions"
1086 >Java Exceptions</externallink>
1087 section of the JNI specification for information on handling exceptions.
1088 </intro>
1089
1090 <category id="memory" label="Memory Management">
1091 <intro>
1092 These functions provide for the allocation and deallocation of
1093 memory used by <jvmti/> functionality and can be used to provide
1094 working memory for agents.
1095 Memory managed by <jvmti/> is not compatible with other memory
1096 allocation libraries and mechanisms.
1097 </intro>
1098
1099 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46">
1100 <synopsis>Allocate</synopsis>
1101 <description>
1102 Allocate an area of memory through the <jvmti/> allocator.
1103 The allocated
1104 memory should be freed with <functionlink id="Deallocate"></functionlink>.
1105 </description>
1106 <origin>jvmdi</origin>
1107 <capabilities>
1108 </capabilities>
1109 <parameters>
1110 <param id="size">
1111 <jlong/>
1112 <description>
1113 The number of bytes to allocate.
1114 <rationale>
1115 <code>jlong</code> is used for compatibility with JVMDI.
1116 </rationale>
1117 </description>
1118 </param>
1119 <param id="mem_ptr">
1120 <allocbuf incount="size"><uchar/></allocbuf>
1121 <description>
1122 On return, a pointer to the beginning of the allocated memory.
1123 If <code>size</code> is zero, a null pointer is returned.
1124 </description>
1125 </param>
1126 </parameters>
1127 <errors>
1128 <error id="JVMTI_ERROR_OUT_OF_MEMORY">
1129 Memory request cannot be honored.
1130 </error>
1131 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
1132 <paramlink id="size"></paramlink> is less than zero.
1133 </error>
1134 </errors>
1135 </function>
1136
1137 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47">
1138 <synopsis>Deallocate</synopsis>
1139 <description>
1140 Deallocate <code>mem</code> using the <jvmti/> allocator.
1141 This function should
1142 be used to deallocate any memory allocated and returned
1143 by a <jvmti/> function
1144 (including memory allocated with <functionlink id="Allocate"></functionlink>).
1145 All allocated memory must be deallocated
1146 or the memory cannot be reclaimed.
1147 </description>
1148 <origin>jvmdi</origin>
1149 <capabilities>
1150 </capabilities>
1151 <parameters>
1152 <param id="mem">
1153 <outbuf>
1154 <uchar/>
1155 <nullok>the call is ignored</nullok>
1156 </outbuf>
1157 <description>
1158 A pointer to the beginning of the allocated memory.
1159 Please ignore "On return, the elements are set."
1160 <todo>keep it from generating "On return, the elements are set"</todo>
1161 </description>
1162 </param>
1163 </parameters>
1164 <errors>
1165 </errors>
1166 </function>
1167 </category>
1168
1169 <category id="threadCategory" label="Thread">
1170 <intro>
1171 These functions provide information about threads and allow an agent to
1172 suspend and resume threads.
1173 <p/>
1174 The <code>jthread</code> specified to these functions can be a JNI
1175 reference to a
1176 <externallink id="../api/java.base/java/lang/Thread.html#platform-threads">platform thread</externallink>
1177 or <externallink id="../api/java.base/java/lang/Thread.html#virtual-threads">virtual thread</externallink>.
1178 Some functions are not supported on virtual threads and return
1179 <code>JVMTI_ERROR_UNSUPPORTED_OPERATION</code> when called with a reference
1180 to a virtual thread.
1181 </intro>
1182
1183 <function id="GetThreadState" num="17">
1184 <synopsis>Get Thread State</synopsis>
1185 <description>
1186 Get the state of a thread. The state of the thread is represented by the
1187 answers to the hierarchical set of questions below:
1188 <ul type="circle">
1189 <li><i>Alive?</i>
1190 <ul>
1191 <li>Not alive.
1192 <ul type="circle">
1193 <li><i>Why not alive?</i>
1194 <ul>
1195 <li>New.</li>
1196 <li>Terminated (<datalink
1197 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li>
1198 </ul>
1199 </li>
1200 </ul>
1201 </li>
1202 <li>Alive (<datalink
1203 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>)
1204 <ul type="circle">
1205 <li><i>Suspended?</i>
1206 <ul>
1207 <li>Suspended (<datalink
1208 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li>
1209 <li>Not suspended</li>
1210 </ul>
1211 </li>
1212 <li><i>Interrupted?</i>
1213 <ul>
1214 <li>Interrupted (<datalink
1215 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li>
1216 <li>Not interrupted.</li>
1217 </ul>
1218 </li>
1219 <li><i>In native?</i>
1220 <ul>
1221 <li>In native code (<datalink
1222 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li>
1223 <li>In Java programming language code</li>
1224 </ul>
1225 </li>
1226 <li><i>What alive state?</i>
1227 <ul>
1228 <li>Runnable (<datalink
1229 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li>
1230 <li>Blocked (<datalink
1231 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li>
1232 <li>Waiting (<datalink
1233 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>)
1234 <ul type="circle">
1235 <li><i>Timed wait?</i>
1236 <ul>
1237 <li>Indefinite (<datalink
1238 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink>)</li>
1239 <li>Timed (<datalink
1240 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li>
1241 </ul>
1242 </li>
1243 <li><i>Why waiting?</i>
1244 <ul>
1245 <li>Object.wait (<datalink
1246 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li>
1247 <li>LockSupport.park (<datalink
1248 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li>
1249 <li>Sleeping (<datalink
1250 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li>
1251 </ul>
1252 </li>
1253 </ul>
1254 </li>
1255 </ul>
1256 </li>
1257 </ul>
1258 </li>
1259 </ul>
1260 </li>
1261 </ul>
1262 <p/>
1263 The answers are represented by the following bit vector.
1264 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits">
1265 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001">
1266 Thread is alive. Zero if thread is new (not started) or terminated.
1267 </constant>
1268 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002">
1269 Thread has completed execution.
1270 </constant>
1271 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004">
1272 Thread is runnable.
1273 </constant>
1274 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400">
1275 Thread is waiting to enter a synchronized block/method or,
1276 after an <code>Object.wait()</code>, waiting to re-enter a
1277 synchronized block/method.
1278 </constant>
1279 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080">
1280 Thread is waiting.
1281 </constant>
1282 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010">
1283 Thread is waiting without a timeout.
1284 For example, <code>Object.wait()</code>.
1285 </constant>
1286 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020">
1287 Thread is waiting with a maximum time to wait specified.
1288 For example, <code>Object.wait(long)</code>.
1289 </constant>
1290 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040">
1291 Thread is sleeping -- <code>Thread.sleep</code>.
1292 </constant>
1293 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100">
1294 Thread is waiting on an object monitor -- <code>Object.wait</code>.
1295 </constant>
1296 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200">
1297 Thread is parked, for example: <code>LockSupport.park</code>,
1298 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>.
1299 A virtual thread that is sleeping, in <code>Thread.sleep</code>, may
1300 have this state flag set instead of <code>JVMTI_THREAD_STATE_SLEEPING</code>.
1301 </constant>
1302 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000">
1303 Thread is suspended by a suspend function
1304 (such as <functionlink id="SuspendThread"></functionlink>).
1305 If this bit is set, the other bits refer to the thread state before
1306 suspension.
1307 </constant>
1308 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000">
1309 Thread has been interrupted.
1310 </constant>
1311 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000">
1312 Thread is in native code--that is, a native method is running
1313 which has not called back into the VM or Java programming
1314 language code.
1315 <p/>
1316 This flag is not set when running VM compiled Java programming
1317 language code nor is it set when running VM code or
1318 VM support code. Native VM interface functions, such as JNI and
1319 <jvmti/> functions, may be implemented as VM code.
1320 </constant>
1321 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000">
1322 Defined by VM vendor.
1323 </constant>
1324 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000">
1325 Defined by VM vendor.
1326 </constant>
1327 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000">
1328 Defined by VM vendor.
1329 </constant>
1330 </constants>
1331 The following definitions are used to convert <jvmti/> thread state
1332 to <code>java.lang.Thread.State</code> style states.
1333 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits">
1334 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK"
1335 num="JVMTI_THREAD_STATE_TERMINATED | JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT">
1336 Mask the state with this before comparison
1337 </constant>
1338 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW"
1339 num="0">
1340 <code>java.lang.Thread.State.NEW</code>
1341 </constant>
1342 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED"
1343 num="JVMTI_THREAD_STATE_TERMINATED">
1344 <code>java.lang.Thread.State.TERMINATED</code>
1345 </constant>
1346 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE"
1347 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE">
1348 <code>java.lang.Thread.State.RUNNABLE</code>
1349 </constant>
1350 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED"
1351 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER">
1352 <code>java.lang.Thread.State.BLOCKED</code>
1353 </constant>
1354 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING"
1355 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY">
1356 <code>java.lang.Thread.State.WAITING</code>
1357 </constant>
1358 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING"
1359 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT">
1360 <code>java.lang.Thread.State.TIMED_WAITING</code>
1361 </constant>
1362 </constants>
1363 <b>Rules</b>
1364 <p/>
1365 There can be no more than one answer to a question, although there can be no
1366 answer (because the answer is unknown, does not apply, or none of the answers is
1367 correct). An answer is set only when the enclosing answers match.
1368 That is, no more than one of
1369 <ul type="circle">
1370 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li>
1371 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li>
1372 <li><code>JVMTI_THREAD_STATE_WAITING</code></li>
1373 </ul>
1374 can be set (a <tm>J2SE</tm> compliant implementation will always set
1375 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set).
1376 And if any of these are set, the enclosing answer
1377 <code>JVMTI_THREAD_STATE_ALIVE</code> is set.
1378 No more than one of
1379 <ul type="circle">
1380 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li>
1381 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li>
1382 </ul>
1383 can be set (a <tm>J2SE</tm> compliant implementation will always set
1384 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set).
1385 And if either is set, the enclosing answers
1386 <code>JVMTI_THREAD_STATE_ALIVE</code> and
1387 <code>JVMTI_THREAD_STATE_WAITING</code> are set.
1388 No more than one of
1389 <ul type="circle">
1390 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li>
1391 <li><code>JVMTI_THREAD_STATE_PARKED</code></li>
1392 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li>
1393 </ul>
1394 can be set. And if any of these is set, the enclosing answers
1395 <code>JVMTI_THREAD_STATE_ALIVE</code> and
1396 <code>JVMTI_THREAD_STATE_WAITING</code> are set.
1397 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set,
1398 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set.
1399 If a state <i>A</i> is implemented using the mechanism of
1400 state <i>B</i> then it is state <i>A</i> which
1401 is returned by this function.
1402 For example, if <code>Thread.sleep(long)</code>
1403 is implemented using <code>Object.wait(long)</code>
1404 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code>
1405 which is returned.
1406 More than one of
1407 <ul type="circle">
1408 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li>
1409 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li>
1410 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li>
1411 </ul>
1412 can be set, but if any is set,
1413 <code>JVMTI_THREAD_STATE_ALIVE</code> is set.
1414 <p/>
1415 And finally,
1416 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless
1417 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set.
1418 <p/>
1419 The thread state representation is designed for extension in future versions
1420 of the specification; thread state values should be used accordingly, that is
1421 they should not be used as ordinals.
1422 Most queries can be made by testing a single bit, if use in a switch statement is desired,
1423 the state bits should be masked with the interesting bits.
1424 All bits not defined above are reserved for future use.
1425 A VM, compliant to the current specification, must set reserved bits to zero.
1426 An agent should ignore reserved bits --
1427 they should not be assumed to be zero and thus should not be included in comparisons.
1428 <p/>
1429 <b>Examples</b>
1430 <p/>
1431 Note that the values below exclude reserved and vendor bits.
1432 <p/>
1433 The state of a thread blocked at a <code>synchronized</code>-statement would be:
1434 <example>
1435 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
1436 </example>
1437 The state of a thread which hasn't started yet would be:
1438 <example>
1439 0
1440 </example>
1441 The state of a thread at a <code>Object.wait(3000)</code> would be:
1442 <example>
1443 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING +
1444 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
1445 JVMTI_THREAD_STATE_IN_OBJECT_WAIT
1446 </example>
1447 The state of a thread suspended while runnable would be:
1448 <example>
1449 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED
1450 </example>
1451 <p/>
1452 <b>Testing the State</b>
1453 <p/>
1454 In most cases, the thread state can be determined by testing the one bit corresponding
1455 to that question. For example, the code to test if a thread is sleeping:
1456 <example>
1457 jint state;
1458 jvmtiError err;
1459
1460 err = (*jvmti)->GetThreadState(jvmti, thread, &state);
1461 if (err == JVMTI_ERROR_NONE) {
1462 if (state & JVMTI_THREAD_STATE_SLEEPING) { ...
1463 </example>
1464 <p/>
1465 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be:
1466 <example>
1467 if (state & JVMTI_THREAD_STATE_WAITING) { ...
1468 </example>
1469 For some states, more than one bit will need to be tested as is the case
1470 when testing if a thread has not yet been started:
1471 <example>
1472 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ...
1473 </example>
1474 To distinguish timed from untimed <code>Object.wait</code>:
1475 <example>
1476 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) {
1477 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) {
1478 printf("in Object.wait(long timeout)\n");
1479 } else {
1480 printf("in Object.wait()\n");
1481 }
1482 }
1483 </example>
1484 <p/>
1485 <b>Relationship to <code>java.lang.Thread.State</code></b>
1486 <p/>
1487 The thread state represented by <code>java.lang.Thread.State</code>
1488 returned from <code>java.lang.Thread.getState()</code> is a subset of the
1489 information returned from this function.
1490 The corresponding <code>java.lang.Thread.State</code> can be determined
1491 by using the provided conversion masks.
1492 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state:
1493 <example>
1494 err = (*jvmti)->GetThreadState(jvmti, thread, &state);
1495 abortOnError(err);
1496 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) {
1497 case JVMTI_JAVA_LANG_THREAD_STATE_NEW:
1498 return "NEW";
1499 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED:
1500 return "TERMINATED";
1501 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE:
1502 return "RUNNABLE";
1503 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED:
1504 return "BLOCKED";
1505 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING:
1506 return "WAITING";
1507 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING:
1508 return "TIMED_WAITING";
1509 }
1510 </example>
1511 </description>
1512 <origin>new</origin>
1513 <capabilities>
1514 </capabilities>
1515 <parameters>
1516 <param id="thread">
1517 <jthread null="current" started="maybe" impl="noconvert"/>
1518 <description>
1519 The thread to query.
1520 </description>
1521 </param>
1522 <param id="thread_state_ptr">
1523 <outptr><jint/></outptr>
1524 <description>
1525 On return, points to state flags,
1526 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>.
1527 </description>
1528 </param>
1529 </parameters>
1530 <errors>
1531 </errors>
1532 </function>
1533
1534 <function id="GetCurrentThread" phase="start" num="18" since="1.1">
1535 <synopsis>Get Current Thread</synopsis>
1536 <description>
1537 Get the current thread.
1538 The current thread is the Java programming language thread which has called the function.
1539 The function may return a null pointer in the start phase if the
1540 <internallink id="jvmtiCapabilities.can_generate_early_vmstart">
1541 <code>can_generate_early_vmstart</code></internallink> capability is enabled
1542 and the <code>java.lang.Thread</code> class has not been initialized yet.
1543 <p/>
1544 Note that most <jvmti/> functions that take a thread
1545 as an argument will accept null to mean
1546 the current thread.
1547 </description>
1548 <origin>new</origin>
1549 <capabilities>
1550 </capabilities>
1551 <parameters>
1552 <param id="thread_ptr">
1553 <outptr><jthread/></outptr>
1554 <description>
1555 On return, points to the current thread, or null.
1556 </description>
1557 </param>
1558 </parameters>
1559 <errors>
1560 </errors>
1561 </function>
1562
1563 <function id="GetAllThreads" num="4">
1564 <synopsis>Get All Threads</synopsis>
1565 <description>
1566 Get all live platform threads that are attached to the VM.
1567 The list of threads includes
1568 <internallink id="RunAgentThread">agent threads</internallink>.
1569 It does not include virtual threads.
1570 A thread is live if <code>java.lang.Thread.isAlive()</code>
1571 would return <code>true</code>, that is, the thread has
1572 been started and has not yet terminated.
1573 The universe of threads is determined by the context of the <jvmti/>
1574 environment, which typically is all threads attached to the VM.
1575 </description>
1576 <origin>jvmdi</origin>
1577 <capabilities>
1578 </capabilities>
1579 <parameters>
1580 <param id="threads_count_ptr">
1581 <outptr><jint/></outptr>
1582 <description>
1583 On return, points to the number of threads.
1584 </description>
1585 </param>
1586 <param id="threads_ptr">
1587 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf>
1588 <description>
1589 On return, points to an array of references, one
1590 for each thread.
1591 </description>
1592 </param>
1593 </parameters>
1594 <errors>
1595 </errors>
1596 </function>
1597
1598 <function id="SuspendThread" num="5">
1599 <synopsis>Suspend Thread</synopsis>
1600 <description>
1601 Suspend the specified thread. If the calling thread is specified,
1602 this function will not return until some other thread calls
1603 <functionlink id="ResumeThread"></functionlink>.
1604 If the thread is currently suspended, this function
1605 does nothing and returns an error.
1606 </description>
1607 <origin>jvmdi</origin>
1608 <capabilities>
1609 <required id="can_suspend"></required>
1610 </capabilities>
1611 <parameters>
1612 <param id="thread">
1613 <jthread null="current" impl="noconvert"/>
1614 <description>
1615 The thread to suspend.
1616 </description>
1617 </param>
1618 </parameters>
1619 <errors>
1620 <error id="JVMTI_ERROR_THREAD_SUSPENDED">
1621 Thread already suspended.
1622 </error>
1623 </errors>
1624 </function>
1625
1626 <elide>
1627 <function id="SuspendAllThreads" num="101">
1628 <synopsis>Suspend All Threads</synopsis>
1629 <description>
1630 <issue>
1631 There has been no explicit call for this function, and it will
1632 thus be removed if there is no interest.
1633 </issue>
1634 Suspend all live threads except:
1635 <ul>
1636 <li>already suspended threads</li>
1637 <li>those listed in <paramlink id="except_list"></paramlink></li>
1638 <li>certain system (non application) threads, as determined
1639 by the VM implementation</li>
1640 </ul>
1641 The threads are Java programming language threads;
1642 native threads which are not attached to the VM are not
1643 Java programming language threads.
1644 A thread is live if <code>java.lang.Thread.isAlive()</code>
1645 would return <code>true</code>, that is, the thread has
1646 been started and has not yet terminated.
1647 The universe of threads is determined
1648 by the context of the <jvmti/>
1649 environment, which, typically, is all threads attached to the VM,
1650 except critical VM internal threads and <jvmti/> agent threads
1651 (see <functionlink id="RunAgentThread"/>).
1652 <p/>
1653 If the calling thread is specified,
1654 all other threads are suspended first then the caller thread is suspended -
1655 this function will not return until some other thread calls
1656 <functionlink id="ResumeThread"></functionlink>.
1657 <p/>
1658 The list of actually
1659 suspended threads is returned in
1660 <paramlink id="suspended_list_ptr"></paramlink>.
1661 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>.
1662 <functionlink id="ResumeThreadList"></functionlink>
1663 can be used to resume the suspended threads.
1664 </description>
1665 <origin>new</origin>
1666 <capabilities>
1667 <required id="can_suspend"></required>
1668 </capabilities>
1669 <parameters>
1670 <param id="except_count">
1671 <jint min="0"/>
1672 <description>
1673 The number of threads in the list of threads not to be suspended.
1674 </description>
1675 </param>
1676 <param id="except_list">
1677 <inbuf incount="except_count">
1678 <jthread/>
1679 <nullok>not an error if <code>except_count == 0</code></nullok>
1680 </inbuf>
1681 <description>
1682 The list of threads not to be suspended.
1683 </description>
1684 </param>
1685 <param id="suspended_count_ptr">
1686 <outptr><jint/></outptr>
1687 <description>
1688 On return, points to the number of threads suspended by this call.
1689 </description>
1690 </param>
1691 <param id="suspended_list_ptr">
1692 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf>
1693 <description>
1694 On return, points to an array of references, one
1695 for each thread suspended.
1696 </description>
1697 </param>
1698 </parameters>
1699 <errors>
1700 <error id="JVMTI_ERROR_INVALID_THREAD">
1701 A thread in <paramlink id="except_list"></paramlink> was invalid.
1702 </error>
1703 <error id="JVMTI_ERROR_NULL_POINTER">
1704 Both <paramlink id="except_list"></paramlink> was null
1705 and <paramlink id="except_count"></paramlink> was non-zero.
1706 </error>
1707 </errors>
1708 </function>
1709 </elide>
1710
1711 <function id="SuspendThreadList" num="92">
1712 <synopsis>Suspend Thread List</synopsis>
1713 <description>
1714 Suspend the <paramlink id="request_count"></paramlink>
1715 threads specified in the
1716 <paramlink id="request_list"></paramlink> array.
1717 Threads may be resumed with
1718 <functionlink id="ResumeThreadList"></functionlink> or
1719 <functionlink id="ResumeThread"></functionlink>.
1720 If the calling thread is specified in the
1721 <paramlink id="request_list"></paramlink> array, this function will
1722 not return until some other thread resumes it.
1723 Errors encountered in the suspension of a thread
1724 are returned in the <paramlink id="results"></paramlink>
1725 array, <b>not</b> in the return value of this function.
1726 Threads that are currently suspended do not change state.
1727 </description>
1728 <origin>jvmdi</origin>
1729 <capabilities>
1730 <required id="can_suspend"></required>
1731 </capabilities>
1732 <parameters>
1733 <param id="request_count">
1734 <jint min="0"/>
1735 <description>
1736 The number of threads to suspend.
1737 </description>
1738 </param>
1739 <param id="request_list">
1740 <inbuf incount="request_count"><jthread/></inbuf>
1741 <description>
1742 The list of threads to suspend.
1743 </description>
1744 </param>
1745 <param id="results">
1746 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>
1747 <description>
1748 An agent supplied array of
1749 <paramlink id="request_count"></paramlink> elements.
1750 On return, filled with the error code for
1751 the suspend of the corresponding thread.
1752 The error code will be
1753 <errorlink id="JVMTI_ERROR_NONE"></errorlink>
1754 if the thread was suspended by this call.
1755 Possible error codes are those specified
1756 for <functionlink id="SuspendThread"></functionlink>.
1757 </description>
1758 </param>
1759 </parameters>
1760 <errors>
1761 </errors>
1762 </function>
1763
1764 <function id="SuspendAllVirtualThreads" num="118" since="21">
1765 <synopsis>Suspend All Virtual Threads</synopsis>
1766 <description>
1767 Suspend all virtual threads except those in the exception list.
1768 Virtual threads that are currently suspended do not change state.
1769 Virtual threads may be resumed with
1770 <functionlink id="ResumeAllVirtualThreads"></functionlink> or
1771 <functionlink id="ResumeThreadList"></functionlink> or
1772 <functionlink id="ResumeThread"></functionlink>.
1773 </description>
1774 <origin>new</origin>
1775 <capabilities>
1776 <required id="can_suspend"></required>
1777 <required id="can_support_virtual_threads">Can support virtual threads</required>
1778 </capabilities>
1779 <parameters>
1780 <param id="except_count">
1781 <jint min="0"/>
1782 <description>
1783 The number of threads in the list of threads not to be suspended.
1784 </description>
1785 </param>
1786 <param id="except_list">
1787 <inbuf incount="except_count">
1788 <jthread/>
1789 <nullok>not an error if <code>except_count == 0</code></nullok>
1790 </inbuf>
1791 <description>
1792 The list of threads not to be suspended.
1793 </description>
1794 </param>
1795 </parameters>
1796 <errors>
1797 <error id="JVMTI_ERROR_INVALID_THREAD">
1798 A thread in <paramlink id="except_list"></paramlink> was invalid.
1799 </error>
1800 <error id="JVMTI_ERROR_NULL_POINTER">
1801 Both <paramlink id="except_list"></paramlink> was null
1802 and <paramlink id="except_count"></paramlink> was non-zero.
1803 </error>
1804 </errors>
1805 </function>
1806
1807 <function id="ResumeThread" num="6">
1808 <synopsis>Resume Thread</synopsis>
1809 <description>
1810 Resume a suspended thread.
1811 Any threads currently suspended through
1812 a <jvmti/> suspend function (eg.
1813 <functionlink id="SuspendThread"></functionlink>)
1814 will resume execution;
1815 all other threads are unaffected.
1816 </description>
1817 <origin>jvmdi</origin>
1818 <capabilities>
1819 <required id="can_suspend"></required>
1820 </capabilities>
1821 <parameters>
1822 <param id="thread">
1823 <jthread impl="noconvert"/>
1824 <description>
1825 The thread to resume.
1826 </description>
1827 </param>
1828 </parameters>
1829 <errors>
1830 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
1831 Thread was not suspended.
1832 </error>
1833 <error id="JVMTI_ERROR_INVALID_TYPESTATE">
1834 The state of the thread has been modified, and is now inconsistent.
1835 </error>
1836 </errors>
1837 </function>
1838
1839 <function id="ResumeThreadList" num="93">
1840 <synopsis>Resume Thread List</synopsis>
1841 <description>
1842 Resume the <paramlink id="request_count"></paramlink>
1843 threads specified in the
1844 <paramlink id="request_list"></paramlink> array.
1845 Any thread suspended through
1846 a <jvmti/> suspend function (eg.
1847 <functionlink id="SuspendThreadList"></functionlink>)
1848 will resume execution.
1849 </description>
1850 <origin>jvmdi</origin>
1851 <capabilities>
1852 <required id="can_suspend"></required>
1853 </capabilities>
1854 <parameters>
1855 <param id="request_count">
1856 <jint min="0"/>
1857 <description>
1858 The number of threads to resume.
1859 </description>
1860 </param>
1861 <param id="request_list">
1862 <inbuf incount="request_count"><jthread/></inbuf>
1863 <description>
1864 The threads to resume.
1865 </description>
1866 </param>
1867 <param id="results">
1868 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>
1869 <description>
1870 An agent supplied array of
1871 <paramlink id="request_count"></paramlink> elements.
1872 On return, filled with the error code for
1873 the resume of the corresponding thread.
1874 The error code will be
1875 <errorlink id="JVMTI_ERROR_NONE"></errorlink>
1876 if the thread was suspended by this call.
1877 Possible error codes are those specified
1878 for <functionlink id="ResumeThread"></functionlink>.
1879 </description>
1880 </param>
1881 </parameters>
1882 <errors>
1883 </errors>
1884 </function>
1885
1886 <function id="ResumeAllVirtualThreads" num="119" since="21">
1887 <synopsis>Resume All Virtual Threads</synopsis>
1888 <description>
1889 Resume all virtual threads except those in the exception list.
1890 Virtual threads that are currently resumed do not change state.
1891 Virtual threads may be suspended with
1892 <functionlink id="SuspendAllVirtualThreads"></functionlink> or
1893 <functionlink id="SuspendThreadList"></functionlink> or
1894 <functionlink id="SuspendThread"></functionlink>.
1895 </description>
1896 <origin>new</origin>
1897 <capabilities>
1898 <required id="can_suspend"></required>
1899 <required id="can_support_virtual_threads">Can support virtual threads</required>
1900 </capabilities>
1901 <parameters>
1902 <param id="except_count">
1903 <jint min="0"/>
1904 <description>
1905 The number of threads in the list of threads not to be resumed.
1906 </description>
1907 </param>
1908 <param id="except_list">
1909 <inbuf incount="except_count">
1910 <jthread/>
1911 <nullok>not an error if <code>except_count == 0</code></nullok>
1912 </inbuf>
1913 <description>
1914 The list of threads not to be resumed.
1915 </description>
1916 </param>
1917 </parameters>
1918 <errors>
1919 <error id="JVMTI_ERROR_INVALID_THREAD">
1920 A thread in <paramlink id="except_list"></paramlink> was invalid.
1921 </error>
1922 <error id="JVMTI_ERROR_NULL_POINTER">
1923 Both <paramlink id="except_list"></paramlink> was null
1924 and <paramlink id="except_count"></paramlink> was non-zero.
1925 </error>
1926 </errors>
1927 </function>
1928
1929 <function id="StopThread" num="7">
1930 <synopsis>Stop Thread</synopsis>
1931 <description>
1932 Send the specified asynchronous exception to the specified thread.
1933 </description>
1934 <origin>jvmdi</origin>
1935 <capabilities>
1936 <required id="can_signal_thread"></required>
1937 </capabilities>
1938 <parameters>
1939 <param id="thread">
1940 <jthread impl="noconvert"/>
1941 <description>
1942 The thread to stop.
1943 The <functionlink id="StopThread"></functionlink> function may be used to send
1944 an asynchronous exception to a virtual thread when it is suspended at an event.
1945 An implementation may support sending an asynchronous exception to a suspended
1946 virtual thread in other cases.
1947 </description>
1948 </param>
1949 <param id="exception">
1950 <jobject/>
1951 <description>
1952 The asynchronous exception object.
1953 </description>
1954 </param>
1955 </parameters>
1956 <errors>
1957 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
1958 Thread is a virtual thread and was not suspended and was not the current thread.
1959 </error>
1960 <error id="JVMTI_ERROR_OPAQUE_FRAME">
1961 The thread is a suspended virtual thread and the implementation was unable
1962 to throw an asynchronous exception from the current frame.
1963 </error>
1964 </errors>
1965 </function>
1966
1967 <function id="InterruptThread" num="8">
1968 <synopsis>Interrupt Thread</synopsis>
1969 <description>
1970 Interrupt the specified thread
1971 (similar to <code>java.lang.Thread.interrupt</code>).
1972 </description>
1973 <origin>jvmdi</origin>
1974 <capabilities>
1975 <required id="can_signal_thread"></required>
1976 </capabilities>
1977 <parameters>
1978 <param id="thread">
1979 <jthread impl="noconvert"/>
1980 <description>
1981 The thread to interrupt.
1982 </description>
1983 </param>
1984 </parameters>
1985 <errors>
1986 </errors>
1987 </function>
1988
1989 <function id="GetThreadInfo" num="9">
1990 <synopsis>Get Thread Info</synopsis>
1991 <typedef id="jvmtiThreadInfo" label="Thread information structure">
1992 <field id="name">
1993 <allocfieldbuf><char/></allocfieldbuf>
1994 <description>
1995 The thread name, encoded as a
1996 <internallink id="mUTF">modified UTF-8</internallink> string.
1997 </description>
1998 </field>
1999 <field id="priority">
2000 <jint/>
2001 <description>
2002 The thread priority. See the thread priority constants:
2003 <datalink id="jvmtiThreadPriority"></datalink>. The priority of a
2004 virtual thread is always <code>JVMTI_THREAD_NORM_PRIORITY</code>.
2005 </description>
2006 </field>
2007 <field id="is_daemon">
2008 <jboolean/>
2009 <description>
2010 Is this a daemon thread? The daemon status of a virtual thread is
2011 always <code>JNI_TRUE</code>.
2012 </description>
2013 </field>
2014 <field id="thread_group">
2015 <jthreadGroup/>
2016 <description>
2017 The thread group to which this thread belongs.
2018 Null if the thread has terminated.
2019 </description>
2020 </field>
2021 <field id="context_class_loader">
2022 <jobject/>
2023 <description>
2024 The context class loader associated with this thread.
2025 </description>
2026 </field>
2027 </typedef>
2028 <description>
2029 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure
2030 are filled in with details of the specified thread.
2031 </description>
2032 <origin>jvmdi</origin>
2033 <capabilities>
2034 </capabilities>
2035 <parameters>
2036 <param id="thread">
2037 <jthread null="current" impl="noconvert" started="maybe"/>
2038 <description>
2039 The thread to query.
2040 </description>
2041 </param>
2042 <param id="info_ptr">
2043 <outptr><struct>jvmtiThreadInfo</struct></outptr>
2044 <description>
2045 On return, filled with information describing the specified thread.
2046 </description>
2047 </param>
2048 </parameters>
2049 <errors>
2050 </errors>
2051 </function>
2052
2053 <function id="GetOwnedMonitorInfo" num="10">
2054 <synopsis>Get Owned Monitor Info</synopsis>
2055 <description>
2056 Get information about the monitors owned by the
2057 specified thread.
2058 </description>
2059 <origin>jvmdiClone</origin>
2060 <capabilities>
2061 <required id="can_get_owned_monitor_info"></required>
2062 </capabilities>
2063 <parameters>
2064 <param id="thread">
2065 <jthread null="current" impl="noconvert"/>
2066 <description>
2067 The thread to query.
2068 </description>
2069 </param>
2070 <param id="owned_monitor_count_ptr">
2071 <outptr><jint/></outptr>
2072 <description>
2073 The number of monitors returned.
2074 </description>
2075 </param>
2076 <param id="owned_monitors_ptr">
2077 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf>
2078 <description>
2079 The array of owned monitors.
2080 </description>
2081 </param>
2082 </parameters>
2083 <errors>
2084 </errors>
2085 </function>
2086
2087 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1">
2088 <synopsis>Get Owned Monitor Stack Depth Info</synopsis>
2089 <typedef id="jvmtiMonitorStackDepthInfo"
2090 label="Monitor stack depth information structure">
2091 <field id="monitor">
2092 <jobject/>
2093 <description>
2094 The owned monitor.
2095 </description>
2096 </field>
2097 <field id="stack_depth">
2098 <jint/>
2099 <description>
2100 The stack depth. Corresponds to the stack depth used in the
2101 <internallink id="stack">Stack Frame functions</internallink>.
2102 That is, zero is the current frame, one is the frame which
2103 called the current frame. And it is negative one if the
2104 implementation cannot determine the stack depth (e.g., for
2105 monitors acquired by JNI <code>MonitorEnter</code>).
2106 </description>
2107 </field>
2108 </typedef>
2109 <description>
2110 Get information about the monitors owned by the
2111 specified thread and the depth of the stack frame which locked them.
2112 </description>
2113 <origin>new</origin>
2114 <capabilities>
2115 <required id="can_get_owned_monitor_stack_depth_info"></required>
2116 </capabilities>
2117 <parameters>
2118 <param id="thread">
2119 <jthread null="current" impl="noconvert"/>
2120 <description>
2121 The thread to query.
2122 </description>
2123 </param>
2124 <param id="monitor_info_count_ptr">
2125 <outptr><jint/></outptr>
2126 <description>
2127 The number of monitors returned.
2128 </description>
2129 </param>
2130 <param id="monitor_info_ptr">
2131 <allocbuf outcount="monitor_info_count_ptr">
2132 <struct>jvmtiMonitorStackDepthInfo</struct>
2133 </allocbuf>
2134 <description>
2135 The array of owned monitor depth information.
2136 </description>
2137 </param>
2138 </parameters>
2139 <errors>
2140 </errors>
2141 </function>
2142
2143 <function id="GetCurrentContendedMonitor" num="11">
2144 <synopsis>Get Current Contended Monitor</synopsis>
2145 <description>
2146 Get the object, if any, whose monitor the specified thread is waiting to
2147 enter or waiting to regain through <code>java.lang.Object.wait</code>.
2148 </description>
2149 <origin>jvmdi</origin>
2150 <capabilities>
2151 <required id="can_get_current_contended_monitor"></required>
2152 </capabilities>
2153 <parameters>
2154 <param id="thread">
2155 <jthread null="current" impl="noconvert"/>
2156 <description>
2157 The thread to query.
2158 </description>
2159 </param>
2160 <param id="monitor_ptr">
2161 <outptr><jobject/></outptr>
2162 <description>
2163 On return, filled with the current contended monitor, or
2164 null if there is none.
2165 </description>
2166 </param>
2167 </parameters>
2168 <errors>
2169 </errors>
2170 </function>
2171
2172 <callback id="jvmtiStartFunction">
2173 <void/>
2174 <synopsis>Agent Start Function</synopsis>
2175 <description>
2176 Agent supplied callback function.
2177 This function is the entry point for an agent thread
2178 started with
2179 <functionlink id="RunAgentThread"></functionlink>.
2180 </description>
2181 <parameters>
2182 <param id="jvmti_env">
2183 <outptr>
2184 <struct>jvmtiEnv</struct>
2185 </outptr>
2186 <description>
2187 The <jvmti/> environment.
2188 </description>
2189 </param>
2190 <param id="jni_env">
2191 <outptr>
2192 <struct>JNIEnv</struct>
2193 </outptr>
2194 <description>
2195 The JNI environment.
2196 </description>
2197 </param>
2198 <param id="arg">
2199 <outptr>
2200 <void/>
2201 </outptr>
2202 <description>
2203 The <code>arg</code> parameter passed to
2204 <functionlink id="RunAgentThread"></functionlink>.
2205 </description>
2206 </param>
2207 </parameters>
2208 </callback>
2209
2210 <function id="RunAgentThread" num="12">
2211 <synopsis>Run Agent Thread</synopsis>
2212 <description>
2213 Starts the execution of an agent thread. with the specified native function.
2214 The parameter <paramlink id="arg"></paramlink> is forwarded on to the
2215 <functionlink id="jvmtiStartFunction">start function</functionlink>
2216 (specified with <paramlink id="proc"></paramlink>) as its single argument.
2217 This function allows the creation of agent threads
2218 for handling communication with another process or for handling events
2219 without the need to load a special subclass of <code>java.lang.Thread</code> or
2220 implementer of <code>java.lang.Runnable</code>.
2221 Instead, the created thread can run entirely in native code.
2222 However, the created thread does require a newly created instance
2223 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to
2224 which it will be associated.
2225 The thread object can be created with JNI calls.
2226 <p/>
2227 The following common thread priorities are provided for your convenience:
2228 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const">
2229 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1">
2230 Minimum possible thread priority
2231 </constant>
2232 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5">
2233 Normal thread priority
2234 </constant>
2235 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10">
2236 Maximum possible thread priority
2237 </constant>
2238 </constants>
2239 <p/>
2240 The new thread is started as a daemon thread with the specified
2241 <paramlink id="priority"></paramlink>.
2242 If enabled, a <eventlink id="ThreadStart"/> event will be sent.
2243 <p/>
2244 Since the thread has been started, the thread will be live when this function
2245 returns, unless the thread terminated immediately.
2246 <p/>
2247 The thread group of the thread is ignored -- specifically, the thread is not
2248 added to the thread group and the thread is not seen on queries of the thread
2249 group at either the Java programming language or <jvmti/> levels.
2250 <p/>
2251 The thread is not visible to Java programming language queries but is
2252 included in <jvmti/> queries (for example,
2253 <functionlink id="GetAllThreads"/> and
2254 <functionlink id="GetAllStackTraces"/>).
2255 <p/>
2256 Upon execution of <code>proc</code>, the new thread will be attached to the
2257 VM -- see the JNI documentation on
2258 <externallink id="jni/invocation.html#attaching-to-the-vm"
2259 >Attaching to the VM</externallink>.
2260 </description>
2261 <origin>jvmdiClone</origin>
2262 <capabilities>
2263 </capabilities>
2264 <parameters>
2265 <param id="thread">
2266 <jthread impl="noconvert" started="no"/>
2267 <description>
2268 The thread to run.
2269 The <code>thread</code> may not be a virtual thread. Otherwise, the error code
2270 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
2271 </description>
2272 </param>
2273 <param id="proc">
2274 <ptrtype>
2275 <struct>jvmtiStartFunction</struct>
2276 </ptrtype>
2277 <description>
2278 The start function.
2279 </description>
2280 </param>
2281 <param id="arg">
2282 <inbuf>
2283 <void/>
2284 <nullok>A null pointer is passed to the start function</nullok>
2285 </inbuf>
2286 <description>
2287 The argument to the start function.
2288 </description>
2289 </param>
2290 <param id="priority">
2291 <jint/>
2292 <description>
2293 The priority of the started thread. Any thread
2294 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including
2295 those in <datalink id="jvmtiThreadPriority"></datalink>.
2296 </description>
2297 </param>
2298 </parameters>
2299 <errors>
2300 <error id="JVMTI_ERROR_INVALID_PRIORITY">
2301 <paramlink id="priority"/> is less than
2302 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/>
2303 or greater than
2304 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/>
2305 </error>
2306 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
2307 <paramlink id="thread"/> is a virtual thread.
2308 </error>
2309 </errors>
2310 </function>
2311
2312 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103">
2313 <synopsis>Set Thread Local Storage</synopsis>
2314 <description>
2315 The VM stores a pointer value associated with each environment-thread
2316 pair. This pointer value is called <i>thread-local storage</i>.
2317 This value is null unless set with this function.
2318 Agents can allocate memory in which they store thread specific
2319 information. By setting thread-local storage it can then be
2320 accessed with
2321 <functionlink id="GetThreadLocalStorage"></functionlink>.
2322 <p/>
2323 This function is called by the agent to set the value of the <jvmti/>
2324 thread-local storage. <jvmti/> supplies to the agent a pointer-size
2325 thread-local storage that can be used to record per-thread
2326 information.
2327 </description>
2328 <origin>jvmpi</origin>
2329 <capabilities>
2330 </capabilities>
2331 <parameters>
2332 <param id="thread">
2333 <jthread null="current" impl="noconvert"/>
2334 <description>
2335 Store to this thread.
2336 </description>
2337 </param>
2338 <param id="data">
2339 <inbuf>
2340 <void/>
2341 <nullok>value is set to null</nullok>
2342 </inbuf>
2343 <description>
2344 The value to be entered into the thread-local storage.
2345 </description>
2346 </param>
2347 </parameters>
2348 <errors>
2349 </errors>
2350 </function>
2351
2352 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102">
2353 <synopsis>Get Thread Local Storage</synopsis>
2354 <description>
2355 Called by the agent to get the value of the <jvmti/> thread-local
2356 storage.
2357 </description>
2358 <origin>jvmpi</origin>
2359 <capabilities>
2360 </capabilities>
2361 <parameters>
2362 <param id="thread">
2363 <jthread null="current" impl="noconvert"/>
2364 <description>
2365 Retrieve from this thread.
2366 </description>
2367 </param>
2368 <param id="data_ptr">
2369 <agentbuf><void/></agentbuf>
2370 <description>
2371 Pointer through which the value of the thread local
2372 storage is returned.
2373 If thread-local storage has not been set with
2374 <functionlink id="SetThreadLocalStorage"></functionlink> the returned
2375 pointer is null.
2376 </description>
2377 </param>
2378 </parameters>
2379 <errors>
2380 </errors>
2381 </function>
2382
2383 </category>
2384
2385 <category id="thread_groups" label="Thread Group">
2386 <intro>
2387 </intro>
2388
2389 <function id="GetTopThreadGroups" num="13">
2390 <synopsis>Get Top Thread Groups</synopsis>
2391 <description>
2392 Return all top-level (parentless) thread groups in the VM.
2393 </description>
2394 <origin>jvmdi</origin>
2395 <capabilities>
2396 </capabilities>
2397 <parameters>
2398 <param id="group_count_ptr">
2399 <outptr><jint/></outptr>
2400 <description>
2401 On return, points to the number of top-level thread groups.
2402 </description>
2403 </param>
2404 <param id="groups_ptr">
2405 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>
2406 <description>
2407 On return, refers to a pointer to the top-level thread group array.
2408 </description>
2409 </param>
2410 </parameters>
2411 <errors>
2412 </errors>
2413 </function>
2414
2415 <function id="GetThreadGroupInfo" num="14">
2416 <synopsis>Get Thread Group Info</synopsis>
2417 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure">
2418 <field id="parent">
2419 <jthreadGroup/>
2420 <description>
2421 The parent thread group.
2422 </description>
2423 </field>
2424 <field id="name">
2425 <allocfieldbuf><char/></allocfieldbuf>
2426 <description>
2427 The thread group's name, encoded as a
2428 <internallink id="mUTF">modified UTF-8</internallink> string.
2429 </description>
2430 </field>
2431 <field id="max_priority">
2432 <jint/>
2433 <description>
2434 The maximum priority for this thread group.
2435 </description>
2436 </field>
2437 <field id="is_daemon">
2438 <jboolean/>
2439 <description>
2440 Is this a daemon thread group?
2441 </description>
2442 </field>
2443 </typedef>
2444 <description>
2445 Get information about the thread group. The fields of the
2446 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure
2447 are filled in with details of the specified thread group.
2448 </description>
2449 <origin>jvmdi</origin>
2450 <capabilities>
2451 </capabilities>
2452 <parameters>
2453 <param id="group">
2454 <jthreadGroup/>
2455 <description>
2456 The thread group to query.
2457 </description>
2458 </param>
2459 <param id="info_ptr">
2460 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr>
2461 <description>
2462 On return, filled with information describing the specified
2463 thread group.
2464 </description>
2465 </param>
2466 </parameters>
2467 <errors>
2468 </errors>
2469 </function>
2470
2471 <function id="GetThreadGroupChildren" num="15">
2472 <synopsis>Get Thread Group Children</synopsis>
2473 <description>
2474 Get the live platform threads and the child thread groups in this
2475 thread group. Virtual threads are not returned by this function.
2476 </description>
2477 <origin>jvmdi</origin>
2478 <capabilities>
2479 </capabilities>
2480 <parameters>
2481 <param id="group">
2482 <jthreadGroup/>
2483 <description>
2484 The group to query.
2485 </description>
2486 </param>
2487 <param id="thread_count_ptr">
2488 <outptr><jint/></outptr>
2489 <description>
2490 On return, points to the number of live threads in this thread group.
2491 </description>
2492 </param>
2493 <param id="threads_ptr">
2494 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf>
2495 <description>
2496 On return, points to an array of the live threads in this thread group.
2497 </description>
2498 </param>
2499 <param id="group_count_ptr">
2500 <outptr><jint/></outptr>
2501 <description>
2502 On return, points to the number of child thread groups
2503 </description>
2504 </param>
2505 <param id="groups_ptr">
2506 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>
2507 <description>
2508 On return, points to an array of the child thread groups.
2509 </description>
2510 </param>
2511 </parameters>
2512 <errors>
2513 </errors>
2514 </function>
2515 </category>
2516
2517 <category id="stack" label="Stack Frame">
2518 <intro>
2519 These functions provide information about the stack of a thread.
2520 Stack frames are referenced by depth.
2521 The frame at depth zero is the current frame.
2522 <p/>
2523 Stack frames are as described in
2524 <vmspec chapter="3.6"/>,
2525 That is, they correspond to method
2526 invocations (including native methods) but do not correspond to platform native or
2527 VM internal frames.
2528 <p/>
2529 A <jvmti/> implementation may use method invocations to launch a thread and
2530 the corresponding frames may be included in the stack as presented by these functions --
2531 that is, there may be frames shown
2532 deeper than <code>main()</code> and <code>run()</code>.
2533 However this presentation must be consistent across all <jvmti/> functionality which
2534 uses stack frames or stack depth.
2535 </intro>
2536
2537 <typedef id="jvmtiFrameInfo" label="Stack frame information structure">
2538 <description>
2539 Information about a stack frame is returned in this structure.
2540 </description>
2541 <field id="method">
2542 <jmethodID/>
2543 <description>
2544 The method executing in this frame.
2545 </description>
2546 </field>
2547 <field id="location">
2548 <jlocation/>
2549 <description>
2550 The index of the instruction executing in this frame.
2551 <code>-1</code> if the frame is executing a native method.
2552 </description>
2553 </field>
2554 </typedef>
2555
2556 <typedef id="jvmtiStackInfo" label="Stack information structure">
2557 <description>
2558 Information about a set of stack frames is returned in this structure.
2559 </description>
2560 <field id="thread">
2561 <jthread/>
2562 <description>
2563 On return, the thread traced.
2564 </description>
2565 </field>
2566 <field id="state">
2567 <jint/>
2568 <description>
2569 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>.
2570 </description>
2571 </field>
2572 <field id="frame_buffer">
2573 <outbuf incount="max_frame_count">
2574 <struct>jvmtiFrameInfo</struct>
2575 </outbuf>
2576 <description>
2577 On return, this agent allocated buffer is filled
2578 with stack frame information.
2579 </description>
2580 </field>
2581 <field id="frame_count">
2582 <jint/>
2583 <description>
2584 On return, the number of records filled into
2585 <code>frame_buffer</code>.
2586 This will be
2587 min(<code>max_frame_count</code>, <i>stackDepth</i>).
2588 </description>
2589 </field>
2590 </typedef>
2591
2592 <function id="GetStackTrace" num="104">
2593 <synopsis>Get Stack Trace</synopsis>
2594 <description>
2595 Get information about the stack of a thread.
2596 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack,
2597 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned,
2598 otherwise the entire stack is returned.
2599 The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2600 <p/>
2601 The following example causes up to five of the topmost frames
2602 to be returned and (if there are any frames) the currently
2603 executing method name to be printed.
2604 <example>
2605 jvmtiFrameInfo frames[5];
2606 jint count;
2607 jvmtiError err;
2608
2609 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5,
2610 frames, &count);
2611 if (err == JVMTI_ERROR_NONE && count >= 1) {
2612 char *methodName;
2613 err = (*jvmti)->GetMethodName(jvmti, frames[0].method,
2614 &methodName, NULL, NULL);
2615 if (err == JVMTI_ERROR_NONE) {
2616 printf("Executing method: %s", methodName);
2617 }
2618 }
2619 </example>
2620 <todo>
2621 check example code.
2622 </todo>
2623 <p/>
2624 The <paramlink id="thread"></paramlink> need not be suspended
2625 to call this function.
2626 <p/>
2627 The <functionlink id="GetLineNumberTable"></functionlink>
2628 function can be used to map locations to line numbers. Note that
2629 this mapping can be done lazily.
2630 </description>
2631 <origin>jvmpi</origin>
2632 <capabilities>
2633 </capabilities>
2634 <parameters>
2635 <param id="thread">
2636 <jthread null="current" impl="noconvert"/>
2637 <description>
2638 Fetch the stack trace of this thread.
2639 </description>
2640 </param>
2641 <param id="start_depth">
2642 <jint/>
2643 <description>
2644 Begin retrieving frames at this depth.
2645 If non-negative, count from the current frame,
2646 the first frame retrieved is at depth <code>start_depth</code>.
2647 For example, if zero, start from the current frame; if one, start from the
2648 caller of the current frame; if two, start from the caller of the
2649 caller of the current frame; and so on.
2650 If negative, count from below the oldest frame,
2651 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>,
2652 where <i>stackDepth</i> is the count of frames on the stack.
2653 For example, if negative one, only the oldest frame is retrieved;
2654 if negative two, start from the frame called by the oldest frame.
2655 </description>
2656 </param>
2657 <param id="max_frame_count">
2658 <jint min="0"/>
2659 <description>
2660 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.
2661 </description>
2662 </param>
2663 <param id="frame_buffer">
2664 <outbuf incount="max_frame_count" outcount="count_ptr">
2665 <struct>jvmtiFrameInfo</struct>
2666 </outbuf>
2667 <description>
2668 On return, this agent allocated buffer is filled
2669 with stack frame information.
2670 </description>
2671 </param>
2672 <param id="count_ptr">
2673 <outptr><jint/></outptr>
2674 <description>
2675 On return, points to the number of records filled in.
2676 For non-negative <code>start_depth</code>, this will be
2677 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>).
2678 For negative <code>start_depth</code>, this will be
2679 min(<code>max_frame_count</code>, <code>-start_depth</code>).
2680 </description>
2681 </param>
2682 </parameters>
2683 <errors>
2684 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
2685 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>.
2686 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>.
2687 </error>
2688 </errors>
2689 </function>
2690
2691
2692 <function id="GetAllStackTraces" num="100">
2693 <synopsis>Get All Stack Traces</synopsis>
2694 <description>
2695 Get the stack traces of all live platform threads attached to the VM.
2696 The list includes the stack traces of
2697 <internallink id="RunAgentThread">agent threads</internallink>.
2698 It does not include the stack traces of virtual threads.
2699 <p/>
2700 If <paramlink id="max_frame_count"/> is less than the depth of a stack,
2701 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,
2702 otherwise the entire stack is returned.
2703 The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2704 <p/>
2705 All stacks are collected simultaneously, that is, no changes will occur to the
2706 thread state or stacks between the sampling of one thread and the next.
2707 The threads need not be suspended.
2708
2709 <example>
2710 jvmtiStackInfo *stack_info;
2711 jint thread_count;
2712 int ti;
2713 jvmtiError err;
2714
2715 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count);
2716 if (err != JVMTI_ERROR_NONE) {
2717 ...
2718 }
2719 for (ti = 0; ti < thread_count; ++ti) {
2720 jvmtiStackInfo *infop = &stack_info[ti];
2721 jthread thread = infop->thread;
2722 jint state = infop->state;
2723 jvmtiFrameInfo *frames = infop->frame_buffer;
2724 int fi;
2725
2726 myThreadAndStatePrinter(thread, state);
2727 for (fi = 0; fi < infop->frame_count; fi++) {
2728 myFramePrinter(frames[fi].method, frames[fi].location);
2729 }
2730 }
2731 /* this one Deallocate call frees all data allocated by GetAllStackTraces */
2732 err = (*jvmti)->Deallocate(jvmti, stack_info);
2733 </example>
2734 <todo>
2735 check example code.
2736 </todo>
2737
2738 </description>
2739 <origin>new</origin>
2740 <capabilities>
2741 </capabilities>
2742 <parameters>
2743 <param id="max_frame_count">
2744 <jint min="0"/>
2745 <description>
2746 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread.
2747 </description>
2748 </param>
2749 <param id="stack_info_ptr">
2750 <allocbuf>
2751 <struct>jvmtiStackInfo</struct>
2752 </allocbuf>
2753 <description>
2754 On return, this buffer is filled
2755 with stack information for each thread.
2756 The number of <datalink id="jvmtiStackInfo"/> records is determined
2757 by <paramlink id="thread_count_ptr"/>.
2758 <p/>
2759 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>
2760 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.
2761 These buffers must not be separately deallocated.
2762 </description>
2763 </param>
2764 <param id="thread_count_ptr">
2765 <outptr><jint/></outptr>
2766 <description>
2767 The number of threads traced.
2768 </description>
2769 </param>
2770 </parameters>
2771 <errors>
2772 </errors>
2773 </function>
2774
2775 <function id="GetThreadListStackTraces" num="101">
2776 <synopsis>Get Thread List Stack Traces</synopsis>
2777 <description>
2778 Get information about the stacks of the supplied threads.
2779 If <paramlink id="max_frame_count"/> is less than the depth of a stack,
2780 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,
2781 otherwise the entire stack is returned.
2782 The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2783 <p/>
2784 All stacks are collected simultaneously, that is, no changes will occur to the
2785 thread state or stacks between the sampling one thread and the next.
2786 The threads need not be suspended.
2787 <p/>
2788 If a thread has not yet started or terminates before the stack information is collected,
2789 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero)
2790 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked.
2791 <p/>
2792 See the example for the similar function
2793 <functionlink id="GetAllStackTraces"/>.
2794 </description>
2795 <origin>new</origin>
2796 <capabilities>
2797 </capabilities>
2798 <parameters>
2799 <param id="thread_count">
2800 <jint min="0"/>
2801 <description>
2802 The number of threads to trace.
2803 </description>
2804 </param>
2805 <param id="thread_list">
2806 <inbuf incount="thread_count"><jthread/></inbuf>
2807 <description>
2808 The list of threads to trace.
2809 </description>
2810 </param>
2811 <param id="max_frame_count">
2812 <jint min="0"/>
2813 <description>
2814 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread.
2815 </description>
2816 </param>
2817 <param id="stack_info_ptr">
2818 <allocbuf outcount="thread_count">
2819 <struct>jvmtiStackInfo</struct>
2820 </allocbuf>
2821 <description>
2822 On return, this buffer is filled
2823 with stack information for each thread.
2824 The number of <datalink id="jvmtiStackInfo"/> records is determined
2825 by <paramlink id="thread_count"/>.
2826 <p/>
2827 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>
2828 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.
2829 These buffers must not be separately deallocated.
2830 </description>
2831 </param>
2832 </parameters>
2833 <errors>
2834 <error id="JVMTI_ERROR_INVALID_THREAD">
2835 An element in <paramlink id="thread_list"/> is not a thread object.
2836 </error>
2837 </errors>
2838 </function>
2839
2840 <elide>
2841 <function id="AsyncGetStackTrace" num="1000">
2842 <synopsis>Get Stack Trace--Asynchronous</synopsis>
2843 <description>
2844 Get information about the entire stack of a thread (or a sub-section of it).
2845 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink>
2846 and is reentrant and safe to call
2847 from asynchronous signal handlers.
2848 The stack trace is returned only for the calling thread.
2849 <p/>
2850 The <functionlink id="GetLineNumberTable"></functionlink>
2851 function can be used to map locations to line numbers. Note that
2852 this mapping can be done lazily.
2853 </description>
2854 <origin>jvmpi</origin>
2855 <capabilities>
2856 <required id="can_get_async_stack_trace"></required>
2857 <capability id="can_show_JVM_spec_async_frames">
2858 If <code>false</code>,
2859 <paramlink id="use_java_stack"></paramlink>
2860 must be <code>false</code>.
2861 </capability>
2862 </capabilities>
2863 <parameters>
2864 <param id="use_java_stack">
2865 <jboolean/>
2866 <description>
2867 Return the stack showing <vmspec/>
2868 model of the stack;
2869 otherwise, show the internal representation of the stack with
2870 inlined and optimized methods missing. If the virtual machine
2871 is using the <i>Java Virtual Machine Specification</i> stack model
2872 internally, this flag is ignored.
2873 </description>
2874 </param>
2875 <param id="max_count">
2876 <jint min="0"/>
2877 <description>
2878 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.
2879 Retrieve this many unless the stack depth is less than <code>max_count</code>.
2880 </description>
2881 </param>
2882 <param id="frame_buffer">
2883 <outbuf incount="max_count" outcount="count_ptr">
2884 <struct>jvmtiFrameInfo</struct>
2885 <nullok>this information is not returned</nullok>
2886 </outbuf>
2887 <description>
2888 The agent passes in a buffer
2889 large enough to hold <code>max_count</code> records of
2890 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be
2891 pre-allocated by the agent.
2892 </description>
2893 </param>
2894 <param id="count_ptr">
2895 <outptr><jint/></outptr>
2896 <description>
2897 On return, points to the number of records filled in..
2898 </description>
2899 </param>
2900 </parameters>
2901 <errors>
2902 <error id="JVMTI_ERROR_UNATTACHED_THREAD">
2903 The thread being used to call this function is not attached
2904 to the virtual machine. Calls must be made from attached threads.
2905 </error>
2906 </errors>
2907 </function>
2908 </elide>
2909
2910 <function id="GetFrameCount" num="16">
2911 <synopsis>Get Frame Count</synopsis>
2912 <description>
2913 Get the number of frames currently in the specified thread's call stack.
2914 <p/>
2915 If this function is called for a thread actively executing bytecodes (for example,
2916 not the current thread and not suspended), the information returned is transient.
2917 </description>
2918 <origin>jvmdi</origin>
2919 <capabilities>
2920 </capabilities>
2921 <parameters>
2922 <param id="thread">
2923 <jthread null="current" impl="noconvert"/>
2924 <description>
2925 The thread to query.
2926 </description>
2927 </param>
2928 <param id="count_ptr">
2929 <outptr><jint/></outptr>
2930 <description>
2931 On return, points to the number of frames in the call stack.
2932 </description>
2933 </param>
2934 </parameters>
2935 <errors>
2936 </errors>
2937 </function>
2938
2939 <function id="PopFrame" num="80">
2940 <synopsis>Pop Frame</synopsis>
2941 <description>
2942 Pop the current frame of <code>thread</code>'s stack.
2943 Popping a frame takes you to the previous frame.
2944 When the thread is resumed, the execution
2945 state of the thread is reset to the state
2946 immediately before the called method was invoked.
2947 That is (using <vmspec/> terminology):
2948 <ul>
2949 <li>the current frame is discarded as the previous frame becomes the current one</li>
2950 <li>the operand stack is restored--the argument values are added back
2951 and if the invoke was not <code>invokestatic</code>,
2952 <code>objectref</code> is added back as well</li>
2953 <li>the Java virtual machine PC is restored to the opcode
2954 of the invoke instruction</li>
2955 </ul>
2956 Note however, that any changes to the arguments, which
2957 occurred in the called method, remain;
2958 when execution continues, the first instruction to
2959 execute will be the invoke.
2960 <p/>
2961 Between calling <code>PopFrame</code> and resuming the
2962 thread the state of the stack is undefined.
2963 To pop frames beyond the first,
2964 these three steps must be repeated:
2965 <ul>
2966 <li>suspend the thread via an event (step, breakpoint, ...)</li>
2967 <li>call <code>PopFrame</code></li>
2968 <li>resume the thread</li>
2969 </ul>
2970 <p/>
2971 A lock acquired by calling the called method
2972 (if it is a <code>synchronized</code> method)
2973 and locks acquired by entering <code>synchronized</code>
2974 blocks within the called method are released.
2975 Note: this does not apply to native locks or
2976 <code>java.util.concurrent.locks</code> locks.
2977 <p/>
2978 Finally blocks are not executed.
2979 <p/>
2980 Changes to global state are not addressed and thus remain changed.
2981 <p/>
2982 The specified thread must be suspended or must be the current thread.
2983 <p/>
2984 Both the called method and calling method must be non-native Java programming
2985 language methods.
2986 <p/>
2987 No <jvmti/> events are generated by this function.
2988 </description>
2989 <origin>jvmdi</origin>
2990 <capabilities>
2991 <required id="can_pop_frame"></required>
2992 </capabilities>
2993 <parameters>
2994 <param id="thread">
2995 <jthread impl="noconvert"/>
2996 <description>
2997 The thread whose current frame is to be popped.
2998 The <functionlink id="PopFrame"></functionlink> function may be used to
2999 pop the current frame of a virtual thread when it is suspended at an event.
3000 An implementation may support popping the current frame of a suspended
3001 virtual thread in other cases.
3002 </description>
3003 </param>
3004 </parameters>
3005 <errors>
3006 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3007 The implementation is unable to pop this frame
3008 (e.g. called or calling method is a native method).
3009 </error>
3010 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3011 Thread was not suspended and was not the current thread.
3012 </error>
3013 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3014 There are less than two stack frames on the call stack.
3015 </error>
3016 </errors>
3017 </function>
3018
3019 <function id="GetFrameLocation" num="19">
3020 <synopsis>Get Frame Location</synopsis>
3021 <description>
3022 <p/>
3023 For a Java programming language frame, return the location of the instruction
3024 currently executing.
3025 </description>
3026 <origin>jvmdiClone</origin>
3027 <capabilities>
3028 </capabilities>
3029 <parameters>
3030 <param id="thread">
3031 <jthread null="current" frame="frame" impl="noconvert"/>
3032 <description>
3033 The thread of the frame to query.
3034 </description>
3035 </param>
3036 <param id="depth">
3037 <jframeID thread="thread"/>
3038 <description>
3039 The depth of the frame to query.
3040 </description>
3041 </param>
3042 <param id="method_ptr">
3043 <outptr><jmethodID/></outptr>
3044 <description>
3045 On return, points to the method for the current location.
3046 </description>
3047 </param>
3048 <param id="location_ptr">
3049 <outptr><jlocation/></outptr>
3050 <description>
3051 On return, points to the index of the currently
3052 executing instruction.
3053 Is set to <code>-1</code> if the frame is executing
3054 a native method.
3055 </description>
3056 </param>
3057 </parameters>
3058 <errors>
3059 </errors>
3060 </function>
3061
3062 <function id="NotifyFramePop" num="20">
3063 <synopsis>Notify Frame Pop</synopsis>
3064 <description>
3065 When the frame that is currently at <paramlink id="depth"></paramlink>
3066 is popped from the stack, generate a
3067 <eventlink id="FramePop"></eventlink> event. See the
3068 <eventlink id="FramePop"></eventlink> event for details.
3069 Only frames corresponding to non-native Java programming language
3070 methods can receive notification.
3071 <p/>
3072 The specified thread must be suspended or must be the current thread.
3073 </description>
3074 <origin>jvmdi</origin>
3075 <capabilities>
3076 <required id="can_generate_frame_pop_events"></required>
3077 </capabilities>
3078 <parameters>
3079 <param id="thread">
3080 <jthread null="current" frame="depth" impl="noconvert"/>
3081 <description>
3082 The thread of the frame for which the frame pop event will be generated.
3083 </description>
3084 </param>
3085 <param id="depth">
3086 <jframeID thread="thread"/>
3087 <description>
3088 The depth of the frame for which the frame pop event will be generated.
3089 </description>
3090 </param>
3091 </parameters>
3092 <errors>
3093 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3094 A <eventlink id="FramePop"></eventlink> event cannot be generated for this frame
3095 (e.g. the frame at <code>depth</code> is executing a native method).
3096 </error>
3097 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3098 Thread was not suspended and was not the current thread.
3099 </error>
3100 <error id="JVMTI_ERROR_DUPLICATE">
3101 There is already a frame pop event request at the specified depth.
3102 </error>
3103 </errors>
3104 </function>
3105
3106 <function id="ClearAllFramePops" num="67" since="25">
3107 <synopsis>Clear Frame Pop</synopsis>
3108 <description>
3109 Clear all frame pop requests so that a <eventlink id="FramePop"></eventlink>
3110 event will not be generated for any frames.
3111 See the <eventlink id="FramePop"></eventlink> event for details.
3112 <p/>
3113 The specified thread must be suspended or must be the current thread.
3114 </description>
3115 <origin>new</origin>
3116 <capabilities>
3117 <required id="can_generate_frame_pop_events"></required>
3118 </capabilities>
3119 <parameters>
3120 <param id="thread">
3121 <jthread null="current" impl="noconvert"/>
3122 <description>
3123 The thread for which all the frame pop events will be cleared.
3124 </description>
3125 </param>
3126 </parameters>
3127 <errors>
3128 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3129 Thread was not suspended and was not the current thread.
3130 </error>
3131 </errors>
3132 </function>
3133
3134 </category>
3135
3136 <category id="ForceEarlyReturn" label="Force Early Return">
3137 <intro>
3138 These functions allow an agent to force a return from the current frame.
3139 The specified thread must be suspended or must be the current thread.
3140 These functions may be used to force a return from the current frame
3141 of a virtual thread when it is suspended at an event.
3142 An implementation may support forcing a return from the current frame
3143 of a suspended virtual thread in other cases.
3144 The method which will return early is referred to as the <i>called method</i>.
3145 The called method is the current method
3146 (as defined by
3147 <vmspec chapter="3.6"/>)
3148 for the specified thread at
3149 the time the function is called.
3150 <p/>
3151 The return occurs when execution of Java programming
3152 language code is resumed on this thread.
3153 Between calling one of these functions and resumption
3154 of thread execution, the state of the stack is undefined.
3155 <p/>
3156 No further instructions are executed in the called method.
3157 Specifically, finally blocks are not executed.
3158 Note: this can cause inconsistent states in the application.
3159 <p/>
3160 A lock acquired by calling the called method
3161 (if it is a <code>synchronized</code> method)
3162 and locks acquired by entering <code>synchronized</code>
3163 blocks within the called method are released.
3164 Note: this does not apply to native locks or
3165 <code>java.util.concurrent.locks</code> locks.
3166 <p/>
3167 Events, such as <eventlink id="MethodExit"></eventlink>,
3168 are generated as they would be in a normal return.
3169 <p/>
3170 The called method must be a non-native Java programming
3171 language method.
3172 Forcing return on a thread with only one frame on the
3173 stack causes the thread to exit when resumed.
3174 </intro>
3175
3176 <function id="ForceEarlyReturnObject" num="81" since="1.1">
3177 <synopsis>Force Early Return - Object</synopsis>
3178 <description>
3179 This function can be used to return from a method whose
3180 result type is <code>Object</code>
3181 or a subclass of <code>Object</code>.
3182 </description>
3183 <origin>new</origin>
3184 <capabilities>
3185 <required id="can_force_early_return"></required>
3186 </capabilities>
3187 <parameters>
3188 <param id="thread">
3189 <jthread null="current" impl="noconvert"/>
3190 <description>
3191 The thread whose current frame is to return early.
3192 </description>
3193 </param>
3194 <param id="value">
3195 <jobject/>
3196 <description>
3197 The return value for the called frame.
3198 An object or a null pointer.
3199 </description>
3200 </param>
3201 </parameters>
3202 <errors>
3203 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3204 The implementation is unable to force the current frame to return
3205 (e.g. current frame is executing a native method).
3206 </error>
3207 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3208 The result type of the called method is not
3209 <code>Object</code> or a subclass of <code>Object</code>.
3210 </error>
3211 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3212 The supplied <paramlink id="value"/> is not compatible with the
3213 result type of the called method.
3214 </error>
3215 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3216 Thread was not suspended and was not the current thread.
3217 </error>
3218 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3219 There are no more frames on the call stack.
3220 </error>
3221 </errors>
3222 </function>
3223
3224 <function id="ForceEarlyReturnInt" num="82" since="1.1">
3225 <synopsis>Force Early Return - Int</synopsis>
3226 <description>
3227 This function can be used to return from a method whose
3228 result type is <code>int</code>, <code>short</code>,
3229 <code>char</code>, <code>byte</code>, or
3230 <code>boolean</code>.
3231 </description>
3232 <origin>new</origin>
3233 <capabilities>
3234 <required id="can_force_early_return"></required>
3235 </capabilities>
3236 <parameters>
3237 <param id="thread">
3238 <jthread null="current" impl="noconvert"/>
3239 <description>
3240 The thread whose current frame is to return early.
3241 </description>
3242 </param>
3243 <param id="value">
3244 <jint/>
3245 <description>
3246 The return value for the called frame.
3247 </description>
3248 </param>
3249 </parameters>
3250 <errors>
3251 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3252 The implementation is unable to force the current frame to return
3253 (e.g. current frame is executing a native method).
3254 </error>
3255 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3256 The result type of the called method is not
3257 <code>int</code>, <code>short</code>,
3258 <code>char</code>, <code>byte</code>, or
3259 <code>boolean</code>.
3260 </error>
3261 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3262 Thread was not suspended and was not the current thread.
3263 </error>
3264 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3265 There are no frames on the call stack.
3266 </error>
3267 </errors>
3268 </function>
3269
3270 <function id="ForceEarlyReturnLong" num="83" since="1.1">
3271 <synopsis>Force Early Return - Long</synopsis>
3272 <description>
3273 This function can be used to return from a method whose
3274 result type is <code>long</code>.
3275 </description>
3276 <origin>new</origin>
3277 <capabilities>
3278 <required id="can_force_early_return"></required>
3279 </capabilities>
3280 <parameters>
3281 <param id="thread">
3282 <jthread null="current" impl="noconvert"/>
3283 <description>
3284 The thread whose current frame is to return early.
3285 </description>
3286 </param>
3287 <param id="value">
3288 <jlong/>
3289 <description>
3290 The return value for the called frame.
3291 </description>
3292 </param>
3293 </parameters>
3294 <errors>
3295 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3296 The implementation is unable to force the current frame to return
3297 (e.g. current frame is executing a native method).
3298 </error>
3299 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3300 The result type of the called method is not <code>long</code>.
3301 </error>
3302 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3303 Thread was not suspended and was not the current thread.
3304 </error>
3305 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3306 There are no frames on the call stack.
3307 </error>
3308 </errors>
3309 </function>
3310
3311 <function id="ForceEarlyReturnFloat" num="84" since="1.1">
3312 <synopsis>Force Early Return - Float</synopsis>
3313 <description>
3314 This function can be used to return from a method whose
3315 result type is <code>float</code>.
3316 </description>
3317 <origin>new</origin>
3318 <capabilities>
3319 <required id="can_force_early_return"></required>
3320 </capabilities>
3321 <parameters>
3322 <param id="thread">
3323 <jthread null="current" impl="noconvert"/>
3324 <description>
3325 The thread whose current frame is to return early.
3326 </description>
3327 </param>
3328 <param id="value">
3329 <jfloat/>
3330 <description>
3331 The return value for the called frame.
3332 </description>
3333 </param>
3334 </parameters>
3335 <errors>
3336 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3337 The implementation is unable to force the current frame to return
3338 (e.g. current frame is executing a native method).
3339 </error>
3340 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3341 The result type of the called method is not <code>float</code>.
3342 </error>
3343 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3344 Thread was not suspended and was not the current thread.
3345 </error>
3346 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3347 There are no frames on the call stack.
3348 </error>
3349 </errors>
3350 </function>
3351
3352 <function id="ForceEarlyReturnDouble" num="85" since="1.1">
3353 <synopsis>Force Early Return - Double</synopsis>
3354 <description>
3355 This function can be used to return from a method whose
3356 result type is <code>double</code>.
3357 </description>
3358 <origin>new</origin>
3359 <capabilities>
3360 <required id="can_force_early_return"></required>
3361 </capabilities>
3362 <parameters>
3363 <param id="thread">
3364 <jthread null="current" impl="noconvert"/>
3365 <description>
3366 The thread whose current frame is to return early.
3367 </description>
3368 </param>
3369 <param id="value">
3370 <jdouble/>
3371 <description>
3372 The return value for the called frame.
3373 </description>
3374 </param>
3375 </parameters>
3376 <errors>
3377 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3378 The implementation is unable to force the current frame to return
3379 (e.g. current frame is executing a native method).
3380 </error>
3381 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3382 The result type of the called method is not <code>double</code>.
3383 </error>
3384 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3385 Thread was not suspended and was not the current thread.
3386 </error>
3387 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3388 There are no frames on the call stack.
3389 </error>
3390 </errors>
3391 </function>
3392
3393 <function id="ForceEarlyReturnVoid" num="86" since="1.1">
3394 <synopsis>Force Early Return - Void</synopsis>
3395 <description>
3396 This function can be used to return from a method with a return type
3397 of <code>void</code>.
3398 A constructor is a special method named <code><init></code> with
3399 a return type of <code>void</code>. A class initializer is a special
3400 method named <code><clinit></code> with a return type of
3401 <code>void</code>.
3402 <p/>
3403 When preview features are enabled, this function can not be used to return
3404 early from the constructor of a value class.
3405 </description>
3406 <origin>new</origin>
3407 <capabilities>
3408 <required id="can_force_early_return"></required>
3409 </capabilities>
3410 <parameters>
3411 <param id="thread">
3412 <jthread null="current" impl="noconvert"/>
3413 <description>
3414 The thread whose current frame is to return early.
3415 </description>
3416 </param>
3417 </parameters>
3418 <errors>
3419 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3420 The implementation is unable to force the current frame to return
3421 (e.g. current frame is executing a native method or if preview features
3422 are enabled, the current frame is the constructor for a value class)
3423 </error>
3424 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3425 The called method has a result type.
3426 </error>
3427 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3428 Thread was not suspended and was not the current thread.
3429 </error>
3430 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3431 There are no frames on the call stack.
3432 </error>
3433 </errors>
3434 </function>
3435
3436 </category>
3437
3438 <category id="Heap" label="Heap">
3439 <intro>
3440 These functions are used to analyze the heap.
3441 Functionality includes the ability to view the objects in the
3442 heap and to tag these objects.
3443 </intro>
3444
3445 <intro id="objectTags" label="Object Tags">
3446 A <i>tag</i> is a value associated with an object.
3447 Tags are explicitly set by the agent using the
3448 <functionlink id="SetTag"></functionlink> function or by
3449 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>.
3450 <p/>
3451 Tags are local to the environment; that is, the tags of one
3452 environment are not visible in another.
3453 <p/>
3454 Tags are <code>jlong</code> values which can be used
3455 simply to mark an object or to store a pointer to more detailed
3456 information. Objects which have not been tagged have a
3457 tag of zero.
3458 Setting a tag to zero makes the object untagged.
3459 <p/>
3460 If the <eventlink id="ObjectFree"/> event is enabled then an Object Free
3461 event is sent for tagged objects when the garbage collector frees the object.
3462 When preview features are enabled, the Object Free event is only sent for tagged
3463 <externallink id="jni/functions.html#hasidentity">identity objects</externallink>.
3464 <b>The event is not sent for tagged value objects.</b>
3465 </intro>
3466
3467 <intro id="heapCallbacks" label="Heap Callback Functions">
3468 Heap functions which iterate through the heap and recursively
3469 follow object references use agent supplied callback functions
3470 to deliver the information.
3471 <p/>
3472 These heap callback functions must adhere to the following restrictions --
3473 These callbacks must not use JNI functions.
3474 These callbacks must not use <jvmti/> functions except
3475 <i>callback safe</i> functions which
3476 specifically allow such use (see the raw monitor, memory management,
3477 and environment local storage functions).
3478 <p/>
3479 An implementation may invoke a callback on an internal thread or
3480 the thread which called the iteration function.
3481 Heap callbacks are single threaded -- no more than one callback will
3482 be invoked at a time.
3483 <p/>
3484 The Heap Filter Flags can be used to prevent reporting
3485 based on the tag status of an object or its class.
3486 If no flags are set (the <code>jint</code> is zero), objects
3487 will not be filtered out.
3488
3489 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits">
3490 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4">
3491 Filter out tagged objects. Objects which are tagged are not included.
3492 </constant>
3493 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8">
3494 Filter out untagged objects. Objects which are not tagged are not included.
3495 </constant>
3496 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10">
3497 Filter out objects with tagged classes. Objects whose class is tagged are not included.
3498 </constant>
3499 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20">
3500 Filter out objects with untagged classes. Objects whose class is not tagged are not included.
3501 </constant>
3502 </constants>
3503
3504 <p/>
3505 The Heap Visit Control Flags are returned by the heap callbacks
3506 and can be used to abort the iteration. For the
3507 <functionlink id="jvmtiHeapReferenceCallback">Heap
3508 Reference Callback</functionlink>, it can also be used
3509 to prune the graph of traversed references
3510 (<code>JVMTI_VISIT_OBJECTS</code> is not set).
3511
3512 <constants id="jvmtiHeapVisitControl"
3513 label="Heap Visit Control Flags"
3514 kind="bits"
3515 since="1.1">
3516 <constant id="JVMTI_VISIT_OBJECTS" num="0x100">
3517 If we are visiting an object and if this callback
3518 was initiated by <functionlink id="FollowReferences"/>,
3519 traverse the references of this object.
3520 Otherwise ignored.
3521 </constant>
3522 <constant id="JVMTI_VISIT_ABORT" num="0x8000">
3523 Abort the iteration. Ignore all other bits.
3524 </constant>
3525 </constants>
3526
3527 <p/>
3528 The Heap Reference Enumeration is provided by the
3529 <functionlink id="jvmtiHeapReferenceCallback">Heap
3530 Reference Callback</functionlink> and
3531 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field
3532 Callback</functionlink> to
3533 describe the kind of reference
3534 being reported.
3535
3536 <constants id="jvmtiHeapReferenceKind"
3537 label="Heap Reference Enumeration"
3538 kind="enum"
3539 since="1.1">
3540 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1">
3541 Reference from an object to its class.
3542 </constant>
3543 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2">
3544 Reference from an object to the value of one of its instance fields.
3545 </constant>
3546 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3">
3547 Reference from an array to one of its elements.
3548 </constant>
3549 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4">
3550 Reference from a class to its class loader.
3551 </constant>
3552 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5">
3553 Reference from a class to its signers array.
3554 </constant>
3555 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6">
3556 Reference from a class to its protection domain.
3557 </constant>
3558 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7">
3559 Reference from a class to one of its interfaces.
3560 Note: interfaces are defined via a constant pool reference,
3561 so the referenced interfaces may also be reported with a
3562 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.
3563 </constant>
3564 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8">
3565 Reference from a class to the value of one of its static fields.
3566 </constant>
3567 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9">
3568 Reference from a class to a resolved entry in the constant pool.
3569 </constant>
3570 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10">
3571 Reference from a class to its superclass.
3572 A callback is not sent if the superclass is <code>java.lang.Object</code>.
3573 Note: loaded classes define superclasses via a constant pool
3574 reference, so the referenced superclass may also be reported with
3575 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.
3576 </constant>
3577 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21">
3578 Heap root reference: JNI global reference.
3579 </constant>
3580 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22">
3581 Heap root reference: System class.
3582 </constant>
3583 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23">
3584 Heap root reference: monitor.
3585 </constant>
3586 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24">
3587 Local variable on a thread stack.
3588 </constant>
3589 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25">
3590 JNI local reference.
3591 </constant>
3592 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26">
3593 Heap root reference: Thread.
3594 </constant>
3595 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27">
3596 Heap root reference: other heap root reference.
3597 </constant>
3598 </constants>
3599
3600 <p/>
3601 Definitions for the single character type descriptors of
3602 primitive types.
3603
3604 <constants id="jvmtiPrimitiveType"
3605 label="Primitive Type Enumeration"
3606 kind="enum"
3607 since="1.1">
3608 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90">
3609 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code>
3610 </constant>
3611 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66">
3612 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code>
3613 </constant>
3614 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67">
3615 'C' - Java programming language <code>char</code> - JNI <code>jchar</code>
3616 </constant>
3617 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83">
3618 'S' - Java programming language <code>short</code> - JNI <code>jshort</code>
3619 </constant>
3620 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73">
3621 'I' - Java programming language <code>int</code> - JNI <code>jint</code>
3622 </constant>
3623 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74">
3624 'J' - Java programming language <code>long</code> - JNI <code>jlong</code>
3625 </constant>
3626 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70">
3627 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code>
3628 </constant>
3629 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68">
3630 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code>
3631 </constant>
3632 </constants>
3633 </intro>
3634
3635 <typedef id="jvmtiHeapReferenceInfoField"
3636 label="Reference information structure for Field references"
3637 since="1.1">
3638 <description>
3639 Reference information returned for
3640 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and
3641 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.
3642 </description>
3643 <field id="index">
3644 <jint/>
3645 <description>
3646 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the
3647 referrer object is not a class or an interface.
3648 In this case, <code>index</code> is the index of the field
3649 in the class of the referrer object.
3650 This class is referred to below as <i>C</i>.
3651 <p/>
3652 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,
3653 the referrer object is a class (referred to below as <i>C</i>)
3654 or an interface (referred to below as <i>I</i>).
3655 In this case, <code>index</code> is the index of the field in
3656 that class or interface.
3657 <p/>
3658 If the referrer object is not an interface, then the field
3659 indices are determined as follows:
3660 <ul>
3661 <li>make a list of all the fields in <i>C</i> and its
3662 superclasses, starting with all the fields in
3663 <code>java.lang.Object</code> and ending with all the
3664 fields in <i>C</i>.</li>
3665 <li>Within this list, put
3666 the fields for a given class in the order returned by
3667 <functionlink id="GetClassFields"/>.</li>
3668 <li>Assign the fields in this list indices
3669 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>
3670 is the count of the fields in all the interfaces
3671 implemented by <i>C</i>.
3672 Note that <i>C</i> implements all interfaces
3673 directly implemented by its superclasses; as well
3674 as all superinterfaces of these interfaces.</li>
3675 </ul>
3676 If the referrer object is an interface, then the field
3677 indices are determined as follows:
3678 <ul>
3679 <li>make a list of the fields directly declared in
3680 <i>I</i>.</li>
3681 <li>Within this list, put
3682 the fields in the order returned by
3683 <functionlink id="GetClassFields"/>.</li>
3684 <li>Assign the fields in this list indices
3685 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>
3686 is the count of the fields in all the superinterfaces
3687 of <i>I</i>.</li>
3688 </ul>
3689 All fields are included in this computation, regardless of
3690 field modifier (static, public, private, etc).
3691 <p/>
3692 For example, given the following classes and interfaces:
3693 <example>
3694 interface I0 {
3695 int p = 0;
3696 }
3697
3698 interface I1 extends I0 {
3699 int x = 1;
3700 }
3701
3702 interface I2 extends I0 {
3703 int y = 2;
3704 }
3705
3706 class C1 implements I1 {
3707 public static int a = 3;
3708 private int b = 4;
3709 }
3710
3711 class C2 extends C1 implements I2 {
3712 static int q = 5;
3713 final int r = 6;
3714 }
3715 </example>
3716 Assume that <functionlink id="GetClassFields"/> called on
3717 <code>C1</code> returns the fields of <code>C1</code> in the
3718 order: a, b; and that the fields of <code>C2</code> are
3719 returned in the order: q, r.
3720 An instance of class <code>C1</code> will have the
3721 following field indices:
3722 <blockquote><table>
3723 <tr class="bgLight">
3724 <th class="centered" scope="col">Field</th>
3725 <th class="centered" scope="col">Index</th>
3726 <th scope="col">Description</th>
3727 </tr>
3728 <tr>
3729 <th class="centered" scope="row">
3730 a
3731 </th>
3732 <td class="centered">
3733 2
3734 </td>
3735 <td>
3736 The count of the fields in the interfaces
3737 implemented by <code>C1</code> is two (<i>n</i>=2):
3738 <code>p</code> of <code>I0</code>
3739 and <code>x</code> of <code>I1</code>.
3740 </td>
3741 </tr>
3742 <tr>
3743 <th class="centered" scope="row">
3744 b
3745 </th>
3746 <td class="centered">
3747 3
3748 </td>
3749 <td>
3750 the subsequent index.
3751 </td>
3752 </tr>
3753 </table></blockquote>
3754 The class <code>C1</code> will have the same field indices.
3755 <p/>
3756 An instance of class <code>C2</code> will have the
3757 following field indices:
3758 <blockquote><table>
3759 <tr class="bgLight">
3760 <th class="centered" scope="col">Field</th>
3761 <th class="centered" scope="col">Index</th>
3762 <th scope="col">Description</th>
3763 </tr>
3764 <tr>
3765 <th class="centered" scope="row">
3766 a
3767 </th>
3768 <td class="centered">
3769 3
3770 </td>
3771 <td>
3772 The count of the fields in the interfaces
3773 implemented by <code>C2</code> is three (<i>n</i>=3):
3774 <code>p</code> of <code>I0</code>,
3775 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code>
3776 (an interface of <code>C2</code>). Note that the field <code>p</code>
3777 of <code>I0</code> is only included once.
3778 </td>
3779 </tr>
3780 <tr>
3781 <th class="centered" scope="row">
3782 b
3783 </th>
3784 <td class="centered">
3785 4
3786 </td>
3787 <td>
3788 the subsequent index to "a".
3789 </td>
3790 </tr>
3791 <tr>
3792 <th class="centered" scope="row">
3793 q
3794 </th>
3795 <td class="centered">
3796 5
3797 </td>
3798 <td>
3799 the subsequent index to "b".
3800 </td>
3801 </tr>
3802 <tr>
3803 <th class="centered" scope="row">
3804 r
3805 </th>
3806 <td class="centered">
3807 6
3808 </td>
3809 <td>
3810 the subsequent index to "q".
3811 </td>
3812 </tr>
3813 </table></blockquote>
3814 The class <code>C2</code> will have the same field indices.
3815 Note that a field may have a different index depending on the
3816 object that is viewing it -- for example field "a" above.
3817 Note also: not all field indices may be visible from the
3818 callbacks, but all indices are shown for illustrative purposes.
3819 <p/>
3820 The interface <code>I1</code> will have the
3821 following field indices:
3822 <blockquote><table>
3823 <tr class="bgLight">
3824 <th class="centered" scope="col">Field</th>
3825 <th class="centered" scope="col">Index</th>
3826 <th scope="col">Description</th>
3827 </tr>
3828 <tr>
3829 <th class="centered" scope="row">
3830 x
3831 </th>
3832 <td class="centered">
3833 1
3834 </td>
3835 <td>
3836 The count of the fields in the superinterfaces
3837 of <code>I1</code> is one (<i>n</i>=1):
3838 <code>p</code> of <code>I0</code>.
3839 </td>
3840 </tr>
3841 </table></blockquote>
3842 </description>
3843 </field>
3844 </typedef>
3845
3846 <typedef id="jvmtiHeapReferenceInfoArray"
3847 label="Reference information structure for Array references"
3848 since="1.1">
3849 <description>
3850 Reference information returned for
3851 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.
3852 </description>
3853 <field id="index">
3854 <jint/>
3855 <description>
3856 The array index.
3857 </description>
3858 </field>
3859 </typedef>
3860
3861 <typedef id="jvmtiHeapReferenceInfoConstantPool"
3862 label="Reference information structure for Constant Pool references"
3863 since="1.1">
3864 <description>
3865 Reference information returned for
3866 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.
3867 </description>
3868 <field id="index">
3869 <jint/>
3870 <description>
3871 The index into the constant pool of the class. See the description in
3872 <vmspec chapter="4.4"/>.
3873 </description>
3874 </field>
3875 </typedef>
3876
3877 <typedef id="jvmtiHeapReferenceInfoStackLocal"
3878 label="Reference information structure for Local Variable references"
3879 since="1.1">
3880 <description>
3881 Reference information returned for
3882 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.
3883 </description>
3884 <field id="thread_tag">
3885 <jlong/>
3886 <description>
3887 The tag of the thread corresponding to this stack, zero if not tagged.
3888 </description>
3889 </field>
3890 <field id="thread_id">
3891 <jlong/>
3892 <description>
3893 The unique thread ID of the thread corresponding to this stack.
3894 </description>
3895 </field>
3896 <field id="depth">
3897 <jint/>
3898 <description>
3899 The depth of the frame.
3900 </description>
3901 </field>
3902 <field id="method">
3903 <jmethodID/>
3904 <description>
3905 The method executing in this frame.
3906 </description>
3907 </field>
3908 <field id="location">
3909 <jlocation/>
3910 <description>
3911 The currently executing location in this frame.
3912 </description>
3913 </field>
3914 <field id="slot">
3915 <jint/>
3916 <description>
3917 The slot number of the local variable.
3918 </description>
3919 </field>
3920 </typedef>
3921
3922 <typedef id="jvmtiHeapReferenceInfoJniLocal"
3923 label="Reference information structure for JNI local references"
3924 since="1.1">
3925 <description>
3926 Reference information returned for
3927 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.
3928 </description>
3929 <field id="thread_tag">
3930 <jlong/>
3931 <description>
3932 The tag of the thread corresponding to this stack, zero if not tagged.
3933 </description>
3934 </field>
3935 <field id="thread_id">
3936 <jlong/>
3937 <description>
3938 The unique thread ID of the thread corresponding to this stack.
3939 </description>
3940 </field>
3941 <field id="depth">
3942 <jint/>
3943 <description>
3944 The depth of the frame.
3945 </description>
3946 </field>
3947 <field id="method">
3948 <jmethodID/>
3949 <description>
3950 The method executing in this frame.
3951 </description>
3952 </field>
3953 </typedef>
3954
3955 <typedef id="jvmtiHeapReferenceInfoReserved"
3956 label="Reference information structure for Other references"
3957 since="1.1">
3958 <description>
3959 Reference information returned for other references.
3960 </description>
3961 <field id="reserved1">
3962 <jlong/>
3963 <description>
3964 reserved for future use.
3965 </description>
3966 </field>
3967 <field id="reserved2">
3968 <jlong/>
3969 <description>
3970 reserved for future use.
3971 </description>
3972 </field>
3973 <field id="reserved3">
3974 <jlong/>
3975 <description>
3976 reserved for future use.
3977 </description>
3978 </field>
3979 <field id="reserved4">
3980 <jlong/>
3981 <description>
3982 reserved for future use.
3983 </description>
3984 </field>
3985 <field id="reserved5">
3986 <jlong/>
3987 <description>
3988 reserved for future use.
3989 </description>
3990 </field>
3991 <field id="reserved6">
3992 <jlong/>
3993 <description>
3994 reserved for future use.
3995 </description>
3996 </field>
3997 <field id="reserved7">
3998 <jlong/>
3999 <description>
4000 reserved for future use.
4001 </description>
4002 </field>
4003 <field id="reserved8">
4004 <jlong/>
4005 <description>
4006 reserved for future use.
4007 </description>
4008 </field>
4009 </typedef>
4010
4011 <uniontypedef id="jvmtiHeapReferenceInfo"
4012 label="Reference information structure"
4013 since="1.1">
4014 <description>
4015 The information returned about referrers.
4016 Represented as a union of the various kinds of reference information.
4017 </description>
4018 <field id="field">
4019 <struct>jvmtiHeapReferenceInfoField</struct>
4020 <description>
4021 The referrer information for
4022 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>
4023 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.
4024 </description>
4025 </field>
4026 <field id="array">
4027 <struct>jvmtiHeapReferenceInfoArray</struct>
4028 <description>
4029 The referrer information for
4030 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.
4031 </description>
4032 </field>
4033 <field id="constant_pool">
4034 <struct>jvmtiHeapReferenceInfoConstantPool</struct>
4035 <description>
4036 The referrer information for
4037 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.
4038 </description>
4039 </field>
4040 <field id="stack_local">
4041 <struct>jvmtiHeapReferenceInfoStackLocal</struct>
4042 <description>
4043 The referrer information for
4044 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.
4045 </description>
4046 </field>
4047 <field id="jni_local">
4048 <struct>jvmtiHeapReferenceInfoJniLocal</struct>
4049 <description>
4050 The referrer information for
4051 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.
4052 </description>
4053 </field>
4054 <field id="other">
4055 <struct>jvmtiHeapReferenceInfoReserved</struct>
4056 <description>
4057 reserved for future use.
4058 </description>
4059 </field>
4060 </uniontypedef>
4061
4062 <typedef id="jvmtiHeapCallbacks"
4063 label="Heap callback function structure"
4064 since="1.1">
4065 <field id="heap_iteration_callback">
4066 <ptrtype>
4067 <struct>jvmtiHeapIterationCallback</struct>
4068 </ptrtype>
4069 <description>
4070 The callback to be called to describe an
4071 object in the heap. Used by the
4072 <functionlink id="IterateThroughHeap"/> function, ignored by the
4073 <functionlink id="FollowReferences"/> function.
4074 </description>
4075 </field>
4076 <field id="heap_reference_callback">
4077 <ptrtype>
4078 <struct>jvmtiHeapReferenceCallback</struct>
4079 </ptrtype>
4080 <description>
4081 The callback to be called to describe an
4082 object reference. Used by the
4083 <functionlink id="FollowReferences"/> function, ignored by the
4084 <functionlink id="IterateThroughHeap"/> function.
4085 </description>
4086 </field>
4087 <field id="primitive_field_callback">
4088 <ptrtype>
4089 <struct>jvmtiPrimitiveFieldCallback</struct>
4090 </ptrtype>
4091 <description>
4092 The callback to be called to describe a
4093 primitive field.
4094 </description>
4095 </field>
4096 <field id="array_primitive_value_callback">
4097 <ptrtype>
4098 <struct>jvmtiArrayPrimitiveValueCallback</struct>
4099 </ptrtype>
4100 <description>
4101 The callback to be called to describe an
4102 array of primitive values.
4103 </description>
4104 </field>
4105 <field id="string_primitive_value_callback">
4106 <ptrtype>
4107 <struct>jvmtiStringPrimitiveValueCallback</struct>
4108 </ptrtype>
4109 <description>
4110 The callback to be called to describe a String value.
4111 </description>
4112 </field>
4113 <field id="reserved5">
4114 <ptrtype>
4115 <struct>jvmtiReservedCallback</struct>
4116 </ptrtype>
4117 <description>
4118 Reserved for future use..
4119 </description>
4120 </field>
4121 <field id="reserved6">
4122 <ptrtype>
4123 <struct>jvmtiReservedCallback</struct>
4124 </ptrtype>
4125 <description>
4126 Reserved for future use..
4127 </description>
4128 </field>
4129 <field id="reserved7">
4130 <ptrtype>
4131 <struct>jvmtiReservedCallback</struct>
4132 </ptrtype>
4133 <description>
4134 Reserved for future use..
4135 </description>
4136 </field>
4137 <field id="reserved8">
4138 <ptrtype>
4139 <struct>jvmtiReservedCallback</struct>
4140 </ptrtype>
4141 <description>
4142 Reserved for future use..
4143 </description>
4144 </field>
4145 <field id="reserved9">
4146 <ptrtype>
4147 <struct>jvmtiReservedCallback</struct>
4148 </ptrtype>
4149 <description>
4150 Reserved for future use..
4151 </description>
4152 </field>
4153 <field id="reserved10">
4154 <ptrtype>
4155 <struct>jvmtiReservedCallback</struct>
4156 </ptrtype>
4157 <description>
4158 Reserved for future use..
4159 </description>
4160 </field>
4161 <field id="reserved11">
4162 <ptrtype>
4163 <struct>jvmtiReservedCallback</struct>
4164 </ptrtype>
4165 <description>
4166 Reserved for future use..
4167 </description>
4168 </field>
4169 <field id="reserved12">
4170 <ptrtype>
4171 <struct>jvmtiReservedCallback</struct>
4172 </ptrtype>
4173 <description>
4174 Reserved for future use..
4175 </description>
4176 </field>
4177 <field id="reserved13">
4178 <ptrtype>
4179 <struct>jvmtiReservedCallback</struct>
4180 </ptrtype>
4181 <description>
4182 Reserved for future use..
4183 </description>
4184 </field>
4185 <field id="reserved14">
4186 <ptrtype>
4187 <struct>jvmtiReservedCallback</struct>
4188 </ptrtype>
4189 <description>
4190 Reserved for future use..
4191 </description>
4192 </field>
4193 <field id="reserved15">
4194 <ptrtype>
4195 <struct>jvmtiReservedCallback</struct>
4196 </ptrtype>
4197 <description>
4198 Reserved for future use..
4199 </description>
4200 </field>
4201 </typedef>
4202
4203
4204 <intro>
4205 <rationale>
4206 The heap dumping functionality (below) uses a callback
4207 for each object. While it would seem that a buffered approach
4208 would provide better throughput, tests do
4209 not show this to be the case--possibly due to locality of
4210 memory reference or array access overhead.
4211 </rationale>
4212
4213 <issue>
4214 Still under investigation as to if java.lang.ref references
4215 are reported as a different type of reference.
4216 </issue>
4217
4218 <issue>
4219 Should or can an indication of the cost or relative cost of
4220 these operations be included?
4221 </issue>
4222
4223 </intro>
4224
4225 <callback id="jvmtiHeapIterationCallback" since="1.1">
4226 <jint/>
4227 <synopsis>Heap Iteration Callback</synopsis>
4228 <description>
4229 Agent supplied callback function.
4230 Describes (but does not pass in) an object in the heap.
4231 <p/>
4232 This function should return a bit vector of the desired
4233 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4234 This will determine if the entire iteration should be aborted
4235 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4236 <p/>
4237 See the <internallink id="heapCallbacks">heap callback
4238 function restrictions</internallink>.
4239 </description>
4240 <parameters>
4241 <param id="class_tag">
4242 <jlong/>
4243 <description>
4244 The tag of the class of object (zero if the class is not tagged).
4245 If the object represents a runtime class,
4246 the <code>class_tag</code> is the tag
4247 associated with <code>java.lang.Class</code>
4248 (zero if <code>java.lang.Class</code> is not tagged).
4249 </description>
4250 </param>
4251 <param id="size">
4252 <jlong/>
4253 <description>
4254 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
4255 </description>
4256 </param>
4257 <param id="tag_ptr">
4258 <outptr><jlong/></outptr>
4259 <description>
4260 The object tag value, or zero if the object is not tagged.
4261 To set the tag value to be associated with the object
4262 the agent sets the <code>jlong</code> pointed to by the parameter.
4263 </description>
4264 </param>
4265 <param id="length">
4266 <jint/>
4267 <description>
4268 If this object is an array, the length of the array. Otherwise negative one (-1).
4269 </description>
4270 </param>
4271 <param id="user_data">
4272 <outptr><void/></outptr>
4273 <description>
4274 The user supplied data that was passed into the iteration function.
4275 </description>
4276 </param>
4277 </parameters>
4278 </callback>
4279
4280 <callback id="jvmtiHeapReferenceCallback" since="1.1">
4281 <jint/>
4282 <synopsis>Heap Reference Callback</synopsis>
4283 <description>
4284 Agent supplied callback function.
4285 Describes a reference from an object or the VM (the referrer) to another object
4286 (the referree) or a heap root to a referree.
4287 <p/>
4288 This function should return a bit vector of the desired
4289 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4290 This will determine if the objects referenced by the referree
4291 should be visited or if the entire iteration should be aborted.
4292 <p/>
4293 See the <internallink id="heapCallbacks">heap callback
4294 function restrictions</internallink>.
4295 </description>
4296 <parameters>
4297 <param id="reference_kind">
4298 <enum>jvmtiHeapReferenceKind</enum>
4299 <description>
4300 The kind of reference.
4301 </description>
4302 </param>
4303 <param id="reference_info">
4304 <inptr>
4305 <struct>jvmtiHeapReferenceInfo</struct>
4306 </inptr>
4307 <description>
4308 Details about the reference.
4309 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is
4310 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>,
4311 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,
4312 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>,
4313 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>,
4314 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>,
4315 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>.
4316 Otherwise a null pointer.
4317 </description>
4318 </param>
4319 <param id="class_tag">
4320 <jlong/>
4321 <description>
4322 The tag of the class of referree object (zero if the class is not tagged).
4323 If the referree object represents a runtime class,
4324 the <code>class_tag</code> is the tag
4325 associated with <code>java.lang.Class</code>
4326 (zero if <code>java.lang.Class</code> is not tagged).
4327 </description>
4328 </param>
4329 <param id="referrer_class_tag">
4330 <jlong/>
4331 <description>
4332 The tag of the class of the referrer object (zero if the class is not tagged
4333 or the referree is a heap root). If the referrer object represents a runtime
4334 class, the <code>referrer_class_tag</code> is the tag associated with
4335 the <code>java.lang.Class</code>
4336 (zero if <code>java.lang.Class</code> is not tagged).
4337 </description>
4338 </param>
4339 <param id="size">
4340 <jlong/>
4341 <description>
4342 Size of the referree object (in bytes).
4343 See <functionlink id="GetObjectSize"/>.
4344 </description>
4345 </param>
4346 <param id="tag_ptr">
4347 <outptr><jlong/></outptr>
4348 <description>
4349 Points to the referree object tag value, or zero if the object is not
4350 tagged.
4351 To set the tag value to be associated with the object
4352 the agent sets the <code>jlong</code> pointed to by the parameter.
4353 </description>
4354 </param>
4355 <param id="referrer_tag_ptr">
4356 <outptr><jlong/></outptr>
4357 <description>
4358 Points to the tag of the referrer object, or
4359 points to the zero if the referrer
4360 object is not tagged.
4361 Null if the referrer in not an object (that is,
4362 this callback is reporting a heap root).
4363 To set the tag value to be associated with the referrer object
4364 the agent sets the <code>jlong</code> pointed to by the parameter.
4365 If this callback is reporting a reference from an object to itself,
4366 <code>referrer_tag_ptr == tag_ptr</code>.
4367 </description>
4368 </param>
4369 <param id="length">
4370 <jint/>
4371 <description>
4372 If this object is an array, the length of the array. Otherwise negative one (-1).
4373 </description>
4374 </param>
4375 <param id="user_data">
4376 <outptr><void/></outptr>
4377 <description>
4378 The user supplied data that was passed into the iteration function.
4379 </description>
4380 </param>
4381 </parameters>
4382 </callback>
4383
4384 <callback id="jvmtiPrimitiveFieldCallback" since="1.1">
4385 <jint/>
4386 <synopsis>Primitive Field Callback</synopsis>
4387 <description>
4388 Agent supplied callback function which
4389 describes a primitive field of an object (<i>the object</i>).
4390 A primitive field is a field whose type is a primitive type.
4391 This callback will describe a static field if the object is a class,
4392 and otherwise will describe an instance field.
4393 <p/>
4394 This function should return a bit vector of the desired
4395 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4396 This will determine if the entire iteration should be aborted
4397 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4398 <p/>
4399 See the <internallink id="heapCallbacks">heap callback
4400 function restrictions</internallink>.
4401 </description>
4402 <parameters>
4403 <param id="kind">
4404 <enum>jvmtiHeapReferenceKind</enum>
4405 <description>
4406 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or
4407 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>).
4408 </description>
4409 </param>
4410 <param id="info">
4411 <inptr>
4412 <struct>jvmtiHeapReferenceInfo</struct>
4413 </inptr>
4414 <description>
4415 Which field (the field index).
4416 </description>
4417 </param>
4418 <param id="object_class_tag">
4419 <jlong/>
4420 <description>
4421 The tag of the class of the object (zero if the class is not tagged).
4422 If the object represents a runtime class, the
4423 <code>object_class_tag</code> is the tag
4424 associated with <code>java.lang.Class</code>
4425 (zero if <code>java.lang.Class</code> is not tagged).
4426 </description>
4427 </param>
4428 <param id="object_tag_ptr">
4429 <outptr><jlong/></outptr>
4430 <description>
4431 Points to the tag of the object, or zero if the object is not
4432 tagged.
4433 To set the tag value to be associated with the object
4434 the agent sets the <code>jlong</code> pointed to by the parameter.
4435 </description>
4436 </param>
4437 <param id="value">
4438 <jvalue/>
4439 <description>
4440 The value of the field.
4441 </description>
4442 </param>
4443 <param id="value_type">
4444 <enum>jvmtiPrimitiveType</enum>
4445 <description>
4446 The type of the field.
4447 </description>
4448 </param>
4449 <param id="user_data">
4450 <outptr><void/></outptr>
4451 <description>
4452 The user supplied data that was passed into the iteration function.
4453 </description>
4454 </param>
4455 </parameters>
4456 </callback>
4457
4458 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1">
4459 <jint/>
4460 <synopsis>Array Primitive Value Callback</synopsis>
4461 <description>
4462 Agent supplied callback function.
4463 Describes the values in an array of a primitive type.
4464 <p/>
4465 This function should return a bit vector of the desired
4466 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4467 This will determine if the entire iteration should be aborted
4468 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4469 <p/>
4470 See the <internallink id="heapCallbacks">heap callback
4471 function restrictions</internallink>.
4472 </description>
4473 <parameters>
4474 <param id="class_tag">
4475 <jlong/>
4476 <description>
4477 The tag of the class of the array object (zero if the class is not tagged).
4478 </description>
4479 </param>
4480 <param id="size">
4481 <jlong/>
4482 <description>
4483 Size of the array (in bytes).
4484 See <functionlink id="GetObjectSize"/>.
4485 </description>
4486 </param>
4487 <param id="tag_ptr">
4488 <outptr><jlong/></outptr>
4489 <description>
4490 Points to the tag of the array object, or zero if the object is not
4491 tagged.
4492 To set the tag value to be associated with the object
4493 the agent sets the <code>jlong</code> pointed to by the parameter.
4494 </description>
4495 </param>
4496 <param id="element_count">
4497 <jint/>
4498 <description>
4499 The length of the primitive array.
4500 </description>
4501 </param>
4502 <param id="element_type">
4503 <enum>jvmtiPrimitiveType</enum>
4504 <description>
4505 The type of the elements of the array.
4506 </description>
4507 </param>
4508 <param id="elements">
4509 <vmbuf><void/></vmbuf>
4510 <description>
4511 The elements of the array in a packed array of <code>element_count</code>
4512 items of <code>element_type</code> size each.
4513 </description>
4514 </param>
4515 <param id="user_data">
4516 <outptr><void/></outptr>
4517 <description>
4518 The user supplied data that was passed into the iteration function.
4519 </description>
4520 </param>
4521 </parameters>
4522 </callback>
4523
4524 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1">
4525 <jint/>
4526 <synopsis>String Primitive Value Callback</synopsis>
4527 <description>
4528 Agent supplied callback function.
4529 Describes the value of a java.lang.String.
4530 <p/>
4531 This function should return a bit vector of the desired
4532 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4533 This will determine if the entire iteration should be aborted
4534 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4535 <p/>
4536 See the <internallink id="heapCallbacks">heap callback
4537 function restrictions</internallink>.
4538 </description>
4539 <parameters>
4540 <param id="class_tag">
4541 <jlong/>
4542 <description>
4543 The tag of the class of the String class (zero if the class is not tagged).
4544 <issue>Is this needed?</issue>
4545 </description>
4546 </param>
4547 <param id="size">
4548 <jlong/>
4549 <description>
4550 Size of the string (in bytes).
4551 See <functionlink id="GetObjectSize"/>.
4552 </description>
4553 </param>
4554 <param id="tag_ptr">
4555 <outptr><jlong/></outptr>
4556 <description>
4557 Points to the tag of the String object, or zero if the object is not
4558 tagged.
4559 To set the tag value to be associated with the object
4560 the agent sets the <code>jlong</code> pointed to by the parameter.
4561 </description>
4562 </param>
4563 <param id="value">
4564 <vmbuf><jchar/></vmbuf>
4565 <description>
4566 The value of the String, encoded as a Unicode string.
4567 </description>
4568 </param>
4569 <param id="value_length">
4570 <jint/>
4571 <description>
4572 The length of the string.
4573 The length is equal to the number of 16-bit Unicode
4574 characters in the string.
4575 </description>
4576 </param>
4577 <param id="user_data">
4578 <outptr><void/></outptr>
4579 <description>
4580 The user supplied data that was passed into the iteration function.
4581 </description>
4582 </param>
4583 </parameters>
4584 </callback>
4585
4586
4587 <callback id="jvmtiReservedCallback" since="1.1">
4588 <jint/>
4589 <synopsis>reserved for future use Callback</synopsis>
4590 <description>
4591 Placeholder -- reserved for future use.
4592 </description>
4593 <parameters>
4594 </parameters>
4595 </callback>
4596
4597 <function id="FollowReferences" num="115" since="1.1">
4598 <synopsis>Follow References</synopsis>
4599 <description>
4600 This function initiates a traversal over the objects that are
4601 directly and indirectly reachable from the specified object or,
4602 if <code>initial_object</code> is not specified, all objects
4603 reachable from the heap roots.
4604 The heap root are the set of system classes,
4605 JNI globals, references from platform thread stacks, and other objects used as roots
4606 for the purposes of garbage collection.
4607 <p/>
4608 This function operates by traversing the reference graph.
4609 Let <i>A</i>, <i>B</i>, ... represent objects.
4610 When a reference from <i>A</i> to <i>B</i> is traversed,
4611 when a reference from a heap root to <i>B</i> is traversed,
4612 or when <i>B</i> is specified as the <paramlink id="initial_object"/>,
4613 then <i>B</i> is said to be <i>visited</i>.
4614 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i>
4615 is visited.
4616 References are reported in the same order that the references are traversed.
4617 Object references are reported by invoking the agent supplied
4618 callback function <functionlink id="jvmtiHeapReferenceCallback"/>.
4619 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known
4620 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>.
4621 The callback is invoked exactly once for each reference from a referrer;
4622 this is true even if there are reference cycles or multiple paths to
4623 the referrer.
4624 There may be more than one reference between a referrer and a referree,
4625 each reference is reported.
4626 These references may be distinguished by examining the
4627 <datalink
4628 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink>
4629 and
4630 <datalink
4631 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink>
4632 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback.
4633 <p/>
4634 This function reports a Java programming language view of object references,
4635 not a virtual machine implementation view. The following object references
4636 are reported when they are non-null:
4637 <ul>
4638 <li>Instance objects report references to each non-primitive instance fields
4639 (including inherited fields).</li>
4640 <li>Instance objects report a reference to the object type (class).</li>
4641 <li>Classes report a reference to the superclass and directly
4642 implemented/extended interfaces.</li>
4643 <li>Classes report a reference to the class loader, protection domain,
4644 signers, and resolved entries in the constant pool.</li>
4645 <li>Classes report a reference to each directly declared non-primitive
4646 static field.</li>
4647 <li>Arrays report a reference to the array type (class) and each
4648 array element.</li>
4649 <li>Primitive arrays report a reference to the array type.</li>
4650 </ul>
4651 <p/>
4652 This function can also be used to examine primitive (non-object) values.
4653 The primitive value of an array or String
4654 is reported after the object has been visited;
4655 it is reported by invoking the agent supplied callback function
4656 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or
4657 <functionlink id="jvmtiStringPrimitiveValueCallback"/>.
4658 A primitive field
4659 is reported after the object with that field is visited;
4660 it is reported by invoking the agent supplied callback function
4661 <functionlink id="jvmtiPrimitiveFieldCallback"/>.
4662 <p/>
4663 Whether a callback is provided or is null only determines
4664 whether the callback will be invoked, it does not influence
4665 which objects are visited nor does it influence whether other callbacks
4666 will be invoked.
4667 However, the
4668 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>
4669 returned by <functionlink id="jvmtiHeapReferenceCallback"/>
4670 do determine if the objects referenced by the
4671 current object as visited.
4672 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>
4673 and <paramlink id="klass"/> provided as parameters to this function
4674 do not control which objects are visited but they do control which
4675 objects and primitive values are reported by the callbacks.
4676 For example, if the only callback that was set is
4677 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>
4678 is set to the array of bytes class, then only arrays of byte will be
4679 reported.
4680 The table below summarizes this:
4681 <p/>
4682 <table>
4683 <tr class="bgLight">
4684 <th/>
4685 <th class="centered" scope="col">Controls objects visited</th>
4686 <th class="centered" scope="col">Controls objects reported</th>
4687 <th class="centered" scope="col">Controls primitives reported</th>
4688 </tr>
4689 <tr>
4690 <th scope="row">
4691 the
4692 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4693 returned by <functionlink id="jvmtiHeapReferenceCallback"/>
4694 </th>
4695 <td class="centered">
4696 <b>Yes</b>
4697 </td>
4698 <td class="centered">
4699 <b>Yes</b>, since visits are controlled
4700 </td>
4701 <td class="centered">
4702 <b>Yes</b>, since visits are controlled
4703 </td>
4704 </tr>
4705 <tr>
4706 <th scope="row">
4707 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>
4708 in <paramlink id="callbacks"/> set
4709 </th>
4710 <td class="centered">
4711 No
4712 </td>
4713 <td class="centered">
4714 <b>Yes</b>
4715 </td>
4716 <td class="centered">
4717 No
4718 </td>
4719 </tr>
4720 <tr>
4721 <th scope="row">
4722 <paramlink id="heap_filter"/>
4723 </th>
4724 <td class="centered">
4725 No
4726 </td>
4727 <td class="centered">
4728 <b>Yes</b>
4729 </td>
4730 <td class="centered">
4731 <b>Yes</b>
4732 </td>
4733 </tr>
4734 <tr>
4735 <th scope="row">
4736 <paramlink id="klass"/>
4737 </th>
4738 <td class="centered">
4739 No
4740 </td>
4741 <td class="centered">
4742 <b>Yes</b>
4743 </td>
4744 <td class="centered">
4745 <b>Yes</b>
4746 </td>
4747 </tr>
4748 </table>
4749 <p/>
4750 During the execution of this function the state of the heap
4751 does not change: no objects are allocated, no objects are
4752 garbage collected, and the state of objects (including
4753 held values) does not change.
4754 As a result, threads executing Java
4755 programming language code, threads attempting to resume the
4756 execution of Java programming language code, and threads
4757 attempting to execute JNI functions are typically stalled.
4758 </description>
4759 <origin>new</origin>
4760 <capabilities>
4761 <required id="can_tag_objects"></required>
4762 </capabilities>
4763 <parameters>
4764 <param id="heap_filter">
4765 <jint/>
4766 <description>
4767 This bit vector of
4768 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>.
4769 restricts the objects for which the callback function is called.
4770 This applies to both the object and primitive callbacks.
4771 </description>
4772 </param>
4773 <param id="klass">
4774 <ptrtype>
4775 <jclass/>
4776 <nullok>callbacks are not limited to instances of a particular
4777 class</nullok>
4778 </ptrtype>
4779 <description>
4780 Callbacks are only reported when the object is an instance of
4781 this class.
4782 Objects which are instances of a subclass of <code>klass</code>
4783 are not reported.
4784 If <code>klass</code> is an interface, no objects are reported.
4785 This applies to both the object and primitive callbacks.
4786 </description>
4787 </param>
4788 <param id="initial_object">
4789 <ptrtype>
4790 <jobject/>
4791 <nullok>references are followed from the heap roots</nullok>
4792 </ptrtype>
4793 <description>
4794 The object to follow
4795 </description>
4796 </param>
4797 <param id="callbacks">
4798 <inptr>
4799 <struct>jvmtiHeapCallbacks</struct>
4800 </inptr>
4801 <description>
4802 Structure defining the set of callback functions.
4803 </description>
4804 </param>
4805 <param id="user_data">
4806 <inbuf>
4807 <void/>
4808 <nullok>a null pointer is passed as the user supplied data</nullok>
4809 </inbuf>
4810 <description>
4811 User supplied data to be passed to the callback.
4812 </description>
4813 </param>
4814 </parameters>
4815 <errors>
4816 <error id="JVMTI_ERROR_INVALID_CLASS">
4817 <paramlink id="klass"/> is not a valid class.
4818 </error>
4819 <error id="JVMTI_ERROR_INVALID_OBJECT">
4820 <paramlink id="initial_object"/> is not a valid object.
4821 </error>
4822 </errors>
4823 </function>
4824
4825
4826 <function id="IterateThroughHeap" num="116" since="1.1">
4827 <synopsis>Iterate Through Heap</synopsis>
4828 <description>
4829 Initiate an iteration over all objects in the heap.
4830 This includes both reachable and
4831 unreachable objects. Objects are visited in no particular order.
4832 <p/>
4833 Heap objects are reported by invoking the agent supplied
4834 callback function <functionlink id="jvmtiHeapIterationCallback"/>.
4835 References between objects are not reported.
4836 If only reachable objects are desired, or if object reference information
4837 is needed, use <functionlink id="FollowReferences"/>.
4838 <p/>
4839 This function can also be used to examine primitive (non-object) values.
4840 The primitive value of an array or String
4841 is reported after the object has been visited;
4842 it is reported by invoking the agent supplied callback function
4843 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or
4844 <functionlink id="jvmtiStringPrimitiveValueCallback"/>.
4845 A primitive field
4846 is reported after the object with that field is visited;
4847 it is reported by invoking the agent supplied
4848 callback function
4849 <functionlink id="jvmtiPrimitiveFieldCallback"/>.
4850 <p/>
4851 Unless the iteration is aborted by the
4852 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4853 returned by a callback, all objects in the heap are visited.
4854 Whether a callback is provided or is null only determines
4855 whether the callback will be invoked, it does not influence
4856 which objects are visited nor does it influence whether other callbacks
4857 will be invoked.
4858 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>
4859 and <paramlink id="klass"/> provided as parameters to this function
4860 do not control which objects are visited but they do control which
4861 objects and primitive values are reported by the callbacks.
4862 For example, if the only callback that was set is
4863 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>
4864 is set to the array of bytes class, then only arrays of byte will be
4865 reported. The table below summarizes this (contrast this with
4866 <functionlink id="FollowReferences"/>):
4867 <p/>
4868 <table>
4869 <tr class="bgLight">
4870 <th/>
4871 <th class="centered" scope="col">Controls objects visited</th>
4872 <th class="centered" scope="col">Controls objects reported</th>
4873 <th class="centered" scope="col">Controls primitives reported</th>
4874 </tr>
4875 <tr>
4876 <th scope="row">
4877 the
4878 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4879 returned by <functionlink id="jvmtiHeapIterationCallback"/>
4880 </th>
4881 <td class="centered">
4882 No<br/>(unless they abort the iteration)
4883 </td>
4884 <td class="centered">
4885 No<br/>(unless they abort the iteration)
4886 </td>
4887 <td class="centered">
4888 No<br/>(unless they abort the iteration)
4889 </td>
4890 </tr>
4891 <tr>
4892 <th scope="row">
4893 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>
4894 in <paramlink id="callbacks"/> set
4895 </th>
4896 <td class="centered">
4897 No
4898 </td>
4899 <td class="centered">
4900 <b>Yes</b>
4901 </td>
4902 <td class="centered">
4903 No
4904 </td>
4905 </tr>
4906 <tr>
4907 <th scope="row">
4908 <paramlink id="heap_filter"/>
4909 </th>
4910 <td class="centered">
4911 No
4912 </td>
4913 <td class="centered">
4914 <b>Yes</b>
4915 </td>
4916 <td class="centered">
4917 <b>Yes</b>
4918 </td>
4919 </tr>
4920 <tr>
4921 <th scope="row">
4922 <paramlink id="klass"/>
4923 </th>
4924 <td class="centered">
4925 No
4926 </td>
4927 <td class="centered">
4928 <b>Yes</b>
4929 </td>
4930 <td class="centered">
4931 <b>Yes</b>
4932 </td>
4933 </tr>
4934 </table>
4935 <p/>
4936 During the execution of this function the state of the heap
4937 does not change: no objects are allocated, no objects are
4938 garbage collected, and the state of objects (including
4939 held values) does not change.
4940 As a result, threads executing Java
4941 programming language code, threads attempting to resume the
4942 execution of Java programming language code, and threads
4943 attempting to execute JNI functions are typically stalled.
4944 </description>
4945 <origin>new</origin>
4946 <capabilities>
4947 <required id="can_tag_objects"></required>
4948 </capabilities>
4949 <parameters>
4950 <param id="heap_filter">
4951 <jint/>
4952 <description>
4953 This bit vector of
4954 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>.
4955 restricts the objects for which the callback function is called.
4956 This applies to both the object and primitive callbacks.
4957 </description>
4958 </param>
4959 <param id="klass">
4960 <ptrtype>
4961 <jclass/>
4962 <nullok>callbacks are not limited to instances of a particular class</nullok>
4963 </ptrtype>
4964 <description>
4965 Callbacks are only reported when the object is an instance of
4966 this class.
4967 Objects which are instances of a subclass of <code>klass</code>
4968 are not reported.
4969 If <code>klass</code> is an interface, no objects are reported.
4970 This applies to both the object and primitive callbacks.
4971 </description>
4972 </param>
4973 <param id="callbacks">
4974 <inptr>
4975 <struct>jvmtiHeapCallbacks</struct>
4976 </inptr>
4977 <description>
4978 Structure defining the set callback functions.
4979 </description>
4980 </param>
4981 <param id="user_data">
4982 <inbuf>
4983 <void/>
4984 <nullok>a null pointer is passed as the user supplied data</nullok>
4985 </inbuf>
4986 <description>
4987 User supplied data to be passed to the callback.
4988 </description>
4989 </param>
4990 </parameters>
4991 <errors>
4992 <error id="JVMTI_ERROR_INVALID_CLASS">
4993 <paramlink id="klass"/> is not a valid class.
4994 </error>
4995 </errors>
4996 </function>
4997
4998 <function id="GetTag" phase="start" num="106">
4999 <synopsis>Get Tag</synopsis>
5000 <description>
5001 Retrieve the tag associated with an object.
5002 The tag is a long value typically used to store a
5003 unique identifier or pointer to object information.
5004 The tag is set with
5005 <functionlink id="SetTag"></functionlink>.
5006 Objects for which no tags have been set return a
5007 tag value of zero.
5008 </description>
5009 <origin>new</origin>
5010 <capabilities>
5011 <required id="can_tag_objects"></required>
5012 </capabilities>
5013 <parameters>
5014 <param id="object">
5015 <jobject/>
5016 <description>
5017 The object whose tag is to be retrieved.
5018 </description>
5019 </param>
5020 <param id="tag_ptr">
5021 <outptr><jlong/></outptr>
5022 <description>
5023 On return, the referenced long is set to the value
5024 of the tag.
5025 </description>
5026 </param>
5027 </parameters>
5028 <errors>
5029 </errors>
5030 </function>
5031
5032 <function id="SetTag" phase="start" num="107">
5033 <synopsis>Set Tag</synopsis>
5034 <description>
5035 Set the tag associated with an object.
5036 The tag is a long value typically used to store a
5037 unique identifier or pointer to object information.
5038 The tag is visible with
5039 <functionlink id="GetTag"></functionlink>.
5040 </description>
5041 <origin>new</origin>
5042 <capabilities>
5043 <required id="can_tag_objects"></required>
5044 </capabilities>
5045 <parameters>
5046 <param id="object">
5047 <jobject/>
5048 <description>
5049 The object whose tag is to be set.
5050 </description>
5051 </param>
5052 <param id="tag">
5053 <jlong/>
5054 <description>
5055 The new value of the tag.
5056 </description>
5057 </param>
5058 </parameters>
5059 <errors>
5060 </errors>
5061 </function>
5062
5063 <function id="GetObjectsWithTags" num="114">
5064 <synopsis>Get Objects With Tags</synopsis>
5065 <description>
5066 Return objects in the heap with the specified tags.
5067 The format is parallel arrays of objects and tags.
5068 </description>
5069 <origin>new</origin>
5070 <capabilities>
5071 <required id="can_tag_objects"></required>
5072 </capabilities>
5073 <parameters>
5074 <param id="tag_count">
5075 <jint min="0"/>
5076 <description>
5077 Number of tags to scan for.
5078 </description>
5079 </param>
5080 <param id="tags">
5081 <inbuf incount="tag_count">
5082 <jlong/>
5083 </inbuf>
5084 <description>
5085 Scan for objects with these tags.
5086 Zero is not permitted in this array.
5087 </description>
5088 </param>
5089 <param id="count_ptr">
5090 <outptr>
5091 <jint/>
5092 </outptr>
5093 <description>
5094 Return the number of objects with any of the tags
5095 in <paramlink id="tags"/>.
5096 </description>
5097 </param>
5098 <param id="object_result_ptr">
5099 <allocbuf outcount="count_ptr">
5100 <jobject/>
5101 <nullok>this information is not returned</nullok>
5102 </allocbuf>
5103 <description>
5104 Returns the array of objects with any of the tags
5105 in <paramlink id="tags"/>.
5106 </description>
5107 </param>
5108 <param id="tag_result_ptr">
5109 <allocbuf outcount="count_ptr">
5110 <jlong/>
5111 <nullok>this information is not returned</nullok>
5112 </allocbuf>
5113 <description>
5114 For each object in <paramlink id="object_result_ptr"/>,
5115 return the tag at the corresponding index.
5116 </description>
5117 </param>
5118 </parameters>
5119 <errors>
5120 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
5121 Zero is present in <paramlink id="tags"></paramlink>.
5122 </error>
5123 </errors>
5124 </function>
5125
5126 <function id="ForceGarbageCollection" num="108">
5127 <synopsis>Force Garbage Collection</synopsis>
5128 <description>
5129 Force the VM to perform a garbage collection.
5130 The garbage collection is as complete as possible.
5131 This function does not cause finalizers to be run.
5132 This function does not return until the garbage collection
5133 is finished.
5134 <p/>
5135 Although garbage collection is as complete
5136 as possible there is no guarantee that all
5137 <eventlink id="ObjectFree"/>
5138 events will have been
5139 sent by the time that this function
5140 returns. In particular, an object may be
5141 prevented from being freed because it
5142 is awaiting finalization.
5143 </description>
5144 <origin>new</origin>
5145 <capabilities>
5146 </capabilities>
5147 <parameters>
5148 </parameters>
5149 <errors>
5150 </errors>
5151 </function>
5152
5153
5154 </category>
5155
5156 <category id="Heap_1_0" label="Heap (1.0)">
5157 <intro>
5158 <b>
5159 These functions and data types were introduced in the original
5160 <jvmti/> version 1.0. They are deprecated and will be changed
5161 to return an error in a future release. They were superseded in
5162 <jvmti/> version 1.2 (Java SE 6) by more
5163 </b>
5164 <internallink id="Heap"><b>powerful and flexible versions</b></internallink>
5165 <b>
5166 which:
5167 </b>
5168 <ul>
5169 <li>
5170 <b>
5171 Allow access to primitive values (the value of Strings, arrays,
5172 and primitive fields)
5173 </b>
5174 </li>
5175 <li>
5176 <b>
5177 Allow the tag of the referrer to be set, thus enabling more
5178 efficient localized reference graph building
5179 </b>
5180 </li>
5181 <li>
5182 <b>
5183 Provide more extensive filtering abilities
5184 </b>
5185 </li>
5186 <li>
5187 <b>
5188 Are extensible, allowing their abilities to grow in future versions of <jvmti/>
5189 </b>
5190 </li>
5191 </ul>
5192 <p/>
5193 <b>Please use the </b>
5194 <internallink id="Heap"><b>current Heap functions</b></internallink>.
5195 <p/>
5196 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum">
5197 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1">
5198 Tagged objects only.
5199 </constant>
5200 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2">
5201 Untagged objects only.
5202 </constant>
5203 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3">
5204 Either tagged or untagged objects.
5205 </constant>
5206 </constants>
5207
5208 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum">
5209 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1">
5210 JNI global reference.
5211 </constant>
5212 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2">
5213 System class.
5214 </constant>
5215 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3">
5216 Monitor.
5217 </constant>
5218 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4">
5219 Stack local.
5220 </constant>
5221 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5">
5222 JNI local reference.
5223 </constant>
5224 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6">
5225 Thread.
5226 </constant>
5227 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7">
5228 Other.
5229 </constant>
5230 </constants>
5231
5232 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum">
5233 <constant id="JVMTI_REFERENCE_CLASS" num="1">
5234 Reference from an object to its class.
5235 </constant>
5236 <constant id="JVMTI_REFERENCE_FIELD" num="2">
5237 Reference from an object to the value of one of its instance fields.
5238 For references of this kind the <code>referrer_index</code>
5239 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5240 jvmtiObjectReferenceCallback</internallink> is the index of the
5241 the instance field. The index is based on the order of all the
5242 object's fields. This includes all fields of the directly declared
5243 static and instance fields in the class, and includes all fields (both
5244 public and private) fields declared in superclasses and superinterfaces.
5245 The index is thus calculated by summing the index of the field in the directly
5246 declared class (see <functionlink id="GetClassFields"/>), with the total
5247 number of fields (both public and private) declared in all superclasses
5248 and superinterfaces. The index starts at zero.
5249 </constant>
5250 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3">
5251 Reference from an array to one of its elements.
5252 For references of this kind the <code>referrer_index</code>
5253 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5254 jvmtiObjectReferenceCallback</internallink> is the array index.
5255 </constant>
5256 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4">
5257 Reference from a class to its class loader.
5258 </constant>
5259 <constant id="JVMTI_REFERENCE_SIGNERS" num="5">
5260 Reference from a class to its signers array.
5261 </constant>
5262 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6">
5263 Reference from a class to its protection domain.
5264 </constant>
5265 <constant id="JVMTI_REFERENCE_INTERFACE" num="7">
5266 Reference from a class to one of its interfaces.
5267 </constant>
5268 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8">
5269 Reference from a class to the value of one of its static fields.
5270 For references of this kind the <code>referrer_index</code>
5271 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5272 jvmtiObjectReferenceCallback</internallink> is the index of the
5273 the static field. The index is based on the order of all the
5274 object's fields. This includes all fields of the directly declared
5275 static and instance fields in the class, and includes all fields (both
5276 public and private) fields declared in superclasses and superinterfaces.
5277 The index is thus calculated by summing the index of the field in the directly
5278 declared class (see <functionlink id="GetClassFields"/>), with the total
5279 number of fields (both public and private) declared in all superclasses
5280 and superinterfaces. The index starts at zero.
5281 Note: this definition differs from that in the <jvmti/> 1.0 Specification.
5282 <rationale>No known implementations used the 1.0 definition.</rationale>
5283 </constant>
5284 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9">
5285 Reference from a class to a resolved entry in the constant pool.
5286 For references of this kind the <code>referrer_index</code>
5287 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5288 jvmtiObjectReferenceCallback</internallink> is the index into
5289 constant pool table of the class, starting at 1. See
5290 <vmspec chapter="4.4"/>.
5291 </constant>
5292 </constants>
5293
5294 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum">
5295 <constant id="JVMTI_ITERATION_CONTINUE" num="1">
5296 Continue the iteration.
5297 If this is a reference iteration, follow the references of this object.
5298 </constant>
5299 <constant id="JVMTI_ITERATION_IGNORE" num="2">
5300 Continue the iteration.
5301 If this is a reference iteration, ignore the references of this object.
5302 </constant>
5303 <constant id="JVMTI_ITERATION_ABORT" num="0">
5304 Abort the iteration.
5305 </constant>
5306 </constants>
5307 </intro>
5308
5309 <callback id="jvmtiHeapObjectCallback">
5310 <enum>jvmtiIterationControl</enum>
5311 <synopsis>Heap Object Callback</synopsis>
5312 <description>
5313 Agent supplied callback function.
5314 Describes (but does not pass in) an object in the heap.
5315 <p/>
5316 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5317 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5318 <p/>
5319 See the <internallink id="heapCallbacks">heap callback
5320 function restrictions</internallink>.
5321 </description>
5322 <parameters>
5323 <param id="class_tag">
5324 <jlong/>
5325 <description>
5326 The tag of the class of object (zero if the class is not tagged).
5327 If the object represents a runtime class,
5328 the <code>class_tag</code> is the tag
5329 associated with <code>java.lang.Class</code>
5330 (zero if <code>java.lang.Class</code> is not tagged).
5331 </description>
5332 </param>
5333 <param id="size">
5334 <jlong/>
5335 <description>
5336 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5337 </description>
5338 </param>
5339 <param id="tag_ptr">
5340 <outptr><jlong/></outptr>
5341 <description>
5342 The object tag value, or zero if the object is not tagged.
5343 To set the tag value to be associated with the object
5344 the agent sets the <code>jlong</code> pointed to by the parameter.
5345 </description>
5346 </param>
5347 <param id="user_data">
5348 <outptr><void/></outptr>
5349 <description>
5350 The user supplied data that was passed into the iteration function.
5351 </description>
5352 </param>
5353 </parameters>
5354 </callback>
5355
5356 <callback id="jvmtiHeapRootCallback">
5357 <enum>jvmtiIterationControl</enum>
5358 <synopsis>Heap Root Object Callback</synopsis>
5359 <description>
5360 Agent supplied callback function.
5361 Describes (but does not pass in) an object that is a root for the purposes
5362 of garbage collection.
5363 <p/>
5364 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5365 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5366 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5367 <p/>
5368 See the <internallink id="heapCallbacks">heap callback
5369 function restrictions</internallink>.
5370 </description>
5371 <parameters>
5372 <param id="root_kind">
5373 <enum>jvmtiHeapRootKind</enum>
5374 <description>
5375 The kind of heap root.
5376 </description>
5377 </param>
5378 <param id="class_tag">
5379 <jlong/>
5380 <description>
5381 The tag of the class of object (zero if the class is not tagged).
5382 If the object represents a runtime class, the <code>class_tag</code> is the tag
5383 associated with <code>java.lang.Class</code>
5384 (zero if <code>java.lang.Class</code> is not tagged).
5385 </description>
5386 </param>
5387 <param id="size">
5388 <jlong/>
5389 <description>
5390 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5391 </description>
5392 </param>
5393 <param id="tag_ptr">
5394 <outptr><jlong/></outptr>
5395 <description>
5396 The object tag value, or zero if the object is not tagged.
5397 To set the tag value to be associated with the object
5398 the agent sets the <code>jlong</code> pointed to by the parameter.
5399 </description>
5400 </param>
5401 <param id="user_data">
5402 <outptr><void/></outptr>
5403 <description>
5404 The user supplied data that was passed into the iteration function.
5405 </description>
5406 </param>
5407 </parameters>
5408 </callback>
5409
5410 <callback id="jvmtiStackReferenceCallback">
5411 <enum>jvmtiIterationControl</enum>
5412 <synopsis>Stack Reference Object Callback</synopsis>
5413 <description>
5414 Agent supplied callback function.
5415 Describes (but does not pass in) an object on the stack that is a root for
5416 the purposes of garbage collection.
5417 <p/>
5418 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5419 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5420 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5421 <p/>
5422 See the <internallink id="heapCallbacks">heap callback
5423 function restrictions</internallink>.
5424 </description>
5425 <parameters>
5426 <param id="root_kind">
5427 <enum>jvmtiHeapRootKind</enum>
5428 <description>
5429 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5430 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>).
5431 </description>
5432 </param>
5433 <param id="class_tag">
5434 <jlong/>
5435 <description>
5436 The tag of the class of object (zero if the class is not tagged).
5437 If the object represents a runtime class, the <code>class_tag</code> is the tag
5438 associated with <code>java.lang.Class</code>
5439 (zero if <code>java.lang.Class</code> is not tagged).
5440 </description>
5441 </param>
5442 <param id="size">
5443 <jlong/>
5444 <description>
5445 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5446 </description>
5447 </param>
5448 <param id="tag_ptr">
5449 <outptr><jlong/></outptr>
5450 <description>
5451 The object tag value, or zero if the object is not tagged.
5452 To set the tag value to be associated with the object
5453 the agent sets the <code>jlong</code> pointed to by the parameter.
5454 </description>
5455 </param>
5456 <param id="thread_tag">
5457 <jlong/>
5458 <description>
5459 The tag of the thread corresponding to this stack, zero if not tagged.
5460 </description>
5461 </param>
5462 <param id="depth">
5463 <jint/>
5464 <description>
5465 The depth of the frame.
5466 </description>
5467 </param>
5468 <param id="method">
5469 <jmethodID/>
5470 <description>
5471 The method executing in this frame.
5472 </description>
5473 </param>
5474 <param id="slot">
5475 <jint/>
5476 <description>
5477 The slot number.
5478 </description>
5479 </param>
5480 <param id="user_data">
5481 <outptr><void/></outptr>
5482 <description>
5483 The user supplied data that was passed into the iteration function.
5484 </description>
5485 </param>
5486 </parameters>
5487 </callback>
5488
5489 <callback id="jvmtiObjectReferenceCallback">
5490 <enum>jvmtiIterationControl</enum>
5491 <synopsis>Object Reference Callback</synopsis>
5492 <description>
5493 Agent supplied callback function.
5494 Describes a reference from an object (the referrer) to another object
5495 (the referree).
5496 <p/>
5497 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5498 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5499 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5500 <p/>
5501 See the <internallink id="heapCallbacks">heap callback
5502 function restrictions</internallink>.
5503 </description>
5504 <parameters>
5505 <param id="reference_kind">
5506 <enum>jvmtiObjectReferenceKind</enum>
5507 <description>
5508 The type of reference.
5509 </description>
5510 </param>
5511 <param id="class_tag">
5512 <jlong/>
5513 <description>
5514 The tag of the class of referree object (zero if the class is not tagged).
5515 If the referree object represents a runtime class,
5516 the <code>class_tag</code> is the tag
5517 associated with <code>java.lang.Class</code>
5518 (zero if <code>java.lang.Class</code> is not tagged).
5519 </description>
5520 </param>
5521 <param id="size">
5522 <jlong/>
5523 <description>
5524 Size of the referree object (in bytes).
5525 See <functionlink id="GetObjectSize"/>.
5526 </description>
5527 </param>
5528 <param id="tag_ptr">
5529 <outptr><jlong/></outptr>
5530 <description>
5531 The referree object tag value, or zero if the object is not
5532 tagged.
5533 To set the tag value to be associated with the object
5534 the agent sets the <code>jlong</code> pointed to by the parameter.
5535 </description>
5536 </param>
5537 <param id="referrer_tag">
5538 <jlong/>
5539 <description>
5540 The tag of the referrer object, or zero if the referrer
5541 object is not tagged.
5542 </description>
5543 </param>
5544 <param id="referrer_index">
5545 <jint/>
5546 <description>
5547 For references of type <code>JVMTI_REFERENCE_FIELD</code> or
5548 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index
5549 of the field in the referrer object. The index is based on the
5550 order of all the object's fields - see <internallink
5551 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink>
5552 or <internallink
5553 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD
5554 </internallink> for further description.
5555 <p/>
5556 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code>
5557 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT">
5558 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description.
5559 <p/>
5560 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code>
5561 the index into the constant pool of the class - see
5562 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL">
5563 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further
5564 description.
5565 <p/>
5566 For references of other kinds the <code>referrer_index</code> is
5567 <code>-1</code>.
5568 </description>
5569 </param>
5570 <param id="user_data">
5571 <outptr><void/></outptr>
5572 <description>
5573 The user supplied data that was passed into the iteration function.
5574 </description>
5575 </param>
5576 </parameters>
5577 </callback>
5578
5579 <function id="IterateOverObjectsReachableFromObject" num="109">
5580 <synopsis>Iterate Over Objects Reachable From Object</synopsis>
5581 <description>
5582 This function iterates over all objects that are directly
5583 and indirectly reachable from the specified object.
5584 For each object <i>A</i> (known
5585 as the referrer) with a reference to object <i>B</i> the specified
5586 callback function is called to describe the object reference.
5587 The callback is called exactly once for each reference from a referrer;
5588 this is true even if there are reference cycles or multiple paths to
5589 the referrer.
5590 There may be more than one reference between a referrer and a referree,
5591 These may be distinguished by the
5592 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5593 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5594 The callback for an object will always occur after the callback for
5595 its referrer.
5596 <p/>
5597 See <functionlink id="FollowReferences"/> for the object
5598 references which are reported.
5599 <p/>
5600 During the execution of this function the state of the heap
5601 does not change: no objects are allocated, no objects are
5602 garbage collected, and the state of objects (including
5603 held values) does not change.
5604 As a result, threads executing Java
5605 programming language code, threads attempting to resume the
5606 execution of Java programming language code, and threads
5607 attempting to execute JNI functions are typically stalled.
5608 </description>
5609 <origin>new</origin>
5610 <capabilities>
5611 <required id="can_tag_objects"></required>
5612 </capabilities>
5613 <parameters>
5614 <param id="object">
5615 <jobject/>
5616 <description>
5617 The object
5618 </description>
5619 </param>
5620 <param id="object_reference_callback">
5621 <ptrtype>
5622 <struct>jvmtiObjectReferenceCallback</struct>
5623 </ptrtype>
5624 <description>
5625 The callback to be called to describe each
5626 object reference.
5627 </description>
5628 </param>
5629 <param id="user_data">
5630 <inbuf>
5631 <void/>
5632 <nullok>a null pointer is passed as the user supplied data</nullok>
5633 </inbuf>
5634 <description>
5635 User supplied data to be passed to the callback.
5636 </description>
5637 </param>
5638 </parameters>
5639 <errors>
5640 </errors>
5641 </function>
5642
5643 <function id="IterateOverReachableObjects" num="110">
5644 <synopsis>Iterate Over Reachable Objects</synopsis>
5645 <description>
5646 This function iterates over the root objects and all objects that
5647 are directly and indirectly reachable from the root objects.
5648 The root objects comprise the set of system classes,
5649 JNI globals, references from platform thread stacks, and other objects used as roots
5650 for the purposes of garbage collection.
5651 <p/>
5652 For each root the <paramlink id="heap_root_callback"></paramlink>
5653 or <paramlink id="stack_ref_callback"></paramlink> callback is called.
5654 An object can be a root object for more than one reason and in that case
5655 the appropriate callback is called for each reason.
5656 <p/>
5657 For each object reference the <paramlink id="object_ref_callback"></paramlink>
5658 callback function is called to describe the object reference.
5659 The callback is called exactly once for each reference from a referrer;
5660 this is true even if there are reference cycles or multiple paths to
5661 the referrer.
5662 There may be more than one reference between a referrer and a referree,
5663 These may be distinguished by the
5664 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5665 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5666 The callback for an object will always occur after the callback for
5667 its referrer.
5668 <p/>
5669 See <functionlink id="FollowReferences"/> for the object
5670 references which are reported.
5671 <p/>
5672 Roots are always reported to the profiler before any object references
5673 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink>
5674 callback will not be called until the appropriate callback has been called
5675 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is
5676 specified as null then this function returns after
5677 reporting the root objects to the profiler.
5678 <p/>
5679 During the execution of this function the state of the heap
5680 does not change: no objects are allocated, no objects are
5681 garbage collected, and the state of objects (including
5682 held values) does not change.
5683 As a result, threads executing Java
5684 programming language code, threads attempting to resume the
5685 execution of Java programming language code, and threads
5686 attempting to execute JNI functions are typically stalled.
5687 </description>
5688 <origin>new</origin>
5689 <capabilities>
5690 <required id="can_tag_objects"></required>
5691 </capabilities>
5692 <parameters>
5693 <param id="heap_root_callback">
5694 <ptrtype>
5695 <struct>jvmtiHeapRootCallback</struct>
5696 <nullok>do not report heap roots</nullok>
5697 </ptrtype>
5698 <description>
5699 The callback function to be called for each heap root of type
5700 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>,
5701 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>,
5702 <code>JVMTI_HEAP_ROOT_MONITOR</code>,
5703 <code>JVMTI_HEAP_ROOT_THREAD</code>, or
5704 <code>JVMTI_HEAP_ROOT_OTHER</code>.
5705 </description>
5706 </param>
5707 <param id="stack_ref_callback">
5708 <ptrtype>
5709 <struct>jvmtiStackReferenceCallback</struct>
5710 <nullok>do not report stack references</nullok>
5711 </ptrtype>
5712 <description>
5713 The callback function to be called for each heap root of
5714 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5715 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>.
5716 </description>
5717 </param>
5718 <param id="object_ref_callback">
5719 <ptrtype>
5720 <struct>jvmtiObjectReferenceCallback</struct>
5721 <nullok>do not follow references from the root objects</nullok>
5722 </ptrtype>
5723 <description>
5724 The callback function to be called for each object reference.
5725 </description>
5726 </param>
5727 <param id="user_data">
5728 <inbuf>
5729 <void/>
5730 <nullok>a null pointer is passed as the user supplied data</nullok>
5731 </inbuf>
5732 <description>
5733 User supplied data to be passed to the callback.
5734 </description>
5735 </param>
5736 </parameters>
5737 <errors>
5738 </errors>
5739 </function>
5740
5741 <function id="IterateOverHeap" num="111">
5742 <synopsis>Iterate Over Heap</synopsis>
5743 <description>
5744 Iterate over all objects in the heap. This includes both reachable and
5745 unreachable objects.
5746 <p/>
5747 The <paramlink id="object_filter"></paramlink> parameter indicates the
5748 objects for which the callback function is called. If this parameter
5749 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5750 called for every object that is tagged. If the parameter is
5751 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5752 for objects that are not tagged. If the parameter
5753 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5754 called for every object in the heap, irrespective of whether it is
5755 tagged or not.
5756 <p/>
5757 During the execution of this function the state of the heap
5758 does not change: no objects are allocated, no objects are
5759 garbage collected, and the state of objects (including
5760 held values) does not change.
5761 As a result, threads executing Java
5762 programming language code, threads attempting to resume the
5763 execution of Java programming language code, and threads
5764 attempting to execute JNI functions are typically stalled.
5765 </description>
5766 <origin>new</origin>
5767 <capabilities>
5768 <required id="can_tag_objects"></required>
5769 </capabilities>
5770 <parameters>
5771 <param id="object_filter">
5772 <enum>jvmtiHeapObjectFilter</enum>
5773 <description>
5774 Indicates the objects for which the callback function is called.
5775 </description>
5776 </param>
5777 <param id="heap_object_callback">
5778 <ptrtype>
5779 <struct>jvmtiHeapObjectCallback</struct>
5780 </ptrtype>
5781 <description>
5782 The iterator function to be called for each
5783 object matching the <paramlink id="object_filter"/>.
5784 </description>
5785 </param>
5786 <param id="user_data">
5787 <inbuf>
5788 <void/>
5789 <nullok>a null pointer is passed as the user supplied data</nullok>
5790 </inbuf>
5791 <description>
5792 User supplied data to be passed to the callback.
5793 </description>
5794 </param>
5795 </parameters>
5796 <errors>
5797 </errors>
5798 </function>
5799
5800 <function id="IterateOverInstancesOfClass" num="112">
5801 <synopsis>Iterate Over Instances Of Class</synopsis>
5802 <description>
5803 Iterate over all objects in the heap that are instances of the specified class.
5804 This includes direct instances of the specified class and
5805 instances of all subclasses of the specified class.
5806 This includes both reachable and unreachable objects.
5807 <p/>
5808 The <paramlink id="object_filter"></paramlink> parameter indicates the
5809 objects for which the callback function is called. If this parameter
5810 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5811 called for every object that is tagged. If the parameter is
5812 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5813 called for objects that are not tagged. If the parameter
5814 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5815 called for every object in the heap, irrespective of whether it is
5816 tagged or not.
5817 <p/>
5818 During the execution of this function the state of the heap
5819 does not change: no objects are allocated, no objects are
5820 garbage collected, and the state of objects (including
5821 held values) does not change.
5822 As a result, threads executing Java
5823 programming language code, threads attempting to resume the
5824 execution of Java programming language code, and threads
5825 attempting to execute JNI functions are typically stalled.
5826 </description>
5827 <origin>new</origin>
5828 <capabilities>
5829 <required id="can_tag_objects"></required>
5830 </capabilities>
5831 <parameters>
5832 <param id="klass">
5833 <jclass/>
5834 <description>
5835 Iterate over objects of this class only.
5836 </description>
5837 </param>
5838 <param id="object_filter">
5839 <enum>jvmtiHeapObjectFilter</enum>
5840 <description>
5841 Indicates the objects for which the callback function is called.
5842 </description>
5843 </param>
5844 <param id="heap_object_callback">
5845 <ptrtype>
5846 <struct>jvmtiHeapObjectCallback</struct>
5847 </ptrtype>
5848 <description>
5849 The iterator function to be called for each
5850 <paramlink id="klass"/> instance matching
5851 the <paramlink id="object_filter"/>.
5852 </description>
5853 </param>
5854 <param id="user_data">
5855 <inbuf>
5856 <void/>
5857 <nullok>null pointeris passed as the user supplied data</nullok>
5858 </inbuf>
5859 <description>
5860 User supplied data to be passed to the callback.
5861 </description>
5862 </param>
5863 </parameters>
5864 <errors>
5865 </errors>
5866 </function>
5867
5868 </category>
5869
5870 <category id="local" label="Local Variable">
5871
5872 <intro>
5873 These functions are used to retrieve or set the value of a local variable.
5874 The variable is identified by the depth of the frame containing its
5875 value and the variable's slot number within that frame.
5876 The mapping of variables to
5877 slot numbers can be obtained with the function
5878 <functionlink id="GetLocalVariableTable"></functionlink>.
5879 <p/>
5880 The <code>GetLocalXXX</code> functions may be used to retrieve the value of
5881 a local variable contained in the frame of a virtual thread.
5882 The <code>SetLocalXXX</code> functions may be used to set the value of a
5883 local variable in the topmost frame of a virtual thread suspended at an event.
5884 An implementation may support setting locals in other cases.
5885 </intro>
5886
5887 <function id="GetLocalObject" num="21">
5888 <synopsis>Get Local Variable - Object</synopsis>
5889 <description>
5890 This function can be used to retrieve the value of a local
5891 variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
5892 <p/>
5893 When preview features are enabled, if the local is the "<code>this</code>"
5894 object and "<code>this</code>" is a value object under construction, the
5895 function retrieves a snapshot of the "<code>this</code>" object representing
5896 the value object's state at the point the snapshot is taken.
5897 <p/>
5898 The specified thread must be suspended or must be the current thread.
5899 </description>
5900 <origin>jvmdi</origin>
5901 <capabilities>
5902 <required id="can_access_local_variables"></required>
5903 </capabilities>
5904 <parameters>
5905 <param id="thread">
5906 <jthread null="current" frame="frame" impl="noconvert"/>
5907 <description>
5908 The thread of the frame containing the variable's value.
5909 </description>
5910 </param>
5911 <param id="depth">
5912 <jframeID thread="thread"/>
5913 <description>
5914 The depth of the frame containing the variable's value.
5915 </description>
5916 </param>
5917 <param id="slot">
5918 <jint/>
5919 <description>
5920 The variable's slot number.
5921 </description>
5922 </param>
5923 <param id="value_ptr">
5924 <outptr><jobject/></outptr>
5925 <description>
5926 On return, points to the variable's value.
5927 When preview features are enabled, if the local is the "<code>this</code>"
5928 object and "<code>this</code>" is a value object under construction,
5929 <code>value_ptr</code> will point to a snapshot of the "<code>this</code>"
5930 object representing the value object's state at the point the snapshot
5931 is taken.
5932 </description>
5933 </param>
5934 </parameters>
5935 <errors>
5936 <error id="JVMTI_ERROR_INVALID_SLOT">
5937 Invalid <code>slot</code>.
5938 </error>
5939 <error id="JVMTI_ERROR_TYPE_MISMATCH">
5940 The variable type is not
5941 <code>Object</code> or a subclass of <code>Object</code>.
5942 </error>
5943 <error id="JVMTI_ERROR_OPAQUE_FRAME">
5944 The implementation is unable to get the frame locals
5945 (e.g. the frame at <code>depth</code> is executing a native method).
5946 </error>
5947 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
5948 Thread was not suspended and was not the current thread.
5949 </error>
5950 </errors>
5951 </function>
5952
5953 <function id="GetLocalInstance" num="155" since="1.2">
5954 <synopsis>Get Local Instance</synopsis>
5955 <description>
5956 This function can be used to retrieve the value of the local object
5957 variable at slot 0 (the "<code>this</code>" object) from non-static
5958 frames. This function can retrieve the "<code>this</code>" object from
5959 native method frames, whereas <code>GetLocalObject()</code> would
5960 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases.
5961 <p/>
5962 When preview features are enabled and the "<code>this</code>" object is
5963 a value object under construction, the function retrieves a snapshot of the
5964 "<code>this</code>" object that represents the value object's state at
5965 the point the snapshot is taken.
5966 <p/>
5967 The specified thread must be suspended or must be the current thread.
5968 </description>
5969 <origin>new</origin>
5970 <capabilities>
5971 <required id="can_access_local_variables"></required>
5972 </capabilities>
5973 <parameters>
5974 <param id="thread">
5975 <jthread null="current" frame="frame" impl="noconvert"/>
5976 <description>
5977 The thread of the frame containing the variable's value.
5978 </description>
5979 </param>
5980 <param id="depth">
5981 <jframeID thread="thread"/>
5982 <description>
5983 The depth of the frame containing the variable's value.
5984 </description>
5985 </param>
5986 <param id="value_ptr">
5987 <outptr><jobject/></outptr>
5988 <description>
5989 On return, points to the variable's value.
5990 When preview features are enabled, and the "<code>this</code>" object is
5991 a value object under construction, <code>value_ptr</code> will point to
5992 a snapshot of the "<code>this</code>" object representing the value
5993 object's state at the point the snapshot is taken.
5994 </description>
5995 </param>
5996 </parameters>
5997 <errors>
5998 <error id="JVMTI_ERROR_INVALID_SLOT">
5999 If the specified frame is a static method frame.
6000 </error>
6001 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6002 Thread was not suspended and was not the current thread.
6003 </error>
6004 </errors>
6005 </function>
6006 <function id="GetLocalInt" num="22">
6007 <synopsis>Get Local Variable - Int</synopsis>
6008 <description>
6009 This function can be used to retrieve the value of a local
6010 variable whose type is <code>int</code>,
6011 <code>short</code>, <code>char</code>, <code>byte</code>, or
6012 <code>boolean</code>.
6013 <p/>
6014 The specified thread must be suspended or must be the current thread.
6015 </description>
6016 <origin>jvmdi</origin>
6017 <capabilities>
6018 <required id="can_access_local_variables"></required>
6019 </capabilities>
6020 <parameters>
6021 <param id="thread">
6022 <jthread null="current" frame="frame" impl="noconvert"/>
6023 <description>
6024 The thread of the frame containing the variable's value.
6025 </description>
6026 </param>
6027 <param id="depth">
6028 <jframeID thread="thread"/>
6029 <description>
6030 The depth of the frame containing the variable's value.
6031 </description>
6032 </param>
6033 <param id="slot">
6034 <jint/>
6035 <description>
6036 The variable's slot number.
6037 </description>
6038 </param>
6039 <param id="value_ptr">
6040 <outptr><jint/></outptr>
6041 <description>
6042 On return, points to the variable's value.
6043 </description>
6044 </param>
6045 </parameters>
6046 <errors>
6047 <error id="JVMTI_ERROR_INVALID_SLOT">
6048 Invalid <code>slot</code>.
6049 </error>
6050 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6051 The variable type is not
6052 <code>int</code>, <code>short</code>,
6053 <code>char</code>, <code>byte</code>, or
6054 <code>boolean</code>.
6055 </error>
6056 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6057 The implementation is unable to get the frame locals
6058 (e.g. the frame at <code>depth</code> is executing a native method).
6059 </error>
6060 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6061 Thread was not suspended and was not the current thread.
6062 </error>
6063 </errors>
6064 </function>
6065
6066 <function id="GetLocalLong" num="23">
6067 <synopsis>Get Local Variable - Long</synopsis>
6068 <description>
6069 This function can be used to retrieve the value of a local
6070 variable whose type is <code>long</code>.
6071 <p/>
6072 The specified thread must be suspended or must be the current thread.
6073 </description>
6074 <origin>jvmdi</origin>
6075 <capabilities>
6076 <required id="can_access_local_variables"></required>
6077 </capabilities>
6078 <parameters>
6079 <param id="thread">
6080 <jthread null="current" frame="frame" impl="noconvert"/>
6081 <description>
6082 The thread of the frame containing the variable's value.
6083 </description>
6084 </param>
6085 <param id="depth">
6086 <jframeID thread="thread"/>
6087 <description>
6088 The depth of the frame containing the variable's value.
6089 </description>
6090 </param>
6091 <param id="slot">
6092 <jint/>
6093 <description>
6094 The variable's slot number.
6095 </description>
6096 </param>
6097 <param id="value_ptr">
6098 <outptr><jlong/></outptr>
6099 <description>
6100 On return, points to the variable's value.
6101 </description>
6102 </param>
6103 </parameters>
6104 <errors>
6105 <error id="JVMTI_ERROR_INVALID_SLOT">
6106 Invalid <code>slot</code>.
6107 </error>
6108 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6109 The variable type is not <code>long</code>.
6110 </error>
6111 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6112 The implementation is unable to get the frame locals
6113 (e.g. the frame at <code>depth</code> is executing a native method).
6114 </error>
6115 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6116 Thread was not suspended and was not the current thread.
6117 </error>
6118 </errors>
6119 </function>
6120
6121 <function id="GetLocalFloat" num="24">
6122 <synopsis>Get Local Variable - Float</synopsis>
6123 <description>
6124 This function can be used to retrieve the value of a local
6125 variable whose type is <code>float</code>.
6126 <p/>
6127 The specified thread must be suspended or must be the current thread.
6128 </description>
6129 <origin>jvmdi</origin>
6130 <capabilities>
6131 <required id="can_access_local_variables"></required>
6132 </capabilities>
6133 <parameters>
6134 <param id="thread">
6135 <jthread null="current" frame="frame" impl="noconvert"/>
6136 <description>
6137 The thread of the frame containing the variable's value.
6138 </description>
6139 </param>
6140 <param id="depth">
6141 <jframeID thread="thread"/>
6142 <description>
6143 The depth of the frame containing the variable's value.
6144 </description>
6145 </param>
6146 <param id="slot">
6147 <jint/>
6148 <description>
6149 The variable's slot number.
6150 </description>
6151 </param>
6152 <param id="value_ptr">
6153 <outptr><jfloat/></outptr>
6154 <description>
6155 On return, points to the variable's value.
6156 </description>
6157 </param>
6158 </parameters>
6159 <errors>
6160 <error id="JVMTI_ERROR_INVALID_SLOT">
6161 Invalid <code>slot</code>.
6162 </error>
6163 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6164 The variable type is not <code>float</code>.
6165 </error>
6166 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6167 The implementation is unable to get the frame locals
6168 (e.g. the frame at <code>depth</code> is executing a native method).
6169 </error>
6170 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6171 Thread was not suspended and was not the current thread.
6172 </error>
6173 </errors>
6174 </function>
6175
6176 <function id="GetLocalDouble" num="25">
6177 <synopsis>Get Local Variable - Double</synopsis>
6178 <description>
6179 This function can be used to retrieve the value of a local
6180 variable whose type is <code>double</code>.
6181 <p/>
6182 The specified thread must be suspended or must be the current thread.
6183 </description>
6184 <origin>jvmdi</origin>
6185 <capabilities>
6186 <required id="can_access_local_variables"></required>
6187 </capabilities>
6188 <parameters>
6189 <param id="thread">
6190 <jthread null="current" frame="frame" impl="noconvert"/>
6191 <description>
6192 The thread of the frame containing the variable's value.
6193 </description>
6194 </param>
6195 <param id="depth">
6196 <jframeID thread="thread"/>
6197 <description>
6198 The depth of the frame containing the variable's value.
6199 </description>
6200 </param>
6201 <param id="slot">
6202 <jint/>
6203 <description>
6204 The variable's slot number.
6205 </description>
6206 </param>
6207 <param id="value_ptr">
6208 <outptr><jdouble/></outptr>
6209 <description>
6210 On return, points to the variable's value.
6211 </description>
6212 </param>
6213 </parameters>
6214 <errors>
6215 <error id="JVMTI_ERROR_INVALID_SLOT">
6216 Invalid <code>slot</code>.
6217 </error>
6218 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6219 The variable type is not <code>double</code>.
6220 </error>
6221 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6222 The implementation is unable to get the frame locals
6223 (e.g. the frame at <code>depth</code> is executing a native method).
6224 </error>
6225 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6226 Thread was not suspended and was not the current thread.
6227 </error>
6228 </errors>
6229 </function>
6230
6231 <function id="SetLocalObject" num="26">
6232 <synopsis>Set Local Variable - Object</synopsis>
6233 <description>
6234 This function can be used to set the value of a local
6235 variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
6236 <p/>
6237 The specified thread must be suspended or must be the current thread.
6238 </description>
6239 <origin>jvmdi</origin>
6240 <capabilities>
6241 <required id="can_access_local_variables"></required>
6242 </capabilities>
6243 <parameters>
6244 <param id="thread">
6245 <jthread null="current" frame="frame" impl="noconvert"/>
6246 <description>
6247 The thread of the frame containing the variable's value.
6248 </description>
6249 </param>
6250 <param id="depth">
6251 <jframeID thread="thread"/>
6252 <description>
6253 The depth of the frame containing the variable's value.
6254 </description>
6255 </param>
6256 <param id="slot">
6257 <jint/>
6258 <description>
6259 The variable's slot number.
6260 </description>
6261 </param>
6262 <param id="value">
6263 <jobject/>
6264 <description>
6265 The new value for the variable.
6266 </description>
6267 </param>
6268 </parameters>
6269 <errors>
6270 <error id="JVMTI_ERROR_INVALID_SLOT">
6271 Invalid <code>slot</code>.
6272 </error>
6273 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6274 The variable type is not
6275 <code>Object</code> or a subclass of <code>Object</code>.
6276 </error>
6277 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6278 The supplied <paramlink id="value"/> is not compatible
6279 with the variable type.
6280 </error>
6281 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6282 The implementation is unable to set the frame locals
6283 (e.g. the frame at <code>depth</code> is executing a native method).
6284 </error>
6285 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6286 Thread was not suspended and was not the current thread.
6287 </error>
6288 </errors>
6289 </function>
6290
6291 <function id="SetLocalInt" num="27">
6292 <synopsis>Set Local Variable - Int</synopsis>
6293 <description>
6294 This function can be used to set the value of a local
6295 variable whose type is <code>int</code>,
6296 <code>short</code>, <code>char</code>, <code>byte</code>, or
6297 <code>boolean</code>.
6298 <p/>
6299 The specified thread must be suspended or must be the current thread.
6300 </description>
6301 <origin>jvmdi</origin>
6302 <capabilities>
6303 <required id="can_access_local_variables"></required>
6304 </capabilities>
6305 <parameters>
6306 <param id="thread">
6307 <jthread null="current" frame="frame" impl="noconvert"/>
6308 <description>
6309 The thread of the frame containing the variable's value.
6310 </description>
6311 </param>
6312 <param id="depth">
6313 <jframeID thread="thread"/>
6314 <description>
6315 The depth of the frame containing the variable's value.
6316 </description>
6317 </param>
6318 <param id="slot">
6319 <jint/>
6320 <description>
6321 The variable's slot number.
6322 </description>
6323 </param>
6324 <param id="value">
6325 <jint/>
6326 <description>
6327 The new value for the variable.
6328 </description>
6329 </param>
6330 </parameters>
6331 <errors>
6332 <error id="JVMTI_ERROR_INVALID_SLOT">
6333 Invalid <code>slot</code>.
6334 </error>
6335 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6336 The variable type is not
6337 <code>int</code>, <code>short</code>,
6338 <code>char</code>, <code>byte</code>, or
6339 <code>boolean</code>.
6340 </error>
6341 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6342 The implementation is unable to set the frame locals
6343 (e.g. the frame at <code>depth</code> is executing a native method).
6344 </error>
6345 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6346 Thread was not suspended and was not the current thread.
6347 </error>
6348 </errors>
6349 </function>
6350
6351 <function id="SetLocalLong" num="28">
6352 <synopsis>Set Local Variable - Long</synopsis>
6353 <description>
6354 This function can be used to set the value of a local
6355 variable whose type is <code>long</code>.
6356 <p/>
6357 The specified thread must be suspended or must be the current thread.
6358 </description>
6359 <origin>jvmdi</origin>
6360 <capabilities>
6361 <required id="can_access_local_variables"></required>
6362 </capabilities>
6363 <parameters>
6364 <param id="thread">
6365 <jthread null="current" frame="frame" impl="noconvert"/>
6366 <description>
6367 The thread of the frame containing the variable's value.
6368 </description>
6369 </param>
6370 <param id="depth">
6371 <jframeID thread="thread"/>
6372 <description>
6373 The depth of the frame containing the variable's value.
6374 </description>
6375 </param>
6376 <param id="slot">
6377 <jint/>
6378 <description>
6379 The variable's slot number.
6380 </description>
6381 </param>
6382 <param id="value">
6383 <jlong/>
6384 <description>
6385 The new value for the variable.
6386 </description>
6387 </param>
6388 </parameters>
6389 <errors>
6390 <error id="JVMTI_ERROR_INVALID_SLOT">
6391 Invalid <code>slot</code>.
6392 </error>
6393 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6394 The variable type is not <code>long</code>.
6395 </error>
6396 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6397 The implementation is unable to set the frame locals
6398 (e.g. the frame at <code>depth</code> is executing a native method).
6399 </error>
6400 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6401 Thread was not suspended and was not the current thread.
6402 </error>
6403 </errors>
6404 </function>
6405
6406 <function id="SetLocalFloat" num="29">
6407 <synopsis>Set Local Variable - Float</synopsis>
6408 <description>
6409 This function can be used to set the value of a local
6410 variable whose type is <code>float</code>.
6411 <p/>
6412 The specified thread must be suspended or must be the current thread.
6413 </description>
6414 <origin>jvmdi</origin>
6415 <capabilities>
6416 <required id="can_access_local_variables"></required>
6417 </capabilities>
6418 <parameters>
6419 <param id="thread">
6420 <jthread null="current" frame="frame" impl="noconvert"/>
6421 <description>
6422 The thread of the frame containing the variable's value.
6423 </description>
6424 </param>
6425 <param id="depth">
6426 <jframeID thread="thread"/>
6427 <description>
6428 The depth of the frame containing the variable's value.
6429 </description>
6430 </param>
6431 <param id="slot">
6432 <jint/>
6433 <description>
6434 The variable's slot number.
6435 </description>
6436 </param>
6437 <param id="value">
6438 <jfloat/>
6439 <description>
6440 The new value for the variable.
6441 </description>
6442 </param>
6443 </parameters>
6444 <errors>
6445 <error id="JVMTI_ERROR_INVALID_SLOT">
6446 Invalid <code>slot</code>.
6447 </error>
6448 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6449 The variable type is not <code>float</code>.
6450 </error>
6451 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6452 The implementation is unable to set the frame locals
6453 (e.g. the frame at <code>depth</code> is executing a native method).
6454 </error>
6455 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6456 Thread was not suspended and was not the current thread.
6457 </error>
6458 </errors>
6459 </function>
6460
6461 <function id="SetLocalDouble" num="30">
6462 <synopsis>Set Local Variable - Double</synopsis>
6463 <description>
6464 This function can be used to set the value of a local
6465 variable whose type is <code>double</code>.
6466 <p/>
6467 The specified thread must be suspended or must be the current thread.
6468 </description>
6469 <origin>jvmdi</origin>
6470 <capabilities>
6471 <required id="can_access_local_variables"></required>
6472 </capabilities>
6473 <parameters>
6474 <param id="thread">
6475 <jthread null="current" frame="frame" impl="noconvert"/>
6476 <description>
6477 The thread of the frame containing the variable's value.
6478 </description>
6479 </param>
6480 <param id="depth">
6481 <jframeID thread="thread"/>
6482 <description>
6483 The depth of the frame containing the variable's value.
6484 </description>
6485 </param>
6486 <param id="slot">
6487 <jint/>
6488 <description>
6489 The variable's slot number.
6490 </description>
6491 </param>
6492 <param id="value">
6493 <jdouble/>
6494 <description>
6495 The new value for the variable.
6496 </description>
6497 </param>
6498 </parameters>
6499 <errors>
6500 <error id="JVMTI_ERROR_INVALID_SLOT">
6501 Invalid <code>slot</code>.
6502 </error>
6503 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6504 The variable type is not <code>double</code>.
6505 </error>
6506 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6507 The implementation is unable to set the frame locals
6508 (e.g. the frame at <code>depth</code> is executing a native method).
6509 </error>
6510 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6511 Thread was not suspended and was not the current thread.
6512 </error>
6513 </errors>
6514 </function>
6515 </category>
6516
6517 <category id="breakpointCategory" label="Breakpoint">
6518
6519 <intro>
6520 </intro>
6521
6522 <function id="SetBreakpoint" num="38">
6523 <synopsis>Set Breakpoint</synopsis>
6524 <description>
6525 Set a breakpoint at the instruction indicated by
6526 <code>method</code> and <code>location</code>.
6527 An instruction can only have one breakpoint.
6528 <p/>
6529 Whenever the designated instruction is about to be executed, a
6530 <eventlink id="Breakpoint"></eventlink> event is generated.
6531 </description>
6532 <origin>jvmdi</origin>
6533 <capabilities>
6534 <required id="can_generate_breakpoint_events"></required>
6535 </capabilities>
6536 <parameters>
6537 <param id="klass">
6538 <jclass method="method"/>
6539 <description>
6540 The class in which to set the breakpoint
6541 </description>
6542 </param>
6543 <param id="method">
6544 <jmethodID class="klass"/>
6545 <description>
6546 The method in which to set the breakpoint
6547 </description>
6548 </param>
6549 <param id="location">
6550 <jlocation/>
6551 <description>
6552 the index of the instruction at which to set the breakpoint
6553
6554 </description>
6555 </param>
6556 </parameters>
6557 <errors>
6558 <error id="JVMTI_ERROR_DUPLICATE">
6559 The designated bytecode already has a breakpoint.
6560 </error>
6561 </errors>
6562 </function>
6563
6564 <function id="ClearBreakpoint" num="39">
6565 <synopsis>Clear Breakpoint</synopsis>
6566 <description>
6567 Clear the breakpoint at the bytecode indicated by
6568 <code>method</code> and <code>location</code>.
6569 </description>
6570 <origin>jvmdi</origin>
6571 <capabilities>
6572 <required id="can_generate_breakpoint_events"></required>
6573 </capabilities>
6574 <parameters>
6575 <param id="klass">
6576 <jclass method="method"/>
6577 <description>
6578 The class in which to clear the breakpoint
6579 </description>
6580 </param>
6581 <param id="method">
6582 <jmethodID class="klass"/>
6583 <description>
6584 The method in which to clear the breakpoint
6585 </description>
6586 </param>
6587 <param id="location">
6588 <jlocation/>
6589 <description>
6590 the index of the instruction at which to clear the breakpoint
6591 </description>
6592 </param>
6593 </parameters>
6594 <errors>
6595 <error id="JVMTI_ERROR_NOT_FOUND">
6596 There's no breakpoint at the designated bytecode.
6597 </error>
6598 </errors>
6599 </function>
6600
6601 </category>
6602
6603 <category id="fieldWatch" label="Watched Field">
6604
6605 <intro>
6606 </intro>
6607
6608 <function id="SetFieldAccessWatch" num="41">
6609 <synopsis>Set Field Access Watch</synopsis>
6610 <description>
6611 Generate a <eventlink id="FieldAccess"></eventlink> event
6612 when the field specified
6613 by <code>klass</code> and
6614 <code>field</code> is about to be accessed.
6615 An event will be generated for each access of the field
6616 until it is canceled with
6617 <functionlink id="ClearFieldAccessWatch"></functionlink>.
6618 Field accesses from Java programming language code or from JNI code are watched,
6619 fields modified by other means are not watched.
6620 Note that <jvmti/> users should be aware that their own field accesses
6621 will trigger the watch.
6622 A field can only have one field access watch set.
6623 Modification of a field is not considered an access--use
6624 <functionlink id="SetFieldModificationWatch"></functionlink>
6625 to monitor modifications.
6626 </description>
6627 <origin>jvmdi</origin>
6628 <capabilities>
6629 <required id="can_generate_field_access_events"></required>
6630 </capabilities>
6631 <parameters>
6632 <param id="klass">
6633 <jclass field="field"/>
6634 <description>
6635 The class containing the field to watch
6636 </description>
6637 </param>
6638 <param id="field">
6639 <jfieldID class="klass"/>
6640 <description>
6641 The field to watch
6642
6643 </description>
6644 </param>
6645 </parameters>
6646 <errors>
6647 <error id="JVMTI_ERROR_DUPLICATE">
6648 The designated field is already being watched for accesses.
6649 </error>
6650 </errors>
6651 </function>
6652
6653 <function id="ClearFieldAccessWatch" num="42">
6654 <synopsis>Clear Field Access Watch</synopsis>
6655 <description>
6656 Cancel a field access watch previously set by
6657 <functionlink id="SetFieldAccessWatch"></functionlink>, on the
6658 field specified
6659 by <code>klass</code> and
6660 <code>field</code>.
6661 </description>
6662 <origin>jvmdi</origin>
6663 <capabilities>
6664 <required id="can_generate_field_access_events"></required>
6665 </capabilities>
6666 <parameters>
6667 <param id="klass">
6668 <jclass field="field"/>
6669 <description>
6670 The class containing the field to watch
6671 </description>
6672 </param>
6673 <param id="field">
6674 <jfieldID class="klass"/>
6675 <description>
6676 The field to watch
6677
6678 </description>
6679 </param>
6680 </parameters>
6681 <errors>
6682 <error id="JVMTI_ERROR_NOT_FOUND">
6683 The designated field is not being watched for accesses.
6684 </error>
6685 </errors>
6686 </function>
6687
6688 <function id="SetFieldModificationWatch" num="43">
6689 <synopsis>Set Field Modification Watch</synopsis>
6690 <description>
6691 Generate a <eventlink id="FieldModification"></eventlink> event
6692 when the field specified
6693 by <code>klass</code> and
6694 <code>field</code> is about to be modified.
6695 An event will be generated for each modification of the field
6696 until it is canceled with
6697 <functionlink id="ClearFieldModificationWatch"></functionlink>.
6698 Field modifications from Java programming language code or from JNI code are watched,
6699 fields modified by other means are not watched.
6700 Note that <jvmti/> users should be aware that their own field modifications
6701 will trigger the watch.
6702 A field can only have one field modification watch set.
6703 </description>
6704 <origin>jvmdi</origin>
6705 <capabilities>
6706 <required id="can_generate_field_modification_events"></required>
6707 </capabilities>
6708 <parameters>
6709 <param id="klass">
6710 <jclass field="field"/>
6711 <description>
6712 The class containing the field to watch
6713 </description>
6714 </param>
6715 <param id="field">
6716 <jfieldID class="klass"/>
6717 <description>
6718 The field to watch
6719
6720 </description>
6721 </param>
6722 </parameters>
6723 <errors>
6724 <error id="JVMTI_ERROR_DUPLICATE">
6725 The designated field is already being watched for modifications.
6726 </error>
6727 </errors>
6728 </function>
6729
6730 <function id="ClearFieldModificationWatch" num="44">
6731 <synopsis>Clear Field Modification Watch</synopsis>
6732 <description>
6733
6734 Cancel a field modification watch previously set by
6735 <functionlink id="SetFieldModificationWatch"></functionlink>, on the
6736 field specified
6737 by <code>klass</code> and
6738 <code>field</code>.
6739 </description>
6740 <origin>jvmdi</origin>
6741 <capabilities>
6742 <required id="can_generate_field_modification_events"></required>
6743 </capabilities>
6744 <parameters>
6745 <param id="klass">
6746 <jclass field="field"/>
6747 <description>
6748 The class containing the field to watch
6749 </description>
6750 </param>
6751 <param id="field">
6752 <jfieldID class="klass"/>
6753 <description>
6754 The field to watch
6755
6756 </description>
6757 </param>
6758 </parameters>
6759 <errors>
6760 <error id="JVMTI_ERROR_NOT_FOUND">
6761 The designated field is not being watched for modifications.
6762 </error>
6763 </errors>
6764 </function>
6765 </category>
6766
6767 <category id="module" label="Module">
6768
6769 <intro>
6770 </intro>
6771
6772 <function id="GetAllModules" num="3" since="9">
6773 <synopsis>Get All Modules</synopsis>
6774 <description>
6775 Return an array of all modules loaded in the virtual machine.
6776 The array includes the unnamed module for each class loader.
6777 The number of modules in the array is returned via
6778 <code>module_count_ptr</code>, and the array itself via
6779 <code>modules_ptr</code>.
6780 <p/>
6781 </description>
6782 <origin>new</origin>
6783 <capabilities>
6784 </capabilities>
6785 <parameters>
6786 <param id="module_count_ptr">
6787 <outptr><jint/></outptr>
6788 <description>
6789 On return, points to the number of returned modules.
6790 </description>
6791 </param>
6792 <param id="modules_ptr">
6793 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf>
6794 <description>
6795 On return, points to an array of references, one
6796 for each module.
6797 </description>
6798 </param>
6799 </parameters>
6800 <errors>
6801 </errors>
6802 </function>
6803
6804 <function id="GetNamedModule" num="40" since="9">
6805 <synopsis>Get Named Module</synopsis>
6806 <description>
6807 Return the <code>java.lang.Module</code> object for a named
6808 module defined to a class loader that contains a given package.
6809 The module is returned via <code>module_ptr</code>.
6810 <p/>
6811 If a named module is defined to the class loader and it
6812 contains the package then that named module is returned,
6813 otherwise null is returned.
6814 <p/>
6815 </description>
6816 <origin>new</origin>
6817 <capabilities>
6818 </capabilities>
6819 <parameters>
6820 <param id="class_loader">
6821 <ptrtype>
6822 <jobject/>
6823 <nullok>the bootstrap loader is assumed</nullok>
6824 </ptrtype>
6825 <description>
6826 A class loader.
6827 If the <code>class_loader</code> is not null
6828 or a subclass of <code>java.lang.ClassLoader</code>
6829 this function returns
6830 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>.
6831 </description>
6832 </param>
6833 <param id="package_name">
6834 <inbuf><char/></inbuf>
6835 <description>
6836 The name of the package, encoded as a
6837 <internallink id="mUTF">modified UTF-8</internallink> string.
6838 The package name is in internal form (JVMS 4.2.1);
6839 identifiers are separated by forward slashes rather than periods.
6840 </description>
6841 </param>
6842 <param id="module_ptr">
6843 <outptr><jobject/></outptr>
6844 <description>
6845 On return, points to a <code>java.lang.Module</code> object
6846 or points to null.
6847 </description>
6848 </param>
6849 </parameters>
6850 <errors>
6851 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6852 If class loader is not null and is not a class loader object.
6853 </error>
6854 </errors>
6855 </function>
6856
6857 <function id="AddModuleReads" num="94" since="9">
6858 <synopsis>Add Module Reads</synopsis>
6859 <description>
6860 Update a module to read another module. This function is a no-op
6861 when <paramlink id="module"></paramlink> is an unnamed module.
6862 This function facilitates the instrumentation of code
6863 in named modules where that instrumentation requires
6864 expanding the set of modules that a module reads.
6865 </description>
6866 <origin>new</origin>
6867 <capabilities>
6868 </capabilities>
6869 <parameters>
6870 <param id="module">
6871 <ptrtype><jobject/></ptrtype>
6872 <description>
6873 The module to update.
6874 </description>
6875 </param>
6876 <param id="to_module">
6877 <ptrtype><jobject/></ptrtype>
6878 <description>
6879 The additional module to read.
6880 </description>
6881 </param>
6882 </parameters>
6883 <errors>
6884 <error id="JVMTI_ERROR_INVALID_MODULE">
6885 If <paramlink id="module"></paramlink> is not a module object.
6886 </error>
6887 <error id="JVMTI_ERROR_INVALID_MODULE">
6888 If <paramlink id="to_module"></paramlink> is not a module object.
6889 </error>
6890 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6891 if the module cannot be modified.
6892 See <functionlink id="IsModifiableModule"/>.
6893 </error>
6894 </errors>
6895 </function>
6896
6897 <function id="AddModuleExports" num="95" since="9">
6898 <synopsis>Add Module Exports</synopsis>
6899 <description>
6900 Update a module to export a package to another module.
6901 This function is a no-op when <paramlink id="module"></paramlink>
6902 is an unnamed module or an open module.
6903 This function facilitates the instrumentation of code
6904 in named modules where that instrumentation requires
6905 expanding the set of packages that a module exports.
6906 </description>
6907 <origin>new</origin>
6908 <capabilities>
6909 </capabilities>
6910 <parameters>
6911 <param id="module">
6912 <ptrtype><jobject/></ptrtype>
6913 <description>
6914 The module to update.
6915 </description>
6916 </param>
6917 <param id="pkg_name">
6918 <inbuf><char/></inbuf>
6919 <description>
6920 The exported package name.
6921 </description>
6922 </param>
6923 <param id="to_module">
6924 <ptrtype><jobject/></ptrtype>
6925 <description>
6926 The module the package is exported to.
6927 If the <code>to_module</code> is not a subclass of
6928 <code>java.lang.Module</code> this function returns
6929 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6930 </description>
6931 </param>
6932 </parameters>
6933 <errors>
6934 <error id="JVMTI_ERROR_INVALID_MODULE">
6935 If <paramlink id="module"></paramlink> is not a module object.
6936 </error>
6937 <error id="JVMTI_ERROR_INVALID_MODULE">
6938 If <paramlink id="to_module"></paramlink> is not a module object.
6939 </error>
6940 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6941 If the package <paramlink id="pkg_name"></paramlink>
6942 does not belong to the module.
6943 </error>
6944 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6945 if the module cannot be modified.
6946 See <functionlink id="IsModifiableModule"/>.
6947 </error>
6948 </errors>
6949 </function>
6950
6951 <function id="AddModuleOpens" num="96" since="9">
6952 <synopsis>Add Module Opens</synopsis>
6953 <description>
6954 Update a module to open a package to another module.
6955 This function is a no-op when <paramlink id="module"></paramlink>
6956 is an unnamed module or an open module.
6957 This function facilitates the instrumentation of code
6958 in modules where that instrumentation requires
6959 expanding the set of packages that a module opens to
6960 other modules.
6961 </description>
6962 <origin>new</origin>
6963 <capabilities>
6964 </capabilities>
6965 <parameters>
6966 <param id="module">
6967 <ptrtype><jobject/></ptrtype>
6968 <description>
6969 The module to update.
6970 </description>
6971 </param>
6972 <param id="pkg_name">
6973 <inbuf><char/></inbuf>
6974 <description>
6975 The package name of the package to open.
6976 </description>
6977 </param>
6978 <param id="to_module">
6979 <ptrtype><jobject/></ptrtype>
6980 <description>
6981 The module with the package to open.
6982 If the <code>to_module</code> is not a subclass of
6983 <code>java.lang.Module</code> this function returns
6984 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6985 </description>
6986 </param>
6987 </parameters>
6988 <errors>
6989 <error id="JVMTI_ERROR_INVALID_MODULE">
6990 If <paramlink id="module"></paramlink> is not a module object.
6991 </error>
6992 <error id="JVMTI_ERROR_INVALID_MODULE">
6993 If <paramlink id="to_module"></paramlink> is not a module object.
6994 </error>
6995 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6996 If the package <paramlink id="pkg_name"></paramlink>
6997 does not belong to the module.
6998 </error>
6999 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7000 if the module cannot be modified.
7001 See <functionlink id="IsModifiableModule"/>.
7002 </error>
7003 </errors>
7004 </function>
7005
7006 <function id="AddModuleUses" num="97" since="9">
7007 <synopsis>Add Module Uses</synopsis>
7008 <description>
7009 Updates a module to add a service to the set of services that
7010 a module uses. This function is a no-op when the module
7011 is an unnamed module.
7012 This function facilitates the instrumentation of code
7013 in named modules where that instrumentation requires
7014 expanding the set of services that a module is using.
7015 </description>
7016 <origin>new</origin>
7017 <capabilities>
7018 </capabilities>
7019 <parameters>
7020 <param id="module">
7021 <ptrtype><jobject/></ptrtype>
7022 <description>
7023 The module to update.
7024 </description>
7025 </param>
7026 <param id="service">
7027 <ptrtype><jclass/></ptrtype>
7028 <description>
7029 The service to use.
7030 </description>
7031 </param>
7032 </parameters>
7033 <errors>
7034 <error id="JVMTI_ERROR_INVALID_MODULE">
7035 If <paramlink id="module"></paramlink> is not a module object.
7036 </error>
7037 <error id="JVMTI_ERROR_INVALID_CLASS">
7038 If <paramlink id="service"></paramlink> is not a class object.
7039 </error>
7040 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7041 if the module cannot be modified.
7042 See <functionlink id="IsModifiableModule"/>.
7043 </error>
7044 </errors>
7045 </function>
7046
7047 <function id="AddModuleProvides" num="98" since="9">
7048 <synopsis>Add Module Provides</synopsis>
7049 <description>
7050 Updates a module to add a service to the set of services that
7051 a module provides. This function is a no-op when the module
7052 is an unnamed module.
7053 This function facilitates the instrumentation of code
7054 in named modules where that instrumentation requires
7055 changes to the services that are provided.
7056 </description>
7057 <origin>new</origin>
7058 <capabilities>
7059 </capabilities>
7060 <parameters>
7061 <param id="module">
7062 <ptrtype><jobject/></ptrtype>
7063 <description>
7064 The module to update.
7065 </description>
7066 </param>
7067 <param id="service">
7068 <ptrtype><jclass/></ptrtype>
7069 <description>
7070 The service to provide.
7071 </description>
7072 </param>
7073 <param id="impl_class">
7074 <ptrtype><jclass/></ptrtype>
7075 <description>
7076 The implementation class for the provided service.
7077 </description>
7078 </param>
7079 </parameters>
7080 <errors>
7081 <error id="JVMTI_ERROR_INVALID_MODULE">
7082 If <paramlink id="module"></paramlink> is not a module object.
7083 </error>
7084 <error id="JVMTI_ERROR_INVALID_CLASS">
7085 If <paramlink id="service"></paramlink> is not a class object.
7086 </error>
7087 <error id="JVMTI_ERROR_INVALID_CLASS">
7088 If <paramlink id="impl_class"></paramlink> is not a class object.
7089 </error>
7090 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7091 if the module cannot be modified.
7092 See <functionlink id="IsModifiableModule"/>.
7093 </error>
7094 </errors>
7095 </function>
7096
7097 <function id="IsModifiableModule" num="99" since="9">
7098 <synopsis>Is Modifiable Module</synopsis>
7099 <description>
7100 Determines whether a module is modifiable.
7101 If a module is modifiable then this module can be updated with
7102 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
7103 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
7104 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
7105 then the module can not be updated with these functions. The result of
7106 this function is always <code>JNI_TRUE</code> when called to determine
7107 if an unnamed module is modifiable.
7108 </description>
7109 <origin>new</origin>
7110 <capabilities>
7111 </capabilities>
7112 <parameters>
7113 <param id="module">
7114 <ptrtype><jobject/></ptrtype>
7115 <description>
7116 The module to query.
7117 </description>
7118 </param>
7119 <param id="is_modifiable_module_ptr">
7120 <outptr><jboolean/></outptr>
7121 <description>
7122 On return, points to the boolean result of this function.
7123 </description>
7124 </param>
7125 </parameters>
7126 <errors>
7127 <error id="JVMTI_ERROR_INVALID_MODULE">
7128 If <paramlink id="module"></paramlink> is not a module object.
7129 </error>
7130 </errors>
7131 </function>
7132
7133 </category>
7134
7135 <category id="class" label="Class">
7136 <function id="GetLoadedClasses" jkernel="yes" num="78">
7137 <synopsis>Get Loaded Classes</synopsis>
7138 <description>
7139 Return an array of all classes loaded in the virtual machine.
7140 The number of classes in the array is returned via
7141 <code>class_count_ptr</code>, and the array itself via
7142 <code>classes_ptr</code>.
7143 <p/>
7144 A class or interface creation can be triggered by one of the following:
7145 <ul>
7146 <li>By loading and deriving a class from a <code>class</code> file representation
7147 using a class loader (see <vmspec chapter="5.3"/>).</li>
7148 <li>By invoking <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte%5B%5D,boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>
7149 that creates a hidden class or interface from a <code>class</code> file representation.</li>
7150 <li>By invoking methods in certain Java SE Platform APIs such as reflection.</li>
7151 </ul>
7152 <p/>
7153 An array class is created directly by the Java virtual machine. The creation
7154 can be triggered by using class loaders or by invoking methods in certain
7155 Java SE Platform APIs such as reflection.
7156 <p/>
7157 The returned list includes all classes and interfaces, including
7158 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">
7159 hidden classes or interfaces</externallink>,
7160 and also array classes of all types
7161 (including arrays of primitive types).
7162 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are
7163 <i>not</i> included in the returned list.
7164 </description>
7165 <origin>jvmdi</origin>
7166 <capabilities>
7167 </capabilities>
7168 <parameters>
7169 <param id="class_count_ptr">
7170 <outptr><jint/></outptr>
7171 <description>
7172 On return, points to the number of classes.
7173 </description>
7174 </param>
7175 <param id="classes_ptr">
7176 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
7177 <description>
7178 On return, points to an array of references, one
7179 for each class.
7180 </description>
7181 </param>
7182 </parameters>
7183 <errors>
7184 </errors>
7185 </function>
7186
7187 <function id="GetClassLoaderClasses" jkernel="yes" num="79">
7188 <synopsis>Get Classloader Classes</synopsis>
7189 <description>
7190 Returns an array of all classes which this class loader
7191 can find by name via
7192 <externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>,
7193 <externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage.
7194 That is, all classes for which <code>initiating_loader</code>
7195 has been recorded as an initiating loader.
7196 Each class in the returned array was created by this class loader,
7197 either by defining it directly or by delegation to another class loader.
7198 See <vmspec chapter="5.3"/>.
7199 <p/>
7200 The returned list does not include
7201 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden
7202 classes or interfaces</externallink> or array classes whose
7203 element type is a hidden class or interface as they cannot be discovered
7204 by any class loader.
7205 <p/>
7206 The number of classes in the array is returned via
7207 <code>class_count_ptr</code>, and the array itself via
7208 <code>classes_ptr</code>.
7209 <p/>
7210 See <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte%5B%5D,boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>.
7211 </description>
7212 <origin>jvmdi</origin>
7213 <capabilities>
7214 </capabilities>
7215 <parameters>
7216 <param id="initiating_loader">
7217 <ptrtype>
7218 <jobject/>
7219 <nullok>the classes initiated by the bootstrap loader will be returned</nullok>
7220 </ptrtype>
7221 <description>
7222 An initiating class loader.
7223 </description>
7224 </param>
7225 <param id="class_count_ptr">
7226 <outptr><jint/></outptr>
7227 <description>
7228 On return, points to the number of classes.
7229 </description>
7230 </param>
7231 <param id="classes_ptr">
7232 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
7233 <description>
7234 On return, points to an array of references, one
7235 for each class.
7236 </description>
7237 </param>
7238 </parameters>
7239 <errors>
7240 </errors>
7241 </function>
7242
7243 <function id="GetClassSignature" phase="start" num="48">
7244 <synopsis>Get Class Signature</synopsis>
7245 <description>
7246 Return the name and the generic signature of the class indicated by <code>klass</code>.
7247 <p/>
7248 If the class is a class or interface, then:
7249 <ul>
7250 <li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
7251 then the returned name is the <externallink id="jni/types.html#type-signatures">
7252 JNI type signature</externallink>.
7253 For example, java.util.List is "Ljava/util/List;"
7254 </li>
7255 <li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
7256 then the returned name is a string of the form:
7257 <code>"L" + N + "." + S + ";"</code>
7258 where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1)
7259 indicated by the <code>class</code> file passed to
7260 <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte%5B%5D,boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>,
7261 and <code>S</code> is an unqualified name.
7262 The returned name is not a type descriptor and does not conform to JVMS 4.3.2.
7263 For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;"
7264 </li>
7265 </ul>
7266 <p/>
7267 If the class indicated by <code>klass</code> represents an array class, then
7268 the returned name is a string consisting of one or more "<code>[</code>" characters
7269 representing the depth of the array nesting, followed by the class signature
7270 of the element type. For example the class signature of java.lang.String[] is
7271 "[Ljava/lang/String;" and that of int[] is "[I".
7272 <p/>
7273 If the class indicated by <code>klass</code> represents primitive type or <code>void</code>,
7274 then the returned name is the <externallink id="jni/types.html#type-signatures">
7275 type signature character of the corresponding primitive type</externallink>.
7276 For example, java.lang.Integer.TYPE is "I".
7277 </description>
7278 <origin>jvmdiClone</origin>
7279 <capabilities>
7280 </capabilities>
7281 <parameters>
7282 <param id="klass">
7283 <jclass/>
7284 <description>
7285 The class to query.
7286 </description>
7287 </param>
7288 <param id="signature_ptr">
7289 <allocbuf>
7290 <char/>
7291 <nullok>the signature is not returned</nullok>
7292 </allocbuf>
7293 <description>
7294 On return, points to the JNI type signature of the class, encoded as a
7295 <internallink id="mUTF">modified UTF-8</internallink> string.
7296 </description>
7297 </param>
7298 <param id="generic_ptr">
7299 <allocbuf>
7300 <char/>
7301 <nullok>the generic signature is not returned</nullok>
7302 </allocbuf>
7303 <description>
7304 On return, points to the generic signature of the class, encoded as a
7305 <internallink id="mUTF">modified UTF-8</internallink> string.
7306 If there is no generic signature attribute for the class, then,
7307 on return, points to null.
7308 </description>
7309 </param>
7310 </parameters>
7311 <errors>
7312 </errors>
7313 </function>
7314
7315 <function id="GetClassStatus" phase="start" num="49">
7316 <synopsis>Get Class Status</synopsis>
7317 <description>
7318 Get the status of the class. Zero or more of the following bits can be
7319 set.
7320 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits">
7321 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1">
7322 Class bytecodes have been verified
7323 </constant>
7324 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2">
7325 Class preparation is complete
7326 </constant>
7327 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4">
7328 Class initialization is complete. Static initializer has been run.
7329 </constant>
7330 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8">
7331 Error during initialization makes class unusable
7332 </constant>
7333 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16">
7334 Class is an array. If set, all other bits are zero.
7335 </constant>
7336 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32">
7337 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>).
7338 If set, all other bits are zero.
7339 </constant>
7340 </constants>
7341 </description>
7342 <origin>jvmdi</origin>
7343 <capabilities>
7344 </capabilities>
7345 <parameters>
7346 <param id="klass">
7347 <jclass/>
7348 <description>
7349 The class to query.
7350 </description>
7351 </param>
7352 <param id="status_ptr">
7353 <outptr><jint/></outptr>
7354 <description>
7355 On return, points to the current state of this class as one or
7356 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>.
7357 </description>
7358 </param>
7359 </parameters>
7360 <errors>
7361 </errors>
7362 </function>
7363
7364 <function id="GetSourceFileName" phase="start" num="50">
7365 <synopsis>Get Source File Name</synopsis>
7366 <description>
7367 For the class indicated by <code>klass</code>, return the source file
7368 name via <code>source_name_ptr</code>. The returned string
7369 is a file name only and never contains a directory name.
7370 <p/>
7371 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>)
7372 and for arrays this function returns
7373 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>.
7374 </description>
7375 <origin>jvmdi</origin>
7376 <capabilities>
7377 <required id="can_get_source_file_name"></required>
7378 </capabilities>
7379 <parameters>
7380 <param id="klass">
7381 <jclass/>
7382 <description>
7383 The class to query.
7384 </description>
7385 </param>
7386 <param id="source_name_ptr">
7387 <allocbuf><char/></allocbuf>
7388 <description>
7389 On return, points to the class's source file name, encoded as a
7390 <internallink id="mUTF">modified UTF-8</internallink> string.
7391 </description>
7392 </param>
7393 </parameters>
7394 <errors>
7395 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7396 Class information does not include a source file name. This includes
7397 cases where the class is an array class or primitive class.
7398 </error>
7399 </errors>
7400 </function>
7401
7402 <function id="GetClassModifiers" phase="start" num="51">
7403 <synopsis>Get Class Modifiers</synopsis>
7404 <description>
7405 For the class indicated by <code>klass</code>, return the Java language
7406 modifiers and class/interface properties of the corresponding
7407 <code>java.lang.Class</code> object, via <code>modifiers_ptr</code>.
7408 <p/>
7409 The modifiers are encoded as a mask of access-flag bit values defined in
7410 <vmspec chapter="4"/>. The returned value is not necessarily the value of the
7411 access_flags item in the class file of <code>klass</code>.
7412 In particular, for member, local, or anonymous classes and interfaces, the result
7413 may include modifiers represented by access flags from the <code>InnerClasses</code>
7414 attribute, such as <code>ACC_STATIC</code>.
7415 <p/>
7416 The modifiers include, as applicable, the Java Virtual Machine constants for
7417 public, private, protected, final, static, abstract, and interface, as well as
7418 access-flag bit values for other class/interface properties encoded in the
7419 result of invoking <code>java.lang.Class.getModifiers()</code> on the
7420 corresponding <code>java.lang.Class</code> object.
7421 <p/>
7422 If <code>klass</code> is an array class, then its public, private, and
7423 protected modifiers are the same as those of its component type. For arrays of
7424 primitives, this component type is represented by one of the primitive
7425 classes, such as <code>java.lang.Integer.TYPE</code>. For array classes, the
7426 abstract and final modifiers are set, and the interface modifier is not set.
7427 <p/>
7428 If <code>klass</code> is a primitive type or void, then its public, abstract,
7429 and final modifiers are always set, and its protected, private, and interface
7430 modifiers are never set.
7431 <p/>
7432 When preview features are enabled, the <code>ACC_IDENTITY</code> access flag
7433 is set if and only if <code>klass</code> is an identity class or an array class.
7434 <p/>
7435 When preview features are disabled, the <code>ACC_SUPER</code> access flag may be
7436 set only if <code>klass</code> is not a primitive type or void. The flag has no
7437 effective meaning.
7438 </description>
7439 <origin>jvmdi</origin>
7440 <capabilities>
7441 </capabilities>
7442 <parameters>
7443 <param id="klass">
7444 <jclass/>
7445 <description>
7446 The class to query.
7447 </description>
7448 </param>
7449 <param id="modifiers_ptr">
7450 <outptr><jint/></outptr>
7451 <description>
7452 On return, points to the modifiers of this class.
7453
7454 </description>
7455 </param>
7456 </parameters>
7457 <errors>
7458 </errors>
7459 </function>
7460
7461 <function id="GetClassMethods" phase="start" num="52">
7462 <synopsis>Get Class Methods</synopsis>
7463 <description>
7464 For the class indicated by <code>klass</code>, return a count of
7465 methods via <code>method_count_ptr</code> and a list of
7466 method IDs via <code>methods_ptr</code>. The method list contains
7467 constructors and static initializers as well as true methods.
7468 Only directly declared methods are returned (not inherited methods).
7469 An empty method list is returned for array classes and primitive classes
7470 (for example, <code>java.lang.Integer.TYPE</code>).
7471 </description>
7472 <origin>jvmdi</origin>
7473 <capabilities>
7474 <capability id="can_maintain_original_method_order"/>
7475 </capabilities>
7476 <parameters>
7477 <param id="klass">
7478 <jclass/>
7479 <description>
7480 The class to query.
7481 </description>
7482 </param>
7483 <param id="method_count_ptr">
7484 <outptr><jint/></outptr>
7485 <description>
7486 On return, points to the number of methods declared in this class.
7487 </description>
7488 </param>
7489 <param id="methods_ptr">
7490 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>
7491 <description>
7492 On return, points to the method ID array.
7493 </description>
7494 </param>
7495 </parameters>
7496 <errors>
7497 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7498 <paramlink id="klass"></paramlink> is not prepared.
7499 </error>
7500 </errors>
7501 </function>
7502
7503 <function id="GetClassFields" phase="start" num="53">
7504 <synopsis>Get Class Fields</synopsis>
7505 <description>
7506 For the class indicated by <code>klass</code>, return a count of fields
7507 via <code>field_count_ptr</code> and a list of field IDs via
7508 <code>fields_ptr</code>.
7509 Only directly declared fields are returned (not inherited fields).
7510 Fields are returned in the order they occur in the class file.
7511 An empty field list is returned for array classes and primitive classes
7512 (for example, <code>java.lang.Integer.TYPE</code>).
7513 Use JNI to determine the length of an array.
7514 </description>
7515 <origin>jvmdi</origin>
7516 <capabilities>
7517 </capabilities>
7518 <parameters>
7519 <param id="klass">
7520 <jclass/>
7521 <description>
7522 The class to query.
7523 </description>
7524 </param>
7525 <param id="field_count_ptr">
7526 <outptr><jint/></outptr>
7527 <description>
7528 On return, points to the number of fields declared in this class.
7529 </description>
7530 </param>
7531 <param id="fields_ptr">
7532 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>
7533 <description>
7534 On return, points to the field ID array.
7535 </description>
7536 </param>
7537 </parameters>
7538 <errors>
7539 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7540 <paramlink id="klass"></paramlink> is not prepared.
7541 </error>
7542 </errors>
7543 </function>
7544
7545 <function id="GetImplementedInterfaces" phase="start" num="54">
7546 <synopsis>Get Implemented Interfaces</synopsis>
7547 <description>
7548 Return the direct super-interfaces of this class. For a class, this
7549 function returns the interfaces declared in its <code>implements</code>
7550 clause. For an interface, this function returns the interfaces declared in
7551 its <code>extends</code> clause.
7552 An empty interface list is returned for array classes and primitive classes
7553 (for example, <code>java.lang.Integer.TYPE</code>).
7554 </description>
7555 <origin>jvmdi</origin>
7556 <capabilities>
7557 </capabilities>
7558 <parameters>
7559 <param id="klass">
7560 <jclass/>
7561 <description>
7562 The class to query.
7563 </description>
7564 </param>
7565 <param id="interface_count_ptr">
7566 <outptr><jint/></outptr>
7567 <description>
7568 On return, points to the number of interfaces.
7569 </description>
7570 </param>
7571 <param id="interfaces_ptr">
7572 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>
7573 <description>
7574 On return, points to the interface array.
7575 </description>
7576 </param>
7577 </parameters>
7578 <errors>
7579 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7580 <paramlink id="klass"></paramlink> is not prepared.
7581 </error>
7582 </errors>
7583 </function>
7584
7585 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">
7586 <synopsis>Get Class Version Numbers</synopsis>
7587 <description>
7588 For the class indicated by <code>klass</code>,
7589 return the minor and major version numbers,
7590 as defined in
7591 <vmspec chapter="4"/>.
7592 </description>
7593 <origin>new</origin>
7594 <capabilities>
7595 </capabilities>
7596 <parameters>
7597 <param id="klass">
7598 <jclass/>
7599 <description>
7600 The class to query.
7601 </description>
7602 </param>
7603 <param id="minor_version_ptr">
7604 <outptr><jint/></outptr>
7605 <description>
7606 On return, points to the value of the
7607 <code>minor_version</code> item of the
7608 Class File Format.
7609 Note: to be consistent with the Class File Format,
7610 the minor version number is the first parameter.
7611 </description>
7612 </param>
7613 <param id="major_version_ptr">
7614 <outptr><jint/></outptr>
7615 <description>
7616 On return, points to the value of the
7617 <code>major_version</code> item of the
7618 Class File Format.
7619 </description>
7620 </param>
7621 </parameters>
7622 <errors>
7623 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7624 The class is a primitive or array class.
7625 </error>
7626 </errors>
7627 </function>
7628
7629 <function id="GetConstantPool" phase="start" num="146" since="1.1">
7630 <synopsis>Get Constant Pool</synopsis>
7631 <description>
7632 For the class indicated by <code>klass</code>,
7633 return the raw bytes of the constant pool in the format of the
7634 <code>constant_pool</code> item of
7635 <vmspec chapter="4"/>.
7636 The format of the constant pool may differ between versions
7637 of the Class File Format, so, the
7638 <functionlink id="GetClassVersionNumbers">minor and major
7639 class version numbers</functionlink> should be checked for
7640 compatibility.
7641 <p/>
7642 The returned constant pool might not have the same layout or
7643 contents as the constant pool in the defining class file.
7644 The constant pool returned by GetConstantPool() may have
7645 more or fewer entries than the defining constant pool.
7646 Entries may be in a different order.
7647 The constant pool returned by GetConstantPool() will match the
7648 constant pool used by
7649 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>.
7650 That is, the bytecodes returned by GetBytecodes() will have
7651 constant pool indices which refer to constant pool entries returned
7652 by GetConstantPool().
7653 Note that since <functionlink id="RetransformClasses"/>
7654 and <functionlink id="RedefineClasses"/> can change
7655 the constant pool, the constant pool returned by this function
7656 can change accordingly. Thus, the correspondence between
7657 GetConstantPool() and GetBytecodes() does not hold if there
7658 is an intervening class retransformation or redefinition.
7659 The value of a constant pool entry used by a given bytecode will
7660 match that of the defining class file (even if the indices don't match).
7661 Constant pool entries which are not used directly or indirectly by
7662 bytecodes (for example, UTF-8 strings associated with annotations) are
7663 not required to exist in the returned constant pool.
7664 </description>
7665 <origin>new</origin>
7666 <capabilities>
7667 <required id="can_get_constant_pool"></required>
7668 </capabilities>
7669 <parameters>
7670 <param id="klass">
7671 <jclass/>
7672 <description>
7673 The class to query.
7674 </description>
7675 </param>
7676 <param id="constant_pool_count_ptr">
7677 <outptr><jint/></outptr>
7678 <description>
7679 On return, points to the number of entries
7680 in the constant pool table plus one.
7681 This corresponds to the <code>constant_pool_count</code>
7682 item of the Class File Format.
7683 </description>
7684 </param>
7685 <param id="constant_pool_byte_count_ptr">
7686 <outptr><jint/></outptr>
7687 <description>
7688 On return, points to the number of bytes
7689 in the returned raw constant pool.
7690 </description>
7691 </param>
7692 <param id="constant_pool_bytes_ptr">
7693 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>
7694 <description>
7695 On return, points to the raw constant pool, that is the bytes
7696 defined by the <code>constant_pool</code> item of the
7697 Class File Format
7698 </description>
7699 </param>
7700 </parameters>
7701 <errors>
7702 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7703 The class is a primitive or array class.
7704 </error>
7705 </errors>
7706 </function>
7707
7708 <function id="IsInterface" phase="start" num="55">
7709 <synopsis>Is Interface</synopsis>
7710 <description>
7711 Determines whether a class object reference represents an interface.
7712 The <code>jboolean</code> result is
7713 <code>JNI_TRUE</code> if the "class" is actually an interface,
7714 <code>JNI_FALSE</code> otherwise.
7715 </description>
7716 <origin>jvmdi</origin>
7717 <capabilities>
7718 </capabilities>
7719 <parameters>
7720 <param id="klass">
7721 <jclass/>
7722 <description>
7723 The class to query.
7724 </description>
7725 </param>
7726 <param id="is_interface_ptr">
7727 <outptr><jboolean/></outptr>
7728 <description>
7729 On return, points to the boolean result of this function.
7730
7731 </description>
7732 </param>
7733 </parameters>
7734 <errors>
7735 </errors>
7736 </function>
7737
7738 <function id="IsArrayClass" phase="start" num="56">
7739 <synopsis>Is Array Class</synopsis>
7740 <description>
7741 Determines whether a class object reference represents an array.
7742 The <code>jboolean</code> result is
7743 <code>JNI_TRUE</code> if the class is an array,
7744 <code>JNI_FALSE</code> otherwise.
7745 </description>
7746 <origin>jvmdi</origin>
7747 <capabilities>
7748 </capabilities>
7749 <parameters>
7750 <param id="klass">
7751 <jclass/>
7752 <description>
7753 The class to query.
7754 </description>
7755 </param>
7756 <param id="is_array_class_ptr">
7757 <outptr><jboolean/></outptr>
7758 <description>
7759 On return, points to the boolean result of this function.
7760
7761 </description>
7762 </param>
7763 </parameters>
7764 <errors>
7765 </errors>
7766 </function>
7767
7768 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">
7769 <synopsis>Is Modifiable Class</synopsis>
7770 <description>
7771 Determines whether a class is modifiable.
7772 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>
7773 returns <code>JNI_TRUE</code>) the class can be
7774 redefined with <functionlink id="RedefineClasses"/> (assuming
7775 the agent possesses the
7776 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
7777 capability) or
7778 retransformed with <functionlink id="RetransformClasses"/> (assuming
7779 the agent possesses the
7780 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
7781 capability).
7782 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>
7783 returns <code>JNI_FALSE</code>) the class can be neither
7784 redefined nor retransformed.
7785 <p/>
7786 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>),
7787 array classes, and some implementation defined classes are never modifiable.
7788 <p/>
7789 </description>
7790 <origin>new</origin>
7791 <capabilities>
7792 <capability id="can_redefine_any_class">
7793 If possessed then all classes (except primitive, array, and some implementation defined
7794 classes) are modifiable with <functionlink id="RedefineClasses"/>.
7795 </capability>
7796 <capability id="can_retransform_any_class">
7797 If possessed then all classes (except primitive, array, and some implementation defined
7798 classes) are modifiable with <functionlink id="RetransformClasses"/>.
7799 </capability>
7800 <capability id="can_redefine_classes">
7801 No effect on the result of the function.
7802 But must additionally be possessed to modify the class with
7803 <functionlink id="RedefineClasses"/>.
7804 </capability>
7805 <capability id="can_retransform_classes">
7806 No effect on the result of the function.
7807 But must additionally be possessed to modify the class with
7808 <functionlink id="RetransformClasses"/>.
7809 </capability>
7810 </capabilities>
7811 <parameters>
7812 <param id="klass">
7813 <jclass/>
7814 <description>
7815 The class to query.
7816 </description>
7817 </param>
7818 <param id="is_modifiable_class_ptr">
7819 <outptr><jboolean/></outptr>
7820 <description>
7821 On return, points to the boolean result of this function.
7822 </description>
7823 </param>
7824 </parameters>
7825 <errors>
7826 </errors>
7827 </function>
7828
7829 <function id="GetClassLoader" phase="start" num="57">
7830 <synopsis>Get Class Loader</synopsis>
7831 <description>
7832 For the class indicated by <code>klass</code>, return via
7833 <code>classloader_ptr</code> a reference to the class loader for the
7834 class.
7835 </description>
7836 <origin>jvmdi</origin>
7837 <capabilities>
7838 </capabilities>
7839 <parameters>
7840 <param id="klass">
7841 <jclass/>
7842 <description>
7843 The class to query.
7844 </description>
7845 </param>
7846 <param id="classloader_ptr">
7847 <outptr><jobject/></outptr>
7848 <description>
7849 On return, points to the class loader that loaded
7850 this class.
7851 If the class was not created by a class loader
7852 or if the class loader is the bootstrap class loader,
7853 points to null.
7854 </description>
7855 </param>
7856 </parameters>
7857 <errors>
7858 </errors>
7859
7860 </function>
7861
7862 <function id="GetSourceDebugExtension" phase="start" num="90">
7863 <synopsis>Get Source Debug Extension</synopsis>
7864 <description>
7865 For the class indicated by <code>klass</code>, return the debug
7866 extension via <code>source_debug_extension_ptr</code>.
7867 The returned string
7868 contains exactly the debug extension information present in the
7869 class file of <code>klass</code>.
7870 </description>
7871 <origin>jvmdi</origin>
7872 <capabilities>
7873 <required id="can_get_source_debug_extension"></required>
7874 </capabilities>
7875 <parameters>
7876 <param id="klass">
7877 <jclass/>
7878 <description>
7879 The class to query.
7880 </description>
7881 </param>
7882 <param id="source_debug_extension_ptr">
7883 <allocbuf><char/></allocbuf>
7884 <description>
7885 On return, points to the class's debug extension, encoded as a
7886 <internallink id="mUTF">modified UTF-8</internallink> string.
7887 </description>
7888 </param>
7889 </parameters>
7890 <errors>
7891 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7892 Class information does not include a debug extension.
7893 </error>
7894 </errors>
7895 </function>
7896
7897 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1">
7898 <synopsis>Retransform Classes</synopsis>
7899 <description>
7900 This function facilitates the
7901 <internallink id="bci">bytecode instrumentation</internallink>
7902 of already loaded classes.
7903 To replace the class definition without reference to the existing
7904 bytecodes, as one might do when recompiling from source for
7905 fix-and-continue debugging, <functionlink id="RedefineClasses"/>
7906 function should be used instead.
7907 <p/>
7908 When classes are initially loaded or when they are
7909 <functionlink id="RedefineClasses">redefined</functionlink>,
7910 the initial class file bytes can be transformed with the
7911 <eventlink id="ClassFileLoadHook"/> event.
7912 This function reruns the transformation process
7913 (whether or not a transformation has previously occurred).
7914 This retransformation follows these steps:
7915 <ul>
7916 <li>starting from the initial class file bytes
7917 </li>
7918 <li>for each <fieldlink id="can_retransform_classes"
7919 struct="jvmtiCapabilities">retransformation
7920 incapable</fieldlink>
7921 agent which received a
7922 <code>ClassFileLoadHook</code> event during the previous
7923 load or redefine, the bytes it returned
7924 (via the <code>new_class_data</code> parameter)
7925 are reused as the output of the transformation;
7926 note that this is equivalent to reapplying
7927 the previous transformation, unaltered. except that
7928 the <code>ClassFileLoadHook</code> event
7929 is <b>not</b> sent to these agents
7930 </li>
7931 <li>for each <fieldlink id="can_retransform_classes"
7932 struct="jvmtiCapabilities">retransformation
7933 capable</fieldlink>
7934 agent, the <code>ClassFileLoadHook</code> event is sent,
7935 allowing a new transformation to be applied
7936 </li>
7937 <li>the transformed class file bytes are installed as the new
7938 definition of the class
7939 </li>
7940 </ul>
7941 See the <eventlink id="ClassFileLoadHook"/> event for more details.
7942 <p/>
7943 The initial class file bytes represent the bytes passed to
7944 <code>ClassLoader.defineClass</code>
7945 or <code>RedefineClasses</code> (before any transformations
7946 were applied), however they may not exactly match them.
7947 The constant pool may differ in ways described in
7948 <functionlink id="GetConstantPool"/>.
7949 Constant pool indices in the bytecodes of methods will correspond.
7950 Some attributes may not be present.
7951 Where order is not meaningful, for example the order of methods,
7952 order may not be preserved.
7953 <p/>
7954 Retransformation can cause new versions of methods to be installed.
7955 Old method versions may become
7956 <internallink id="obsoleteMethods">obsolete</internallink>
7957 The new method version will be used on new invokes.
7958 If a method has active stack frames, those active frames continue to
7959 run the bytecodes of the original method version.
7960 <p/>
7961 This function does not cause any initialization except that which
7962 would occur under the customary JVM semantics.
7963 In other words, retransforming a class does not cause its initializers to be
7964 run. The values of static fields will remain as they were
7965 prior to the call.
7966 <p/>
7967 Threads need not be suspended.
7968 <p/>
7969 All breakpoints in the class are cleared.
7970 <p/>
7971 All attributes are updated.
7972 <p/>
7973 Instances of the retransformed class are not affected -- fields retain their
7974 previous values.
7975 <functionlink id="GetTag">Tags</functionlink> on the instances are
7976 also unaffected.
7977 <p/>
7978 In response to this call, no events other than the
7979 <eventlink id="ClassFileLoadHook"/> event
7980 will be sent.
7981 <p/>
7982 The retransformation may change method bodies, the constant pool and attributes
7983 (unless explicitly prohibited).
7984 The retransformation must not add, remove or rename fields or methods, change the
7985 signatures of methods, change modifiers, or change inheritance.
7986 The retransformation must not change the <code>NestHost</code>,
7987 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
7988 attributes.
7989 These restrictions may be lifted in future versions.
7990 See the error return description below for information on error codes
7991 returned if an unsupported retransformation is attempted.
7992 The class file bytes are not verified or installed until they have passed
7993 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
7994 returned error code reflects the result of the transformations.
7995 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
7996 none of the classes to be retransformed will have a new definition installed.
7997 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
7998 all of the classes to be retransformed will have their new definitions installed.
7999 </description>
8000 <origin>new</origin>
8001 <capabilities>
8002 <required id="can_retransform_classes"></required>
8003 <capability id="can_retransform_any_class"></capability>
8004 </capabilities>
8005 <parameters>
8006 <param id="class_count">
8007 <jint min="0"/>
8008 <description>
8009 The number of classes to be retransformed.
8010 </description>
8011 </param>
8012 <param id="classes">
8013 <inbuf incount="class_count"><jclass/></inbuf>
8014 <description>
8015 The array of classes to be retransformed.
8016 </description>
8017 </param>
8018 </parameters>
8019 <errors>
8020 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
8021 One of the <paramlink id="classes"/> cannot be modified.
8022 See <functionlink id="IsModifiableClass"/>.
8023 </error>
8024 <error id="JVMTI_ERROR_INVALID_CLASS">
8025 One of the <paramlink id="classes"/> is not a valid class.
8026 </error>
8027 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
8028 A retransformed class file has a version number not supported by this VM.
8029 </error>
8030 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
8031 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).
8032 </error>
8033 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
8034 The retransformed class file definitions would lead to a circular definition
8035 (the VM would return a <code>ClassCircularityError</code>).
8036 </error>
8037 <error id="JVMTI_ERROR_FAILS_VERIFICATION">
8038 The retransformed class file bytes fail verification.
8039 </error>
8040 <error id="JVMTI_ERROR_NAMES_DONT_MATCH">
8041 The class name defined in a retransformed class file is
8042 different from the name in the old class object.
8043 </error>
8044 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
8045 A retransformed class file would require adding a method.
8046 </error>
8047 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
8048 A retransformed class file changes a field.
8049 </error>
8050 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
8051 A direct superclass is different for a retransformed class file,
8052 or the set of directly implemented
8053 interfaces is different.
8054 </error>
8055 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
8056 A retransformed class file does not declare a method
8057 declared in the old class version.
8058 </error>
8059 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
8060 A retransformed class file has unsupported differences in class attributes.
8061 </error>
8062 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
8063 A retransformed class file has different class modifiers.
8064 </error>
8065 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
8066 A method in the retransformed class file has different modifiers
8067 than its counterpart in the old class version.
8068 </error>
8069 </errors>
8070 </function>
8071
8072 <function id="RedefineClasses" jkernel="yes" num="87">
8073 <synopsis>Redefine Classes</synopsis>
8074 <typedef id="jvmtiClassDefinition" label="Class redefinition description">
8075 <field id="klass">
8076 <jclass/>
8077 <description>
8078 Class object for this class
8079 </description>
8080 </field>
8081 <field id="class_byte_count">
8082 <jint/>
8083 <description>
8084 Number of bytes defining class (below)
8085 </description>
8086 </field>
8087 <field id="class_bytes">
8088 <inbuf incount="class_byte_count"><uchar/></inbuf>
8089 <description>
8090 Bytes defining class (in <vmspec chapter="4"/>)
8091 </description>
8092 </field>
8093 </typedef>
8094 <description>
8095 All classes given are redefined according to the definitions
8096 supplied.
8097 This function is used to replace the definition of a class
8098 with a new definition, as might be needed in fix-and-continue
8099 debugging.
8100 Where the existing class file bytes are to be transformed, for
8101 example in
8102 <internallink id="bci">bytecode instrumentation</internallink>,
8103 <functionlink id="RetransformClasses"/> should be used.
8104 <p/>
8105 Redefinition can cause new versions of methods to be installed.
8106 Old method versions may become
8107 <internallink id="obsoleteMethods">obsolete</internallink>
8108 The new method version will be used on new invokes.
8109 If a method has active stack frames, those active frames continue to
8110 run the bytecodes of the original method version.
8111 If resetting of stack frames is desired, use
8112 <functionlink id="PopFrame"></functionlink>
8113 to pop frames with obsolete method versions.
8114 <p/>
8115 This function does not cause any initialization except that which
8116 would occur under the customary JVM semantics.
8117 In other words, redefining a class does not cause its initializers to be
8118 run. The values of static fields will remain as they were
8119 prior to the call.
8120 <p/>
8121 Threads need not be suspended.
8122 <p/>
8123 All breakpoints in the class are cleared.
8124 <p/>
8125 All attributes are updated.
8126 <p/>
8127 Instances of the redefined class are not affected -- fields retain their
8128 previous values.
8129 <functionlink id="GetTag">Tags</functionlink> on the instances are
8130 also unaffected.
8131 <p/>
8132 In response to this call, the <jvmti/> event
8133 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>
8134 will be sent (if enabled), but no other <jvmti/> events will be sent.
8135 <p/>
8136 The redefinition may change method bodies, the constant pool and attributes
8137 (unless explicitly prohibited).
8138 The redefinition must not add, remove or rename fields or methods, change the
8139 signatures of methods, change modifiers, or change inheritance.
8140 The redefinition must not change the <code>NestHost</code>,
8141 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
8142 attributes.
8143 These restrictions may be lifted in future versions.
8144 See the error return description below for information on error codes
8145 returned if an unsupported redefinition is attempted.
8146 The class file bytes are not verified or installed until they have passed
8147 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
8148 returned error code reflects the result of the transformations applied
8149 to the bytes passed into <paramlink id="class_definitions"/>.
8150 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
8151 none of the classes to be redefined will have a new definition installed.
8152 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
8153 all of the classes to be redefined will have their new definitions installed.
8154 </description>
8155 <origin>jvmdi</origin>
8156 <capabilities>
8157 <required id="can_redefine_classes"></required>
8158 <capability id="can_redefine_any_class"></capability>
8159 </capabilities>
8160 <parameters>
8161 <param id="class_count">
8162 <jint min="0"/>
8163 <description>
8164 The number of classes specified in <code>class_definitions</code>
8165 </description>
8166 </param>
8167 <param id="class_definitions">
8168 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>
8169 <description>
8170 The array of new class definitions
8171 </description>
8172 </param>
8173 </parameters>
8174 <errors>
8175 <error id="JVMTI_ERROR_NULL_POINTER">
8176 One of <code>class_bytes</code> is null.
8177 </error>
8178 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
8179 An element of <code>class_definitions</code> cannot be modified.
8180 See <functionlink id="IsModifiableClass"/>.
8181 </error>
8182 <error id="JVMTI_ERROR_INVALID_CLASS">
8183 An element of <code>class_definitions</code> is not a valid class.
8184 </error>
8185 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
8186 A new class file has a version number not supported by this VM.
8187 </error>
8188 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
8189 A new class file is malformed (The VM would return a <code>ClassFormatError</code>).
8190 </error>
8191 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
8192 The new class file definitions would lead to a circular definition
8193 (the VM would return a <code>ClassCircularityError</code>).
8194 </error>
8195 <error id="JVMTI_ERROR_FAILS_VERIFICATION">
8196 The class bytes fail verification.
8197 </error>
8198 <error id="JVMTI_ERROR_NAMES_DONT_MATCH">
8199 The class name defined in a new class file is
8200 different from the name in the old class object.
8201 </error>
8202 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
8203 A new class file would require adding a method.
8204 </error>
8205 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
8206 A new class version changes a field.
8207 </error>
8208 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
8209 A direct superclass is different for a new class
8210 version, or the set of directly implemented
8211 interfaces is different.
8212 </error>
8213 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
8214 A new class version does not declare a method
8215 declared in the old class version.
8216 </error>
8217 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
8218 A new class version has unsupported differences in class attributes.
8219 </error>
8220 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
8221 A new class version has different modifiers.
8222 </error>
8223 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
8224 A method in the new class version has different modifiers
8225 than its counterpart in the old class version.
8226 </error>
8227 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
8228 A module cannot be modified.
8229 See <functionlink id="IsModifiableModule"/>.
8230 </error>
8231 </errors>
8232 </function>
8233
8234 </category>
8235
8236 <category id="object" label="Object">
8237
8238 <function id="GetObjectSize" jkernel="yes" phase="start" num="154">
8239 <synopsis>Get Object Size</synopsis>
8240 <description>
8241 For the object indicated by <code>object</code>,
8242 return via <code>size_ptr</code> the size of the object.
8243 This size is an implementation-specific approximation of
8244 the amount of storage consumed by this object.
8245 It may include some or all of the object's overhead, and thus
8246 is useful for comparison within an implementation but not
8247 between implementations.
8248 The estimate may change during a single invocation of the JVM.
8249 </description>
8250 <origin>new</origin>
8251 <capabilities>
8252 </capabilities>
8253 <parameters>
8254 <param id="object">
8255 <jobject/>
8256 <description>
8257 The object to query.
8258 </description>
8259 </param>
8260 <param id="size_ptr">
8261 <outptr><jlong/></outptr>
8262 <description>
8263 On return, points to the object's size in bytes.
8264 </description>
8265 </param>
8266 </parameters>
8267 <errors>
8268 </errors>
8269 </function>
8270
8271 <function id="GetObjectHashCode" phase="start" num="58">
8272 <synopsis>Get Object Hash Code</synopsis>
8273 <description>
8274 For the object indicated by <code>object</code>,
8275 return via <code>hash_code_ptr</code> a hash code.
8276 This hash code could be used to maintain a hash table of object references,
8277 however, on some implementations this can cause significant performance
8278 impacts--in most cases
8279 <internallink id="Heap">tags</internallink>
8280 will be a more efficient means of associating information with objects.
8281 This function guarantees
8282 the same hash code value for a particular object throughout its life
8283 </description>
8284 <origin>jvmdi</origin>
8285 <capabilities>
8286 </capabilities>
8287 <parameters>
8288 <param id="object">
8289 <jobject/>
8290 <description>
8291 The object to query.
8292 </description>
8293 </param>
8294 <param id="hash_code_ptr">
8295 <outptr><jint/></outptr>
8296 <description>
8297 On return, points to the object's hash code.
8298 </description>
8299 </param>
8300 </parameters>
8301 <errors>
8302 </errors>
8303 </function>
8304
8305 <function id="GetObjectMonitorUsage" num="59">
8306 <synopsis>Get Object Monitor Usage</synopsis>
8307 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information">
8308 <field id="owner">
8309 <jthread/>
8310 <description>
8311 The platform thread owning this monitor, or null if owned
8312 by a virtual thread or not owned
8313 </description>
8314 </field>
8315 <field id="entry_count">
8316 <jint/>
8317 <description>
8318 The number of times the platform thread owning this monitor has entered it,
8319 or <code>0</code> if owned by a virtual thread or not owned
8320 </description>
8321 </field>
8322 <field id="waiter_count">
8323 <jint/>
8324 <description>
8325 The number of platform threads waiting to own this monitor, or <code>0</code>
8326 if only virtual threads are waiting or no threads are waiting
8327 </description>
8328 </field>
8329 <field id="waiters">
8330 <allocfieldbuf><jthread/></allocfieldbuf>
8331 <description>
8332 The <code>waiter_count</code> waiting platform threads
8333 </description>
8334 </field>
8335 <field id="notify_waiter_count">
8336 <jint/>
8337 <description>
8338 The number of platform threads waiting to own this monitor, or <code>0</code>
8339 if only virtual threads are waiting to be notified or no threads are waiting
8340 to be notified
8341 </description>
8342 </field>
8343 <field id="notify_waiters">
8344 <allocfieldbuf><jthread/></allocfieldbuf>
8345 <description>
8346 The <code>notify_waiter_count</code> platform threads waiting to be notified
8347 </description>
8348 </field>
8349 </typedef>
8350 <description>
8351 Get information about the object's monitor.
8352 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
8353 are filled in with information about usage of the monitor.
8354 <p/>
8355 When preview features are enabled, the object to query may be a value object.
8356 It is not possible to synchronize on a value object, so there is no monitor
8357 usage information to return. The fields of the returned
8358 <functionlink id="jvmtiMonitorUsage"></functionlink> structure will always
8359 be filled in with null values and zeros.
8360 <p/>
8361 <b> This function does not support getting information about an object's monitor
8362 when it is owned by a virtual thread. It also does not support returning a
8363 reference to virtual threads that are waiting to own a monitor or waiting to
8364 be notified.
8365 </b>
8366 <todo>
8367 Decide and then clarify suspend requirements.
8368 </todo>
8369 </description>
8370 <origin>jvmdi</origin>
8371 <capabilities>
8372 <required id="can_get_monitor_info"></required>
8373 </capabilities>
8374 <parameters>
8375 <param id="object">
8376 <jobject/>
8377 <description>
8378 The object to query.
8379 </description>
8380 </param>
8381 <param id="info_ptr">
8382 <outptr><struct>jvmtiMonitorUsage</struct></outptr>
8383 <description>
8384 On return, filled with monitor information for the
8385 specified object.
8386 </description>
8387 </param>
8388 </parameters>
8389 <errors>
8390 </errors>
8391 </function>
8392
8393 <elide>
8394 <function id="GetObjectMonitors" num="116">
8395 <synopsis>Get Object Monitors</synopsis>
8396 <description>
8397 Return the list of object monitors.
8398 <p/>
8399 Note: details about each monitor can be examined with
8400 <functionlink id="GetObjectMonitorUsage"></functionlink>.
8401 </description>
8402 <origin>new</origin>
8403 <capabilities>
8404 <required id="can_get_monitor_info"></required>
8405 </capabilities>
8406 <parameters>
8407 <param id="monitorCnt">
8408 <outptr><jint/></outptr>
8409 <description>
8410 On return, pointer to the number
8411 of monitors returned in <code>monitors_ptr</code>.
8412 </description>
8413 </param>
8414 <param id="monitors_ptr">
8415 <allocbuf outcount="monitorCnt"><jobject/></allocbuf>
8416 <description>
8417 On return, pointer to the monitor list.
8418 </description>
8419 </param>
8420 </parameters>
8421 <errors>
8422 </errors>
8423 </function>
8424 </elide>
8425
8426 </category>
8427
8428 <category id="fieldCategory" label="Field">
8429
8430 <intro>
8431 </intro>
8432
8433 <function id="GetFieldName" phase="start" num="60">
8434 <synopsis>Get Field Name (and Signature)</synopsis>
8435 <description>
8436 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,
8437 return the field name via <paramlink id="name_ptr"/> and field signature via
8438 <paramlink id="signature_ptr"/>.
8439 <p/>
8440 Field signatures are defined in the
8441 <externallink id="jni/index.html">JNI Specification</externallink>
8442 and are referred to as <code>field descriptors</code> in
8443 <vmspec chapter="4.3.2"/>.
8444 </description>
8445 <origin>jvmdiClone</origin>
8446 <capabilities>
8447 </capabilities>
8448 <parameters>
8449 <param id="klass">
8450 <jclass field="field"/>
8451 <description>
8452 The class of the field to query.
8453 </description>
8454 </param>
8455 <param id="field">
8456 <jfieldID class="klass"/>
8457 <description>
8458 The field to query.
8459 </description>
8460 </param>
8461 <param id="name_ptr">
8462 <allocbuf>
8463 <char/>
8464 <nullok>the name is not returned</nullok>
8465 </allocbuf>
8466 <description>
8467 On return, points to the field name, encoded as a
8468 <internallink id="mUTF">modified UTF-8</internallink> string.
8469 </description>
8470 </param>
8471 <param id="signature_ptr">
8472 <allocbuf>
8473 <char/>
8474 <nullok>the signature is not returned</nullok>
8475 </allocbuf>
8476 <description>
8477 On return, points to the field signature, encoded as a
8478 <internallink id="mUTF">modified UTF-8</internallink> string.
8479 </description>
8480 </param>
8481 <param id="generic_ptr">
8482 <allocbuf>
8483 <char/>
8484 <nullok>the generic signature is not returned</nullok>
8485 </allocbuf>
8486 <description>
8487 On return, points to the generic signature of the field, encoded as a
8488 <internallink id="mUTF">modified UTF-8</internallink> string.
8489 If there is no generic signature attribute for the field, then,
8490 on return, points to null.
8491 </description>
8492 </param>
8493 </parameters>
8494 <errors>
8495 </errors>
8496 </function>
8497
8498 <function id="GetFieldDeclaringClass" phase="start" num="61">
8499 <synopsis>Get Field Declaring Class</synopsis>
8500 <description>
8501 For the field indicated by <code>klass</code> and <code>field</code>
8502 return the class that defined it via <code>declaring_class_ptr</code>.
8503 The declaring class will either be <code>klass</code>, a superclass, or
8504 an implemented interface.
8505 </description>
8506 <origin>jvmdi</origin>
8507 <capabilities>
8508 </capabilities>
8509 <parameters>
8510 <param id="klass">
8511 <jclass field="field"/>
8512 <description>
8513 The class to query.
8514 </description>
8515 </param>
8516 <param id="field">
8517 <jfieldID class="klass"/>
8518 <description>
8519 The field to query.
8520 </description>
8521 </param>
8522 <param id="declaring_class_ptr">
8523 <outptr><jclass/></outptr>
8524 <description>
8525 On return, points to the declaring class
8526 </description>
8527 </param>
8528 </parameters>
8529 <errors>
8530 </errors>
8531 </function>
8532
8533 <function id="GetFieldModifiers" phase="start" num="62">
8534 <synopsis>Get Field Modifiers</synopsis>
8535 <description>
8536 For the field indicated by <code>klass</code> and <code>field</code>
8537 return the access flags via <code>modifiers_ptr</code>.
8538 Access flags are defined in <vmspec chapter="4"/>.
8539 </description>
8540 <origin>jvmdi</origin>
8541 <capabilities>
8542 </capabilities>
8543 <parameters>
8544 <param id="klass">
8545 <jclass field="field"/>
8546 <description>
8547 The class to query.
8548 </description>
8549 </param>
8550 <param id="field">
8551 <jfieldID class="klass"/>
8552 <description>
8553 The field to query.
8554 </description>
8555 </param>
8556 <param id="modifiers_ptr">
8557 <outptr><jint/></outptr>
8558 <description>
8559 On return, points to the access flags.
8560 </description>
8561 </param>
8562 </parameters>
8563 <errors>
8564 </errors>
8565 </function>
8566
8567 <function id="IsFieldSynthetic" phase="start" num="63">
8568 <synopsis>Is Field Synthetic</synopsis>
8569 <description>
8570 For the field indicated by <code>klass</code> and <code>field</code>, return a
8571 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.
8572 Synthetic fields are generated by the compiler but not present in the
8573 original source code.
8574 </description>
8575 <origin>jvmdi</origin>
8576 <capabilities>
8577 <required id="can_get_synthetic_attribute"></required>
8578 </capabilities>
8579 <parameters>
8580 <param id="klass">
8581 <jclass field="field"/>
8582 <description>
8583 The class of the field to query.
8584 </description>
8585 </param>
8586 <param id="field">
8587 <jfieldID class="klass"/>
8588 <description>
8589 The field to query.
8590 </description>
8591 </param>
8592 <param id="is_synthetic_ptr">
8593 <outptr><jboolean/></outptr>
8594 <description>
8595 On return, points to the boolean result of this function.
8596 </description>
8597 </param>
8598 </parameters>
8599 <errors>
8600 </errors>
8601 </function>
8602
8603 </category>
8604
8605 <category id="method" label="Method">
8606
8607 <intro>
8608 These functions provide information about a method (represented as a
8609 <typelink id="jmethodID"/>) and set how methods are processed.
8610 </intro>
8611
8612 <intro id="obsoleteMethods" label="Obsolete Methods">
8613 The functions <functionlink id="RetransformClasses"/> and
8614 <functionlink id="RedefineClasses"/> can cause new versions
8615 of methods to be installed.
8616 An original version of a method is considered equivalent
8617 to the new version if:
8618 <ul>
8619 <li>their bytecodes are the same except for indices into the
8620 constant pool and </li>
8621 <li>the referenced constants are equal.</li>
8622 </ul>
8623 An original method version which is not equivalent to the
8624 new method version is called obsolete and is assigned a new method ID;
8625 the original method ID now refers to the new method version.
8626 A method ID can be tested for obsolescence with
8627 <functionlink id="IsMethodObsolete"/>.
8628 </intro>
8629
8630 <function id="GetMethodName" phase="start" num="64">
8631 <synopsis>Get Method Name (and Signature)</synopsis>
8632 <description>
8633 For the method indicated by <code>method</code>,
8634 return the method name via <code>name_ptr</code> and method signature via
8635 <code>signature_ptr</code>.
8636 <p/>
8637 Method signatures are defined in the
8638 <externallink id="jni/index.html">JNI Specification</externallink>
8639 and are referred to as <code>method descriptors</code> in
8640 <vmspec chapter="4.3.3"/>.
8641 Note this is different
8642 than method signatures as defined in the <i>Java Language Specification</i>.
8643 </description>
8644 <origin>jvmdiClone</origin>
8645 <capabilities>
8646 </capabilities>
8647 <parameters>
8648 <param id="method">
8649 <jmethodID/>
8650 <description>
8651 The method to query.
8652 </description>
8653 </param>
8654 <param id="name_ptr">
8655 <allocbuf>
8656 <char/>
8657 <nullok>the name is not returned</nullok>
8658 </allocbuf>
8659 <description>
8660 On return, points to the method name, encoded as a
8661 <internallink id="mUTF">modified UTF-8</internallink> string.
8662 </description>
8663 </param>
8664 <param id="signature_ptr">
8665 <allocbuf>
8666 <char/>
8667 <nullok>the signature is not returned</nullok>
8668 </allocbuf>
8669 <description>
8670 On return, points to the method signature, encoded as a
8671 <internallink id="mUTF">modified UTF-8</internallink> string.
8672 </description>
8673 </param>
8674 <param id="generic_ptr">
8675 <allocbuf>
8676 <char/>
8677 <nullok>the generic signature is not returned</nullok>
8678 </allocbuf>
8679 <description>
8680 On return, points to the generic signature of the method, encoded as a
8681 <internallink id="mUTF">modified UTF-8</internallink> string.
8682 If there is no generic signature attribute for the method, then,
8683 on return, points to null.
8684 </description>
8685 </param>
8686 </parameters>
8687 <errors>
8688 </errors>
8689 </function>
8690
8691 <function id="GetMethodDeclaringClass" phase="start" num="65">
8692 <synopsis>Get Method Declaring Class</synopsis>
8693 <description>
8694 For the method indicated by <code>method</code>,
8695 return the class that defined it via <code>declaring_class_ptr</code>.
8696 </description>
8697 <origin>jvmdi</origin>
8698 <capabilities>
8699 </capabilities>
8700 <parameters>
8701 <param id="klass">
8702 <jclass method="method"/>
8703 <description>
8704 The class to query.
8705 </description>
8706 </param>
8707 <param id="method">
8708 <jmethodID class="klass"/>
8709 <description>
8710 The method to query.
8711 </description>
8712 </param>
8713 <param id="declaring_class_ptr">
8714 <outptr><jclass/></outptr>
8715 <description>
8716 On return, points to the declaring class
8717 </description>
8718 </param>
8719 </parameters>
8720 <errors>
8721 </errors>
8722 </function>
8723
8724 <function id="GetMethodModifiers" phase="start" num="66">
8725 <synopsis>Get Method Modifiers</synopsis>
8726 <description>
8727 For the method indicated by <code>method</code>,
8728 return the access flags via <code>modifiers_ptr</code>.
8729 Access flags are defined in <vmspec chapter="4"/>.
8730 </description>
8731 <origin>jvmdi</origin>
8732 <capabilities>
8733 </capabilities>
8734 <parameters>
8735 <param id="klass">
8736 <jclass method="method"/>
8737 <description>
8738 The class to query.
8739 </description>
8740 </param>
8741 <param id="method">
8742 <jmethodID class="klass"/>
8743 <description>
8744 The method to query.
8745 </description>
8746 </param>
8747 <param id="modifiers_ptr">
8748 <outptr><jint/></outptr>
8749 <description>
8750 On return, points to the access flags.
8751 </description>
8752 </param>
8753 </parameters>
8754 <errors>
8755 </errors>
8756 </function>
8757
8758 <function id="GetMaxLocals" phase="start" num="68">
8759 <synopsis>Get Max Locals</synopsis>
8760 <description>
8761 For the method indicated by <code>method</code>,
8762 return the number of local variable slots used by the method,
8763 including the local variables used to pass parameters to the
8764 method on its invocation.
8765 <p/>
8766 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.
8767 </description>
8768 <origin>jvmdi</origin>
8769 <capabilities>
8770 </capabilities>
8771 <parameters>
8772 <param id="klass">
8773 <jclass method="method"/>
8774 <description>
8775 The class to query.
8776 </description>
8777 </param>
8778 <param id="method">
8779 <jmethodID class="klass" native="error"/>
8780 <description>
8781 The method to query.
8782 </description>
8783 </param>
8784 <param id="max_ptr">
8785 <outptr><jint/></outptr>
8786 <description>
8787 On return, points to the maximum number of local slots
8788 </description>
8789 </param>
8790 </parameters>
8791 <errors>
8792 </errors>
8793 </function>
8794
8795 <function id="GetArgumentsSize" phase="start" num="69">
8796 <synopsis>Get Arguments Size</synopsis>
8797 <description>
8798 For the method indicated by <code>method</code>,
8799 return via <code>max_ptr</code> the number of local variable slots used
8800 by the method's arguments.
8801 Note that two-word arguments use two slots.
8802 </description>
8803 <origin>jvmdi</origin>
8804 <capabilities>
8805 </capabilities>
8806 <parameters>
8807 <param id="klass">
8808 <jclass method="method"/>
8809 <description>
8810 The class to query.
8811 </description>
8812 </param>
8813 <param id="method">
8814 <jmethodID class="klass" native="error"/>
8815 <description>
8816 The method to query.
8817 </description>
8818 </param>
8819 <param id="size_ptr">
8820 <outptr><jint/></outptr>
8821 <description>
8822 On return, points to the number of argument slots
8823 </description>
8824 </param>
8825 </parameters>
8826 <errors>
8827 </errors>
8828 </function>
8829
8830 <function id="GetLineNumberTable" phase="start" num="70">
8831 <synopsis>Get Line Number Table</synopsis>
8832 <typedef id="jvmtiLineNumberEntry" label="Line number table entry">
8833 <field id="start_location">
8834 <jlocation/>
8835 <description>
8836 the <datalink id="jlocation"></datalink> where the line begins
8837 </description>
8838 </field>
8839 <field id="line_number">
8840 <jint/>
8841 <description>
8842 the line number
8843 </description>
8844 </field>
8845 </typedef>
8846 <description>
8847 For the method indicated by <code>method</code>,
8848 return a table of source line number entries. The size of the table is
8849 returned via <code>entry_count_ptr</code> and the table itself is
8850 returned via <code>table_ptr</code>.
8851 </description>
8852 <origin>jvmdi</origin>
8853 <capabilities>
8854 <required id="can_get_line_numbers"></required>
8855 </capabilities>
8856 <parameters>
8857 <param id="klass">
8858 <jclass method="method"/>
8859 <description>
8860 The class to query.
8861 </description>
8862 </param>
8863 <param id="method">
8864 <jmethodID class="klass" native="error"/>
8865 <description>
8866 The method to query.
8867 </description>
8868 </param>
8869 <param id="entry_count_ptr">
8870 <outptr><jint/></outptr>
8871 <description>
8872 On return, points to the number of entries in the table
8873 </description>
8874 </param>
8875 <param id="table_ptr">
8876 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>
8877 <description>
8878 On return, points to the line number table pointer.
8879 </description>
8880 </param>
8881 </parameters>
8882 <errors>
8883 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8884 Class information does not include line numbers.
8885 </error>
8886 </errors>
8887 </function>
8888
8889 <function id="GetMethodLocation" phase="start" num="71">
8890 <synopsis>Get Method Location</synopsis>
8891 <description>
8892 For the method indicated by <code>method</code>,
8893 return the beginning and ending addresses through
8894 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a
8895 conventional bytecode indexing scheme,
8896 <code>start_location_ptr</code> will always point to zero
8897 and <code>end_location_ptr</code>
8898 will always point to the bytecode count minus one.
8899 </description>
8900 <origin>jvmdi</origin>
8901 <capabilities>
8902 </capabilities>
8903 <parameters>
8904 <param id="klass">
8905 <jclass method="method"/>
8906 <description>
8907 The class to query.
8908 </description>
8909 </param>
8910 <param id="method">
8911 <jmethodID class="klass" native="error"/>
8912 <description>
8913 The method to query.
8914 </description>
8915 </param>
8916 <param id="start_location_ptr">
8917 <outptr><jlocation/></outptr>
8918 <description>
8919 On return, points to the first location, or
8920 <code>-1</code> if location information is not available.
8921 If the information is available and
8922 <functionlink id="GetJLocationFormat"></functionlink>
8923 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>
8924 then this will always be zero.
8925 </description>
8926 </param>
8927 <param id="end_location_ptr">
8928 <outptr><jlocation/></outptr>
8929 <description>
8930 On return, points to the last location,
8931 or <code>-1</code> if location information is not available.
8932 </description>
8933 </param>
8934 </parameters>
8935 <errors>
8936 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8937 Class information does not include method sizes.
8938 </error>
8939 </errors>
8940 </function>
8941
8942 <function id="GetLocalVariableTable" num="72">
8943 <synopsis>Get Local Variable Table</synopsis>
8944 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">
8945 <field id="start_location">
8946 <jlocation/>
8947 <description>
8948 The code array index where the local variable is first valid
8949 (that is, where it must have a value).
8950 </description>
8951 </field>
8952 <field id="length">
8953 <jint/>
8954 <description>
8955 The length of the valid section for this local variable.
8956 The last code array index where the local variable is valid
8957 is <code>start_location + length</code>.
8958 </description>
8959 </field>
8960 <field id="name">
8961 <allocfieldbuf><char/></allocfieldbuf>
8962 <description>
8963 The local variable name, encoded as a
8964 <internallink id="mUTF">modified UTF-8</internallink> string.
8965 </description>
8966 </field>
8967 <field id="signature">
8968 <allocfieldbuf><char/></allocfieldbuf>
8969 <description>
8970 The local variable's type signature, encoded as a
8971 <internallink id="mUTF">modified UTF-8</internallink> string.
8972 The signature format is the same as that defined in
8973 <vmspec chapter="4.3.2"/>.
8974 </description>
8975 </field>
8976 <field id="generic_signature">
8977 <allocfieldbuf><char/></allocfieldbuf>
8978 <description>
8979 The local variable's generic signature, encoded as a
8980 <internallink id="mUTF">modified UTF-8</internallink> string.
8981 The value of this field will be null for any local
8982 variable which does not have a generic type.
8983 </description>
8984 </field>
8985 <field id="slot">
8986 <jint/>
8987 <description>
8988 The local variable's slot. See <internallink id="local">Local Variables</internallink>.
8989 </description>
8990 </field>
8991 </typedef>
8992 <description>
8993 Return local variable information.
8994 </description>
8995 <origin>jvmdiClone</origin>
8996 <capabilities>
8997 <required id="can_access_local_variables"></required>
8998 </capabilities>
8999 <parameters>
9000 <param id="method">
9001 <jmethodID native="error"/>
9002 <description>
9003 The method to query.
9004 </description>
9005 </param>
9006 <param id="entry_count_ptr">
9007 <outptr><jint/></outptr>
9008 <description>
9009 On return, points to the number of entries in the table
9010 </description>
9011 </param>
9012 <param id="table_ptr">
9013 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>
9014 <description>
9015 On return, points to an array of local variable table entries.
9016 </description>
9017 </param>
9018 </parameters>
9019 <errors>
9020 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
9021 Class information does not include local variable
9022 information.
9023 </error>
9024 </errors>
9025 </function>
9026
9027 <function id="GetBytecodes" phase="start" num="75">
9028 <synopsis>Get Bytecodes</synopsis>
9029 <description>
9030 For the method indicated by <code>method</code>,
9031 return the bytecodes that implement the method. The number of
9032 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes
9033 themselves are returned via <code>bytecodes_ptr</code>.
9034 </description>
9035 <origin>jvmdi</origin>
9036 <capabilities>
9037 <required id="can_get_bytecodes"></required>
9038 </capabilities>
9039 <parameters>
9040 <param id="klass">
9041 <jclass method="method"/>
9042 <description>
9043 The class to query.
9044 </description>
9045 </param>
9046 <param id="method">
9047 <jmethodID class="klass" native="error"/>
9048 <description>
9049 The method to query.
9050 </description>
9051 </param>
9052 <param id="bytecode_count_ptr">
9053 <outptr><jint/></outptr>
9054 <description>
9055 On return, points to the length of the bytecode array
9056 </description>
9057 </param>
9058 <param id="bytecodes_ptr">
9059 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>
9060 <description>
9061 On return, points to the pointer to the bytecode array
9062 </description>
9063 </param>
9064 </parameters>
9065 <errors>
9066 </errors>
9067 </function>
9068
9069 <function id="IsMethodNative" phase="start" num="76">
9070 <synopsis>Is Method Native</synopsis>
9071 <description>
9072 For the method indicated by <code>method</code>, return a
9073 value indicating whether the method is native via <code>is_native_ptr</code>
9074 </description>
9075 <origin>jvmdi</origin>
9076 <capabilities>
9077 </capabilities>
9078 <parameters>
9079 <param id="klass">
9080 <jclass method="method"/>
9081 <description>
9082 The class to query.
9083 </description>
9084 </param>
9085 <param id="method">
9086 <jmethodID class="klass"/>
9087 <description>
9088 The method to query.
9089 </description>
9090 </param>
9091 <param id="is_native_ptr">
9092 <outptr><jboolean/></outptr>
9093 <description>
9094 On return, points to the boolean result of this function.
9095 </description>
9096 </param>
9097 </parameters>
9098 <errors>
9099 </errors>
9100 </function>
9101
9102 <function id="IsMethodSynthetic" phase="start" num="77">
9103 <synopsis>Is Method Synthetic</synopsis>
9104 <description>
9105 For the method indicated by <code>method</code>, return a
9106 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.
9107 Synthetic methods are generated by the compiler but not present in the
9108 original source code.
9109 </description>
9110 <origin>jvmdi</origin>
9111 <capabilities>
9112 <required id="can_get_synthetic_attribute"></required>
9113 </capabilities>
9114 <parameters>
9115 <param id="klass">
9116 <jclass method="method"/>
9117 <description>
9118 The class to query.
9119 </description>
9120 </param>
9121 <param id="method">
9122 <jmethodID class="klass"/>
9123 <description>
9124 The method to query.
9125 </description>
9126 </param>
9127 <param id="is_synthetic_ptr">
9128 <outptr><jboolean/></outptr>
9129 <description>
9130 On return, points to the boolean result of this function.
9131 </description>
9132 </param>
9133 </parameters>
9134 <errors>
9135 </errors>
9136 </function>
9137
9138 <function id="IsMethodObsolete" phase="start" num="91">
9139 <synopsis>Is Method Obsolete</synopsis>
9140 <description>
9141 Determine if a method ID refers to an
9142 <internallink id="obsoleteMethods">obsolete</internallink>
9143 method version.
9144 </description>
9145 <origin>jvmdi</origin>
9146 <capabilities>
9147 </capabilities>
9148 <parameters>
9149 <param id="klass">
9150 <jclass method="method"/>
9151 <description>
9152 The class to query.
9153 </description>
9154 </param>
9155 <param id="method">
9156 <jmethodID class="klass"/>
9157 <description>
9158 The method ID to query.
9159 </description>
9160 </param>
9161 <param id="is_obsolete_ptr">
9162 <outptr><jboolean/></outptr>
9163 <description>
9164 On return, points to the boolean result of this function.
9165 </description>
9166 </param>
9167 </parameters>
9168 <errors>
9169 </errors>
9170 </function>
9171
9172 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">
9173 <synopsis>Set Native Method Prefix</synopsis>
9174 <description>
9175 This function modifies the failure handling of
9176 native method resolution by allowing retry
9177 with a prefix applied to the name.
9178 When used with the
9179 <eventlink id="ClassFileLoadHook">ClassFileLoadHook
9180 event</eventlink>, it enables native methods to be
9181 <internallink id="bci">instrumented</internallink>.
9182 <p/>
9183 Since native methods cannot be directly instrumented
9184 (they have no bytecodes), they must be wrapped with
9185 a non-native method which can be instrumented.
9186 For example, if we had:
9187 <example>
9188 native boolean foo(int x);</example>
9189 <p/>
9190 We could transform the class file (with the
9191 ClassFileLoadHook event) so that this becomes:
9192 <example>
9193 boolean foo(int x) {
9194 <i>... record entry to foo ...</i>
9195 return wrapped_foo(x);
9196 }
9197
9198 native boolean wrapped_foo(int x);</example>
9199 <p/>
9200 Where foo becomes a wrapper for the actual native method
9201 with the appended prefix "wrapped_". Note that
9202 "wrapped_" would be a poor choice of prefix since it
9203 might conceivably form the name of an existing method
9204 thus something like "$$$MyAgentWrapped$$$_" would be
9205 better but would make these examples less readable.
9206 <p/>
9207 The wrapper will allow data to be collected on the native
9208 method call, but now the problem becomes linking up the
9209 wrapped method with the native implementation.
9210 That is, the method <code>wrapped_foo</code> needs to be
9211 resolved to the native implementation of <code>foo</code>,
9212 which might be:
9213 <example>
9214 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>
9215 <p/>
9216 This function allows the prefix to be specified and the
9217 proper resolution to occur.
9218 Specifically, when the standard resolution fails, the
9219 resolution is retried taking the prefix into consideration.
9220 There are two ways that resolution occurs, explicit
9221 resolution with the JNI function <code>RegisterNatives</code>
9222 and the normal automatic resolution. For
9223 <code>RegisterNatives</code>, the VM will attempt this
9224 association:
9225 <example>
9226 method(foo) -> nativeImplementation(foo)</example>
9227 <p/>
9228 When this fails, the resolution will be retried with
9229 the specified prefix prepended to the method name,
9230 yielding the correct resolution:
9231 <example>
9232 method(wrapped_foo) -> nativeImplementation(foo)</example>
9233 <p/>
9234 For automatic resolution, the VM will attempt:
9235 <example>
9236 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>
9237 <p/>
9238 When this fails, the resolution will be retried with
9239 the specified prefix deleted from the implementation name,
9240 yielding the correct resolution:
9241 <example>
9242 method(wrapped_foo) -> nativeImplementation(foo)</example>
9243 <p/>
9244 Note that since the prefix is only used when standard
9245 resolution fails, native methods can be wrapped selectively.
9246 <p/>
9247 Since each <jvmti/> environment is independent and
9248 can do its own transformation of the bytecodes, more
9249 than one layer of wrappers may be applied. Thus each
9250 environment needs its own prefix. Since transformations
9251 are applied in order, the prefixes, if applied, will
9252 be applied in the same order.
9253 The order of transformation application is described in
9254 the <eventlink id="ClassFileLoadHook"/> event.
9255 Thus if three environments applied
9256 wrappers, <code>foo</code> might become
9257 <code>$env3_$env2_$env1_foo</code>. But if, say,
9258 the second environment did not apply a wrapper to
9259 <code>foo</code> it would be just
9260 <code>$env3_$env1_foo</code>. To be able to
9261 efficiently determine the sequence of prefixes,
9262 an intermediate prefix is only applied if its non-native
9263 wrapper exists. Thus, in the last example, even though
9264 <code>$env1_foo</code> is not a native method, the
9265 <code>$env1_</code> prefix is applied since
9266 <code>$env1_foo</code> exists.
9267 <p/>
9268 Since the prefixes are used at resolution time
9269 and since resolution may be arbitrarily delayed, a
9270 native method prefix must remain set as long as there
9271 are corresponding prefixed native methods.
9272 </description>
9273 <origin>new</origin>
9274 <capabilities>
9275 <required id="can_set_native_method_prefix"></required>
9276 </capabilities>
9277 <parameters>
9278 <param id="prefix">
9279 <inbuf>
9280 <char/>
9281 <nullok>
9282 any existing prefix in this environment is cancelled
9283 </nullok>
9284 </inbuf>
9285 <description>
9286 The prefix to apply, encoded as a
9287 <internallink id="mUTF">modified UTF-8</internallink> string.
9288 </description>
9289 </param>
9290 </parameters>
9291 <errors>
9292 </errors>
9293 </function>
9294
9295 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">
9296 <synopsis>Set Native Method Prefixes</synopsis>
9297 <description>
9298 For a normal agent, <functionlink id="SetNativeMethodPrefix"/>
9299 will provide all needed native method prefixing.
9300 For a meta-agent that performs multiple independent class
9301 file transformations (for example as a proxy for another
9302 layer of agents) this function allows each transformation
9303 to have its own prefix.
9304 The prefixes are applied in the order supplied and are
9305 processed in the same manner as described for the
9306 application of prefixes from multiple <jvmti/> environments
9307 in <functionlink id="SetNativeMethodPrefix"/>.
9308 <p/>
9309 Any previous prefixes are replaced. Thus, calling this
9310 function with a <paramlink id="prefix_count"/> of <code>0</code>
9311 disables prefixing in this environment.
9312 <p/>
9313 <functionlink id="SetNativeMethodPrefix"/> and this function
9314 are the two ways to set the prefixes.
9315 Calling <code>SetNativeMethodPrefix</code> with
9316 a prefix is the same as calling this function with
9317 <paramlink id="prefix_count"/> of <code>1</code>.
9318 Calling <code>SetNativeMethodPrefix</code> with
9319 a null pointer is the same as calling this function with
9320 <paramlink id="prefix_count"/> of <code>0</code>.
9321 </description>
9322 <origin>new</origin>
9323 <capabilities>
9324 <required id="can_set_native_method_prefix"></required>
9325 </capabilities>
9326 <parameters>
9327 <param id="prefix_count">
9328 <jint min="0"/>
9329 <description>
9330 The number of prefixes to apply.
9331 </description>
9332 </param>
9333 <param id="prefixes">
9334 <agentbuf>
9335 <char/>
9336 </agentbuf>
9337 <description>
9338 The prefixes to apply for this environment, each encoded as a
9339 <internallink id="mUTF">modified UTF-8</internallink> string.
9340 </description>
9341 </param>
9342 </parameters>
9343 <errors>
9344 </errors>
9345 </function>
9346
9347 </category>
9348
9349 <category id="RawMonitors" label="Raw Monitor">
9350
9351 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">
9352 <synopsis>Create Raw Monitor</synopsis>
9353 <description>
9354 Create a raw monitor.
9355 </description>
9356 <origin>jvmdi</origin>
9357 <capabilities>
9358 </capabilities>
9359 <parameters>
9360 <param id="name">
9361 <inbuf><char/></inbuf>
9362 <description>
9363 A name to identify the monitor, encoded as a
9364 <internallink id="mUTF">modified UTF-8</internallink> string.
9365 </description>
9366 </param>
9367 <param id="monitor_ptr">
9368 <outptr><jrawMonitorID/></outptr>
9369 <description>
9370 On return, points to the created monitor.
9371 </description>
9372 </param>
9373 </parameters>
9374 <errors>
9375 </errors>
9376 </function>
9377
9378 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">
9379 <synopsis>Destroy Raw Monitor</synopsis>
9380 <description>
9381 Destroy the raw monitor.
9382 If the monitor being destroyed has been entered by this thread, it will be
9383 exited before it is destroyed.
9384 If the monitor being destroyed has been entered by another thread,
9385 an error will be returned and the monitor will not be destroyed.
9386 </description>
9387 <origin>jvmdi</origin>
9388 <capabilities>
9389 </capabilities>
9390 <parameters>
9391 <param id="monitor">
9392 <jrawMonitorID/>
9393 <description>
9394 The monitor
9395 </description>
9396 </param>
9397 </parameters>
9398 <errors>
9399 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9400 Not monitor owner
9401 </error>
9402 </errors>
9403 </function>
9404
9405 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">
9406 <synopsis>Raw Monitor Enter</synopsis>
9407 <description>
9408 Gain exclusive ownership of a raw monitor.
9409 The same thread may enter a monitor more then once.
9410 The thread must
9411 <functionlink id="RawMonitorExit">exit</functionlink>
9412 the monitor the same number of times as it is entered.
9413 If a monitor is entered during <code>OnLoad</code> (before attached threads exist)
9414 and has not exited when attached threads come into existence, the enter
9415 is considered to have occurred on the main thread.
9416 </description>
9417 <origin>jvmdi</origin>
9418 <capabilities>
9419 </capabilities>
9420 <parameters>
9421 <param id="monitor">
9422 <jrawMonitorID/>
9423 <description>
9424 The monitor
9425 </description>
9426 </param>
9427 </parameters>
9428 <errors>
9429 </errors>
9430 </function>
9431
9432 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">
9433 <synopsis>Raw Monitor Exit</synopsis>
9434 <description>
9435 Release exclusive ownership of a raw monitor.
9436 </description>
9437 <origin>jvmdi</origin>
9438 <capabilities>
9439 </capabilities>
9440 <parameters>
9441 <param id="monitor">
9442 <jrawMonitorID/>
9443 <description>
9444 The monitor
9445 </description>
9446 </param>
9447 </parameters>
9448 <errors>
9449 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9450 Not monitor owner
9451 </error>
9452 </errors>
9453 </function>
9454
9455 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">
9456 <synopsis>Raw Monitor Wait</synopsis>
9457 <description>
9458 Wait for notification of the raw monitor.
9459 <p/>
9460 Causes the current thread to wait until either another thread calls
9461 <functionlink id="RawMonitorNotify"/> or
9462 <functionlink id="RawMonitorNotifyAll"/>
9463 for the specified raw monitor, or the specified
9464 <paramlink id="millis">timeout</paramlink>
9465 has elapsed.
9466 </description>
9467 <origin>jvmdi</origin>
9468 <capabilities>
9469 </capabilities>
9470 <parameters>
9471 <param id="monitor">
9472 <jrawMonitorID/>
9473 <description>
9474 The monitor
9475 </description>
9476 </param>
9477 <param id="millis">
9478 <jlong/>
9479 <description>
9480 The timeout, in milliseconds. If the timeout is
9481 zero, then real time is not taken into consideration
9482 and the thread simply waits until notified.
9483 </description>
9484 </param>
9485 </parameters>
9486 <errors>
9487 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9488 Not monitor owner
9489 </error>
9490 <error id="JVMTI_ERROR_INTERRUPT">
9491 Wait was interrupted, try again
9492 </error>
9493 </errors>
9494 </function>
9495
9496 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">
9497 <synopsis>Raw Monitor Notify</synopsis>
9498 <description>
9499 Notify a single thread waiting on the raw monitor.
9500 </description>
9501 <origin>jvmdi</origin>
9502 <capabilities>
9503 </capabilities>
9504 <parameters>
9505 <param id="monitor">
9506 <jrawMonitorID/>
9507 <description>
9508 The monitor
9509 </description>
9510 </param>
9511 </parameters>
9512 <errors>
9513 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9514 Not monitor owner
9515 </error>
9516 </errors>
9517 </function>
9518
9519 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">
9520 <synopsis>Raw Monitor Notify All</synopsis>
9521 <description>
9522 Notify all threads waiting on the raw monitor.
9523 </description>
9524 <origin>jvmdi</origin>
9525 <capabilities>
9526 </capabilities>
9527 <parameters>
9528 <param id="monitor">
9529 <jrawMonitorID/>
9530 <description>
9531 The monitor
9532 </description>
9533 </param>
9534 </parameters>
9535 <errors>
9536 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9537 Not monitor owner
9538 </error>
9539 </errors>
9540 </function>
9541
9542 <elide>
9543 <function id="GetRawMonitorUse" num="118">
9544 <synopsis>Get Raw Monitor Use</synopsis>
9545 <description>
9546 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
9547 are filled in with information about usage of the raw monitor.
9548 </description>
9549 <origin>new</origin>
9550 <capabilities>
9551 <required id="can_get_raw_monitor_usage"></required>
9552 </capabilities>
9553 <parameters>
9554 <param id="monitor">
9555 <jrawMonitorID/>
9556 <description>
9557 the raw monitor to query.
9558 </description>
9559 </param>
9560 <param id="info_ptr">
9561 <outptr><struct>jvmtiMonitorUsage</struct></outptr>
9562 <description>
9563 On return, filled with monitor information for the
9564 specified raw monitor.
9565 </description>
9566 </param>
9567 </parameters>
9568 <errors>
9569 </errors>
9570 </function>
9571
9572 <function id="GetRawMonitors" num="119">
9573 <synopsis>Get Raw Monitors</synopsis>
9574 <description>
9575 Return the list of raw monitors.
9576 <p/>
9577 Note: details about each monitor can be examined with
9578 <functionlink id="GetRawMonitorUse"></functionlink>.
9579 </description>
9580 <origin>new</origin>
9581 <capabilities>
9582 <required id="can_get_raw_monitor_usage"></required>
9583 </capabilities>
9584 <parameters>
9585 <param id="monitorCnt">
9586 <outptr><jint/></outptr>
9587 <description>
9588 On return, pointer to the number
9589 of monitors returned in <code>monitors_ptr</code>.
9590 </description>
9591 </param>
9592 <param id="monitors_ptr">
9593 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>
9594 <description>
9595 On return, pointer to the monitor list.
9596 </description>
9597 </param>
9598 </parameters>
9599 <errors>
9600 </errors>
9601 </function>
9602 </elide>
9603 </category>
9604
9605 <category id="jniIntercept" label="JNI Function Interception">
9606
9607 <intro>
9608 Provides the ability to intercept and resend
9609 Java Native Interface (JNI) function calls
9610 by manipulating the JNI function table.
9611 See <externallink id="jni/functions.html">JNI
9612 Functions</externallink> in the <i>Java Native Interface Specification</i>.
9613 <p/>
9614 The following example illustrates intercepting the
9615 <code>NewGlobalRef</code> JNI call in order to count reference
9616 creation.
9617 <example>
9618 JNIEnv original_jni_Functions;
9619 JNIEnv redirected_jni_Functions;
9620 int my_global_ref_count = 0;
9621
9622 jobject
9623 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {
9624 ++my_global_ref_count;
9625 return originalJNIFunctions->NewGlobalRef(env, lobj);
9626 }
9627
9628 void
9629 myInit() {
9630 jvmtiError err;
9631
9632 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions);
9633 if (err != JVMTI_ERROR_NONE) {
9634 die();
9635 }
9636 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions);
9637 if (err != JVMTI_ERROR_NONE) {
9638 die();
9639 }
9640 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef;
9641 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);
9642 if (err != JVMTI_ERROR_NONE) {
9643 die();
9644 }
9645 }
9646 </example>
9647 Sometime after <code>myInit</code> is called the user's JNI
9648 code is executed which makes the call to create a new global
9649 reference. Instead of going to the normal JNI implementation
9650 the call goes to <code>myNewGlobalRef</code>. Note that a
9651 copy of the original function table is kept so that the normal
9652 JNI function can be called after the data is collected.
9653 Note also that any JNI functions which are not overwritten
9654 will behave normally.
9655 <todo>
9656 check that the example compiles and executes.
9657 </todo>
9658 </intro>
9659
9660 <function id="SetJNIFunctionTable" phase="start" num="120">
9661 <synopsis>Set JNI Function Table</synopsis>
9662 <description>
9663 Set the JNI function table
9664 in all current and future JNI environments.
9665 As a result, all future JNI calls are directed to the specified functions.
9666 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the
9667 function table to pass to this function.
9668 For this function to take effect the updated table entries must be
9669 used by the JNI clients.
9670 Since the table is defined <code>const</code> some compilers may optimize
9671 away the access to the table, thus preventing this function from taking
9672 effect.
9673 The table is copied--changes to the local copy of the
9674 table have no effect.
9675 This function affects only the function table, all other aspects of the environment are
9676 unaffected.
9677 See the examples <internallink id="jniIntercept">above</internallink>.
9678 </description>
9679 <origin>new</origin>
9680 <capabilities>
9681 </capabilities>
9682 <parameters>
9683 <param id="function_table">
9684 <inptr>
9685 <struct>jniNativeInterface</struct>
9686 </inptr>
9687 <description>
9688 Points to the new JNI function table.
9689 </description>
9690 </param>
9691 </parameters>
9692 <errors>
9693 </errors>
9694 </function>
9695
9696 <function id="GetJNIFunctionTable" phase="start" num="121">
9697 <synopsis>Get JNI Function Table</synopsis>
9698 <description>
9699 Get the JNI function table.
9700 The JNI function table is copied into allocated memory.
9701 If <functionlink id="SetJNIFunctionTable"></functionlink>
9702 has been called, the modified (not the original) function
9703 table is returned.
9704 Only the function table is copied, no other aspects of the environment
9705 are copied.
9706 See the examples <internallink id="jniIntercept">above</internallink>.
9707 </description>
9708 <origin>new</origin>
9709 <capabilities>
9710 </capabilities>
9711 <parameters>
9712 <param id="function_table">
9713 <allocbuf>
9714 <struct>jniNativeInterface</struct>
9715 </allocbuf>
9716 <description>
9717 On return, <code>*function_table</code>
9718 points a newly allocated copy of the JNI function table.
9719 </description>
9720 </param>
9721 </parameters>
9722 <errors>
9723 </errors>
9724 </function>
9725
9726 </category>
9727
9728 <category id="eventManagement" label="Event Management">
9729
9730 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">
9731 <synopsis>Set Event Callbacks</synopsis>
9732 <description>
9733 Set the functions to be called for each event.
9734 The callbacks are specified by supplying a replacement function table.
9735 The function table is copied--changes to the local copy of the
9736 table have no effect.
9737 This is an atomic action, all callbacks are set at once.
9738 No events are sent before this function is called.
9739 When an entry is null or when the event is beyond
9740 <paramlink id="size_of_callbacks"></paramlink> no event is sent.
9741 Details on events are
9742 described <internallink id="EventSection">later</internallink> in this document.
9743 An event must be enabled and have a callback in order to be
9744 sent--the order in which this function and
9745 <functionlink id="SetEventNotificationMode"></functionlink>
9746 are called does not affect the result.
9747 </description>
9748 <origin>new</origin>
9749 <capabilities>
9750 </capabilities>
9751 <parameters>
9752 <param id="callbacks">
9753 <inptr>
9754 <struct>jvmtiEventCallbacks</struct>
9755 <nullok>remove the existing callbacks</nullok>
9756 </inptr>
9757 <description>
9758 The new event callbacks.
9759 </description>
9760 </param>
9761 <param id="size_of_callbacks">
9762 <jint min="0"/>
9763 <description>
9764 <code>sizeof(jvmtiEventCallbacks)</code>--for version
9765 compatibility.
9766 </description>
9767 </param>
9768 </parameters>
9769 <errors>
9770 </errors>
9771 </function>
9772
9773 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">
9774 <synopsis>Set Event Notification Mode</synopsis>
9775 <description>
9776 Control the generation of events.
9777 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">
9778 <constant id="JVMTI_ENABLE" num="1">
9779 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,
9780 the event <paramlink id="event_type"></paramlink> will be enabled
9781 </constant>
9782 <constant id="JVMTI_DISABLE" num="0">
9783 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,
9784 the event <paramlink id="event_type"></paramlink> will be disabled
9785 </constant>
9786 </constants>
9787 If <code>event_thread</code> is null,
9788 the event is enabled or disabled globally; otherwise, it is
9789 enabled or disabled for a particular thread.
9790 An event is generated for
9791 a particular thread if it is enabled either at the thread or global
9792 levels.
9793 <p/>
9794 See <internallink id="EventIndex">below</internallink> for information on specific events.
9795 <p/>
9796 The following events cannot be controlled at the thread
9797 level through this function.
9798 <ul>
9799 <li><eventlink id="VMInit"></eventlink></li>
9800 <li><eventlink id="VMStart"></eventlink></li>
9801 <li><eventlink id="VMDeath"></eventlink></li>
9802 <li><eventlink id="ThreadStart"></eventlink></li>
9803 <li><eventlink id="VirtualThreadStart"></eventlink></li>
9804 <li><eventlink id="CompiledMethodLoad"></eventlink></li>
9805 <li><eventlink id="CompiledMethodUnload"></eventlink></li>
9806 <li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9807 <li><eventlink id="DataDumpRequest"></eventlink></li>
9808 </ul>
9809 <p/>
9810 Initially, no events are enabled at either the thread level
9811 or the global level.
9812 <p/>
9813 Any needed capabilities (see Event Enabling Capabilities below) must be possessed
9814 before calling this function.
9815 <p/>
9816 Details on events are
9817 described <internallink id="EventSection">below</internallink>.
9818 </description>
9819 <origin>jvmdiClone</origin>
9820 <eventcapabilities></eventcapabilities>
9821 <parameters>
9822 <param id="mode">
9823 <enum>jvmtiEventMode</enum>
9824 <description>
9825 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>
9826 </description>
9827 </param>
9828 <param id="event_type">
9829 <enum>jvmtiEvent</enum>
9830 <description>
9831 the event to control
9832 </description>
9833 </param>
9834 <param id="event_thread">
9835 <ptrtype>
9836 <jthread impl="noconvert"/>
9837 <nullok>event is controlled at the global level</nullok>
9838 </ptrtype>
9839 <description>
9840 The thread to control
9841 </description>
9842 </param>
9843 <param id="...">
9844 <varargs/>
9845 <description>
9846 for future expansion
9847 </description>
9848 </param>
9849 </parameters>
9850 <errors>
9851 <error id="JVMTI_ERROR_INVALID_THREAD">
9852 <paramlink id="event_thread"/> is non-null and is not a valid thread.
9853 </error>
9854 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE">
9855 <paramlink id="event_thread"/> is non-null and is not alive
9856 (has not been started or has terminated).
9857 </error>
9858 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9859 thread level control was attempted on events which do not
9860 permit thread level control.
9861 </error>
9862 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9863 The Required Event Enabling Capability is not possessed.
9864 </error>
9865 </errors>
9866 </function>
9867
9868 <function id="GenerateEvents" num="123">
9869 <synopsis>Generate Events</synopsis>
9870 <description>
9871 Generate events to represent the current state of the VM.
9872 For example, if <paramlink id="event_type"/> is
9873 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,
9874 a <eventlink id="CompiledMethodLoad"></eventlink> event will be
9875 sent for each currently compiled method.
9876 Methods that were loaded and now have been unloaded are not sent.
9877 The history of what events have previously been sent does not
9878 effect what events are sent by this function--for example,
9879 all currently compiled methods
9880 will be sent each time this function is called.
9881 <p/>
9882 This function is useful when
9883 events may have been missed due to the agent attaching after program
9884 execution begins; this function generates the missed events.
9885 <p/>
9886 Attempts to execute Java programming language code or
9887 JNI functions may be paused until this function returns -
9888 so neither should be called from the thread sending the event.
9889 This function returns only after the missed events have been
9890 sent, processed and have returned.
9891 The event may be sent on a different thread than the thread
9892 on which the event occurred.
9893 The callback for the event must be set with
9894 <functionlink id="SetEventCallbacks"></functionlink>
9895 and the event must be enabled with
9896 <functionlink id="SetEventNotificationMode"></functionlink>
9897 or the events will not occur.
9898 If the VM no longer has the information to generate some or
9899 all of the requested events, the events are simply not sent -
9900 no error is returned.
9901 <p/>
9902 Only the following events are supported:
9903 <ul>
9904 <li><eventlink id="CompiledMethodLoad"></eventlink></li>
9905 <li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9906 </ul>
9907 </description>
9908 <origin>new</origin>
9909 <capabilities>
9910 <capability id="can_generate_compiled_method_load_events"></capability>
9911 </capabilities>
9912 <parameters>
9913 <param id="event_type">
9914 <enum>jvmtiEvent</enum>
9915 <description>
9916 The type of event to generate. Must be one of these:
9917 <ul>
9918 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>
9919 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>
9920 </ul>
9921 </description>
9922 </param>
9923 </parameters>
9924 <errors>
9925 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9926 <paramlink id="event_type"/> is
9927 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9928 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>
9929 is <code>false</code>.
9930 </error>
9931 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9932 <paramlink id="event_type"/> is other than
9933 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9934 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.
9935 </error>
9936 </errors>
9937 </function>
9938
9939 </category>
9940
9941 <category id="extension" label="Extension Mechanism">
9942
9943 <intro>
9944 These functions
9945 allow a <jvmti/> implementation to provide functions and events
9946 beyond those defined in this specification.
9947 <p/>
9948 Both extension functions and extension events have parameters
9949 each of which has a 'type' and 'kind' chosen from the following tables:
9950
9951 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">
9952 <constant id="JVMTI_TYPE_JBYTE" num="101">
9953 Java programming language primitive type - <code>byte</code>.
9954 JNI type <code>jbyte</code>.
9955 </constant>
9956 <constant id="JVMTI_TYPE_JCHAR" num="102">
9957 Java programming language primitive type - <code>char</code>.
9958 JNI type <code>jchar</code>.
9959 </constant>
9960 <constant id="JVMTI_TYPE_JSHORT" num="103">
9961 Java programming language primitive type - <code>short</code>.
9962 JNI type <code>jshort</code>.
9963 </constant>
9964 <constant id="JVMTI_TYPE_JINT" num="104">
9965 Java programming language primitive type - <code>int</code>.
9966 JNI type <datalink id="jint"></datalink>.
9967 </constant>
9968 <constant id="JVMTI_TYPE_JLONG" num="105">
9969 Java programming language primitive type - <code>long</code>.
9970 JNI type <datalink id="jlong"></datalink>.
9971 </constant>
9972 <constant id="JVMTI_TYPE_JFLOAT" num="106">
9973 Java programming language primitive type - <code>float</code>.
9974 JNI type <datalink id="jfloat"></datalink>.
9975 </constant>
9976 <constant id="JVMTI_TYPE_JDOUBLE" num="107">
9977 Java programming language primitive type - <code>double</code>.
9978 JNI type <datalink id="jdouble"></datalink>.
9979 </constant>
9980 <constant id="JVMTI_TYPE_JBOOLEAN" num="108">
9981 Java programming language primitive type - <code>boolean</code>.
9982 JNI type <datalink id="jboolean"></datalink>.
9983 </constant>
9984 <constant id="JVMTI_TYPE_JOBJECT" num="109">
9985 Java programming language object type - <code>java.lang.Object</code>.
9986 JNI type <datalink id="jobject"></datalink>.
9987 Returned values are JNI local references and must be managed.
9988 </constant>
9989 <constant id="JVMTI_TYPE_JTHREAD" num="110">
9990 Java programming language object type - <code>java.lang.Thread</code>.
9991 <jvmti/> type <datalink id="jthread"></datalink>.
9992 Returned values are JNI local references and must be managed.
9993 </constant>
9994 <constant id="JVMTI_TYPE_JCLASS" num="111">
9995 Java programming language object type - <code>java.lang.Class</code>.
9996 JNI type <datalink id="jclass"></datalink>.
9997 Returned values are JNI local references and must be managed.
9998 </constant>
9999 <constant id="JVMTI_TYPE_JVALUE" num="112">
10000 Union of all Java programming language primitive and object types -
10001 JNI type <datalink id="jvalue"></datalink>.
10002 Returned values which represent object types are JNI local references and must be managed.
10003 </constant>
10004 <constant id="JVMTI_TYPE_JFIELDID" num="113">
10005 Java programming language field identifier -
10006 JNI type <datalink id="jfieldID"></datalink>.
10007 </constant>
10008 <constant id="JVMTI_TYPE_JMETHODID" num="114">
10009 Java programming language method identifier -
10010 JNI type <datalink id="jmethodID"></datalink>.
10011 </constant>
10012 <constant id="JVMTI_TYPE_CCHAR" num="115">
10013 C programming language type - <code>char</code>.
10014 </constant>
10015 <constant id="JVMTI_TYPE_CVOID" num="116">
10016 C programming language type - <code>void</code>.
10017 </constant>
10018 <constant id="JVMTI_TYPE_JNIENV" num="117">
10019 JNI environment - <code>JNIEnv</code>.
10020 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.
10021 </constant>
10022 </constants>
10023
10024 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">
10025 <constant id="JVMTI_KIND_IN" num="91">
10026 Ingoing argument - <code>foo</code>.
10027 </constant>
10028 <constant id="JVMTI_KIND_IN_PTR" num="92">
10029 Ingoing pointer argument - <code>const foo*</code>.
10030 </constant>
10031 <constant id="JVMTI_KIND_IN_BUF" num="93">
10032 Ingoing array argument - <code>const foo*</code>.
10033 </constant>
10034 <constant id="JVMTI_KIND_ALLOC_BUF" num="94">
10035 Outgoing allocated array argument - <code>foo**</code>.
10036 Free with <code>Deallocate</code>.
10037 </constant>
10038 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">
10039 Outgoing allocated array of allocated arrays argument - <code>foo***</code>.
10040 Free with <code>Deallocate</code>.
10041 </constant>
10042 <constant id="JVMTI_KIND_OUT" num="96">
10043 Outgoing argument - <code>foo*</code>.
10044 </constant>
10045 <constant id="JVMTI_KIND_OUT_BUF" num="97">
10046 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.
10047 Do not <code>Deallocate</code>.
10048 </constant>
10049 </constants>
10050
10051 </intro>
10052
10053 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">
10054 <field id="name">
10055 <allocfieldbuf><char/></allocfieldbuf>
10056 <description>
10057 The parameter name, encoded as a
10058 <internallink id="mUTF">modified UTF-8</internallink> string
10059 </description>
10060 </field>
10061 <field id="kind">
10062 <enum>jvmtiParamKind</enum>
10063 <description>
10064 The kind of the parameter - type modifiers
10065 </description>
10066 </field>
10067 <field id="base_type">
10068 <enum>jvmtiParamTypes</enum>
10069 <description>
10070 The base type of the parameter - modified by <code>kind</code>
10071 </description>
10072 </field>
10073 <field id="null_ok">
10074 <jboolean/>
10075 <description>
10076 Is a null pointer argument permitted? Applies only to pointer and object types.
10077 </description>
10078 </field>
10079 </typedef>
10080
10081 <callback id="jvmtiExtensionFunction">
10082 <enum>jvmtiError</enum>
10083 <synopsis>Extension Function</synopsis>
10084 <description>
10085 This is the implementation-specific extension function.
10086 </description>
10087 <parameters>
10088 <param id="jvmti_env">
10089 <outptr>
10090 <struct>jvmtiEnv</struct>
10091 </outptr>
10092 <description>
10093 The <jvmti/> environment is the only fixed parameter for extension functions.
10094 </description>
10095 </param>
10096 <param id="...">
10097 <varargs/>
10098 <description>
10099 The extension function-specific parameters
10100 </description>
10101 </param>
10102 </parameters>
10103 </callback>
10104
10105 <function id="GetExtensionFunctions" phase="onload" num="124">
10106 <synopsis>Get Extension Functions</synopsis>
10107
10108 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">
10109 <field id="func">
10110 <ptrtype>
10111 <struct>jvmtiExtensionFunction</struct>
10112 </ptrtype>
10113 <description>
10114 The actual function to call
10115 </description>
10116 </field>
10117 <field id="id">
10118 <allocfieldbuf><char/></allocfieldbuf>
10119 <description>
10120 The identifier for the extension function, encoded as a
10121 <internallink id="mUTF">modified UTF-8</internallink> string.
10122 Uses package name conventions.
10123 For example, <code>com.sun.hotspot.bar</code>
10124 </description>
10125 </field>
10126 <field id="short_description">
10127 <allocfieldbuf><char/></allocfieldbuf>
10128 <description>
10129 A one sentence description of the function, encoded as a
10130 <internallink id="mUTF">modified UTF-8</internallink> string.
10131 </description>
10132 </field>
10133 <field id="param_count">
10134 <jint/>
10135 <description>
10136 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
10137 </description>
10138 </field>
10139 <field id="params">
10140 <allocfieldbuf outcount="param_count">
10141 <struct>jvmtiParamInfo</struct>
10142 </allocfieldbuf>
10143 <description>
10144 Array of
10145 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
10146 parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
10147 </description>
10148 </field>
10149 <field id="error_count">
10150 <jint/>
10151 <description>
10152 The number of possible error returns (excluding universal errors)
10153 </description>
10154 </field>
10155 <field id="errors">
10156 <allocfieldbuf outcount="error_count">
10157 <enum>jvmtiError</enum>
10158 </allocfieldbuf>
10159 <description>
10160 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
10161 possible errors
10162 </description>
10163 </field>
10164 </typedef>
10165
10166 <description>
10167 Returns the set of extension functions.
10168 </description>
10169 <origin>new</origin>
10170 <capabilities>
10171 </capabilities>
10172 <parameters>
10173 <param id="extension_count_ptr">
10174 <outptr><jint/></outptr>
10175 <description>
10176 On return, points to the number of extension functions
10177 </description>
10178 </param>
10179 <param id="extensions">
10180 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>
10181 <description>
10182 Returns an array of extension function info, one per function
10183 </description>
10184 </param>
10185 </parameters>
10186 <errors>
10187 </errors>
10188 </function>
10189
10190 <function id="GetExtensionEvents" phase="onload" num="125">
10191 <synopsis>Get Extension Events</synopsis>
10192
10193 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">
10194 <field id="extension_event_index">
10195 <jint/>
10196 <description>
10197 The identifying index of the event
10198 </description>
10199 </field>
10200 <field id="id">
10201 <allocfieldbuf><char/></allocfieldbuf>
10202 <description>
10203 The identifier for the extension event, encoded as a
10204 <internallink id="mUTF">modified UTF-8</internallink> string.
10205 Uses package name conventions.
10206 For example, <code>com.sun.hotspot.bar</code>
10207 </description>
10208 </field>
10209 <field id="short_description">
10210 <allocfieldbuf><char/></allocfieldbuf>
10211 <description>
10212 A one sentence description of the event, encoded as a
10213 <internallink id="mUTF">modified UTF-8</internallink> string.
10214 </description>
10215 </field>
10216 <field id="param_count">
10217 <jint/>
10218 <description>
10219 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
10220 </description>
10221 </field>
10222 <field id="params">
10223 <allocfieldbuf outcount="param_count">
10224 <struct>jvmtiParamInfo</struct>
10225 </allocfieldbuf>
10226 <description>
10227 Array of
10228 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>
10229 parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
10230 </description>
10231 </field>
10232 </typedef>
10233
10234 <description>
10235 Returns the set of extension events.
10236 </description>
10237 <origin>new</origin>
10238 <capabilities>
10239 </capabilities>
10240 <parameters>
10241 <param id="extension_count_ptr">
10242 <outptr><jint/></outptr>
10243 <description>
10244 On return, points to the number of extension events
10245 </description>
10246 </param>
10247 <param id="extensions">
10248 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>
10249 <description>
10250 Returns an array of extension event info, one per event
10251 </description>
10252 </param>
10253 </parameters>
10254 <errors>
10255 </errors>
10256 </function>
10257
10258 <callback id="jvmtiExtensionEvent">
10259 <void/>
10260 <synopsis>Extension Event</synopsis>
10261 <description>
10262 This is the implementation-specific event.
10263 The event handler is set with
10264 <functionlink id="SetExtensionEventCallback"/>.
10265 <p/>
10266 Event handlers for extension events must be declared varargs to match this definition.
10267 Failure to do so could result in calling convention mismatch and undefined behavior
10268 on some platforms.
10269 <p/>
10270 For example, if the <code>jvmtiParamInfo</code>
10271 returned by <functionlink id="GetExtensionEvents"/> indicates that
10272 there is a <code>jint</code> parameter, the event handler should be
10273 declared:
10274 <example>
10275 void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
10276 </example>
10277 Note the terminal "<code>...</code>" which indicates varargs.
10278 The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
10279 the <code>va_*</code> syntax of the C programming language.
10280 </description>
10281 <parameters>
10282 <param id="jvmti_env">
10283 <outptr>
10284 <struct>jvmtiEnv</struct>
10285 </outptr>
10286 <description>
10287 The <jvmti/> environment is the only fixed parameter for extension events.
10288 </description>
10289 </param>
10290 <param id="...">
10291 <varargs/>
10292 <description>
10293 The extension event-specific parameters
10294 </description>
10295 </param>
10296 </parameters>
10297 </callback>
10298
10299 <function id="SetExtensionEventCallback" phase="onload" num="126">
10300 <synopsis>Set Extension Event Callback</synopsis>
10301
10302 <description>
10303 Sets the callback function for an extension event and
10304 enables the event. Or, if the callback is null, disables
10305 the event. Note that unlike standard events, setting
10306 the callback and enabling the event are a single operation.
10307 </description>
10308 <origin>new</origin>
10309 <capabilities>
10310 </capabilities>
10311 <parameters>
10312 <param id="extension_event_index">
10313 <jint/>
10314 <description>
10315 Identifies which callback to set.
10316 This index is the
10317 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>
10318 field of
10319 <datalink id="jvmtiExtensionEventInfo"/>.
10320 </description>
10321 </param>
10322 <param id="callback">
10323 <ptrtype>
10324 <struct>jvmtiExtensionEvent</struct>
10325 <nullok>disable the event</nullok>
10326 </ptrtype>
10327 <description>
10328 If <code>callback</code> is non-null,
10329 set <code>callback</code> to be the event callback function
10330 and enable the event.
10331 </description>
10332 </param>
10333 </parameters>
10334 <errors>
10335 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
10336 <paramlink id="extension_event_index"/> is not an
10337 <fieldlink id="extension_event_index"
10338 struct="jvmtiExtensionEventInfo"/>
10339 returned by
10340 <functionlink id="GetExtensionEvents"/>
10341 </error>
10342 </errors>
10343 </function>
10344
10345 </category>
10346
10347 <category id="capability" label="Capability">
10348
10349 <intro>
10350 The capabilities functions allow you to change the
10351 functionality available to <jvmti/>--that is,
10352 which <jvmti/>
10353 functions can be called, what events can be generated,
10354 and what functionality these events and functions can
10355 provide.
10356 <p/>
10357 The "Capabilities" section of each function and event describe which
10358 capabilities, if any, they are associated with. "Required Functionality"
10359 means it is available for use and no capabilities must be added to use it.
10360 "Optional Functionality" means the agent must possess the capability
10361 before it can be used.
10362 To possess a capability, the agent must
10363 <functionlink id="AddCapabilities">add the capability</functionlink>.
10364 "Optional Features" describe capabilities which,
10365 if added, extend the feature set.
10366 <p/>
10367 The potentially available capabilities of each <jvmti/> implementation are different.
10368 Depending on the implementation, a capability:
10369 <ul>
10370 <li>may never be added</li>
10371 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>
10372 <li>may be added only during the <code>OnLoad</code> phase</li>
10373 <li>may be possessed by only one environment at a time</li>
10374 <li>may be possessed by only one environment at a time,
10375 and only during the <code>OnLoad</code> phase</li>
10376 <li>and so on ...</li>
10377 </ul>
10378 Frequently, the addition of a capability may incur a cost in execution speed, start up
10379 time, and/or memory footprint. Note that the overhead of using a capability
10380 is completely different than the overhead of possessing a capability.
10381 Take single stepping as an example. When single stepping is on (that
10382 is, when the event is enabled and thus actively sending events)
10383 the overhead of sending and processing an event
10384 on each instruction is huge in any implementation.
10385 However, the overhead of possessing the capability may be small or large,
10386 depending on the implementation. Also, when and if a capability is potentially
10387 available depends on the implementation. Some examples:
10388 <ul>
10389 <li>One VM might perform all execution by compiling bytecodes into
10390 native code and be unable to generate single step instructions.
10391 In this implementation the capability can not be added.</li>
10392 <li>Another VM may be able to switch execution to a single stepping
10393 interpreter at any time. In this implementation, having the capability has no
10394 overhead and could be added at any time.</li>
10395 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted
10396 execution engine at start up, but be unable to switch between them.
10397 In this implementation the capability would need to be added
10398 during the <code>OnLoad</code> phase (before bytecode
10399 execution begins) and would have a large impact on execution speed
10400 even if single stepping was never used.</li>
10401 <li>Still another VM might be able to add an "is single stepping on" check
10402 into compiled bytecodes or a generated interpreter. Again in this implementation
10403 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test
10404 and branch on each instruction) would be considerably less.</li>
10405 </ul>
10406 <p/>
10407 Each <jvmti/> <internallink id="environments">environment</internallink>
10408 has its own set of capabilities.
10409 Initially, that set is empty.
10410 Any desired capability must be added.
10411 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most
10412 virtual machines certain capabilities require special set up for
10413 the virtual machine and this set up must happen
10414 during the <code>OnLoad</code> phase, before the virtual machine begins execution.
10415 Once a capability is added, it can
10416 only be removed if explicitly relinquished by the environment.
10417 <p/>
10418 The agent can,
10419 <functionlink id="GetPotentialCapabilities">determine what
10420 capabilities this VM can potentially provide</functionlink>,
10421 <functionlink id="AddCapabilities">add the capabilities
10422 to be used</functionlink>,
10423 <functionlink id="RelinquishCapabilities">release capabilities
10424 which are no longer needed</functionlink>, and
10425 <functionlink id="GetCapabilities">examine the currently available
10426 capabilities</functionlink>.
10427 </intro>
10428
10429 <intro id="capabilityExamples" label="Capability Examples">
10430 For example, a freshly started agent (in the <code>OnLoad</code> function)
10431 wants to enable all possible capabilities.
10432 Note that, in general, this is not advisable as the agent may suffer
10433 a performance penalty for functionality it is not using.
10434 The code might look like this in C:
10435 <example>
10436 jvmtiCapabilities capa;
10437 jvmtiError err;
10438
10439 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa);
10440 if (err == JVMTI_ERROR_NONE) {
10441 err = (*jvmti)->AddCapabilities(jvmti, &capa);
10442 </example>
10443 For example, if an agent wants to check if it can get
10444 the bytecodes of a method (that is, it wants to check
10445 if it previously added this capability and has not
10446 relinquished it), the code might
10447 look like this in C:
10448 <example>
10449 jvmtiCapabilities capa;
10450 jvmtiError err;
10451
10452 err = (*jvmti)->GetCapabilities(jvmti, &capa);
10453 if (err == JVMTI_ERROR_NONE) {
10454 if (capa.can_get_bytecodes) { ... } }
10455 </example>
10456 </intro>
10457
10458 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">
10459 <description>
10460 The functions in this category use this capabilities structure
10461 which contains boolean flags corresponding to each capability:
10462 </description>
10463 <capabilityfield id="can_tag_objects">
10464 <description>
10465 Can set and get tags, as described in the
10466 <internallink id="Heap">Heap category</internallink>.
10467 </description>
10468 </capabilityfield>
10469 <capabilityfield id="can_generate_field_modification_events">
10470 <description>
10471 Can set watchpoints on field modification -
10472 <functionlink id="SetFieldModificationWatch"></functionlink>
10473 </description>
10474 </capabilityfield>
10475 <capabilityfield id="can_generate_field_access_events">
10476 <description>
10477 Can set watchpoints on field access -
10478 <functionlink id="SetFieldAccessWatch"></functionlink>
10479 </description>
10480 </capabilityfield>
10481 <capabilityfield id="can_get_bytecodes">
10482 <description>
10483 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>
10484 </description>
10485 </capabilityfield>
10486 <capabilityfield id="can_get_synthetic_attribute">
10487 <description>
10488 Can test if a field or method is synthetic -
10489 <functionlink id="IsFieldSynthetic"></functionlink> and
10490 <functionlink id="IsMethodSynthetic"></functionlink>
10491 </description>
10492 </capabilityfield>
10493 <capabilityfield id="can_get_owned_monitor_info">
10494 <description>
10495 Can get information about ownership of monitors -
10496 <functionlink id="GetOwnedMonitorInfo"></functionlink>
10497 </description>
10498 </capabilityfield>
10499 <capabilityfield id="can_get_current_contended_monitor">
10500 <description>
10501 Can <functionlink id="GetCurrentContendedMonitor"></functionlink>
10502 </description>
10503 </capabilityfield>
10504 <capabilityfield id="can_get_monitor_info">
10505 <description>
10506 Can <functionlink id="GetObjectMonitorUsage"></functionlink>
10507 </description>
10508 </capabilityfield>
10509 <capabilityfield id="can_pop_frame">
10510 <description>
10511 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>
10512 </description>
10513 </capabilityfield>
10514 <capabilityfield id="can_redefine_classes">
10515 <description>
10516 Can redefine classes with <functionlink id="RedefineClasses"/>.
10517 </description>
10518 </capabilityfield>
10519 <capabilityfield id="can_signal_thread">
10520 <description>
10521 Can send stop or interrupt to threads
10522 </description>
10523 </capabilityfield>
10524 <capabilityfield id="can_get_source_file_name">
10525 <description>
10526 Can get the source file name of a class
10527 </description>
10528 </capabilityfield>
10529 <capabilityfield id="can_get_line_numbers">
10530 <description>
10531 Can get the line number table of a method
10532 </description>
10533 </capabilityfield>
10534 <capabilityfield id="can_get_source_debug_extension">
10535 <description>
10536 Can get the source debug extension of a class
10537 </description>
10538 </capabilityfield>
10539 <capabilityfield id="can_access_local_variables">
10540 <description>
10541 Can set and get local variables
10542 </description>
10543 </capabilityfield>
10544 <capabilityfield id="can_maintain_original_method_order">
10545 <description>
10546 Can return methods in the order they occur in the class file
10547 </description>
10548 </capabilityfield>
10549 <capabilityfield id="can_generate_single_step_events">
10550 <description>
10551 Can get <eventlink id="SingleStep">single step</eventlink> events
10552 </description>
10553 </capabilityfield>
10554 <capabilityfield id="can_generate_exception_events">
10555 <description>
10556 Can get <eventlink id="Exception">exception thrown</eventlink> and
10557 <eventlink id="ExceptionCatch">exception catch</eventlink> events
10558 </description>
10559 </capabilityfield>
10560 <capabilityfield id="can_generate_frame_pop_events">
10561 <description>
10562 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get
10563 <eventlink id="FramePop"></eventlink> events
10564 </description>
10565 </capabilityfield>
10566 <capabilityfield id="can_generate_breakpoint_events">
10567 <description>
10568 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get
10569 <eventlink id="Breakpoint"></eventlink> events
10570 </description>
10571 </capabilityfield>
10572 <capabilityfield id="can_suspend">
10573 <description>
10574 Can suspend and resume threads
10575 </description>
10576 </capabilityfield>
10577 <capabilityfield id="can_redefine_any_class">
10578 <description>
10579 <functionlink id="RedefineClasses"/> can be called on any modifiable class.
10580 See <functionlink id="IsModifiableClass"/>.
10581 (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
10582 must also be set)
10583 </description>
10584 </capabilityfield>
10585 <capabilityfield id="can_get_current_thread_cpu_time">
10586 <description>
10587 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>
10588 current thread CPU time
10589 </description>
10590 </capabilityfield>
10591 <capabilityfield id="can_get_thread_cpu_time">
10592 <description>
10593 Can <functionlink id="GetThreadCpuTime">get</functionlink>
10594 thread CPU time
10595 </description>
10596 </capabilityfield>
10597 <capabilityfield id="can_generate_method_entry_events"
10598 disp1="can_generate" disp2="_method_entry_events"
10599 >
10600 <description>
10601 Can generate method entry events on entering a method
10602 </description>
10603 </capabilityfield>
10604 <capabilityfield id="can_generate_method_exit_events"
10605 disp1="can_generate" disp2="_method_exit_events"
10606 >
10607 <description>
10608 Can generate method exit events on leaving a method
10609 </description>
10610 </capabilityfield>
10611 <capabilityfield id="can_generate_all_class_hook_events"
10612 disp1="can_generate" disp2="_all_class_hook_events"
10613 >
10614 <description>
10615 Can generate ClassFileLoadHook events for every loaded class.
10616 </description>
10617 </capabilityfield>
10618 <capabilityfield id="can_generate_compiled_method_load_events"
10619 disp1="can_generate" disp2="_compiled_method_load_events"
10620 >
10621 <description>
10622 Can generate events when a method is compiled or unloaded
10623 </description>
10624 </capabilityfield>
10625 <capabilityfield id="can_generate_monitor_events"
10626 disp1="can_generate" disp2="_monitor_events"
10627 >
10628 <description>
10629 Can generate events on monitor activity
10630 </description>
10631 </capabilityfield>
10632 <capabilityfield id="can_generate_vm_object_alloc_events"
10633 disp1="can_generate" disp2="_vm_object_alloc_events"
10634 >
10635 <description>
10636 Can generate events on VM allocation of an object
10637 </description>
10638 </capabilityfield>
10639 <capabilityfield id="can_generate_native_method_bind_events"
10640 disp1="can_generate" disp2="_native_method_bind_events"
10641 >
10642 <description>
10643 Can generate events when a native method is bound to its
10644 implementation
10645 </description>
10646 </capabilityfield>
10647 <capabilityfield id="can_generate_garbage_collection_events"
10648 disp1="can_generate" disp2="_garbage_collection_events"
10649 >
10650 <description>
10651 Can generate events when garbage collection begins or ends
10652 </description>
10653 </capabilityfield>
10654 <capabilityfield id="can_generate_object_free_events"
10655 disp1="can_generate" disp2="_object_free_events"
10656 >
10657 <description>
10658 Can generate events when the garbage collector frees an object
10659 </description>
10660 </capabilityfield>
10661 <capabilityfield id="can_force_early_return" since="1.1">
10662 <description>
10663 Can return early from a method, as described in the
10664 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>.
10665 </description>
10666 </capabilityfield>
10667 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">
10668 <description>
10669 Can get information about owned monitors with stack depth -
10670 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>
10671 </description>
10672 </capabilityfield>
10673 <capabilityfield id="can_get_constant_pool" since="1.1">
10674 <description>
10675 Can get the constant pool of a class -
10676 <functionlink id="GetConstantPool"></functionlink>
10677 </description>
10678 </capabilityfield>
10679 <capabilityfield id="can_set_native_method_prefix" since="1.1">
10680 <description>
10681 Can set prefix to be applied when native method cannot be resolved -
10682 <functionlink id="SetNativeMethodPrefix"/> and
10683 <functionlink id="SetNativeMethodPrefixes"/>
10684 </description>
10685 </capabilityfield>
10686 <capabilityfield id="can_retransform_classes" since="1.1">
10687 <description>
10688 Can retransform classes with <functionlink id="RetransformClasses"/>.
10689 In addition to the restrictions imposed by the specific
10690 implementation on this capability (see the
10691 <internallink id="capability">Capability</internallink> section),
10692 this capability must be set before the
10693 <eventlink id="ClassFileLoadHook"/> event is enabled for the
10694 first time in this environment.
10695 An environment that possesses this capability at the time that
10696 <code>ClassFileLoadHook</code> is enabled for the first time is
10697 said to be <i>retransformation capable</i>.
10698 An environment that does not possess this capability at the time that
10699 <code>ClassFileLoadHook</code> is enabled for the first time is
10700 said to be <i>retransformation incapable</i>.
10701 </description>
10702 </capabilityfield>
10703 <capabilityfield id="can_retransform_any_class" since="1.1">
10704 <description>
10705 <functionlink id="RetransformClasses"/> can be called on any modifiable class.
10706 See <functionlink id="IsModifiableClass"/>.
10707 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
10708 must also be set)
10709 </description>
10710 </capabilityfield>
10711 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">
10712 <description>
10713 Can generate events when the VM is unable to allocate memory from
10714 the <tm>Java</tm> platform heap.
10715 See <eventlink id="ResourceExhausted"/>.
10716 </description>
10717 </capabilityfield>
10718 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">
10719 <description>
10720 Can generate events when the VM is unable to create a thread.
10721 See <eventlink id="ResourceExhausted"/>.
10722 </description>
10723 </capabilityfield>
10724 <capabilityfield id="can_generate_early_vmstart" since="9">
10725 <description>
10726 Can generate the <code>VMStart</code> event early.
10727 See <eventlink id="VMStart"/>.
10728 </description>
10729 </capabilityfield>
10730 <capabilityfield id="can_generate_early_class_hook_events" since="9">
10731 <description>
10732 Can generate the <eventlink id="ClassFileLoadHook"/> events
10733 in the primordial phase. If this capability and
10734 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
10735 <code>can_generate_all_class_hook_events</code></internallink>
10736 are enabled then the <eventlink id="ClassFileLoadHook"/> events
10737 can be posted for classes loaded in the primordial phase.
10738 See <eventlink id="ClassFileLoadHook"/>.
10739 </description>
10740 </capabilityfield>
10741 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11">
10742 <description>
10743 Can generate sampled allocation events.
10744 If this capability is enabled then the heap sampling method
10745 <functionlink id="SetHeapSamplingInterval"></functionlink> can be
10746 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.
10747 </description>
10748 </capabilityfield>
10749 <capabilityfield id="can_support_virtual_threads" since="21">
10750 <description>
10751 Can support virtual threads.
10752 If this capability is enabled then the following functions can be called:
10753 <functionlink id="SuspendAllVirtualThreads"></functionlink>,
10754 <functionlink id="ResumeAllVirtualThreads"></functionlink>,
10755 and the following events can be enabled:
10756 <eventlink id="VirtualThreadStart"></eventlink>,
10757 <eventlink id="VirtualThreadEnd"></eventlink>.
10758 </description>
10759 </capabilityfield>
10760 <capabilityfield id="can_support_value_objects" since="28">
10761 <description>
10762 Can support value objects.
10763 When preview features are enabled and this capability is enabled, then
10764 events are sent for value objects when the following two events are enabled:
10765 <eventlink id="VMObjectAlloc"></eventlink>,
10766 <eventlink id="SampledObjectAlloc"></eventlink>.
10767 <b> can_support_value_objects is a preview API of the Java platform. </b>
10768 <i>Preview features may be removed in a future release, or upgraded to
10769 permanent features of the Java platform.</i>
10770 </description>
10771 </capabilityfield>
10772 </capabilitiestypedef>
10773
10774 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">
10775 <synopsis>Get Potential Capabilities</synopsis>
10776 <description>
10777 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>
10778 features that can potentially be possessed by this environment
10779 at this time.
10780 The returned capabilities differ from the complete set of capabilities
10781 implemented by the VM in two cases: another environment possesses
10782 capabilities that can only be possessed by one environment, or the
10783 current <functionlink id="GetPhase">phase</functionlink> is live,
10784 and certain capabilities can only be added during the <code>OnLoad</code> phase.
10785 The <functionlink id="AddCapabilities"></functionlink> function
10786 may be used to set any or all or these capabilities.
10787 Currently possessed capabilities are included.
10788 <p/>
10789 Typically this function is used in the <code>OnLoad</code> function.
10790 Some virtual machines may allow a limited set of capabilities to be
10791 added in the live phase.
10792 In this case, the set of potentially available capabilities
10793 will likely differ from the <code>OnLoad</code> phase set.
10794 <p/>
10795 See the
10796 <internallink id="capabilityExamples">Capability Examples</internallink>.
10797 </description>
10798 <origin>new</origin>
10799 <capabilities>
10800 </capabilities>
10801 <parameters>
10802 <param id="capabilities_ptr">
10803 <outptr><struct>jvmtiCapabilities</struct></outptr>
10804 <description>
10805 On return, points to the <jvmti/> capabilities that may be added.
10806 </description>
10807 </param>
10808 </parameters>
10809 <errors>
10810 </errors>
10811 </function>
10812
10813 <elide>
10814 <function id="EstimateCostOfCapabilities" phase="onload" num="141">
10815 <synopsis>Estimate Cost Of Capabilities</synopsis>
10816 <description>
10817 <issue>There is strong opposition to this function. The concern is
10818 that it would be difficult or impossible to provide meaningful
10819 numbers, as the amount of impact is conditional on many factors
10820 that a single number could not represent. There is doubt that
10821 conditional implementations would be used or are even a good idea.
10822 The thought is that release documentation for the implementation
10823 would be the best means of exposing this information.
10824 Unless new arguments are presented, I intend to remove this
10825 function in the next revision.
10826 </issue>
10827 <p/>
10828 Return via the <paramlink id="time_impact_ptr"></paramlink> and
10829 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact
10830 of adding the capabilities pointed to by
10831 <paramlink id="capabilities_ptr"></paramlink>.
10832 The returned estimates are in percentage of additional overhead, thus
10833 a time impact of 100 mean the application might run
10834 at half the speed.
10835 The estimates are very rough approximations and are not guaranteed.
10836 Note also, that the estimates are of the impact of having the
10837 capability available--when and if it is used the impact may be
10838 much greater.
10839 Estimates can be for a single capability or for a set of
10840 capabilities. Note that the costs are not necessarily additive,
10841 adding support for one capability might make another available
10842 for free or conversely having two capabilities at once may
10843 have multiplicative impact.
10844 Estimates are relative to the current set of capabilities -
10845 that is, how much more impact given the currently possessed capabilities.
10846 <p/>
10847 Typically this function is used in the OnLoad function,
10848 some virtual machines may allow a limited set of capabilities to be
10849 added in the live phase.
10850 In this case, the set of potentially available capabilities
10851 will likely differ from the OnLoad phase set.
10852 <p/>
10853 See the
10854 <internallink id="capabilityExamples">Capability Examples</internallink>.
10855 </description>
10856 <origin>new</origin>
10857 <capabilities>
10858 </capabilities>
10859 <parameters>
10860 <param id="capabilities_ptr">
10861 <inptr><struct>jvmtiCapabilities</struct></inptr>
10862 <description>
10863 points to the <jvmti/> capabilities to evaluate.
10864 </description>
10865 </param>
10866 <param id="time_impact_ptr">
10867 <outptr><jint/></outptr>
10868 <description>
10869 On return, points to the estimated percentage increase in
10870 run time if this capability was added.
10871 </description>
10872 </param>
10873 <param id="space_impact_ptr">
10874 <outptr><jint/></outptr>
10875 <description>
10876 On return, points to the estimated percentage increase in
10877 memory space used if this capability was added.
10878 </description>
10879 </param>
10880 </parameters>
10881 <errors>
10882 <error id="JVMTI_ERROR_NOT_AVAILABLE">
10883 The desired capabilities are not even potentially available.
10884 </error>
10885 </errors>
10886 </function>
10887 </elide>
10888
10889 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142">
10890 <synopsis>Add Capabilities</synopsis>
10891 <description>
10892 Set new capabilities by adding the capabilities
10893 whose values are set to one (<code>1</code>) in
10894 <code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10895 All previous capabilities are retained.
10896 Typically this function is used in the <code>OnLoad</code> function.
10897 Some virtual machines may allow a limited set of capabilities to be
10898 added in the live phase.
10899 <p/>
10900 See the
10901 <internallink id="capabilityExamples">Capability Examples</internallink>.
10902 </description>
10903 <origin>new</origin>
10904 <capabilities>
10905 </capabilities>
10906 <parameters>
10907 <param id="capabilities_ptr">
10908 <inptr><struct>jvmtiCapabilities</struct></inptr>
10909 <description>
10910 Points to the <jvmti/> capabilities to add.
10911 </description>
10912 </param>
10913 </parameters>
10914 <errors>
10915 <error id="JVMTI_ERROR_NOT_AVAILABLE">
10916 The desired capabilities are not even potentially available.
10917 </error>
10918 </errors>
10919 </function>
10920
10921
10922 <function id="RelinquishCapabilities" phase="onload" num="143">
10923 <synopsis>Relinquish Capabilities</synopsis>
10924 <description>
10925 Relinquish the capabilities
10926 whose values are set to one (<code>1</code>) in
10927 <code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10928 Some implementations may allow only one environment to have a capability
10929 (see the <internallink id="capability">capability introduction</internallink>).
10930 This function releases capabilities
10931 so that they may be used by other agents.
10932 All other capabilities are retained.
10933 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.
10934 Attempting to relinquish a capability that the agent does not possess is not an error.
10935 <issue>
10936 It is possible for the agent to be actively using capabilities
10937 which are being relinquished. For example, a thread is currently
10938 suspended and can_suspend is being relinquished or an event is currently
10939 enabled and can_generate_whatever is being relinquished.
10940 There are three possible ways we could spec this:
10941 <ul>
10942 <li>relinquish automatically releases them</li>
10943 <li>relinquish checks and returns some error code if held</li>
10944 <li>it is the agent's responsibility and it is not checked</li>
10945 </ul>
10946 One of these should be chosen.
10947 </issue>
10948 </description>
10949 <origin>new</origin>
10950 <capabilities>
10951 </capabilities>
10952 <parameters>
10953 <param id="capabilities_ptr">
10954 <inptr><struct>jvmtiCapabilities</struct></inptr>
10955 <description>
10956 Points to the <jvmti/> capabilities to relinquish.
10957 </description>
10958 </param>
10959 </parameters>
10960 <errors>
10961 </errors>
10962 </function>
10963
10964
10965
10966 <function id="GetCapabilities" jkernel="yes" phase="any" num="89">
10967 <synopsis>Get Capabilities</synopsis>
10968 <description>
10969 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>
10970 features which this environment currently possesses.
10971 Each possessed capability is indicated by a one (<code>1</code>) in the
10972 corresponding field of the <internallink id="jvmtiCapabilities">capabilities
10973 structure</internallink>.
10974 An environment does not possess a capability unless it has been successfully added with
10975 <functionlink id="AddCapabilities"/>.
10976 An environment only loses possession of a capability if it has been relinquished with
10977 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result
10978 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which
10979 have been made.
10980 <p/>
10981 See the
10982 <internallink id="capabilityExamples">Capability Examples</internallink>.
10983 </description>
10984 <origin>jvmdiClone</origin>
10985 <capabilities>
10986 </capabilities>
10987 <parameters>
10988 <param id="capabilities_ptr">
10989 <outptr><struct>jvmtiCapabilities</struct></outptr>
10990 <description>
10991 On return, points to the <jvmti/> capabilities.
10992 </description>
10993 </param>
10994 </parameters>
10995 <errors>
10996 </errors>
10997 </function>
10998
10999 </category>
11000
11001
11002 <category id="timers" label="Timers">
11003
11004 <intro>
11005 These functions provide timing information.
11006 The resolution at which the time is updated is not specified.
11007 They provides nanosecond precision, but not necessarily nanosecond accuracy.
11008 Details about the timers, such as their maximum values, can be accessed with
11009 the timer information functions.
11010 </intro>
11011
11012 <typedef id="jvmtiTimerInfo" label="Timer Info">
11013 <description>
11014 The information function for each timer returns this data structure.
11015 </description>
11016 <field id="max_value">
11017 <jlong/>
11018 <description>
11019 The maximum value the timer can reach.
11020 After this value is reached the timer wraps back to zero.
11021 This is an unsigned value. If tested or printed as a jlong (signed value)
11022 it may appear to be a negative number.
11023 </description>
11024 </field>
11025 <field id="may_skip_forward">
11026 <jboolean/>
11027 <description>
11028 If true, the timer can be externally adjusted and as a result skip forward.
11029 If false, the timer value will never increase faster than real time.
11030 </description>
11031 </field>
11032 <field id="may_skip_backward">
11033 <jboolean/>
11034 <description>
11035 If true, the timer can be externally adjusted and as a result skip backward.
11036 If false, the timer value will be monotonically increasing.
11037 </description>
11038 </field>
11039 <field id="kind">
11040 <enum>jvmtiTimerKind</enum>
11041 <description>
11042 The kind of timer.
11043 On a platform that does not distinguish between user and system time, <datalink
11044 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>
11045 is returned.
11046 </description>
11047 </field>
11048 <field id="reserved1">
11049 <jlong/>
11050 <description>
11051 Reserved for future use.
11052 </description>
11053 </field>
11054 <field id="reserved2">
11055 <jlong/>
11056 <description>
11057 Reserved for future use.
11058 </description>
11059 </field>
11060 </typedef>
11061
11062 <intro>
11063 Where the timer kind is --
11064
11065 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">
11066 <constant id="JVMTI_TIMER_USER_CPU" num="30">
11067 CPU time that a thread is in user mode.
11068 </constant>
11069 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31">
11070 CPU time that a thread is in user or system mode.
11071 </constant>
11072 <constant id="JVMTI_TIMER_ELAPSED" num="32">
11073 Elapsed time.
11074 </constant>
11075 </constants>
11076 </intro>
11077
11078 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">
11079 <synopsis>Get Current Thread CPU Timer Information</synopsis>
11080 <description>
11081 Get information about the
11082 <functionlink id="GetCurrentThreadCpuTime"/> timer.
11083 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11084 are filled in with details about the timer.
11085 This information is specific to the platform and the implementation of
11086 <functionlink id="GetCurrentThreadCpuTime"/> and thus
11087 does not vary by thread nor does it vary
11088 during a particular invocation of the VM.
11089 <p/>
11090 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
11091 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
11092 returned by <code>GetCurrentThreadCpuTimerInfo</code>
11093 and <functionlink id="GetThreadCpuTimerInfo"/>
11094 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
11095 </description>
11096 <origin>new</origin>
11097 <capabilities>
11098 <required id="can_get_current_thread_cpu_time">
11099 Can get current thread CPU time.
11100 </required>
11101 </capabilities>
11102 <parameters>
11103 <param id="info_ptr">
11104 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11105 <description>
11106 On return, filled with information describing the time
11107 returned by <functionlink id="GetCurrentThreadCpuTime"/>.
11108 </description>
11109 </param>
11110 </parameters>
11111 <errors>
11112 </errors>
11113 </function>
11114
11115 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">
11116 <synopsis>Get Current Thread CPU Time</synopsis>
11117 <description>
11118 Return the CPU time utilized by the current thread.
11119 <p/>
11120 Note that the <functionlink id="GetThreadCpuTime"/>
11121 function provides CPU time for any thread, including
11122 the current thread. <code>GetCurrentThreadCpuTime</code>
11123 exists to support platforms which cannot
11124 supply CPU time for threads other than the current
11125 thread or which have more accurate information for
11126 the current thread (see
11127 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs
11128 <functionlink id="GetThreadCpuTimerInfo"/>).
11129 An implementation is not required to support this function
11130 when the current thread is a virtual thread, in which case
11131 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
11132 On many platforms this call will be equivalent to:
11133 <example>
11134 GetThreadCpuTime(env, NULL, nanos_ptr)
11135 </example>
11136 </description>
11137 <origin>new</origin>
11138 <capabilities>
11139 <required id="can_get_current_thread_cpu_time">
11140 Can get current thread CPU time.
11141 <p/>
11142 If this capability is enabled after threads have started,
11143 the implementation may choose any time up
11144 to and including the time that the capability is enabled
11145 as the point where CPU time collection starts.
11146 <p/>
11147 This capability must be potentially available on any
11148 platform where
11149 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>
11150 is potentially available.
11151 </required>
11152 </capabilities>
11153 <parameters>
11154 <param id="nanos_ptr">
11155 <outptr><jlong/></outptr>
11156 <description>
11157 On return, points to the CPU time used by this thread
11158 in nanoseconds.
11159 This is an unsigned value. If tested or printed as a jlong (signed value)
11160 it may appear to be a negative number.
11161 </description>
11162 </param>
11163 </parameters>
11164 <errors>
11165 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
11166 The current thread is a virtual thread and the implementation does not support
11167 getting the current thread CPU time when the current thread is a virtual thread.
11168 </error>
11169 </errors>
11170 </function>
11171
11172 <function id="GetThreadCpuTimerInfo" num="136">
11173 <synopsis>Get Thread CPU Timer Information</synopsis>
11174 <description>
11175 Get information about the
11176 <functionlink id="GetThreadCpuTime"/> timer.
11177 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11178 are filled in with details about the timer.
11179 This information is specific to the platform and the implementation of
11180 <functionlink id="GetThreadCpuTime"/> and thus
11181 does not vary by thread nor does it vary
11182 during a particular invocation of the VM.
11183 <p/>
11184 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
11185 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
11186 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>
11187 and <code>GetThreadCpuTimerInfo</code>
11188 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
11189 </description>
11190 <origin>new</origin>
11191 <capabilities>
11192 <required id="can_get_thread_cpu_time">
11193 Can get thread CPU time.
11194 </required>
11195 </capabilities>
11196 <parameters>
11197 <param id="info_ptr">
11198 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11199 <description>
11200 On return, filled with information describing the time
11201 returned by <functionlink id="GetThreadCpuTime"/>.
11202 </description>
11203 </param>
11204 </parameters>
11205 <errors>
11206 </errors>
11207 </function>
11208
11209 <function id="GetThreadCpuTime" num="137">
11210 <synopsis>Get Thread CPU Time</synopsis>
11211 <description>
11212 Return the CPU time utilized by the specified thread.
11213 <p/>
11214 Get information about this timer with
11215 <functionlink id="GetThreadCpuTimerInfo"/>.
11216 </description>
11217 <origin>new</origin>
11218 <capabilities>
11219 <required id="can_get_thread_cpu_time">
11220 Can get thread CPU time.
11221 <p/>
11222 If this capability is enabled after threads have started,
11223 the implementation may choose any time up
11224 to and including the time that the capability is enabled
11225 as the point where CPU time collection starts.
11226 </required>
11227 </capabilities>
11228 <parameters>
11229 <param id="thread">
11230 <jthread null="current" impl="noconvert"/>
11231 <description>
11232 The thread to query.
11233 An implementation is not required to support this function
11234 when the given thread is a virtual thread, in which case
11235 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
11236 </description>
11237 </param>
11238 <param id="nanos_ptr">
11239 <outptr impl="nonullcheck"><jlong/></outptr>
11240 <description>
11241 On return, points to the CPU time used by the specified thread
11242 in nanoseconds.
11243 This is an unsigned value. If tested or printed as a jlong (signed value)
11244 it may appear to be a negative number.
11245 </description>
11246 </param>
11247 </parameters>
11248 <errors>
11249 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
11250 <paramlink id="thread"/> is a virtual thread and the implementation does not
11251 support getting the thread CPU time of a virtual thread.
11252 </error>
11253 </errors>
11254 </function>
11255
11256 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">
11257 <synopsis>Get Timer Information</synopsis>
11258 <description>
11259 Get information about the
11260 <functionlink id="GetTime"/> timer.
11261 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11262 are filled in with details about the timer.
11263 This information will not change during a particular invocation of the VM.
11264 </description>
11265 <origin>new</origin>
11266 <capabilities>
11267 </capabilities>
11268 <parameters>
11269 <param id="info_ptr">
11270 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11271 <description>
11272 On return, filled with information describing the time
11273 returned by <functionlink id="GetTime"/>.
11274 </description>
11275 </param>
11276 </parameters>
11277 <errors>
11278 </errors>
11279 </function>
11280
11281 <function id="GetTime" phase="any" callbacksafe="safe" num="139">
11282 <synopsis>Get Time</synopsis>
11283 <description>
11284 Return the current value of the system timer, in nanoseconds.
11285 <p/>
11286 The value returned represents nanoseconds since some fixed but
11287 arbitrary time (perhaps in the future, so values may be
11288 negative). This function provides nanosecond precision, but not
11289 necessarily nanosecond accuracy. No guarantees are made about
11290 how frequently values change.
11291 <p/>
11292 Get information about this timer with
11293 <functionlink id="GetTimerInfo"/>.
11294 </description>
11295 <origin>new</origin>
11296 <capabilities>
11297 </capabilities>
11298 <parameters>
11299 <param id="nanos_ptr">
11300 <outptr><jlong/></outptr>
11301 <description>
11302 On return, points to the time in nanoseconds.
11303 This is an unsigned value. If tested or printed as a jlong (signed value)
11304 it may appear to be a negative number.
11305 </description>
11306 </param>
11307 </parameters>
11308 <errors>
11309 </errors>
11310 </function>
11311
11312 <function id="GetAvailableProcessors" phase="any" num="144">
11313 <synopsis>Get Available Processors</synopsis>
11314 <description>
11315 Returns the number of processors available to the Java virtual machine.
11316 <p/>
11317 This value may change during a particular invocation of the virtual machine.
11318 Applications that are sensitive to the number of available processors should
11319 therefore occasionally poll this property.
11320 </description>
11321 <origin>new</origin>
11322 <capabilities>
11323 </capabilities>
11324 <parameters>
11325 <param id="processor_count_ptr">
11326 <outptr><jint/></outptr>
11327 <description>
11328 On return, points to the maximum number of processors available to the
11329 virtual machine; never smaller than one.
11330 </description>
11331 </param>
11332 </parameters>
11333 <errors>
11334 </errors>
11335 </function>
11336
11337 </category>
11338
11339
11340 <category id="classLoaderSearch" label="Class Loader Search">
11341
11342 <intro>
11343 These functions allow the agent to add to the locations that a class loader searches for a class.
11344 This is useful for installing instrumentation under the correct class loader.
11345 </intro>
11346
11347 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">
11348 <synopsis>Add To Bootstrap Class Loader Search</synopsis>
11349 <description>
11350 This function can be used to cause instrumentation classes to be defined by the
11351 bootstrap class loader. See <vmspec chapter="5.3.1"/>.
11352 After the bootstrap
11353 class loader unsuccessfully searches for a class, the specified platform-dependent
11354 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in
11355 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,
11356 the segments will be searched in the order that this function was called.
11357 <p/>
11358 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11359 search path segment to be searched after the bootstrap class loader unsuccessfully searches
11360 for a class. The segment is typically a directory or JAR file.
11361 <p/>
11362 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent
11363 path to a <externallink id="jar/jar.html">
11364 JAR file</externallink>. The agent should take care that the JAR file does not
11365 contain any classes or resources other than those to be defined by the bootstrap
11366 class loader for the purposes of instrumentation.
11367 <p/>
11368 <vmspec/> specifies that a subsequent attempt to resolve a symbolic
11369 reference that the Java virtual machine has previously unsuccessfully attempted
11370 to resolve always fails with the same error that was thrown as a result of the
11371 initial resolution attempt. Consequently, if the JAR file contains an entry
11372 that corresponds to a class for which the Java virtual machine has
11373 unsuccessfully attempted to resolve a reference, then subsequent attempts to
11374 resolve that reference will fail with the same error as the initial attempt.
11375 </description>
11376 <origin>new</origin>
11377 <capabilities>
11378 </capabilities>
11379 <parameters>
11380 <param id="segment">
11381 <inbuf><char/></inbuf>
11382 <description>
11383 The platform-dependent search path segment, encoded as a
11384 <internallink id="mUTF">modified UTF-8</internallink> string.
11385 </description>
11386 </param>
11387 </parameters>
11388 <errors>
11389 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11390 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11391 existing JAR file is an invalid path.
11392 </error>
11393 </errors>
11394 </function>
11395
11396 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">
11397 <synopsis>Add To System Class Loader Search</synopsis>
11398 <description>
11399 This function can be used to cause instrumentation classes to be
11400 defined by the system class loader. See <vmspec chapter="5.3.2"/>.
11401 After the class loader unsuccessfully searches for a class, the specified platform-dependent search
11402 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the
11403 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the
11404 segments will be searched in the order that this function was called.
11405 <p/>
11406 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11407 search path segment to be searched after the system class loader unsuccessfully searches
11408 for a class. The segment is typically a directory or JAR file.
11409 <p/>
11410 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a
11411 <externallink id="jar/jar.html">JAR file</externallink> to be
11412 searched after the system class loader unsuccessfully searches for a class. The agent should
11413 take care that the JAR file does not contain any classes or resources other than those to be
11414 defined by the system class loader for the purposes of instrumentation.
11415 <p/>
11416 In the live phase the system class loader supports adding a JAR file to be searched if
11417 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>
11418 which takes a single parameter of type <code>java.lang.String</code>. The method is not required
11419 to have <code>public</code> access.
11420 <p/>
11421 <vmspec/> specifies that a subsequent attempt to resolve a symbolic
11422 reference that the Java virtual machine has previously unsuccessfully attempted
11423 to resolve always fails with the same error that was thrown as a result of the
11424 initial resolution attempt. Consequently, if the JAR file contains an entry
11425 that corresponds to a class for which the Java virtual machine has
11426 unsuccessfully attempted to resolve a reference, then subsequent attempts to
11427 resolve that reference will fail with the same error as the initial attempt.
11428 </description>
11429 <origin>new</origin>
11430 <capabilities>
11431 </capabilities>
11432 <parameters>
11433 <param id="segment">
11434 <inbuf><char/></inbuf>
11435 <description>
11436 The platform-dependent search path segment, encoded as a
11437 <internallink id="mUTF">modified UTF-8</internallink> string.
11438 </description>
11439 </param>
11440 </parameters>
11441 <errors>
11442 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11443 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11444 existing JAR file is an invalid path.
11445 </error>
11446 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">
11447 Operation not supported by the system class loader.
11448 </error>
11449 </errors>
11450 </function>
11451
11452 </category>
11453
11454
11455 <category id="props" label="System Properties">
11456
11457 <intro>
11458 These functions get and set system properties.
11459 </intro>
11460
11461 <function id="GetSystemProperties" phase="onload" num="130">
11462 <synopsis>Get System Properties</synopsis>
11463 <description>
11464 The list of VM system property keys which may be used with
11465 <functionlink id="GetSystemProperty"/> is returned.
11466 It is strongly recommended that virtual machines provide the
11467 following property keys:
11468 <ul>
11469 <li><code>java.vm.vendor</code></li>
11470 <li><code>java.vm.version</code></li>
11471 <li><code>java.vm.name</code></li>
11472 <li><code>java.vm.info</code></li>
11473 <li><code>java.library.path</code></li>
11474 <li><code>java.class.path</code></li>
11475 </ul>
11476 Provides access to system properties defined by and used
11477 by the VM.
11478 Properties set on the command-line are included.
11479 This allows getting and setting of these properties
11480 before the VM even begins executing bytecodes.
11481 Since this is a VM view of system properties, the set of available
11482 properties will usually be different than that
11483 in <code>java.lang.System.getProperties</code>.
11484 JNI method invocation may be used to access
11485 <code>java.lang.System.getProperties</code>.
11486 <p/>
11487 The set of properties may grow during execution.
11488 </description>
11489 <origin>new</origin>
11490 <capabilities>
11491 </capabilities>
11492 <parameters>
11493 <param id="count_ptr">
11494 <outptr><jint/></outptr>
11495 <description>
11496 On return, points to the number of property keys returned.
11497 </description>
11498 </param>
11499 <param id="property_ptr">
11500 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf>
11501 <description>
11502 On return, points to an array of property keys, encoded as
11503 <internallink id="mUTF">modified UTF-8</internallink> strings.
11504 </description>
11505 </param>
11506 </parameters>
11507 <errors>
11508 </errors>
11509 </function>
11510
11511 <function id="GetSystemProperty" phase="onload" num="131">
11512 <synopsis>Get System Property</synopsis>
11513 <description>
11514 Return a VM system property value given the property key.
11515 <p/>
11516 The function <functionlink id="GetSystemProperties"/>
11517 returns the set of property keys which may be used.
11518 The properties which can be retrieved may grow during
11519 execution.
11520 <p/>
11521 Since this is a VM view of system properties, the values
11522 of properties may differ from that returned by
11523 <code>java.lang.System.getProperty(String)</code>.
11524 A typical VM might copy the values of the VM system
11525 properties into the <code>Properties</code> held by
11526 <code>java.lang.System</code> during the initialization
11527 of that class. Thereafter any changes to the VM system
11528 properties (with <functionlink id="SetSystemProperty"/>)
11529 or the <code>java.lang.System</code> system properties
11530 (with <code>java.lang.System.setProperty(String,String)</code>)
11531 would cause the values to diverge.
11532 JNI method invocation may be used to access
11533 <code>java.lang.System.getProperty(String)</code>.
11534 </description>
11535 <origin>new</origin>
11536 <capabilities>
11537 </capabilities>
11538 <parameters>
11539 <param id="property">
11540 <inbuf><char/></inbuf>
11541 <description>
11542 The key of the property to retrieve, encoded as a
11543 <internallink id="mUTF">modified UTF-8</internallink> string.
11544 </description>
11545 </param>
11546 <param id="value_ptr">
11547 <allocbuf><char/></allocbuf>
11548 <description>
11549 On return, points to the property value, encoded as a
11550 <internallink id="mUTF">modified UTF-8</internallink> string.
11551 </description>
11552 </param>
11553 </parameters>
11554 <errors>
11555 <error id="JVMTI_ERROR_NOT_AVAILABLE">
11556 This property is not available.
11557 Use <functionlink id="GetSystemProperties"/> to find available properties.
11558 </error>
11559 </errors>
11560 </function>
11561
11562 <function id="SetSystemProperty" phase="onloadOnly" num="132">
11563 <synopsis>Set System Property</synopsis>
11564 <description>
11565 Set a VM system property value.
11566 <p/>
11567 The function <functionlink id="GetSystemProperties"/>
11568 returns the set of property keys, some of these may be settable.
11569 See <functionlink id="GetSystemProperty"/>.
11570 </description>
11571 <origin>new</origin>
11572 <capabilities>
11573 </capabilities>
11574 <parameters>
11575 <param id="property">
11576 <inbuf><char/></inbuf>
11577 <description>
11578 The key of the property, encoded as a
11579 <internallink id="mUTF">modified UTF-8</internallink> string.
11580 </description>
11581 </param>
11582 <param id="value_ptr">
11583 <inbuf>
11584 <char/>
11585 <nullok>
11586 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>
11587 if the property is not writeable
11588 </nullok>
11589 </inbuf>
11590 <description>
11591 The property value to set, encoded as a
11592 <internallink id="mUTF">modified UTF-8</internallink> string.
11593 </description>
11594 </param>
11595 </parameters>
11596 <errors>
11597 <error id="JVMTI_ERROR_NOT_AVAILABLE">
11598 This property is not available or is not writeable.
11599 </error>
11600 </errors>
11601 </function>
11602
11603 </category>
11604
11605 <category id="general" label="General">
11606
11607 <intro>
11608 </intro>
11609
11610 <function id="GetPhase" jkernel="yes" phase="any" num="133">
11611 <synopsis>Get Phase</synopsis>
11612 <description>
11613 Return the current phase of VM execution.
11614 The phases proceed in sequence:
11615 <constants id="jvmtiPhase" label="Phases of execution" kind="enum">
11616 <constant id="JVMTI_PHASE_ONLOAD" num="1">
11617 <code>OnLoad</code> phase: while in the
11618 <internallink id="onload"><code>Agent_OnLoad</code></internallink>
11619 or, for statically linked agents, the <internallink id="onload">
11620 <code>Agent_OnLoad_<agent-lib-name>
11621 </code></internallink> function.
11622 </constant>
11623 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2">
11624 Primordial phase: between return from <code>Agent_OnLoad</code>
11625 or <code>Agent_OnLoad_<agent-lib-name></code> and the
11626 <code>VMStart</code> event.
11627 </constant>
11628 <constant id="JVMTI_PHASE_START" num="6">
11629 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event
11630 is sent and until the <code>VMInit</code> event is sent.
11631 </constant>
11632 <constant id="JVMTI_PHASE_LIVE" num="4">
11633 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent
11634 and until the <eventlink id="VMDeath"></eventlink> event returns.
11635 </constant>
11636 <constant id="JVMTI_PHASE_DEAD" num="8">
11637 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after
11638 start-up failure.
11639 </constant>
11640 </constants>
11641 In the case of start-up failure the VM will proceed directly to the dead
11642 phase skipping intermediate phases and neither a <code>VMInit</code> nor
11643 <code>VMDeath</code> event will be sent.
11644 <p/>
11645 Most <jvmti/> functions operate only in the live phase.
11646 The following functions operate in either the <code>OnLoad</code> or live phases:
11647 <functionphaselist phase="onload"/>
11648 The following functions operate in only the <code>OnLoad</code> phase:
11649 <functionphaselist phase="onloadOnly"/>
11650 The following functions operate in the start or live phases:
11651 <functionphaselist phase="start"/>
11652 The following functions operate in any phase:
11653 <functionphaselist phase="any"/>
11654 JNI functions (except the Invocation API) must only be used in the start or live phases.
11655 <p/>
11656 Most <jvmti/> events are sent only in the live phase.
11657 The following events operate in others phases:
11658 <eventphaselist phase="start"/>
11659 <eventphaselist phase="any"/>
11660 </description>
11661 <origin>new</origin>
11662 <capabilities>
11663 </capabilities>
11664 <parameters>
11665 <param id="phase_ptr">
11666 <outptr><enum>jvmtiPhase</enum></outptr>
11667 <description>
11668 On return, points to the phase.
11669 </description>
11670 </param>
11671 </parameters>
11672 <errors>
11673 </errors>
11674 </function>
11675
11676 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">
11677 <synopsis>Dispose Environment</synopsis>
11678 <description>
11679 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>
11680 (see <internallink id="environments"><jvmti/> Environments</internallink>).
11681 Dispose of any resources held by the environment.
11682 <issue>
11683 What resources are reclaimed? What is undone?
11684 Breakpoints,watchpoints removed?
11685 </issue>
11686 Threads suspended by this environment are not resumed by this call,
11687 this must be done explicitly by the agent.
11688 Memory allocated by this environment via calls to <jvmti/> functions
11689 is not released, this can be done explicitly by the agent
11690 by calling <functionlink id="Deallocate"/>.
11691 Raw monitors created by this environment are not destroyed,
11692 this can be done explicitly by the agent
11693 by calling <functionlink id="DestroyRawMonitor"/>.
11694 The state of threads waiting on raw monitors created by this environment
11695 are not affected.
11696 <p/>
11697 Any <functionlink id="SetNativeMethodPrefix">native method
11698 prefixes</functionlink> for this environment will be unset;
11699 the agent must remove any prefixed native methods before
11700 dispose is called.
11701 <p/>
11702 Any <internallink id="capability">capabilities</internallink>
11703 held by this environment are relinquished.
11704 <p/>
11705 Events enabled by this environment will no longer be sent, however
11706 event handlers currently running will continue to run. Caution must
11707 be exercised in the design of event handlers whose environment may
11708 be disposed and thus become invalid during their execution.
11709 <p/>
11710 This environment may not be used after this call.
11711 This call returns to the caller.
11712 </description>
11713 <origin>new</origin>
11714 <capabilities>
11715 </capabilities>
11716 <parameters>
11717 </parameters>
11718 <errors>
11719 </errors>
11720 </function>
11721
11722 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">
11723 <synopsis>Set Environment Local Storage</synopsis>
11724 <description>
11725 The VM stores a pointer value associated with each environment.
11726 This pointer value is called <i>environment-local storage</i>.
11727 This value is null unless set with this function.
11728 Agents can allocate memory in which they store environment specific
11729 information. By setting environment-local storage it can then be
11730 accessed with
11731 <functionlink id="GetEnvironmentLocalStorage"></functionlink>.
11732 <p/>
11733 Called by the agent to set the value of the <jvmti/>
11734 environment-local storage. <jvmti/> supplies to the agent a pointer-size
11735 environment-local storage that can be used to record per-environment
11736 information.
11737 </description>
11738 <origin>new</origin>
11739 <capabilities>
11740 </capabilities>
11741 <parameters>
11742 <param id="data">
11743 <inbuf>
11744 <void/>
11745 <nullok>value is set to null</nullok>
11746 </inbuf>
11747 <description>
11748 The value to be entered into the environment-local storage.
11749 </description>
11750 </param>
11751 </parameters>
11752 <errors>
11753 </errors>
11754 </function>
11755
11756 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">
11757 <synopsis>Get Environment Local Storage</synopsis>
11758 <description>
11759 Called by the agent to get the value of the <jvmti/> environment-local
11760 storage.
11761 </description>
11762 <origin>new</origin>
11763 <capabilities>
11764 </capabilities>
11765 <parameters>
11766 <param id="data_ptr">
11767 <agentbuf><void/></agentbuf>
11768 <description>
11769 Pointer through which the value of the environment local
11770 storage is returned.
11771 If environment-local storage has not been set with
11772 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned
11773 pointer is null.
11774 </description>
11775 </param>
11776 </parameters>
11777 <errors>
11778 </errors>
11779 </function>
11780
11781 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88">
11782 <synopsis>Get Version Number</synopsis>
11783 <description>
11784 Return the <jvmti/> version via <code>version_ptr</code>.
11785 The return value is the version identifier.
11786 The version identifier includes major, minor and micro
11787 version as well as the interface type.
11788 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">
11789 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">
11790 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.
11791 </constant>
11792 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">
11793 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.
11794 </constant>
11795 </constants>
11796 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">
11797 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">
11798 Mask to extract interface type.
11799 The value of the version returned by this function masked with
11800 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always
11801 <code>JVMTI_VERSION_INTERFACE_JVMTI</code>
11802 since this is a <jvmti/> function.
11803 </constant>
11804 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">
11805 Mask to extract major version number.
11806 </constant>
11807 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">
11808 Mask to extract minor version number.
11809 </constant>
11810 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">
11811 Mask to extract micro version number.
11812 </constant>
11813 </constants>
11814 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">
11815 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">
11816 Shift to extract major version number.
11817 </constant>
11818 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">
11819 Shift to extract minor version number.
11820 </constant>
11821 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">
11822 Shift to extract micro version number.
11823 </constant>
11824 </constants>
11825 </description>
11826 <origin>jvmdi</origin>
11827 <capabilities>
11828 </capabilities>
11829 <parameters>
11830 <param id="version_ptr">
11831 <outptr><jint/></outptr>
11832 <description>
11833 On return, points to the <jvmti/> version.
11834 </description>
11835 </param>
11836 </parameters>
11837 <errors>
11838 </errors>
11839 </function>
11840
11841
11842 <function id="GetErrorName" phase="any" num="128">
11843 <synopsis>Get Error Name</synopsis>
11844 <description>
11845 Return the symbolic name for an
11846 <internallink id="ErrorSection">error code</internallink>.
11847 <p/>
11848 For example
11849 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code>
11850 would return in <code>err_name</code> the string
11851 <code>"JVMTI_ERROR_NONE"</code>.
11852 </description>
11853 <origin>new</origin>
11854 <capabilities>
11855 </capabilities>
11856 <parameters>
11857 <param id="error">
11858 <enum>jvmtiError</enum>
11859 <description>
11860 The error code.
11861 </description>
11862 </param>
11863 <param id="name_ptr">
11864 <allocbuf><char/></allocbuf>
11865 <description>
11866 On return, points to the error name.
11867 The name is encoded as a
11868 <internallink id="mUTF">modified UTF-8</internallink> string,
11869 but is restricted to the ASCII subset.
11870 </description>
11871 </param>
11872 </parameters>
11873 <errors>
11874 </errors>
11875 </function>
11876
11877 <function id="SetVerboseFlag" phase="any" num="150">
11878 <synopsis>Set Verbose Flag</synopsis>
11879 <description>
11880 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">
11881 <constant id="JVMTI_VERBOSE_OTHER" num="0">
11882 Verbose output other than the below.
11883 </constant>
11884 <constant id="JVMTI_VERBOSE_GC" num="1">
11885 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.
11886 </constant>
11887 <constant id="JVMTI_VERBOSE_CLASS" num="2">
11888 Verbose class loading output, like that specified with <code>-verbose:class</code>.
11889 </constant>
11890 <constant id="JVMTI_VERBOSE_JNI" num="4">
11891 Verbose JNI output, like that specified with <code>-verbose:jni</code>.
11892 </constant>
11893 </constants>
11894 Control verbose output.
11895 This is the output which typically is sent to <code>stderr</code>.
11896 </description>
11897 <origin>new</origin>
11898 <capabilities>
11899 </capabilities>
11900 <parameters>
11901 <param id="flag">
11902 <enum>jvmtiVerboseFlag</enum>
11903 <description>
11904 Which verbose flag to set.
11905 </description>
11906 </param>
11907 <param id="value">
11908 <jboolean/>
11909 <description>
11910 New value of the flag.
11911 </description>
11912 </param>
11913 </parameters>
11914 <errors>
11915 </errors>
11916 </function>
11917
11918
11919 <function id="GetJLocationFormat" phase="any" num="129">
11920 <synopsis>Get JLocation Format</synopsis>
11921 <description>
11922 Although the greatest functionality is achieved with location information
11923 referencing the virtual machine bytecode index, the definition of
11924 <code>jlocation</code> has intentionally been left unconstrained to allow VM
11925 implementations that do not have this information.
11926 <p/>
11927 This function describes the representation of <code>jlocation</code> used in this VM.
11928 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,
11929 <code>jlocation</code>s can
11930 be used as in indices into the array returned by
11931 <functionlink id="GetBytecodes"></functionlink>.
11932 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">
11933 <constant id="JVMTI_JLOCATION_JVMBCI" num="1">
11934 <code>jlocation</code> values represent virtual machine
11935 bytecode indices--that is, offsets into the
11936 virtual machine code for a method.
11937 </constant>
11938 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2">
11939 <code>jlocation</code> values represent native machine
11940 program counter values.
11941 </constant>
11942 <constant id="JVMTI_JLOCATION_OTHER" num="0">
11943 <code>jlocation</code> values have some other representation.
11944 </constant>
11945 </constants>
11946 </description>
11947 <origin>new</origin>
11948 <capabilities>
11949 </capabilities>
11950 <parameters>
11951 <param id="format_ptr">
11952 <outptr><enum>jvmtiJlocationFormat</enum></outptr>
11953 <description>
11954 On return, points to the format identifier for <code>jlocation</code> values.
11955 </description>
11956 </param>
11957 </parameters>
11958 <errors>
11959 </errors>
11960 </function>
11961
11962 </category>
11963
11964 <category id="heap_monitoring" label="Heap Monitoring">
11965 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11">
11966 <synopsis>Set Heap Sampling Interval</synopsis>
11967 <description>
11968 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated.
11969 Each thread keeps a counter of bytes allocated. The event will only be generated
11970 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink>
11971 since the last sample.
11972 <p/>
11973 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be
11974 generated by each allocation supported by the system once the new interval is taken into account.
11975 <p/>
11976 Note that updating the new sampling interval might take various number of allocations
11977 to provoke internal data structure updates. Therefore it is important to
11978 consider the sampling interval as an average. This includes the interval 0, where events
11979 might not be generated straight away for each allocation.
11980 </description>
11981 <origin>new</origin>
11982 <capabilities>
11983 <required id="can_generate_sampled_object_alloc_events"></required>
11984 </capabilities>
11985 <parameters>
11986 <param id="sampling_interval">
11987 <jint/>
11988 <description>
11989 The sampling interval in bytes. The sampler uses a statistical approach to
11990 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of
11991 memory allocated by a given thread.
11992 <p/>
11993 Once the new sampling interval is taken into account, 0 as a sampling interval will generate
11994 a sample for every allocation.
11995 <p/>
11996 Note: The overhead of this feature is directly correlated with the sampling interval.
11997 A high sampling interval, such as 1024 bytes, will incur a high overhead.
11998 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only
11999 be used with an understanding that it may impact performance.
12000 </description>
12001 </param>
12002 </parameters>
12003 <errors>
12004 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
12005 <paramlink id="sampling_interval"></paramlink> is less than zero.
12006 </error>
12007 </errors>
12008 </function>
12009 </category>
12010
12011 </functionsection>
12012
12013 <errorsection label="Error Reference">
12014 <intro>
12015 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.
12016 <p/>
12017 It is the responsibility of the agent to call <jvmti/> functions with
12018 valid parameters and in the proper context (calling thread is attached,
12019 phase is correct, etc.).
12020 Detecting some error conditions may be difficult, inefficient, or
12021 impossible for an implementation.
12022 The errors listed in
12023 <internallink id="reqerrors">Function Specific Required Errors</internallink>
12024 must be detected by the implementation.
12025 All other errors represent the recommended response to the error
12026 condition.
12027 </intro>
12028
12029 <errorcategory id="universal-error" label="Universal Errors">
12030 <intro>
12031 The following errors may be returned by any function
12032 </intro>
12033
12034 <errorid id="JVMTI_ERROR_NONE" num="0">
12035 No error has occurred. This is the error code that is returned
12036 on successful completion of the function.
12037 </errorid>
12038 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100">
12039 Pointer is unexpectedly null.
12040 </errorid>
12041 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">
12042 The function attempted to allocate memory and no more memory was
12043 available for allocation.
12044 </errorid>
12045 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">
12046 The desired functionality has not been enabled in this virtual machine.
12047 </errorid>
12048 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">
12049 The thread being used to call this function is not attached
12050 to the virtual machine. Calls must be made from attached threads.
12051 See <code>AttachCurrentThread</code> in the JNI invocation API.
12052 </errorid>
12053 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">
12054 The <jvmti/> environment provided is no longer connected or is
12055 not an environment.
12056 </errorid>
12057 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">
12058 The desired functionality is not available in the current
12059 <functionlink id="GetPhase">phase</functionlink>.
12060 Always returned if the virtual machine has completed running.
12061 </errorid>
12062 <errorid id="JVMTI_ERROR_INTERNAL" num="113">
12063 An unexpected internal error has occurred.
12064 </errorid>
12065 </errorcategory>
12066
12067 <errorcategory id="reqerrors" label="Function Specific Required Errors">
12068 <intro>
12069 The following errors are returned by some <jvmti/> functions and must
12070 be returned by the implementation when the condition occurs.
12071 </intro>
12072
12073 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">
12074 Invalid priority.
12075 </errorid>
12076 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">
12077 Thread was not suspended.
12078 </errorid>
12079 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">
12080 Thread already suspended.
12081 </errorid>
12082 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">
12083 This operation requires the thread to be alive--that is,
12084 it must be started and not yet terminated.
12085 </errorid>
12086 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">
12087 The class has been loaded but not yet prepared.
12088 </errorid>
12089 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">
12090 There are no Java programming language or JNI stack frames at the specified depth.
12091 </errorid>
12092 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">
12093 Information about the frame is not available (e.g. for native frames),
12094 or the implementation is unable to provide this functionality on this frame.
12095 </errorid>
12096 <errorid id="JVMTI_ERROR_DUPLICATE" num="40">
12097 Item already set.
12098 </errorid>
12099 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41">
12100 Desired element (e.g. field or breakpoint) not found
12101 </errorid>
12102 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">
12103 This thread doesn't own the raw monitor.
12104 </errorid>
12105 <errorid id="JVMTI_ERROR_INTERRUPT" num="52">
12106 The call has been interrupted before completion.
12107 </errorid>
12108 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">
12109 The class cannot be modified.
12110 </errorid>
12111 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">
12112 The module cannot be modified.
12113 </errorid>
12114 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">
12115 The functionality is not available in this virtual machine.
12116 </errorid>
12117 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">
12118 The requested information is not available.
12119 </errorid>
12120 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">
12121 The specified event type ID is not recognized.
12122 </errorid>
12123 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">
12124 The requested information is not available for native method.
12125 </errorid>
12126 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">
12127 The class loader does not support this operation.
12128 </errorid>
12129 </errorcategory>
12130
12131 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors">
12132 <intro>
12133 The following errors are returned by some <jvmti/> functions.
12134 They are returned in the event of invalid parameters passed by the
12135 agent or usage in an invalid context.
12136 An implementation is not required to detect these errors.
12137 </intro>
12138
12139 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">
12140 The passed thread is not a valid thread.
12141 </errorid>
12142 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">
12143 Invalid field.
12144 </errorid>
12145 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">
12146 Invalid module.
12147 </errorid>
12148 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">
12149 Invalid method.
12150 </errorid>
12151 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">
12152 Invalid location.
12153 </errorid>
12154 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">
12155 Invalid object.
12156 </errorid>
12157 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">
12158 Invalid class.
12159 </errorid>
12160 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">
12161 The variable is not an appropriate type for the function used.
12162 </errorid>
12163 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">
12164 Invalid slot.
12165 </errorid>
12166 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">
12167 The capability being used is false in this environment.
12168 </errorid>
12169 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">
12170 Thread group invalid.
12171 </errorid>
12172 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">
12173 Invalid raw monitor.
12174 </errorid>
12175 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">
12176 Illegal argument.
12177 </errorid>
12178 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">
12179 The state of the thread has been modified, and is now inconsistent.
12180 </errorid>
12181 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">
12182 A new class file has a version number not supported by this VM.
12183 </errorid>
12184 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">
12185 A new class file is malformed (the VM would return a <code>ClassFormatError</code>).
12186 </errorid>
12187 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">
12188 The new class file definitions would lead to a circular
12189 definition (the VM would return a <code>ClassCircularityError</code>).
12190 </errorid>
12191 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">
12192 A new class file would require adding a method.
12193 </errorid>
12194 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">
12195 A new class version changes a field.
12196 </errorid>
12197 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">
12198 The class bytes fail verification.
12199 </errorid>
12200 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">
12201 A direct superclass is different for the new class
12202 version, or the set of directly implemented
12203 interfaces is different.
12204 </errorid>
12205 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">
12206 A new class version does not declare a method
12207 declared in the old class version.
12208 </errorid>
12209 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">
12210 The class name defined in the new class file is
12211 different from the name in the old class object.
12212 </errorid>
12213 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">
12214 A new class version has different modifiers.
12215 </errorid>
12216 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">
12217 A method in the new class version has different modifiers
12218 than its counterpart in the old class version.
12219 </errorid>
12220 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72">
12221 A new class version has unsupported differences in class attributes.
12222 </errorid>
12223 <errorid id="JVMTI_ERROR_UNSUPPORTED_OPERATION" num="73">
12224 Functionality is unsupported in this implementation.
12225 </errorid>
12226 </errorcategory>
12227 </errorsection>
12228
12229 <eventsection label="Events">
12230 <intro label="Handling Events" id="eventIntro">
12231 Agents can be informed of many events that occur in application
12232 programs.
12233 <p/>
12234 To handle events, designate a set of callback functions with
12235 <functionlink id="SetEventCallbacks"></functionlink>.
12236 For each event the corresponding callback function will be
12237 called.
12238 Arguments to the callback function provide additional
12239 information about the event.
12240 <p/>
12241 The callback function is usually called from within an application
12242 thread. The <jvmti/> implementation does not
12243 queue events in any way. This means
12244 that event callback functions must be written
12245 carefully. Here are some general guidelines. See
12246 the individual event descriptions for further
12247 suggestions.
12248 <p/>
12249 <ul>
12250 <li>Any exception thrown during the execution of an event callback can
12251 overwrite any current pending exception in the current application thread.
12252 Care must be taken to preserve a pending exception
12253 when an event callback makes a JNI call that might generate an exception.
12254 </li>
12255 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does
12256 not queue events. If an agent needs to process events one at a time, it
12257 can use a raw monitor inside the
12258 event callback functions to serialize event processing.
12259 </li>
12260 <li>Event callback functions that execute JNI's FindClass function to load
12261 classes need to note that FindClass locates the class loader associated
12262 with the current native method. For the purposes of class loading, an
12263 event callback that includes a JNI environment as a parameter to the
12264 callback will treated as if it is a native call, where the native method
12265 is in the class of the event thread's current frame.
12266 </li>
12267 </ul>
12268 <p/>
12269 Some <jvmti/> events identify objects with JNI references.
12270 All references
12271 in <jvmti/> events are JNI local references and will become invalid
12272 after the event callback returns.
12273 Unless stated otherwise, memory referenced by pointers sent in event
12274 callbacks may not be referenced after the event callback returns.
12275 <p/>
12276 Except where stated otherwise, events are delivered on the thread
12277 that caused the event.
12278 Events are sent at the time they occur.
12279 The specification for each event includes the set of
12280 <functionlink id="GetPhase">phases</functionlink> in which it can be sent;
12281 if an event triggering activity occurs during another phase, no event
12282 is sent.
12283 <p/>
12284 A thread that generates an event does not change its execution status
12285 (for example, the event does not cause the thread to be suspended).
12286 If an agent wishes the event to result in suspension, then the agent
12287 is responsible for explicitly suspending the thread with
12288 <functionlink id="SuspendThread"></functionlink>.
12289 <p/>
12290 If an event is enabled in multiple environments, the event will be sent
12291 to each agent in the order that the environments were created.
12292 </intro>
12293
12294 <intro label="Enabling Events" id="enablingevents">
12295 All events are initially disabled. In order to receive any
12296 event:
12297 <ul>
12298 <li>
12299 If the event requires a capability, that capability must
12300 be added with
12301 <functionlink id="AddCapabilities"></functionlink>.
12302 </li>
12303 <li>
12304 A callback for the event must be set with
12305 <functionlink id="SetEventCallbacks"></functionlink>.
12306 </li>
12307 <li>
12308 The event must be enabled with
12309 <functionlink id="SetEventNotificationMode"></functionlink>.
12310 </li>
12311 </ul>
12312 </intro>
12313
12314 <intro label="Multiple Co-located Events" id="eventorder">
12315 In many situations it is possible for multiple events to occur
12316 at the same location in one thread. When this happens, all the events
12317 are reported through the event callbacks in the order specified in this section.
12318 <p/>
12319 If the current location is at the entry point of a method, the
12320 <eventlink id="MethodEntry"></eventlink> event is reported before
12321 any other event at the current location in the same thread.
12322 <p/>
12323 If an exception catch has been detected at the current location,
12324 either because it is the beginning of a catch clause or a native method
12325 that cleared a pending exception has returned, the
12326 <code>exceptionCatch</code> event is reported before
12327 any other event at the current location in the same thread.
12328 <p/>
12329 If a <code>singleStep</code> event or
12330 <code>breakpoint</code> event is triggered at the
12331 current location, the event is defined to occur
12332 immediately before the code at the current location is executed.
12333 These events are reported before any events which are triggered
12334 by the execution of code at the current location in the same
12335 thread (specifically:
12336 <code>exception</code>,
12337 <code>fieldAccess</code>, and
12338 <code>fieldModification</code>).
12339 If both a step and breakpoint event are triggered for the same thread and
12340 location, the step event is reported before the breakpoint event.
12341 <p/>
12342 If the current location is the exit point of a method (that is, the last
12343 location before returning to the caller), the
12344 <eventlink id="MethodExit"></eventlink> event and
12345 the <eventlink id="FramePop"></eventlink> event (if requested)
12346 are reported after all other events at the current location in the same
12347 thread. There is no specified ordering of these two events
12348 with respect to each other.
12349 <p/>
12350 Co-located events can be triggered during the processing of some other
12351 event by the agent at the same location in the same thread.
12352 If such an event, of type <i>y</i>, is triggered during the processing of
12353 an event of type <i>x</i>, and if <i>x</i>
12354 precedes <i>y</i> in the ordering specified above, the co-located event
12355 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede
12356 <i>y</i>, <i>y</i> is not reported for the current thread and location.
12357 For example, if a breakpoint is set at the current location
12358 during the processing of <eventlink id="SingleStep"></eventlink>,
12359 that breakpoint will be reported before the thread moves off the current
12360 location.
12361 <p/>The following events are never considered to be co-located with
12362 other events.
12363 <ul>
12364 <li><eventlink id="VMStart"></eventlink></li>
12365 <li><eventlink id="VMInit"></eventlink></li>
12366 <li><eventlink id="VMDeath"></eventlink></li>
12367 <li><eventlink id="ThreadStart"></eventlink></li>
12368 <li><eventlink id="ThreadEnd"></eventlink></li>
12369 <li><eventlink id="VirtualThreadStart"></eventlink></li>
12370 <li><eventlink id="VirtualThreadEnd"></eventlink></li>
12371 <li><eventlink id="ClassLoad"></eventlink></li>
12372 <li><eventlink id="ClassPrepare"></eventlink></li>
12373 </ul>
12374 </intro>
12375
12376 <intro label="Event Callbacks" id="jvmtiEventCallbacks">
12377 The event callback structure below is used to specify the handler function
12378 for events. It is set with the
12379 <functionlink id="SetEventCallbacks"></functionlink> function.
12380 </intro>
12381
12382 <event label="Single Step"
12383 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">
12384 <description>
12385 Single step events allow the agent to trace thread execution
12386 at the finest granularity allowed by the VM. A single step event is
12387 generated whenever a thread reaches a new location.
12388 Typically, single step events represent the completion of one VM
12389 instruction as defined in <vmspec/>. However, some implementations
12390 may define locations differently. In any case the
12391 <code>method</code> and <code>location</code>
12392 parameters uniquely identify the current location and allow
12393 the mapping to source file and line number when that information is
12394 available.
12395 <p/>
12396 No single step events are generated from within native methods.
12397 </description>
12398 <origin>jvmdi</origin>
12399 <capabilities>
12400 <required id="can_generate_single_step_events"></required>
12401 </capabilities>
12402 <parameters>
12403 <param id="jni_env">
12404 <outptr>
12405 <struct>JNIEnv</struct>
12406 </outptr>
12407 <description>
12408 The JNI environment of the event (current) thread
12409 </description>
12410 </param>
12411 <param id="thread">
12412 <jthread/>
12413 <description>
12414 Thread about to execution a new instruction
12415 </description>
12416 </param>
12417 <param id="klass">
12418 <jclass method="method"/>
12419 <description>
12420 Class of the method about to execute a new instruction
12421 </description>
12422 </param>
12423 <param id="method">
12424 <jmethodID class="klass"/>
12425 <description>
12426 Method about to execute a new instruction
12427 </description>
12428 </param>
12429 <param id="location">
12430 <jlocation/>
12431 <description>
12432 Location of the new instruction
12433 </description>
12434 </param>
12435 </parameters>
12436 </event>
12437
12438 <event label="Breakpoint"
12439 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">
12440 <description>
12441 Breakpoint events are generated whenever a thread reaches a location
12442 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.
12443 The <code>method</code> and <code>location</code>
12444 parameters uniquely identify the current location and allow
12445 the mapping to source file and line number when that information is
12446 available.
12447 </description>
12448 <origin>jvmdi</origin>
12449 <capabilities>
12450 <required id="can_generate_breakpoint_events"></required>
12451 </capabilities>
12452 <parameters>
12453 <param id="jni_env">
12454 <outptr>
12455 <struct>JNIEnv</struct>
12456 </outptr>
12457 <description>
12458 The JNI environment of the event (current) thread.
12459 </description>
12460 </param>
12461 <param id="thread">
12462 <jthread/>
12463 <description>
12464 Thread that hit the breakpoint
12465 </description>
12466 </param>
12467 <param id="klass">
12468 <jclass method="method"/>
12469 <description>
12470 Class of the method that hit the breakpoint
12471 </description>
12472 </param>
12473 <param id="method">
12474 <jmethodID class="klass"/>
12475 <description>
12476 Method that hit the breakpoint
12477 </description>
12478 </param>
12479 <param id="location">
12480 <jlocation/>
12481 <description>
12482 location of the breakpoint
12483 </description>
12484 </param>
12485 </parameters>
12486 </event>
12487
12488 <event label="Field Access"
12489 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">
12490 <description>
12491 Field access events are generated whenever a thread accesses
12492 a field that was designated as a watchpoint
12493 with <functionlink id="SetFieldAccessWatch"></functionlink>.
12494 The <code>method</code> and <code>location</code>
12495 parameters uniquely identify the current location and allow
12496 the mapping to source file and line number when that information is
12497 available.
12498 </description>
12499 <origin>jvmdi</origin>
12500 <capabilities>
12501 <required id="can_generate_field_access_events"></required>
12502 </capabilities>
12503 <parameters>
12504 <param id="jni_env">
12505 <outptr>
12506 <struct>JNIEnv</struct>
12507 </outptr>
12508 <description>
12509 The JNI environment of the event (current) thread
12510 </description>
12511 </param>
12512 <param id="thread">
12513 <jthread/>
12514 <description>
12515 Thread accessing the field
12516 </description>
12517 </param>
12518 <param id="klass">
12519 <jclass method="method"/>
12520 <description>
12521 Class of the method where the access is occurring
12522 </description>
12523 </param>
12524 <param id="method">
12525 <jmethodID class="klass"/>
12526 <description>
12527 Method where the access is occurring
12528 </description>
12529 </param>
12530 <param id="location">
12531 <jlocation/>
12532 <description>
12533 Location where the access is occurring
12534 </description>
12535 </param>
12536 <param id="field_klass">
12537 <jclass field="field"/>
12538 <description>
12539 Class of the field being accessed
12540 </description>
12541 </param>
12542 <param id="object">
12543 <jobject/>
12544 <description>
12545 Object with the field being accessed if the field is an
12546 instance field; a null pointer otherwise
12547 </description>
12548 </param>
12549 <param id="field">
12550 <jfieldID class="field_klass"/>
12551 <description>
12552 Field being accessed
12553 </description>
12554 </param>
12555 </parameters>
12556 </event>
12557
12558 <event label="Field Modification"
12559 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">
12560 <description>
12561 Field modification events are generated whenever a thread modifies
12562 a field that was designated as a watchpoint
12563 with <functionlink id="SetFieldModificationWatch"></functionlink>.
12564 The <code>method</code> and <code>location</code>
12565 parameters uniquely identify the current location and allow
12566 the mapping to source file and line number when that information is
12567 available.
12568 </description>
12569 <origin>jvmdi</origin>
12570 <capabilities>
12571 <required id="can_generate_field_modification_events"></required>
12572 </capabilities>
12573 <parameters>
12574 <param id="jni_env">
12575 <outptr>
12576 <struct>JNIEnv</struct>
12577 </outptr>
12578 <description>
12579 The JNI environment of the event (current) thread
12580 </description>
12581 </param>
12582 <param id="thread">
12583 <jthread/>
12584 <description>
12585 Thread modifying the field
12586 </description>
12587 </param>
12588 <param id="klass">
12589 <jclass method="method"/>
12590 <description>
12591 Class of the method where the modification is occurring
12592 </description>
12593 </param>
12594 <param id="method">
12595 <jmethodID class="klass"/>
12596 <description>
12597 Method where the modification is occurring
12598 </description>
12599 </param>
12600 <param id="location">
12601 <jlocation/>
12602 <description>
12603 Location where the modification is occurring
12604 </description>
12605 </param>
12606 <param id="field_klass">
12607 <jclass field="field"/>
12608 <description>
12609 Class of the field being modified
12610 </description>
12611 </param>
12612 <param id="object">
12613 <jobject/>
12614 <description>
12615 Object with the field being modified if the field is an
12616 instance field; a null pointer otherwise
12617 </description>
12618 </param>
12619 <param id="field">
12620 <jfieldID class="field_klass"/>
12621 <description>
12622 Field being modified
12623 </description>
12624 </param>
12625 <param id="signature_type">
12626 <char/>
12627 <description>
12628 Signature type of the new value
12629 </description>
12630 </param>
12631 <param id="new_value">
12632 <jvalue/>
12633 <description>
12634 The new value
12635 </description>
12636 </param>
12637 </parameters>
12638 </event>
12639
12640 <event label="Frame Pop"
12641 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">
12642 <description>
12643 Frame pop events are generated upon exit from a single method
12644 in a single frame as specified
12645 in a call to <functionlink id="NotifyFramePop"></functionlink>.
12646 This is true whether termination is caused by
12647 executing its return instruction
12648 or by throwing an exception to its caller
12649 (see <paramlink id="was_popped_by_exception"></paramlink>).
12650 However, frame pops caused by the <functionlink id="PopFrame"/>
12651 function are not reported.
12652 <p/>
12653 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12654 for the depth 0 identifies the executable location in the returning method,
12655 immediately prior to the return.
12656 </description>
12657 <origin>jvmdi</origin>
12658 <capabilities>
12659 <required id="can_generate_frame_pop_events"></required>
12660 </capabilities>
12661 <parameters>
12662 <param id="jni_env">
12663 <outptr>
12664 <struct>JNIEnv</struct>
12665 </outptr>
12666 <description>
12667 The JNI environment of the event (current) thread
12668 </description>
12669 </param>
12670 <param id="thread">
12671 <jthread/>
12672 <description>
12673 Thread that is popping the frame
12674 </description>
12675 </param>
12676 <param id="klass">
12677 <jclass method="method"/>
12678 <description>
12679 Class of the method being popped
12680 </description>
12681 </param>
12682 <param id="method">
12683 <jmethodID class="klass"/>
12684 <description>
12685 Method being popped
12686 </description>
12687 </param>
12688 <param id="was_popped_by_exception">
12689 <jboolean/>
12690 <description>
12691 True if frame was popped by a thrown exception.
12692 False if method exited through its return instruction.
12693 </description>
12694 </param>
12695 </parameters>
12696 </event>
12697
12698 <event label="Method Entry"
12699 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">
12700 <description>
12701 Method entry events are generated upon entry of Java
12702 programming language methods (including native methods).
12703 <p/>
12704 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12705 for the depth 0 identifies the initial executable location in the method.
12706 <p/>
12707 Enabling method
12708 entry or exit events will significantly degrade performance on many platforms and is thus
12709 not advised for performance critical usage (such as profiling).
12710 <internallink id="bci">Bytecode instrumentation</internallink> should be
12711 used in these cases.
12712 </description>
12713 <origin>jvmdi</origin>
12714 <capabilities>
12715 <required id="can_generate_method_entry_events"></required>
12716 </capabilities>
12717 <parameters>
12718 <param id="jni_env">
12719 <outptr>
12720 <struct>JNIEnv</struct>
12721 </outptr>
12722 <description>
12723 The JNI environment of the event (current) thread
12724 </description>
12725 </param>
12726 <param id="thread">
12727 <jthread/>
12728 <description>
12729 Thread entering the method
12730 </description>
12731 </param>
12732 <param id="klass">
12733 <jclass method="method"/>
12734 <description>
12735 Class of the method being entered
12736 </description>
12737 </param>
12738 <param id="method">
12739 <jmethodID class="klass"/>
12740 <description>
12741 Method being entered
12742 </description>
12743 </param>
12744 </parameters>
12745 </event>
12746
12747 <event label="Method Exit"
12748 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">
12749 <description>
12750 Method exit events are generated upon exit from Java
12751 programming language methods (including native methods).
12752 This is true whether termination is caused by
12753 executing its return instruction
12754 or by throwing an exception to its caller
12755 (see <paramlink id="was_popped_by_exception"></paramlink>).
12756 <p/>
12757 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12758 for the depth 0 identifies the executable location in the returning method
12759 immediately prior to the return.
12760 <p/>
12761 Enabling method
12762 entry or exit events will significantly degrade performance on many platforms and is thus
12763 not advised for performance critical usage (such as profiling).
12764 <internallink id="bci">Bytecode instrumentation</internallink> should be
12765 used in these cases.
12766 </description>
12767 <origin>jvmdi</origin>
12768 <capabilities>
12769 <required id="can_generate_method_exit_events"></required>
12770 </capabilities>
12771 <parameters>
12772 <param id="jni_env">
12773 <outptr>
12774 <struct>JNIEnv</struct>
12775 </outptr>
12776 <description>
12777 The JNI environment of the event (current) thread
12778 </description>
12779 </param>
12780 <param id="thread">
12781 <jthread/>
12782 <description>
12783 Thread exiting the method
12784 </description>
12785 </param>
12786 <param id="klass">
12787 <jclass method="method"/>
12788 <description>
12789 Class of the method being exited
12790 </description>
12791 </param>
12792 <param id="method">
12793 <jmethodID class="klass"/>
12794 <description>
12795 Method being exited
12796 </description>
12797 </param>
12798 <param id="was_popped_by_exception">
12799 <jboolean/>
12800 <description>
12801 True if frame was popped by a thrown exception.
12802 False if method exited through its return instruction.
12803 </description>
12804 </param>
12805 <param id="return_value">
12806 <jvalue/>
12807 <description>
12808 The return value of the method being exited.
12809 Undefined and should not be used if
12810 <paramlink id="was_popped_by_exception"></paramlink>
12811 is true.
12812 </description>
12813 </param>
12814 </parameters>
12815 </event>
12816
12817 <event label="Native Method Bind" phase="any"
12818 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">
12819 <description>
12820 A Native Method Bind event is sent when a VM binds a
12821 Java programming language native method
12822 to the address of a function that implements the native method.
12823 This will occur when the native method is called for the first time
12824 and also occurs when the JNI function <code>RegisterNatives</code> is called.
12825 This event allows the bind to be redirected to an agent-specified
12826 proxy function.
12827 This event is not sent when the native method is unbound.
12828 Typically, this proxy function will need to be specific to a
12829 particular method or, to handle the general case, automatically
12830 generated assembly code, since after instrumentation code is
12831 executed the function at the original binding
12832 address will usually be invoked.
12833 The original binding can be restored or the redirection changed
12834 by use of the JNI function <code>RegisterNatives</code>.
12835 Some events may be sent during the primordial phase, JNI and
12836 most of <jvmti/> cannot be used at this time but the method and
12837 address can be saved for use later.
12838 </description>
12839 <origin>new</origin>
12840 <capabilities>
12841 <required id="can_generate_native_method_bind_events"></required>
12842 </capabilities>
12843 <parameters>
12844 <param id="jni_env">
12845 <outptr>
12846 <struct>JNIEnv</struct>
12847 </outptr>
12848 <description>
12849 The JNI environment of the event (current) thread
12850 Will be null if sent during the primordial
12851 <functionlink id="GetPhase">phase</functionlink>.
12852 </description>
12853 </param>
12854 <param id="thread">
12855 <jthread/>
12856 <description>
12857 Thread requesting the bind
12858 </description>
12859 </param>
12860 <param id="klass">
12861 <jclass method="method"/>
12862 <description>
12863 Class of the method being bound
12864 </description>
12865 </param>
12866 <param id="method">
12867 <jmethodID class="klass"/>
12868 <description>
12869 Native method being bound
12870 </description>
12871 </param>
12872 <param id="address">
12873 <outptr><void/></outptr>
12874 <description>
12875 The address the VM is about to bind to--that is, the
12876 address of the implementation of the native method
12877 </description>
12878 </param>
12879 <param id="new_address_ptr">
12880 <agentbuf><void/></agentbuf>
12881 <description>
12882 if the referenced address is changed (that is, if
12883 <code>*new_address_ptr</code> is set), the binding
12884 will instead be made to the supplied address.
12885 </description>
12886 </param>
12887 </parameters>
12888 </event>
12889
12890 <event label="Exception"
12891 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">
12892 <description>
12893 Exception events are generated whenever an exception is first detected
12894 in a Java programming language method.
12895 Where "exception" means any <code>java.lang.Throwable</code>.
12896 The exception may have been thrown by a Java programming language or native
12897 method, but in the case of native methods, the event is not generated
12898 until the exception is first seen by a Java programming language method. If an exception is
12899 set and cleared in a native method (and thus is never visible to Java programming language code),
12900 no exception event is generated.
12901 <p/>
12902 The <code>method</code> and <code>location</code>
12903 parameters uniquely identify the current location
12904 (where the exception was detected) and allow
12905 the mapping to source file and line number when that information is
12906 available. The <code>exception</code> parameter identifies the thrown
12907 exception object. The <code>catch_method</code>
12908 and <code>catch_location</code> identify the location of the catch clause,
12909 if any, that handles the thrown exception. If there is no such catch clause,
12910 the <code>catch_method</code> is set to null and the <code>catch_location</code>is set to 0.
12911 There is no guarantee that the thread will ever
12912 reach this catch clause. If there are native methods on the call stack
12913 between the throw location and the catch clause, the exception may
12914 be reset by one of those native methods.
12915 Similarly, exceptions that are reported as uncaught (<code>catch_method</code>
12916 set to null) may in fact be caught by native code.
12917 Agents can check for these occurrences by monitoring
12918 <eventlink id="ExceptionCatch"></eventlink> events.
12919 Note that finally clauses are implemented as catch and re-throw. Therefore they
12920 will be reported in the catch location.
12921 </description>
12922 <origin>jvmdi</origin>
12923 <capabilities>
12924 <required id="can_generate_exception_events"></required>
12925 </capabilities>
12926 <parameters>
12927 <param id="jni_env">
12928 <outptr>
12929 <struct>JNIEnv</struct>
12930 </outptr>
12931 <description>
12932 The JNI environment of the event (current) thread
12933 </description>
12934 </param>
12935 <param id="thread">
12936 <jthread/>
12937 <description>
12938 Thread generating the exception
12939 </description>
12940 </param>
12941 <param id="klass">
12942 <jclass method="method"/>
12943 <description>
12944 Class generating the exception
12945 </description>
12946 </param>
12947 <param id="method">
12948 <jmethodID class="klass"/>
12949 <description>
12950 Method generating the exception
12951 </description>
12952 </param>
12953 <param id="location">
12954 <jlocation/>
12955 <description>
12956 Location where exception occurred
12957 </description>
12958 </param>
12959 <param id="exception">
12960 <jobject/>
12961 <description>
12962 The exception being thrown
12963 </description>
12964 </param>
12965 <param id="catch_klass">
12966 <jclass method="catch_method"/>
12967 <description>
12968 Class that will catch the exception, or null if no known catch
12969 </description>
12970 </param>
12971 <param id="catch_method">
12972 <jmethodID class="catch_klass"/>
12973 <description>
12974 Method that will catch the exception, or null if no known catch
12975 </description>
12976 </param>
12977 <param id="catch_location">
12978 <jlocation/>
12979 <description>
12980 location which will catch the exception or zero if no known catch
12981 </description>
12982 </param>
12983 </parameters>
12984 </event>
12985
12986 <event label="Exception Catch"
12987 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">
12988 <description>
12989 Exception catch events are generated whenever a thrown exception is caught.
12990 Where "exception" means any <code>java.lang.Throwable</code>.
12991 If the exception is caught in a Java programming language method, the event is generated
12992 when the catch clause is reached. If the exception is caught in a native
12993 method, the event is generated as soon as control is returned to a Java programming language
12994 method. Exception catch events are generated for any exception for which
12995 a throw was detected in a Java programming language method.
12996 Note that finally clauses are implemented as catch and re-throw. Therefore they
12997 will generate exception catch events.
12998 <p/>
12999 The <code>method</code> and <code>location</code>
13000 parameters uniquely identify the current location
13001 and allow the mapping to source file and line number when that information is
13002 available. For exceptions caught in a Java programming language method, the
13003 <code>exception</code> object identifies the exception object. Exceptions
13004 caught in native methods are not necessarily available by the time the
13005 exception catch is reported, so the <code>exception</code> parameter is set
13006 to null.
13007 </description>
13008 <origin>jvmdi</origin>
13009 <capabilities>
13010 <required id="can_generate_exception_events"></required>
13011 </capabilities>
13012 <parameters>
13013 <param id="jni_env">
13014 <outptr>
13015 <struct>JNIEnv</struct>
13016 </outptr>
13017 <description>
13018 The JNI environment of the event (current) thread
13019 </description>
13020 </param>
13021 <param id="thread">
13022 <jthread/>
13023 <description>
13024 Thread catching the exception
13025 </description>
13026 </param>
13027 <param id="klass">
13028 <jclass method="method"/>
13029 <description>
13030 Class catching the exception
13031 </description>
13032 </param>
13033 <param id="method">
13034 <jmethodID class="klass"/>
13035 <description>
13036 Method catching the exception
13037 </description>
13038 </param>
13039 <param id="location">
13040 <jlocation/>
13041 <description>
13042 Location where exception is being caught
13043 </description>
13044 </param>
13045 <param id="exception">
13046 <jobject/>
13047 <description>
13048 Exception being caught
13049 </description>
13050 </param>
13051 </parameters>
13052 </event>
13053
13054 <event label="Thread Start"
13055 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">
13056 <description>
13057 A thread start event is generated by a new thread before its initial
13058 method executes.
13059 <p/>
13060 This event is generated by platform thread. It is not generated by virtual threads.
13061 <p/>
13062 Agents with the <code>can_support_virtual_threads</code> capability
13063 can enable the <eventlink id="VirtualThreadStart"></eventlink> event
13064 to be notified by newly started virtual threads.
13065 <p/>
13066 A platform thread may be listed in the array returned by
13067 <functionlink id="GetAllThreads"></functionlink>
13068 before its thread start event is generated.
13069 It is possible for other events to be generated
13070 on a thread before its thread start event.
13071 <p/>
13072 The event is sent on the newly started <paramlink id="thread"></paramlink>.
13073 </description>
13074 <origin>jvmdi</origin>
13075 <capabilities>
13076 </capabilities>
13077 <parameters>
13078 <param id="jni_env">
13079 <outptr>
13080 <struct>JNIEnv</struct>
13081 </outptr>
13082 <description>
13083 The JNI environment of the event (current) thread.
13084 </description>
13085 </param>
13086 <param id="thread">
13087 <jthread/>
13088 <description>
13089 Thread starting
13090 </description>
13091 </param>
13092 </parameters>
13093 </event>
13094
13095 <event label="Thread End"
13096 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">
13097 <description>
13098 A thread end event is generated by a terminating thread after its
13099 initial method has finished execution.
13100 <p/>
13101 This event is generated by platform thread. It is not generated by virtual threads.
13102 <p/>
13103 Agents with the <code>can_support_virtual_threads</code> capability
13104 can enable the <eventlink id="VirtualThreadEnd"></eventlink> event
13105 to be notified by terminating virtual threads.
13106 <p/>
13107 A platform thread may be listed in the array returned by
13108 <functionlink id="GetAllThreads"></functionlink>
13109 after its thread end event is generated.
13110 No events are generated on a thread
13111 after its thread end event.
13112 <p/>
13113 The event is sent on the terminating <paramlink id="thread"></paramlink>.
13114 </description>
13115 <origin>jvmdi</origin>
13116 <capabilities>
13117 </capabilities>
13118 <parameters>
13119 <param id="jni_env">
13120 <outptr>
13121 <struct>JNIEnv</struct>
13122 </outptr>
13123 <description>
13124 The JNI environment of the event (current) thread.
13125 </description>
13126 </param>
13127 <param id="thread">
13128 <jthread/>
13129 <description>
13130 Thread ending
13131 </description>
13132 </param>
13133 </parameters>
13134 </event>
13135
13136 <event label="Virtual Thread Start"
13137 id="VirtualThreadStart" const="JVMTI_EVENT_VIRTUAL_THREAD_START" num="87" phase="start" since="21">
13138 <description>
13139 A virtual thread start event is generated before its initial method executes.
13140 <p/>
13141 The event is sent on the newly started <paramlink id="virtual_thread"></paramlink>.
13142 </description>
13143 <origin>new</origin>
13144 <capabilities>
13145 <required id="can_support_virtual_threads">Can support virtual threads</required>
13146 </capabilities>
13147 <parameters>
13148 <param id="jni_env">
13149 <outptr>
13150 <struct>JNIEnv</struct>
13151 </outptr>
13152 <description>
13153 The JNI environment of the event (current) thread.
13154 </description>
13155 </param>
13156 <param id="virtual_thread">
13157 <jthread/>
13158 <description>
13159 Virtual thread started for execution.
13160 </description>
13161 </param>
13162 </parameters>
13163 </event>
13164
13165 <event label="Virtual Thread End"
13166 id="VirtualThreadEnd" const="JVMTI_EVENT_VIRTUAL_THREAD_END" filtered="thread" num="88" phase="start" since="21">
13167 <description>
13168 A virtual thread end event is generated after its initial method has finished execution.
13169 <p/>
13170 The event is sent on the terminating <paramlink id="virtual_thread"></paramlink>.
13171 </description>
13172 <origin>new</origin>
13173 <capabilities>
13174 <required id="can_support_virtual_threads">Can support virtual threads</required>
13175 </capabilities>
13176 <parameters>
13177 <param id="jni_env">
13178 <outptr>
13179 <struct>JNIEnv</struct>
13180 </outptr>
13181 <description>
13182 The JNI environment of the event (current) thread.
13183 </description>
13184 </param>
13185 <param id="virtual_thread">
13186 <jthread/>
13187 <description>
13188 Virtual thread being ended.
13189 </description>
13190 </param>
13191 </parameters>
13192 </event>
13193
13194 <elide>
13195 <event label="Virtual Thread Mount"
13196 id="VirtualThreadMount" const="JVMTI_EVENT_VIRTUAL_THREAD_MOUNT" filtered="thread" num="89" phase="start" since="99">
13197 <description>
13198 A virtual thread mount event is generated before its method continue to execute on the mounted thread.
13199 <p/>
13200 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is mounted to.
13201 </description>
13202 <origin>new</origin>
13203 <capabilities>
13204 <required id="can_support_virtual_threads">Can support virtual threads</required>
13205 </capabilities>
13206 <parameters>
13207 <param id="jni_env">
13208 <outptr>
13209 <struct>JNIEnv</struct>
13210 </outptr>
13211 <description>
13212 The JNI environment of the event (current) thread.
13213 </description>
13214 </param>
13215 <param id="virtual_thread">
13216 <jthread/>
13217 <description>
13218 Virtual thread that is mounted.
13219 </description>
13220 </param>
13221 </parameters>
13222 </event>
13223 </elide>
13224
13225 <elide>
13226 <event label="Virtual Thread Unmount"
13227 id="VirtualThreadUnmount" const="JVMTI_EVENT_VIRTUAL_THREAD_UNMOUNT" filtered="thread" num="90" phase="start" since="99">
13228 <description>
13229 A virtual thread unmount event is generated when the virtual thread is about to be unmounted from the carrier thread.
13230 <p/>
13231 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is unmounted from.
13232 </description>
13233 <origin>new</origin>
13234 <capabilities>
13235 <required id="can_support_virtual_threads">Can support virtual threads</required>
13236 </capabilities>
13237 <parameters>
13238 <param id="jni_env">
13239 <outptr>
13240 <struct>JNIEnv</struct>
13241 </outptr>
13242 <description>
13243 The JNI environment of the event (current) thread.
13244 </description>
13245 </param>
13246 <param id="virtual_thread">
13247 <jthread/>
13248 <description>
13249 Virtual thread that is unmounted.
13250 </description>
13251 </param>
13252 </parameters>
13253 </event>
13254 </elide>
13255
13256 <event label="Class Load"
13257 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">
13258 <description>
13259 A class load event is generated
13260 <functionlink id="GetLoadedClasses">when a class or interface is created</functionlink>.
13261 <p/>
13262 Array class creation does not generate a class load event.
13263 The creation of a primitive class (for example, java.lang.Integer.TYPE)
13264 does not generate a class load event.
13265 <p/>
13266 The order of class load events generated by a particular thread is guaranteed
13267 to match the order of class loading within that thread.
13268 <p/>
13269 This event is sent at an early stage in loading the class. As
13270 a result the class should be used carefully. Note, for example,
13271 that methods and fields are not yet loaded, so queries for methods,
13272 fields, subclasses, and so on will not give correct results.
13273 See "Loading of Classes and Interfaces" in the <i>Java Language
13274 Specification</i>. For most
13275 purposes the <eventlink id="ClassPrepare"></eventlink> event will
13276 be more useful.
13277 </description>
13278 <origin>jvmdi</origin>
13279 <capabilities>
13280 </capabilities>
13281 <parameters>
13282 <param id="jni_env">
13283 <outptr>
13284 <struct>JNIEnv</struct>
13285 </outptr>
13286 <description>
13287 The JNI environment of the event (current) thread
13288 </description>
13289 </param>
13290 <param id="thread">
13291 <jthread/>
13292 <description>
13293 Thread loading the class
13294 </description>
13295 </param>
13296 <param id="klass">
13297 <jclass/>
13298 <description>
13299 Class being loaded
13300 </description>
13301 </param>
13302 </parameters>
13303 </event>
13304
13305 <elide>
13306 <event label="Class Unload"
13307 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">
13308 <description>
13309 A class unload event is generated when the class is about to be unloaded.
13310 Class unload events take place during garbage collection and must be
13311 handled extremely carefully. The garbage collector holds many locks
13312 and has suspended all other threads, so the event handler cannot depend
13313 on the ability to acquire any locks. The class unload event handler should
13314 do as little as possible, perhaps by queuing information to be processed
13315 later. In particular, the <code>jclass</code> should be used only in
13316 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:
13317 <ul>
13318 <li><functionlink id="GetClassSignature"></functionlink></li>
13319 <li><functionlink id="GetSourceFileName"></functionlink></li>
13320 <li><functionlink id="IsInterface"></functionlink></li>
13321 <li><functionlink id="IsArrayClass"></functionlink></li>
13322 </ul>
13323 </description>
13324 <origin>jvmdi</origin>
13325 <capabilities>
13326 </capabilities>
13327 <parameters>
13328 <param id="jni_env">
13329 <outptr>
13330 <struct>JNIEnv</struct>
13331 </outptr>
13332 <description>
13333 The JNI environment of the event (current) thread
13334 </description>
13335 </param>
13336 <param id="thread">
13337 <jthread/>
13338 <description>
13339 Thread generating the class unload
13340 </description>
13341 </param>
13342 <param id="klass">
13343 <jclass/>
13344 <description>
13345 Class being unloaded
13346 </description>
13347 </param>
13348 </parameters>
13349 </event>
13350 </elide>
13351
13352 <event label="Class Prepare"
13353 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">
13354 <description>
13355 A class prepare event is generated when class preparation is complete.
13356 At this point, class fields, methods, and implemented interfaces are
13357 available, and no code from the class has been executed. Since array
13358 classes never have fields or methods, class prepare events are not
13359 generated for them. Class prepare events are not generated for
13360 primitive classes (for example, <code>java.lang.Integer.TYPE</code>).
13361 </description>
13362 <origin>jvmdi</origin>
13363 <capabilities>
13364 </capabilities>
13365 <parameters>
13366 <param id="jni_env">
13367 <outptr>
13368 <struct>JNIEnv</struct>
13369 </outptr>
13370 <description>
13371 The JNI environment of the event (current) thread
13372 </description>
13373 </param>
13374 <param id="thread">
13375 <jthread/>
13376 <description>
13377 Thread generating the class prepare
13378 </description>
13379 </param>
13380 <param id="klass">
13381 <jclass/>
13382 <description>
13383 Class being prepared
13384 </description>
13385 </param>
13386 </parameters>
13387 </event>
13388
13389 <event label="Class File Load Hook" phase="any"
13390 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">
13391 <description>
13392 This event is sent when the VM obtains class file data,
13393 but before it constructs
13394 the in-memory representation for that class.
13395 This event is also sent when the class is being modified by the
13396 <functionlink id="RetransformClasses"/> function or
13397 the <functionlink id="RedefineClasses"/> function,
13398 called in any <jvmti/> environment.
13399 The agent can instrument
13400 the existing class file data sent by the VM to include profiling/debugging hooks.
13401 See the description of
13402 <internallink id="bci">bytecode instrumentation</internallink>
13403 for usage information.
13404 <p/>
13405 When the capabilities
13406 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events">
13407 <code>can_generate_early_class_hook_events</code></internallink> and
13408 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
13409 <code>can_generate_all_class_hook_events</code></internallink>
13410 are enabled then this event may be sent in the primordial phase.
13411 Otherwise, this event may be sent before the VM is initialized (the start
13412 <functionlink id="GetPhase">phase</functionlink>).
13413 Some classes might not be compatible
13414 with the function (eg. ROMized classes or implementation defined classes) and this event will
13415 not be generated for these classes.
13416 <p/>
13417 The agent must allocate the space for the modified
13418 class file data buffer
13419 using the memory allocation function
13420 <functionlink id="Allocate"></functionlink> because the
13421 VM is responsible for freeing the new class file data buffer
13422 using <functionlink id="Deallocate"></functionlink>.
13423 <p/>
13424 If the agent wishes to modify the class file, it must set
13425 <code>new_class_data</code> to point
13426 to the newly instrumented class file data buffer and set
13427 <code>new_class_data_len</code> to the length of that
13428 buffer before returning
13429 from this call. If no modification is desired, the agent simply
13430 does not set <code>new_class_data</code>. If multiple agents
13431 have enabled this event the results are chained. That is, if
13432 <code>new_class_data</code> has been set, it becomes the
13433 <code>class_data</code> for the next agent.
13434 <p/>
13435 When handling a class load in the live phase, then the
13436 <functionlink id="GetNamedModule"></functionlink>
13437 function can be used to map class loader and a package name to a module.
13438 When a class is being redefined or retransformed then
13439 <code>class_being_redefined</code> is non-null and so
13440 the JNI <code>GetModule</code> function can also be used
13441 to obtain the Module.
13442 <p/>
13443 The order that this event is sent to each environment differs
13444 from other events.
13445 This event is sent to environments in the following order:
13446 <ul>
13447 <li><fieldlink id="can_retransform_classes"
13448 struct="jvmtiCapabilities">retransformation
13449 incapable</fieldlink>
13450 environments, in the
13451 order in which they were created
13452 </li>
13453 <li><fieldlink id="can_retransform_classes"
13454 struct="jvmtiCapabilities">retransformation
13455 capable</fieldlink>
13456 environments, in the
13457 order in which they were created
13458 </li>
13459 </ul>
13460 When triggered by <functionlink id="RetransformClasses"/>,
13461 this event is sent only to <fieldlink id="can_retransform_classes"
13462 struct="jvmtiCapabilities">retransformation
13463 capable</fieldlink>
13464 environments.
13465 </description>
13466 <origin>jvmpi</origin>
13467 <capabilities>
13468 <capability id="can_generate_all_class_hook_events"></capability>
13469 <capability id="can_generate_early_class_hook_events"></capability>
13470 </capabilities>
13471 <parameters>
13472 <param id="jni_env">
13473 <outptr>
13474 <struct>JNIEnv</struct>
13475 </outptr>
13476 <description>
13477 The JNI environment of the event (current) thread.
13478 </description>
13479 </param>
13480 <param id="class_being_redefined">
13481 <jclass/>
13482 <description>
13483 The class being
13484 <functionlink id="RedefineClasses">redefined</functionlink> or
13485 <functionlink id="RetransformClasses">retransformed</functionlink>.
13486 A null pointer if sent by class load.
13487 </description>
13488 </param>
13489 <param id="loader">
13490 <jobject/>
13491 <description>
13492 The class loader loading the class.
13493 A null pointer if the bootstrap class loader.
13494 </description>
13495 </param>
13496 <param id="name">
13497 <vmbuf><char/></vmbuf>
13498 <description>
13499 Name of class being loaded as a VM internal qualified name
13500 (for example, "java/util/List"), encoded as a
13501 <internallink id="mUTF">modified UTF-8</internallink> string.
13502 Note: if the class is defined with a null pointer name,
13503 <code>name</code> will be null.
13504 </description>
13505 </param>
13506 <param id="protection_domain">
13507 <jobject/>
13508 <description>
13509 The <code>ProtectionDomain</code> of the class.
13510 </description>
13511 </param>
13512 <param id="class_data_len">
13513 <jint/>
13514 <description>
13515 Length of current class file data buffer.
13516 </description>
13517 </param>
13518 <param id="class_data">
13519 <vmbuf><uchar/></vmbuf>
13520 <description>
13521 Pointer to the current class file data buffer.
13522 </description>
13523 </param>
13524 <param id="new_class_data_len">
13525 <outptr><jint/></outptr>
13526 <description>
13527 Pointer to the length of the new class file data buffer.
13528 </description>
13529 </param>
13530 <param id="new_class_data">
13531 <agentbuf incount="new_class_data_len"><uchar/></agentbuf>
13532 <description>
13533 Pointer to the pointer to the instrumented class file data buffer.
13534 </description>
13535 </param>
13536 </parameters>
13537 </event>
13538
13539 <event label="VM Start Event"
13540 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">
13541 <description>
13542 The VM start event signals the start of the VM.
13543 At this time JNI is live but the VM is not yet fully initialized.
13544 Once this event is generated, the agent is free to call any JNI function.
13545 This event signals the beginning of the start phase,
13546 <jvmti/> functions permitted in the start phase may be called.
13547 <p/>
13548 The timing of this event may depend on whether the agent has added the
13549 <internallink id="jvmtiCapabilities.can_generate_early_vmstart">
13550 <code>can_generate_early_vmstart</code></internallink> capability or not.
13551 If the capability has been added then the VM posts the event as early
13552 as possible. The VM is capable of executing bytecode but it may not have
13553 initialized to the point where it can load classes in modules other than
13554 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>.
13555 Agents that do load-time instrumentation in this
13556 phase must take great care when instrumenting code that potentially
13557 executes in this phase. Extreme care should also be taken with JNI
13558 <code>FindClass</code> as it may not be possible to load classes and attempts
13559 to do so may result in unpredictable behavior, maybe even stability issues
13560 on some VM implementations.
13561 If the capability has not been added then the VM delays posting this
13562 event until it is capable of loading classes in modules other than
13563 <code>java.base</code> or the VM has completed its initialization.
13564 Agents that create more than one JVM TI environment, where the
13565 capability is added to some but not all environments, may observe the
13566 start phase beginning earlier in the JVM TI environments that possess
13567 the capability.
13568 <p/>
13569 In the case of VM start-up failure, this event will not be sent.
13570 </description>
13571 <origin>jvmdi</origin>
13572 <capabilities>
13573 </capabilities>
13574 <parameters>
13575 <param id="jni_env">
13576 <outptr>
13577 <struct>JNIEnv</struct>
13578 </outptr>
13579 <description>
13580 The JNI environment of the event (current) thread.
13581 </description>
13582 </param>
13583 </parameters>
13584 </event>
13585
13586 <event label="VM Initialization Event"
13587 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">
13588 <description>
13589 The VM initialization event signals the completion of VM initialization. Once
13590 this event is generated, the agent is free to call any JNI or <jvmti/>
13591 function. The VM initialization event can be preceded by or can be concurrent
13592 with other events, but
13593 the preceding events should be handled carefully, if at all, because the
13594 VM has not completed its initialization. The thread start event for the
13595 main application thread is guaranteed not to occur until after the
13596 handler for the VM initialization event returns.
13597 <p/>
13598 In the case of VM start-up failure, this event will not be sent.
13599 </description>
13600 <origin>jvmdi</origin>
13601 <capabilities>
13602 </capabilities>
13603 <parameters>
13604 <param id="jni_env">
13605 <outptr>
13606 <struct>JNIEnv</struct>
13607 </outptr>
13608 <description>
13609 The JNI environment of the event (current) thread.
13610 </description>
13611 </param>
13612 <param id="thread">
13613 <jthread/>
13614 <description>
13615 The initial thread
13616 </description>
13617 </param>
13618 </parameters>
13619 </event>
13620
13621 <event label="VM Death Event"
13622 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">
13623 <description>
13624 The VM death event notifies the agent of the termination of the VM.
13625 No events will occur after the VMDeath event.
13626 <p/>
13627 In the case of VM start-up failure, this event will not be sent.
13628 Note that <internallink id="onunload">Agent_OnUnload</internallink>
13629 will still be called in these cases.
13630 </description>
13631 <origin>jvmdi</origin>
13632 <capabilities>
13633 </capabilities>
13634 <parameters>
13635 <param id="jni_env">
13636 <outptr>
13637 <struct>JNIEnv</struct>
13638 </outptr>
13639 <description>
13640 The JNI environment of the event (current) thread
13641 </description>
13642 </param>
13643 </parameters>
13644 </event>
13645
13646 <event label="Compiled Method Load" phase="start"
13647 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">
13648 <description>
13649 Sent when a method is compiled and loaded into memory by the VM.
13650 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.
13651 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,
13652 followed by a new <code>CompiledMethodLoad</code> event.
13653 Note that a single method may have multiple compiled forms, and that
13654 this event will be sent for each form.
13655 Note also that several methods may be inlined into a single
13656 address range, and that this event will be sent for each method.
13657 <p/>
13658 These events can be sent after their initial occurrence with
13659 <functionlink id="GenerateEvents"></functionlink>.
13660 </description>
13661 <origin>jvmpi</origin>
13662 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry">
13663 <field id="start_address">
13664 <vmbuf><void/></vmbuf>
13665 <description>
13666 Starting native address of code corresponding to a location
13667 </description>
13668 </field>
13669 <field id="location">
13670 <jlocation/>
13671 <description>
13672 Corresponding location. See
13673 <functionlink id="GetJLocationFormat"></functionlink>
13674 for the meaning of location.
13675 </description>
13676 </field>
13677 </typedef>
13678 <capabilities>
13679 <required id="can_generate_compiled_method_load_events"></required>
13680 </capabilities>
13681 <parameters>
13682 <param id="klass">
13683 <jclass method="method"/>
13684 <description>
13685 Class of the method being compiled and loaded
13686 </description>
13687 </param>
13688 <param id="method">
13689 <jmethodID class="klass"/>
13690 <description>
13691 Method being compiled and loaded
13692 </description>
13693 </param>
13694 <param id="code_size">
13695 <jint/>
13696 <description>
13697 Size of compiled code
13698 </description>
13699 </param>
13700 <param id="code_addr">
13701 <vmbuf><void/></vmbuf>
13702 <description>
13703 Address where compiled method code is loaded
13704 </description>
13705 </param>
13706 <param id="map_length">
13707 <jint/>
13708 <description>
13709 Number of <typelink id="jvmtiAddrLocationMap"></typelink>
13710 entries in the address map.
13711 Zero if mapping information cannot be supplied.
13712 </description>
13713 </param>
13714 <param id="map">
13715 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>
13716 <description>
13717 Map from native addresses to location.
13718 The native address range of each entry is from
13719 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>
13720 to <code>start_address-1</code> of the next entry.
13721 A null pointer if mapping information cannot be supplied.
13722 </description>
13723 </param>
13724 <param id="compile_info">
13725 <vmbuf><void/></vmbuf>
13726 <description>
13727 VM-specific compilation information.
13728 The referenced compile information is managed by the VM
13729 and must not depend on the agent for collection.
13730 A VM implementation defines the content and lifetime
13731 of the information.
13732 </description>
13733 </param>
13734 </parameters>
13735 </event>
13736
13737 <event label="Compiled Method Unload" phase="start"
13738 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">
13739 <description>
13740 Sent when a compiled method is unloaded from memory.
13741 This event might not be sent on the thread which performed the unload.
13742 This event may be sent sometime after the unload occurs, but
13743 will be sent before the memory is reused
13744 by a newly generated compiled method. This event may be sent after
13745 the class is unloaded.
13746 </description>
13747 <origin>jvmpi</origin>
13748 <capabilities>
13749 <required id="can_generate_compiled_method_load_events"></required>
13750 </capabilities>
13751 <parameters>
13752 <param id="klass">
13753 <jclass method="method"/>
13754 <description>
13755 Class of the compiled method being unloaded.
13756 </description>
13757 </param>
13758 <param id="method">
13759 <jmethodID class="klass"/>
13760 <description>
13761 Compiled method being unloaded.
13762 For identification of the compiled method only -- the class
13763 may be unloaded and therefore the method should not be used
13764 as an argument to further JNI or <jvmti/> functions.
13765 </description>
13766 </param>
13767 <param id="code_addr">
13768 <vmbuf><void/></vmbuf>
13769 <description>
13770 Address where compiled method code was loaded.
13771 For identification of the compiled method only --
13772 the space may have been reclaimed.
13773 </description>
13774 </param>
13775 </parameters>
13776 </event>
13777
13778 <event label="Dynamic Code Generated" phase="any"
13779 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">
13780 <description>
13781 Sent when a component of the virtual machine is generated dynamically.
13782 This does not correspond to Java programming language code that is
13783 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.
13784 This is for native code--for example, an interpreter that is generated
13785 differently depending on command-line options.
13786 <p/>
13787 Note that this event has no controlling capability.
13788 If a VM cannot generate these events, it simply does not send any.
13789 <p/>
13790 These events can be sent after their initial occurrence with
13791 <functionlink id="GenerateEvents"></functionlink>.
13792 </description>
13793 <origin>jvmpi</origin>
13794 <capabilities>
13795 </capabilities>
13796 <parameters>
13797 <param id="name">
13798 <vmbuf><char/></vmbuf>
13799 <description>
13800 Name of the code, encoded as a
13801 <internallink id="mUTF">modified UTF-8</internallink> string.
13802 Intended for display to an end-user.
13803 The name might not be unique.
13804 </description>
13805 </param>
13806 <param id="address">
13807 <vmbuf><void/></vmbuf>
13808 <description>
13809 Native address of the code
13810 </description>
13811 </param>
13812 <param id="length">
13813 <jint/>
13814 <description>
13815 Length in bytes of the code
13816 </description>
13817 </param>
13818 </parameters>
13819 </event>
13820
13821 <event label="Data Dump Request"
13822 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">
13823 <description>
13824 Sent by the VM to request the agent to dump its data. This
13825 is just a hint and the agent need not react to this event.
13826 This is useful for processing command-line signals from users. For
13827 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux
13828 causes the VM to send this event to the agent.
13829 </description>
13830 <origin>jvmpi</origin>
13831 <capabilities>
13832 </capabilities>
13833 <parameters>
13834 </parameters>
13835 </event>
13836
13837 <event label="Monitor Contended Enter"
13838 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">
13839 <description>
13840 Sent when a thread is attempting to enter a Java programming language
13841 monitor already acquired by another thread.
13842 </description>
13843 <origin>jvmpi</origin>
13844 <capabilities>
13845 <required id="can_generate_monitor_events"></required>
13846 </capabilities>
13847 <parameters>
13848 <param id="jni_env">
13849 <outptr>
13850 <struct>JNIEnv</struct>
13851 </outptr>
13852 <description>
13853 The JNI environment of the event (current) thread
13854 </description>
13855 </param>
13856 <param id="thread">
13857 <jthread/>
13858 <description>
13859 JNI local reference to the thread
13860 attempting to enter the monitor
13861 </description>
13862 </param>
13863 <param id="object">
13864 <jobject/>
13865 <description>
13866 JNI local reference to the monitor
13867 </description>
13868 </param>
13869 </parameters>
13870 </event>
13871
13872 <event label="Monitor Contended Entered"
13873 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">
13874 <description>
13875 Sent when a thread enters a Java programming language
13876 monitor after waiting for it to be released by another thread.
13877 </description>
13878 <origin>jvmpi</origin>
13879 <capabilities>
13880 <required id="can_generate_monitor_events"></required>
13881 </capabilities>
13882 <parameters>
13883 <param id="jni_env">
13884 <outptr>
13885 <struct>JNIEnv</struct>
13886 </outptr>
13887 <description>
13888 The JNI environment of the event (current) thread
13889 </description>
13890 </param>
13891 <param id="thread">
13892 <jthread/>
13893 <description>
13894 JNI local reference to the thread entering
13895 the monitor
13896 </description>
13897 </param>
13898 <param id="object">
13899 <jobject/>
13900 <description>
13901 JNI local reference to the monitor
13902 </description>
13903 </param>
13904 </parameters>
13905 </event>
13906
13907 <event label="Monitor Wait"
13908 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">
13909 <description>
13910 Sent when a thread is about to wait on an object.
13911 </description>
13912 <origin>jvmpi</origin>
13913 <capabilities>
13914 <required id="can_generate_monitor_events"></required>
13915 </capabilities>
13916 <parameters>
13917 <param id="jni_env">
13918 <outptr>
13919 <struct>JNIEnv</struct>
13920 </outptr>
13921 <description>
13922 The JNI environment of the event (current) thread
13923 </description>
13924 </param>
13925 <param id="thread">
13926 <jthread/>
13927 <description>
13928 JNI local reference to the thread about to wait
13929 </description>
13930 </param>
13931 <param id="object">
13932 <jobject/>
13933 <description>
13934 JNI local reference to the monitor
13935 </description>
13936 </param>
13937 <param id="timeout">
13938 <jlong/>
13939 <description>
13940 The number of milliseconds the thread will wait
13941 </description>
13942 </param>
13943 </parameters>
13944 </event>
13945
13946 <event label="Monitor Waited"
13947 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">
13948 <description>
13949 Sent when a thread finishes waiting on an object.
13950 </description>
13951 <origin>jvmpi</origin>
13952 <capabilities>
13953 <required id="can_generate_monitor_events"></required>
13954 </capabilities>
13955 <parameters>
13956 <param id="jni_env">
13957 <outptr>
13958 <struct>JNIEnv</struct>
13959 </outptr>
13960 <description>
13961 The JNI environment of the event (current) thread
13962 </description>
13963 </param>
13964 <param id="thread">
13965 <jthread/>
13966 <description>
13967 JNI local reference to the thread that was finished waiting
13968 </description>
13969 </param>
13970 <param id="object">
13971 <jobject/>
13972 <description>
13973 JNI local reference to the monitor.
13974 </description>
13975 </param>
13976 <param id="timed_out">
13977 <jboolean/>
13978 <description>
13979 True if the monitor timed out
13980 </description>
13981 </param>
13982 </parameters>
13983 </event>
13984
13985 <event label="Resource Exhausted"
13986 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"
13987 since="1.1">
13988 <description>
13989 Sent when a VM resource needed by a running application has been exhausted.
13990 Except as required by the optional capabilities, the set of resources
13991 which report exhaustion is implementation dependent.
13992 <p/>
13993 The following bit flags define the properties of the resource exhaustion:
13994 <constants id="jvmtiResourceExhaustionFlags"
13995 label="Resource Exhaustion Flags"
13996 kind="bits"
13997 since="1.1">
13998 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">
13999 After this event returns, the VM will throw a
14000 <code>java.lang.OutOfMemoryError</code>.
14001 </constant>
14002 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">
14003 The VM was unable to allocate memory from the <tm>Java</tm>
14004 platform <i>heap</i>.
14005 The <i>heap</i> is the runtime
14006 data area from which memory for all class instances and
14007 arrays are allocated.
14008 </constant>
14009 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">
14010 The VM was unable to create a thread.
14011 </constant>
14012 </constants>
14013 </description>
14014 <origin>new</origin>
14015 <capabilities>
14016 <capability id="can_generate_resource_exhaustion_heap_events">
14017 Can generate events when the VM is unable to allocate memory from the
14018 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.
14019 </capability>
14020 <capability id="can_generate_resource_exhaustion_threads_events">
14021 Can generate events when the VM is unable to
14022 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create
14023 a thread</internallink>.
14024 </capability>
14025 </capabilities>
14026 <parameters>
14027 <param id="jni_env">
14028 <outptr>
14029 <struct>JNIEnv</struct>
14030 </outptr>
14031 <description>
14032 The JNI environment of the event (current) thread
14033 </description>
14034 </param>
14035 <param id="flags">
14036 <jint/>
14037 <description>
14038 Flags defining the properties of the of resource exhaustion
14039 as specified by the
14040 <internallink id="jvmtiResourceExhaustionFlags">Resource
14041 Exhaustion Flags</internallink>.
14042 </description>
14043 </param>
14044 <param id="reserved">
14045 <vmbuf><void/></vmbuf>
14046 <description>
14047 Reserved.
14048 </description>
14049 </param>
14050 <param id="description">
14051 <vmbuf><char/></vmbuf>
14052 <description>
14053 Description of the resource exhaustion, encoded as a
14054 <internallink id="mUTF">modified UTF-8</internallink> string.
14055 </description>
14056 </param>
14057 </parameters>
14058 </event>
14059
14060 <event label="VM Object Allocation"
14061 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">
14062 <description>
14063 Sent when a method causes the virtual machine to directly allocate an
14064 Object visible to Java programming language code.
14065 Generally object allocation should be detected by instrumenting
14066 the bytecodes of allocating methods.
14067 Object allocation generated in native code by JNI function
14068 calls should be detected using
14069 <internallink id="jniIntercept">JNI function interception</internallink>.
14070 Some methods might not have associated bytecodes and are not
14071 native methods, they instead are executed directly by the
14072 VM. These methods should send this event.
14073 Virtual machines which are incapable of bytecode instrumentation
14074 for some or all of their methods can send this event.
14075 <p/>
14076 When preview features are enabled and the capability <code>can_support_value_objects</code>
14077 is enabled, this event is sent for the value object allocations.
14078 <code>null</code> is passed for the <paramlink id="object"></paramlink> parameter in such cases.
14079 <p/>
14080 Note that the <internallink
14081 id="SampledObjectAlloc">SampledObjectAlloc</internallink>
14082 event is triggered on all Java object allocations, including those
14083 caused by bytecode method execution, JNI method execution, and
14084 directly by VM methods.
14085 <p/>
14086 Typical examples where this event might be sent:
14087 <ul>
14088 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>
14089 <li>Methods not represented by bytecodes -- for example, VM intrinsics and
14090 J2ME preloaded classes</li>
14091 </ul>
14092 Cases where this event would not be generated:
14093 <ul>
14094 <li>Allocation due to bytecodes -- for example, the <code>new</code>
14095 and <code>newarray</code> VM instructions</li>
14096 <li>Allocation due to JNI function calls -- for example,
14097 <code>AllocObject</code></li>
14098 <li>Allocations during VM initialization</li>
14099 <li>VM internal objects</li>
14100 </ul>
14101 </description>
14102 <origin>new</origin>
14103 <capabilities>
14104 <required id="can_generate_vm_object_alloc_events"></required>
14105 <capability id="can_support_value_objects"></capability>
14106 </capabilities>
14107 <parameters>
14108 <param id="jni_env">
14109 <outptr>
14110 <struct>JNIEnv</struct>
14111 </outptr>
14112 <description>
14113 The JNI environment of the event (current) thread
14114 </description>
14115 </param>
14116 <param id="thread">
14117 <jthread/>
14118 <description>
14119 Thread allocating the object.
14120 </description>
14121 </param>
14122 <param id="object">
14123 <jobject/>
14124 <description>
14125 JNI local reference to the object that was allocated.
14126 Null when preview features are enabled, the capability <code>can_support_value_objects</code>
14127 is enabled, and the allocated object has no identity.
14128 </description>
14129 </param>
14130 <param id="object_klass">
14131 <jclass/>
14132 <description>
14133 JNI local reference to the class of the object.
14134 </description>
14135 </param>
14136 <param id="size">
14137 <jlong/>
14138 <description>
14139 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
14140 </description>
14141 </param>
14142 </parameters>
14143 </event>
14144
14145 <event label="Sampled Object Allocation"
14146 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">
14147 <description>
14148 Sent when an allocated object is sampled.
14149 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid
14150 pattern-based bias and provides an approximate overall average interval over long periods of
14151 sampling.
14152 <p/>
14153 Each thread tracks how many bytes it has allocated since it sent the last event.
14154 When the number of bytes exceeds the sampling interval, it will send another event.
14155 This implies that, on average, one object will be sampled every time a thread has
14156 allocated 512KB bytes since the last sample.
14157 <p/>
14158 Note that the sampler is pseudo-random: it will not sample every 512KB precisely.
14159 The goal of this is to ensure high quality sampling even if allocation is
14160 happening in a fixed pattern (i.e., the same set of objects are being allocated
14161 every 512KB).
14162 <p/>
14163 If another sampling interval is required, the user can call
14164 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value,
14165 representing the new sampling interval.
14166 <p/>
14167 This event is sent once the sampled allocation has been performed. It provides the object, stack trace
14168 of the allocation, the thread allocating, the size of allocation, and the object's class.
14169 <p/>
14170 A typical use case of this system is to determine where heap allocations originate.
14171 In conjunction with weak references and the function
14172 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which
14173 stack trace, and which are still live during the execution of the program.
14174 <p/>
14175 When preview features are enabled and the capability <code>can_support_value_objects</code>
14176 is enabled, this event is sent for the allocated objects that have no identity.
14177 <code>null</code> is passed for the <paramlink id="object"></paramlink> parameter in such cases.
14178 </description>
14179 <origin>new</origin>
14180 <capabilities>
14181 <required id="can_generate_sampled_object_alloc_events"></required>
14182 <capability id="can_support_value_objects"></capability>
14183 </capabilities>
14184 <parameters>
14185 <param id="jni_env">
14186 <outptr>
14187 <struct>JNIEnv</struct>
14188 </outptr>
14189 <description>
14190 The JNI environment of the event (current) thread.
14191 </description>
14192 </param>
14193 <param id="thread">
14194 <jthread/>
14195 <description>
14196 Thread allocating the object.
14197 </description>
14198 </param>
14199 <param id="object">
14200 <jobject/>
14201 <description>
14202 JNI local reference to the object that was allocated.
14203 Null when preview features are enabled, the capability <code>can_support_value_objects</code>
14204 is enabled, and the allocated object has no identity.
14205 </description>
14206 </param>
14207 <param id="object_klass">
14208 <jclass/>
14209 <description>
14210 JNI local reference to the class of the object
14211 </description>
14212 </param>
14213 <param id="size">
14214 <jlong/>
14215 <description>
14216 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
14217 </description>
14218 </param>
14219 </parameters>
14220 </event>
14221
14222 <event label="Object Free"
14223 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">
14224 <description>
14225 An Object Free event is sent when the garbage collector frees an object.
14226 Events are only sent for tagged objects--see
14227 <internallink id="Heap">heap functions</internallink>.
14228 <p/>
14229 When preview features are enabled, the Object Free event is only sent for tagged
14230 <externallink id="jni/functions.html#hasidentity">identity objects</externallink>.
14231 <b>The event is not sent for tagged value objects.</b>
14232 <p/>
14233 The event handler must not use JNI functions and
14234 must not use <jvmti/> functions except those which
14235 specifically allow such use (see the raw monitor, memory management,
14236 and environment local storage functions).
14237 </description>
14238 <origin>new</origin>
14239 <capabilities>
14240 <required id="can_generate_object_free_events"></required>
14241 </capabilities>
14242 <parameters>
14243 <param id="tag">
14244 <jlong/>
14245 <description>
14246 The freed object's tag
14247 </description>
14248 </param>
14249 </parameters>
14250 </event>
14251
14252 <event label="Garbage Collection Start"
14253 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">
14254 <description>
14255 A Garbage Collection Start event is sent when a
14256 garbage collection pause begins.
14257 Only stop-the-world collections are reported--that is, collections during
14258 which all threads cease to modify the state of the Java virtual machine.
14259 This means that some collectors will never generate these events.
14260 This event is sent while the VM is still stopped, thus
14261 the event handler must not use JNI functions and
14262 must not use <jvmti/> functions except those which
14263 specifically allow such use (see the raw monitor, memory management,
14264 and environment local storage functions).
14265 <p/>
14266 This event is always sent as a matched pair with
14267 <eventlink id="GarbageCollectionFinish"/>
14268 (assuming both events are enabled) and no garbage collection
14269 events will occur between them.
14270 </description>
14271 <origin>new</origin>
14272 <capabilities>
14273 <required id="can_generate_garbage_collection_events"></required>
14274 </capabilities>
14275 <parameters>
14276 </parameters>
14277 </event>
14278
14279 <event label="Garbage Collection Finish"
14280 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">
14281 <description>
14282 A Garbage Collection Finish event is sent when a
14283 garbage collection pause ends.
14284 This event is sent while the VM is still stopped, thus
14285 the event handler must not use JNI functions and
14286 must not use <jvmti/> functions except those which
14287 specifically allow such use (see the raw monitor, memory management,
14288 and environment local storage functions).
14289 <p/>
14290 Some agents may need to do post garbage collection operations that
14291 require the use of the disallowed <jvmti/> or JNI functions. For these
14292 cases an agent thread can be created which waits on a raw monitor,
14293 and the handler for the Garbage Collection Finish event simply
14294 notifies the raw monitor
14295 <p/>
14296 This event is always sent as a matched pair with
14297 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).
14298 <issue>
14299 The most important use of this event is to provide timing information,
14300 and thus additional information is not required. However,
14301 information about the collection which is "free" should be included -
14302 what that information is needs to be determined.
14303 </issue>
14304 </description>
14305 <origin>new</origin>
14306 <capabilities>
14307 <required id="can_generate_garbage_collection_events"></required>
14308 </capabilities>
14309 <parameters>
14310 </parameters>
14311 </event>
14312
14313 <elide>
14314 <event label="Verbose Output" phase="any"
14315 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">
14316 <description>
14317 Send verbose messages as strings.
14318 <issue>
14319 This format is extremely fragile, as it can change with each
14320 platform, collector and version. Alternatives include:
14321 <ul>
14322 <li>building off Java programming language M and M APIs</li>
14323 <li>XML</li>
14324 <li>key/value pairs</li>
14325 <li>removing it</li>
14326 </ul>
14327 </issue>
14328 <issue>
14329 Though this seemed trivial to implement.
14330 In the RI it appears this will be quite complex.
14331 </issue>
14332 </description>
14333 <origin>new</origin>
14334 <capabilities>
14335 </capabilities>
14336 <parameters>
14337 <param id="flag">
14338 <enum>jvmtiVerboseFlag</enum>
14339 <description>
14340 Which verbose output is being sent.
14341 </description>
14342 </param>
14343 <param id="message">
14344 <vmbuf><char/></vmbuf>
14345 <description>
14346 Message text, encoded as a
14347 <internallink id="mUTF">modified UTF-8</internallink> string.
14348 </description>
14349 </param>
14350 </parameters>
14351 </event>
14352 </elide>
14353
14354 </eventsection>
14355
14356 <datasection>
14357 <intro>
14358 <jvmti/> extends the data types defined by JNI.
14359 </intro>
14360 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">
14361 <basetype id="jboolean">
14362 <description>
14363 Holds a Java programming language <code>boolean</code>.
14364 Unsigned 8 bits.
14365 </description>
14366 </basetype>
14367 <basetype id="jchar">
14368 <description>
14369 Holds a Java programming language <code>char</code>.
14370 Unsigned 16 bits.
14371 </description>
14372 </basetype>
14373 <basetype id="jint">
14374 <description>
14375 Holds a Java programming language <code>int</code>.
14376 Signed 32 bits.
14377 </description>
14378 </basetype>
14379 <basetype id="jlong">
14380 <description>
14381 Holds a Java programming language <code>long</code>.
14382 Signed 64 bits.
14383 </description>
14384 </basetype>
14385 <basetype id="jfloat">
14386 <description>
14387 Holds a Java programming language <code>float</code>.
14388 32 bits.
14389 </description>
14390 </basetype>
14391 <basetype id="jdouble">
14392 <description>
14393 Holds a Java programming language <code>double</code>.
14394 64 bits.
14395 </description>
14396 </basetype>
14397 <basetype id="jobject">
14398 <description>
14399 Holds a Java programming language object.
14400 </description>
14401 </basetype>
14402 <basetype id="jclass">
14403 <description>
14404 Holds a Java programming language class.
14405 </description>
14406 </basetype>
14407 <basetype id="jvalue">
14408 <description>
14409 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java
14410 programming language value.
14411 </description>
14412 </basetype>
14413 <basetype id="jfieldID">
14414 <description>
14415 Identifies a Java programming language field.
14416 <code>jfieldID</code>s returned by <jvmti/> functions and events may be
14417 safely stored.
14418 </description>
14419 </basetype>
14420 <basetype id="jmethodID">
14421 <description>
14422 Identifies a Java programming language method, initializer, or constructor.
14423 <code>jmethodID</code>s returned by <jvmti/> functions and events may be
14424 safely stored. However, if the class is unloaded, they become invalid
14425 and must not be used.
14426 </description>
14427 </basetype>
14428 <basetype id="JNIEnv">
14429 <description>
14430 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)
14431 is a JNI environment.
14432 </description>
14433 </basetype>
14434 </basetypes>
14435
14436 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">
14437 <basetype id="jvmtiEnv">
14438 <description>
14439 The <jvmti/> <internallink id="environments">environment</internallink> pointer.
14440 See the <internallink id="FunctionSection">Function Section</internallink>.
14441 <code>jvmtiEnv</code> points to the
14442 <internallink id="FunctionTable">function table</internallink> pointer.
14443 </description>
14444 </basetype>
14445 <basetype id="jthread">
14446 <definition>typedef jobject jthread;</definition>
14447 <description>
14448 Subtype of <datalink id="jobject"></datalink> that holds a thread.
14449 </description>
14450 </basetype>
14451 <basetype id="jthreadGroup">
14452 <definition>typedef jobject jthreadGroup;</definition>
14453 <description>
14454 Subtype of <datalink id="jobject"></datalink> that holds a thread group.
14455 </description>
14456 </basetype>
14457 <basetype id="jlocation">
14458 <definition>typedef jlong jlocation;</definition>
14459 <description>
14460 A 64 bit value, representing a monotonically increasing
14461 executable position within a method.
14462 <code>-1</code> indicates a native method.
14463 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a
14464 given VM.
14465 </description>
14466 </basetype>
14467 <basetype id="jrawMonitorID">
14468 <definition>struct _jrawMonitorID;
14469 typedef struct _jrawMonitorID *jrawMonitorID;</definition>
14470 <description>
14471 A raw monitor.
14472 </description>
14473 </basetype>
14474 <basetype id="jvmtiError">
14475 <description>
14476 Holds an error return code.
14477 See the <internallink id="ErrorSection">Error section</internallink> for possible values.
14478 <example>
14479 typedef enum {
14480 JVMTI_ERROR_NONE = 0,
14481 JVMTI_ERROR_INVALID_THREAD = 10,
14482 ...
14483 } jvmtiError;
14484 </example>
14485 </description>
14486 </basetype>
14487 <basetype id="jvmtiEvent">
14488 <description>
14489 An identifier for an event type.
14490 See the <internallink id="EventSection">Event section</internallink> for possible values.
14491 It is guaranteed that future versions of this specification will
14492 never assign zero as an event type identifier.
14493 <example>
14494 typedef enum {
14495 JVMTI_EVENT_SINGLE_STEP = 1,
14496 JVMTI_EVENT_BREAKPOINT = 2,
14497 ...
14498 } jvmtiEvent;
14499 </example>
14500 </description>
14501 </basetype>
14502 <basetype id="jvmtiEventCallbacks" name="eventCallbacks">
14503 <description>
14504 The callbacks used for events.
14505 <example>
14506 typedef struct {
14507 jvmtiEventVMInit VMInit;
14508 jvmtiEventVMDeath VMDeath;
14509 ...
14510 } jvmtiEventCallbacks;
14511 </example>
14512 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>
14513 for the complete structure.
14514 <p/>
14515 Where, for example, the VM initialization callback is defined:
14516 <example>
14517 typedef void (JNICALL *jvmtiEventVMInit)
14518 (jvmtiEnv *jvmti_env,
14519 JNIEnv* jni_env,
14520 jthread thread);
14521 </example>
14522 See the individual events for the callback function definition.
14523 </description>
14524 </basetype>
14525 <basetype id="jniNativeInterface">
14526 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>
14527 <description>
14528 Typedef for the JNI function table <code>JNINativeInterface</code>
14529 defined in the
14530 <externallink id="jni/functions.html#interface-function-table">
14531 JNI Specification</externallink>.
14532 The JNI reference implementation defines this with an underscore.
14533 </description>
14534 </basetype>
14535 </basetypes>
14536
14537 </datasection>
14538
14539 <issuessection label="Issues">
14540 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">
14541 JVMDI requires that the agent suspend threads before calling
14542 certain sensitive functions. JVMPI requires garbage collection to be
14543 disabled before calling certain sensitive functions.
14544 It was suggested that rather than have this requirement, that
14545 VM place itself in a suitable state before performing an
14546 operation. This makes considerable sense since each VM
14547 knows its requirements and can most easily arrange a
14548 safe state.
14549 <p/>
14550 The ability to externally suspend/resume threads will, of
14551 course, remain. The ability to enable/disable garbage collection will not.
14552 <p/>
14553 This issue is resolved--suspend will not
14554 be required. The spec has been updated to reflect this.
14555 </intro>
14556
14557 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">
14558 There are a variety of approaches to sampling call stacks.
14559 The biggest bifurcation is between VM controlled and agent
14560 controlled.
14561 <p/>
14562 This issue is resolved--agent controlled
14563 sampling will be the approach.
14564 </intro>
14565
14566 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation">
14567 JVMDI represents threads as jthread. JVMPI primarily
14568 uses JNIEnv* to represent threads.
14569 <p/>
14570 The Expert Group has chosen jthread as the representation
14571 for threads in <jvmti/>.
14572 JNIEnv* is sent by
14573 events since it is needed to JNI functions. JNIEnv, per the
14574 JNI spec, are not supposed to be used outside their thread.
14575 </intro>
14576
14577 <intro id="design" label="Resolved Issue: Method Representation">
14578 The JNI spec allows an implementation to depend on jclass/jmethodID
14579 pairs, rather than simply a jmethodID, to reference a method.
14580 JVMDI, for consistency, choose the same representation.
14581 JVMPI, however, specifies that a jmethodID alone maps to a
14582 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store
14583 pointers in jmethodIDs, and as a result, a jmethodID is sufficient.
14584 In fact, any JVM implementation that supports JVMPI must have
14585 such a representation.
14586 <jvmti/> will use jmethodID as a unique representation of a method
14587 (no jclass is used).
14588 There should be efficiency gains, particularly in
14589 functionality like stack dumping, to this representation.
14590 <p/>
14591 Note that fields were not used in JVMPI and that the access profile
14592 of fields differs from methods--for implementation efficiency
14593 reasons, a jclass/jfieldID pair will still be needed for field
14594 reference.
14595 </intro>
14596
14597 <intro id="localReferenceIssue" label="Resolved Issue: Local References">
14598 Functions return local references.
14599 </intro>
14600
14601 <intro id="frameRep" label="Resolved Issue: Representation of frames">
14602 In JVMDI, a frame ID is used to represent a frame. Problem with this
14603 is that a VM must track when a frame becomes invalid, a far better
14604 approach, and the one used in <jvmti/>, is to reference frames by depth.
14605 </intro>
14606
14607 <intro id="requiredCapabilities" label="Issue: Required Capabilities">
14608 Currently, having a required capabilities means that the functionality
14609 is optional. Capabilities are useful even for required functionality
14610 since they can inform the VM is needed set-up. Thus, there should be
14611 a set of capabilities that a conformant implementation must provide
14612 (if requested during Agent_OnLoad).
14613 </intro>
14614
14615 <intro id="taghint" label="Proposal: add tag hint function">
14616 A hint of the percentage of objects that will be tagged would
14617 help the VM pick a good implementation.
14618 </intro>
14619
14620 <intro id="moreMonitorQueries" label="Request: More Monitor Quires">
14621 How difficult or easy would be to extend the monitor_info category to include
14622 <pre>
14623 - current number of monitors
14624 - enumeration of monitors
14625 - enumeration of threads waiting on a given monitor
14626 </pre>
14627 The reason for my question is the fact that current get_monitor_info support
14628 requires the agent to specify a given thread to get the info which is probably
14629 OK in the profiling/debugging space, while in the monitoring space the agent
14630 could be watching the monitor list and then decide which thread to ask for
14631 the info. You might ask why is this important for monitoring .... I think it
14632 can aid in the detection/prediction of application contention caused by hot-locks.
14633 </intro>
14634 </issuessection>
14635
14636 <changehistory id="ChangeHistory" update="09/05/07">
14637 <intro>
14638 The <jvmti/> specification is an evolving document with major, minor,
14639 and micro version numbers.
14640 A released version of the specification is uniquely identified
14641 by its major and minor version.
14642 The functions, events, and capabilities in this specification
14643 indicate a "Since" value which is the major and minor version in
14644 which it was introduced.
14645 The version of the specification implemented by the VM can
14646 be retrieved at runtime with the <functionlink id="GetVersionNumber"/>
14647 function.
14648 </intro>
14649 <change date="14 Nov 2002">
14650 Converted to XML document.
14651 </change>
14652 <change date="14 Nov 2002">
14653 Elided heap dump functions (for now) since what was there
14654 was wrong.
14655 </change>
14656 <change date="18 Nov 2002">
14657 Added detail throughout.
14658 </change>
14659 <change date="18 Nov 2002">
14660 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.
14661 </change>
14662 <change date="19 Nov 2002">
14663 Added AsyncGetStackTrace.
14664 </change>
14665 <change date="19 Nov 2002">
14666 Added jframeID return to GetStackTrace.
14667 </change>
14668 <change date="19 Nov 2002">
14669 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there
14670 since they are redundant with GetStackTrace.
14671 </change>
14672 <change date="19 Nov 2002">
14673 Elided ClearAllBreakpoints since it has always been redundant.
14674 </change>
14675 <change date="19 Nov 2002">
14676 Added GetSystemProperties.
14677 </change>
14678 <change date="19 Nov 2002">
14679 Changed the thread local storage functions to use jthread.
14680 </change>
14681 <change date="20 Nov 2002">
14682 Added GetJLocationFormat.
14683 </change>
14684 <change date="22 Nov 2002">
14685 Added events and introductory text.
14686 </change>
14687 <change date="22 Nov 2002">
14688 Cross reference type and constant definitions.
14689 </change>
14690 <change date="24 Nov 2002">
14691 Added DTD.
14692 </change>
14693 <change date="24 Nov 2002">
14694 Added capabilities function section.
14695 </change>
14696 <change date="29 Nov 2002">
14697 Assign capabilities to each function and event.
14698 </change>
14699 <change date="29 Nov 2002">
14700 Add <internallink id="jniIntercept">JNI interception functions</internallink>.
14701 </change>
14702 <change date="30 Nov 2002">
14703 Auto generate SetEventNotificationMode capabilities.
14704 </change>
14705 <change date="30 Nov 2002">
14706 Add <eventlink id="VMObjectAlloc"></eventlink> event.
14707 </change>
14708 <change date="30 Nov 2002">
14709 Add <eventlink id="DynamicCodeGenerated"></eventlink> event.
14710 </change>
14711 <change date="30 Nov 2002">
14712 Add const to declarations.
14713 </change>
14714 <change date="30 Nov 2002">
14715 Change method exit and frame pop to send on exception.
14716 </change>
14717 <change date="1 Dec 2002">
14718 Add ForceGarbageCollection.
14719 </change>
14720 <change date="2 Dec 2002">
14721 Redo Xrun section; clarify GetStackTrace and add example;
14722 Fix width problems; use "agent" consistently.
14723 </change>
14724 <change date="8 Dec 2002">
14725 Remove previous start-up intro.
14726 Add <internallink id="environments"><jvmti/> Environments</internallink>
14727 section.
14728 </change>
14729 <change date="8 Dec 2002">
14730 Add <functionlink id="DisposeEnvironment"></functionlink>.
14731 </change>
14732 <change date="9 Dec 2002">
14733 Numerous minor updates.
14734 </change>
14735 <change date="15 Dec 2002">
14736 Add heap profiling functions added:
14737 get/set annotation, iterate live objects/heap.
14738 Add heap profiling functions place holder added:
14739 heap roots.
14740 Heap profiling event added: object free.
14741 Heap profiling event redesigned: vm object allocation.
14742 Heap profiling event placeholders added: garbage collection start/finish.
14743 Native method bind event added.
14744 </change>
14745 <change date="19 Dec 2002">
14746 Revamp suspend/resume functions.
14747 Add origin information with jvmdi tag.
14748 Misc fixes.
14749 </change>
14750 <change date="24 Dec 2002">
14751 Add semantics to types.
14752 </change>
14753 <change date="27 Dec 2002">
14754 Add local reference section.
14755 Autogenerate parameter descriptions from types.
14756 </change>
14757 <change date="28 Dec 2002">
14758 Document that RunAgentThread sends threadStart.
14759 </change>
14760 <change date="29 Dec 2002">
14761 Remove redundant local ref and dealloc warning.
14762 Convert GetRawMonitorName to allocated buffer.
14763 Add GenerateEvents.
14764 </change>
14765 <change date="30 Dec 2002">
14766 Make raw monitors a type and rename to "jrawMonitorID".
14767 </change>
14768 <change date="1 Jan 2003">
14769 Include origin information.
14770 Clean-up JVMDI issue references.
14771 Remove Deallocate warnings which are now automatically generated.
14772 </change>
14773 <change date="2 Jan 2003">
14774 Fix representation issues for jthread.
14775 </change>
14776 <change date="3 Jan 2003">
14777 Make capabilities buffered out to 64 bits - and do it automatically.
14778 </change>
14779 <change date="4 Jan 2003">
14780 Make constants which are enumeration into enum types.
14781 Parameters now of enum type.
14782 Clean-up and index type section.
14783 Replace remaining datadef entities with callback.
14784 </change>
14785 <change date="7 Jan 2003">
14786 Correct GenerateEvents description.
14787 More internal semantics work.
14788 </change>
14789 <change date="9 Jan 2003">
14790 Replace previous GetSystemProperties with two functions
14791 which use allocated information instead fixed.
14792 Add SetSystemProperty.
14793 More internal semantics work.
14794 </change>
14795 <change date="12 Jan 2003">
14796 Add varargs to end of SetEventNotificationMode.
14797 </change>
14798 <change date="20 Jan 2003">
14799 Finish fixing spec to reflect that alloc sizes are jlong.
14800 </change>
14801 <change date="22 Jan 2003">
14802 Allow null as RunAgentThread arg.
14803 </change>
14804 <change date="22 Jan 2003">
14805 Fixed names to standardized naming convention
14806 Removed AsyncGetStackTrace.
14807 </change>
14808 <change date="29 Jan 2003">
14809 Since we are using jthread, removed GetThread.
14810 </change>
14811 <change date="31 Jan 2003">
14812 Change GetFieldName to allow null like GetMethodName.
14813 </change>
14814 <change date="29 Feb 2003" version="v40">
14815 Rewrite the introductory text, adding sections on
14816 start-up, environments and bytecode instrumentation.
14817 Change the command line arguments per EG discussions.
14818 Add an introduction to the capabilities section.
14819 Add the extension mechanism category and functions.
14820 Mark for deletion, but clarified anyhow, SuspendAllThreads.
14821 Rename IterateOverLiveObjects to IterateOverReachableObjects and
14822 change the text accordingly.
14823 Clarify IterateOverHeap.
14824 Clarify CompiledMethodLoad.
14825 Discuss prerequisite state for Calling Functions.
14826 Clarify SetAllocationHooks.
14827 Added issues ("To be resolved:") through-out.
14828 And so on...
14829 </change>
14830 <change date="6 Mar 2003" version="v41">
14831 Remove struct from the call to GetOwnedMonitorInfo.
14832 Automatically generate most error documentation, remove
14833 (rather broken) hand written error doc.
14834 Better describe capability use (empty initial set).
14835 Add min value to jint params.
14836 Remove the capability can_access_thread_local_storage.
14837 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
14838 same for *NOT_IMPLEMENTED.
14839 Description fixes.
14840 </change>
14841 <change date="8 Mar 2003" version="v42">
14842 Rename GetClassSignature to GetClassName.
14843 Rename IterateOverClassObjects to IterateOverInstancesOfClass.
14844 Remove GetMaxStack (operand stack isn't used in <jvmti/>).
14845 Description fixes: define launch-time, remove native frame pop
14846 from PopFrame, and assorted clarifications.
14847 </change>
14848 <change date="8 Mar 2003" version="v43">
14849 Fix minor editing problem.
14850 </change>
14851 <change date="10 Mar 2003" version="v44">
14852 Add phase information.
14853 Remap (compact) event numbers.
14854 </change>
14855 <change date="11 Mar 2003" version="v45">
14856 More phase information - allow "any".
14857 Elide raw monitor queries and events.
14858 Minor description fixes.
14859 </change>
14860 <change date="12 Mar 2003" version="v46">
14861 Add GetPhase.
14862 Use "phase" through document.
14863 Elide GetRawMonitorName.
14864 Elide GetObjectMonitors.
14865 </change>
14866 <change date="12 Mar 2003" version="v47">
14867 Fixes from link, XML, and spell checking.
14868 Auto-generate the callback structure.
14869 </change>
14870 <change date="13 Mar 2003" version="v48">
14871 One character XML fix.
14872 </change>
14873 <change date="13 Mar 2003" version="v49">
14874 Change function parameter names to be consistent with
14875 event parameters (fooBarBaz becomes foo_bar_baz).
14876 </change>
14877 <change date="14 Mar 2003" version="v50">
14878 Fix broken link. Fix thread markers.
14879 </change>
14880 <change date="14 Mar 2003" version="v51">
14881 Change constants so they are under 128 to workaround
14882 compiler problems.
14883 </change>
14884 <change date="23 Mar 2003" version="v52">
14885 Overhaul capabilities. Separate GetStackTrace into
14886 GetStackTrace and GetStackFrames.
14887 </change>
14888 <change date="8 Apr 2003" version="v54">
14889 Use depth instead of jframeID to reference frames.
14890 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.
14891 Remove frame arg from events.
14892 </change>
14893 <change date="9 Apr 2003" version="v55">
14894 Remove GetObjectWithAnnotation since tests show buffered approach more efficient.
14895 Add missing annotation_count to GetObjectsWithAnnotations
14896 </change>
14897 <change date="10 Apr 2003" version="v56">
14898 Remove confusing parenthetical statement in GetObjectsWithAnnotations
14899 </change>
14900 <change date="13 Apr 2003" version="v58">
14901 Replace jclass/jmethodID representation of method with simply jmethodID;
14902 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.
14903 Replace can_access_frames with can_access_local_variables; remove from purely stack access.
14904 Use can_get_synthetic_attribute; fix description.
14905 Clarify that zero length arrays must be deallocated.
14906 Clarify RelinquishCapabilities.
14907 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.
14908 </change>
14909 <change date="27 Apr 2003" version="v59">
14910 Remove lingering indirect references to OBSOLETE_METHOD_ID.
14911 </change>
14912 <change date="4 May 2003" version="v60">
14913 Allow DestroyRawMonitor during OnLoad.
14914 </change>
14915 <change date="7 May 2003" version="v61">
14916 Added not monitor owner error return to DestroyRawMonitor.
14917 </change>
14918 <change date="13 May 2003" version="v62">
14919 Clarify semantics of raw monitors.
14920 Change flags on <code>GetThreadStatus</code>.
14921 <code>GetClassLoader</code> return a null pointer for the bootstrap class loader.
14922 Add <code>GetClassName</code> issue.
14923 Define local variable signature.
14924 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.
14925 Remove over specification in <code>GetObjectsWithAnnotations</code>.
14926 Elide <code>SetAllocationHooks</code>.
14927 Elide <code>SuspendAllThreads</code>.
14928 </change>
14929 <change date="14 May 2003" version="v63">
14930 Define the data type <code>jvmtiEventCallbacks</code>.
14931 Zero length allocations return a null pointer.
14932 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.
14933 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.
14934 </change>
14935 <change date="15 May 2003" version="v64">
14936 Better wording, per review.
14937 </change>
14938 <change date="15 May 2003" version="v65">
14939 First Alpha.
14940 Make jmethodID and jfieldID unique, jclass not used.
14941 </change>
14942 <change date="27 May 2003" version="v66">
14943 Fix minor XSLT errors.
14944 </change>
14945 <change date="13 June 2003" version="v67">
14946 Undo making jfieldID unique (jmethodID still is).
14947 </change>
14948 <change date="17 June 2003" version="v68">
14949 Changes per June 11th Expert Group meeting --
14950 Overhaul Heap functionality: single callback,
14951 remove GetHeapRoots, add reachable iterators,
14952 and rename "annotation" to "tag".
14953 A null pointer thread parameter on most functions is current
14954 thread.
14955 Add timers.
14956 Remove ForceExit.
14957 Add GetEnvironmentLocalStorage.
14958 Add verbose flag and event.
14959 Add AddToBootstrapClassLoaderSearch.
14960 Update ClassFileLoadHook.
14961 </change>
14962 <change date="18 June 2003" version="v69">
14963 Clean up issues sections.
14964 Rename GetClassName back to GetClassSignature and
14965 fix description.
14966 Add generic signature to GetClassSignature,
14967 GetFieldSignature, GetMethodSignature, and
14968 GetLocalVariableTable.
14969 Elide EstimateCostOfCapabilities.
14970 Clarify that the system property functions operate
14971 on the VM view of system properties.
14972 Clarify Agent_OnLoad.
14973 Remove "const" from JNIEnv* in events.
14974 Add metadata accessors.
14975 </change>
14976 <change date="18 June 2003" version="v70">
14977 Add start_depth to GetStackTrace.
14978 Move system properties to a new category.
14979 Add GetObjectSize.
14980 Remove "X" from command line flags.
14981 XML, HTML, and spell check corrections.
14982 </change>
14983 <change date="19 June 2003" version="v71">
14984 Fix JVMTI_HEAP_ROOT_THREAD to be 6.
14985 Make each synopsis match the function name.
14986 Fix unclear wording.
14987 </change>
14988 <change date="26 June 2003" version="v72">
14989 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value
14990 to be set to null pointer.
14991 NotifyFramePop, GetFrameLocationm and all the local variable operations
14992 needed to have their wording about frames fixed.
14993 Grammar and clarity need to be fixed throughout.
14994 Capitalization and puntuation need to be consistent.
14995 Need micro version number and masks for accessing major, minor, and micro.
14996 The error code lists should indicate which must be returned by
14997 an implementation.
14998 The command line properties should be visible in the properties functions.
14999 Disallow popping from the current thread.
15000 Allow implementations to return opaque frame error when they cannot pop.
15001 The NativeMethodBind event should be sent during any phase.
15002 The DynamicCodeGenerated event should be sent during any phase.
15003 The following functions should be allowed to operate before VMInit:
15004 Set/GetEnvironmentLocalStorage
15005 GetMethodDeclaringClass
15006 GetClassSignature
15007 GetClassModifiers
15008 IsInterface
15009 IsArrayClass
15010 GetMethodName
15011 GetMethodModifiers
15012 GetMaxLocals
15013 GetArgumentsSize
15014 GetLineNumberTable
15015 GetMethodLocation
15016 IsMethodNative
15017 IsMethodSynthetic.
15018 Other changes (to XSL):
15019 Argument description should show asterisk after not before pointers.
15020 NotifyFramePop, GetFrameLocationm and all the local variable operations
15021 should hsve the NO_MORE_FRAMES error added.
15022 Not alive threads should have a different error return than invalid thread.
15023 </change>
15024 <change date="7 July 2003" version="v73">
15025 VerboseOutput event was missing message parameter.
15026 Minor fix-ups.
15027 </change>
15028 <change date="14 July 2003" version="v74">
15029 Technical Publications Department corrections.
15030 Allow thread and environment local storage to be set to null pointer.
15031 </change>
15032 <change date="23 July 2003" version="v75">
15033 Use new Agent_OnLoad rather than overloaded JVM_OnLoad.
15034 Add JNICALL to callbacks (XSL).
15035 Document JNICALL requirement for both events and callbacks (XSL).
15036 Restrict RedefineClasses to methods and attributes.
15037 Elide the VerboseOutput event.
15038 VMObjectAlloc: restrict when event is sent and remove method parameter.
15039 Finish loose ends from Tech Pubs edit.
15040 </change>
15041 <change date="24 July 2003" version="v76">
15042 Change ClassFileLoadHook event to send the class instead of a boolean of redefine.
15043 </change>
15044 <change date="24 July 2003" version="v77">
15045 XML fixes.
15046 Minor text clarifications and corrections.
15047 </change>
15048 <change date="24 July 2003" version="v78">
15049 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.
15050 Clarify that stack frames are JVM Spec frames.
15051 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,
15052 and can_get_source_debug_extension.
15053 PopFrame cannot have a native calling method.
15054 Removed incorrect statement in GetClassloaderClasses
15055 (see <vmspec chapter="4.4"/>).
15056 </change>
15057 <change date="24 July 2003" version="v79">
15058 XML and text fixes.
15059 Move stack frame description into Stack Frame category.
15060 </change>
15061 <change date="26 July 2003" version="v80">
15062 Allow null pointer (means bootstrap loader) for GetClassloaderClasses.
15063 Add new heap reference kinds for references from classes.
15064 Add timer information struct and query functions.
15065 Add AvailableProcessors.
15066 Rename GetOtherThreadCpuTime to GetThreadCpuTime.
15067 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE
15068 to SetEventNotification mode.
15069 Add initial thread to the VM_INIT event.
15070 Remove platform assumptions from AddToBootstrapClassLoaderSearch.
15071 </change>
15072 <change date="26 July 2003" version="v81">
15073 Grammar and clarity changes per review.
15074 </change>
15075 <change date="27 July 2003" version="v82">
15076 More grammar and clarity changes per review.
15077 Add Agent_OnUnload.
15078 </change>
15079 <change date="28 July 2003" version="v83">
15080 Change return type of Agent_OnUnload to void.
15081 </change>
15082 <change date="28 July 2003" version="v84">
15083 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.
15084 </change>
15085 <change date="28 July 2003" version="v85">
15086 Steal java.lang.Runtime.availableProcessors() wording for
15087 AvailableProcessors().
15088 Guarantee that zero will never be an event ID.
15089 Remove some issues which are no longer issues.
15090 Per review, rename and more completely document the timer
15091 information functions.
15092 </change>
15093 <change date="29 July 2003" version="v86">
15094 Non-spec visible change to XML controlled implementation:
15095 SetThreadLocalStorage must run in VM mode.
15096 </change>
15097 <change date="5 August 2003" version="0.1.87">
15098 Add GetErrorName.
15099 Add varargs warning to jvmtiExtensionEvent.
15100 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.
15101 Remove unused can_get_exception_info capability.
15102 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.
15103 Fix jvmtiExtensionFunctionInfo.func declared type.
15104 Extension function returns error code.
15105 Use new version numbering.
15106 </change>
15107 <change date="5 August 2003" version="0.2.88">
15108 Remove the ClassUnload event.
15109 </change>
15110 <change date="8 August 2003" version="0.2.89">
15111 Heap reference iterator callbacks return an enum that
15112 allows outgoing object references to be ignored.
15113 Allow JNIEnv as a param type to extension events/functions.
15114 </change>
15115 <change date="15 August 2003" version="0.2.90">
15116 Fix a typo.
15117 </change>
15118 <change date="2 September 2003" version="0.2.91">
15119 Remove all metadata functions: GetClassMetadata,
15120 GetFieldMetadata, and GetMethodMetadata.
15121 </change>
15122 <change date="1 October 2003" version="0.2.92">
15123 Mark the functions Allocate. Deallocate, RawMonitor*,
15124 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage
15125 as safe for use in heap callbacks and GC events.
15126 </change>
15127 <change date="24 November 2003" version="0.2.93">
15128 Add pass through opaque user data pointer to heap iterate
15129 functions and callbacks.
15130 In the CompiledMethodUnload event, send the code address.
15131 Add GarbageCollectionOccurred event.
15132 Add constant pool reference kind.
15133 Mark the functions CreateRawMonitor and DestroyRawMonitor
15134 as safe for use in heap callbacks and GC events.
15135 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,
15136 GetThreadCpuTimerInfo, IterateOverReachableObjects,
15137 IterateOverObjectsReachableFromObject, GetTime and
15138 JVMTI_ERROR_NULL_POINTER.
15139 Add missing errors to: GenerateEvents and
15140 AddToBootstrapClassLoaderSearch.
15141 Fix description of ClassFileLoadHook name parameter.
15142 In heap callbacks and GC/ObjectFree events, specify
15143 that only explicitly allowed functions can be called.
15144 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,
15145 GetTimerInfo, and GetTime during callback.
15146 Allow calling SetTag/GetTag during the onload phase.
15147 SetEventNotificationMode, add: error attempted inappropriate
15148 thread level control.
15149 Remove jvmtiExceptionHandlerEntry.
15150 Fix handling of native methods on the stack --
15151 location_ptr param of GetFrameLocation, remove
15152 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,
15153 jvmtiFrameInfo.location, and jlocation.
15154 Remove typo (from JVMPI) implying that the MonitorWaited
15155 event is sent on sleep.
15156 </change>
15157 <change date="25 November 2003" version="0.2.94">
15158 Clarifications and typos.
15159 </change>
15160 <change date="3 December 2003" version="0.2.95">
15161 Allow null pointer user_data in heap iterators.
15162 </change>
15163 <change date="28 January 2004" version="0.2.97">
15164 Add GetThreadState, deprecate GetThreadStatus.
15165 </change>
15166 <change date="29 January 2004" version="0.2.98">
15167 INVALID_SLOT and TYPE_MISMATCH errors should be optional.
15168 </change>
15169 <change date="12 February 2004" version="0.2.102">
15170 Remove MonitorContendedExit.
15171 Added JNIEnv parameter to VMObjectAlloc.
15172 Clarified definition of class_tag and referrer_index
15173 parameters to heap callbacks.
15174 </change>
15175 <change date="16 February 2004" version="0.2.103">
15176 Document JAVA_TOOL_OPTIONS.
15177 </change>
15178 <change date="17 February 2004" version="0.2.105">
15179 Divide start phase into primordial and start.
15180 Add VMStart event
15181 Change phase associations of functions and events.
15182 </change>
15183 <change date="18 February 2004" version="0.3.6">
15184 Elide deprecated GetThreadStatus.
15185 Bump minor version, subtract 100 from micro version
15186 </change>
15187 <change date="18 February 2004" version="0.3.7">
15188 Document that timer nanosecond values are unsigned.
15189 Clarify text having to do with native methods.
15190 </change>
15191 <change date="19 February 2004" version="0.3.8">
15192 Fix typos.
15193 Remove elided deprecated GetThreadStatus.
15194 </change>
15195 <change date="23 February 2004" version="0.3.9">
15196 Require NotifyFramePop to act on suspended threads.
15197 </change>
15198 <change date="24 February 2004" version="0.3.10">
15199 Add capabilities
15200 (<internallink id="jvmtiCapabilities.can_redefine_any_class"
15201 ><code>can_redefine_any_class</code></internallink>
15202 and
15203 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"
15204 ><code>can_generate_all_class_hook_events</code></internallink>)
15205 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)
15206 which allow some classes to be unmodifiable.
15207 </change>
15208 <change date="28 February 2004" version="0.3.11">
15209 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.
15210 </change>
15211 <change date="8 March 2004" version="0.3.12">
15212 Clarified CompiledMethodUnload so that it is clear the event
15213 may be posted after the class has been unloaded.
15214 </change>
15215 <change date="5 March 2004" version="0.3.13">
15216 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.
15217 </change>
15218 <change date="13 March 2004" version="0.3.14">
15219 Added guideline for the use of the JNI FindClass function in event
15220 callback functions.
15221 </change>
15222 <change date="15 March 2004" version="0.3.15">
15223 Add GetAllStackTraces and GetThreadListStackTraces.
15224 </change>
15225 <change date="19 March 2004" version="0.3.16">
15226 ClassLoad and ClassPrepare events can be posted during start phase.
15227 </change>
15228 <change date="25 March 2004" version="0.3.17">
15229 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,
15230 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.
15231 </change>
15232 <change date="29 March 2004" version="0.3.18">
15233 Return the timer kind in the timer information structure.
15234 </change>
15235 <change date="31 March 2004" version="0.3.19">
15236 Spec clarifications:
15237 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.
15238 ForceGarbageCollection does not run finalizers.
15239 The context of the specification is the Java platform.
15240 Warn about early instrumentation.
15241 </change>
15242 <change date="1 April 2004" version="0.3.20">
15243 Refinements to the above clarifications and
15244 Clarify that an error returned by Agent_OnLoad terminates the VM.
15245 </change>
15246 <change date="1 April 2004" version="0.3.21">
15247 Array class creation does not generate a class load event.
15248 </change>
15249 <change date="7 April 2004" version="0.3.22">
15250 Align thread state hierarchy more closely with java.lang.Thread.State.
15251 </change>
15252 <change date="12 April 2004" version="0.3.23">
15253 Clarify the documentation of thread state.
15254 </change>
15255 <change date="19 April 2004" version="0.3.24">
15256 Remove GarbageCollectionOccurred event -- can be done by agent.
15257 </change>
15258 <change date="22 April 2004" version="0.3.25">
15259 Define "command-line option".
15260 </change>
15261 <change date="29 April 2004" version="0.3.26">
15262 Describe the intended use of bytecode instrumentation.
15263 Fix description of extension event first parameter.
15264 </change>
15265 <change date="30 April 2004" version="0.3.27">
15266 Clarification and typos.
15267 </change>
15268 <change date="18 May 2004" version="0.3.28">
15269 Remove DataDumpRequest event.
15270 </change>
15271 <change date="18 May 2004" version="0.3.29">
15272 Clarify RawMonitorWait with zero timeout.
15273 Clarify thread state after RunAgentThread.
15274 </change>
15275 <change date="24 May 2004" version="0.3.30">
15276 Clean-up: fix bad/old links, etc.
15277 </change>
15278 <change date="30 May 2004" version="0.3.31">
15279 Clarifications including:
15280 All character strings are modified UTF-8.
15281 Agent thread visibiity.
15282 Meaning of obsolete method version.
15283 Thread invoking heap callbacks,
15284 </change>
15285 <change date="1 June 2004" version="1.0.32">
15286 Bump major.minor version numbers to "1.0".
15287 </change>
15288 <change date="2 June 2004" version="1.0.33">
15289 Clarify interaction between ForceGarbageCollection
15290 and ObjectFree.
15291 </change>
15292 <change date="6 June 2004" version="1.0.34">
15293 Restrict AddToBootstrapClassLoaderSearch and
15294 SetSystemProperty to the OnLoad phase only.
15295 </change>
15296 <change date="11 June 2004" version="1.0.35">
15297 Fix typo in SetTag.
15298 </change>
15299 <change date="18 June 2004" version="1.0.36">
15300 Fix trademarks.
15301 Add missing parameter in example GetThreadState usage.
15302 </change>
15303 <change date="4 August 2004" version="1.0.37">
15304 Copyright updates.
15305 </change>
15306 <change date="5 November 2004" version="1.0.38">
15307 Add missing function table layout.
15308 Add missing description of C++ member function format of functions.
15309 Clarify that name in CFLH can be null pointer.
15310 Released as part of <tm>J2SE</tm> 5.0.
15311 </change>
15312 <change date="24 April 2005" version="1.1.47">
15313 Bump major.minor version numbers to "1.1".
15314 Add ForceEarlyReturn* functions.
15315 Add GetOwnedMonitorStackDepthInfo function.
15316 Add GetCurrentThread function.
15317 Add "since" version marker.
15318 Add AddToSystemClassLoaderSearch.
15319 Allow AddToBootstrapClassLoaderSearch be used in live phase.
15320 Fix historic rubbish in the descriptions of the heap_object_callback
15321 parameter of IterateOverHeap and IterateOverInstancesOfClass functions;
15322 disallow null pointer for this parameter.
15323 Clarify, correct and make consistent: wording about current thread,
15324 opaque frames and insufficient number of frames in PopFrame.
15325 Consistently use "current frame" rather than "topmost".
15326 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*
15327 by making them compatible with those in ForceEarlyReturn*.
15328 Many other clarifications and wording clean ups.
15329 </change>
15330 <change date="25 April 2005" version="1.1.48">
15331 Add GetConstantPool.
15332 Switch references to the first edition of the VM Spec, to the seconds edition.
15333 </change>
15334 <change date="26 April 2005" version="1.1.49">
15335 Clarify minor/major version order in GetConstantPool.
15336 </change>
15337 <change date="26 April 2005" version="1.1.50">
15338 Add SetNativeMethodPrefix and SetNativeMethodPrefixes.
15339 Reassign GetOwnedMonitorStackDepthInfo to position 153.
15340 Break out Class Loader Search in its own documentation category.
15341 Deal with overly long lines in XML source.
15342 </change>
15343 <change date="29 April 2005" version="1.1.51">
15344 Allow agents be started in the live phase.
15345 Added paragraph about deploying agents.
15346 </change>
15347 <change date="30 April 2005" version="1.1.52">
15348 Add specification description to SetNativeMethodPrefix(es).
15349 Better define the conditions on GetConstantPool.
15350 </change>
15351 <change date="30 April 2005" version="1.1.53">
15352 Break out the GetClassVersionNumber function from GetConstantPool.
15353 Clean-up the references to the VM Spec.
15354 </change>
15355 <change date="1 May 2005" version="1.1.54">
15356 Allow SetNativeMethodPrefix(es) in any phase.
15357 Add clarifications about the impact of redefinition on GetConstantPool.
15358 </change>
15359 <change date="2 May 2005" version="1.1.56">
15360 Various clarifications to SetNativeMethodPrefix(es).
15361 </change>
15362 <change date="2 May 2005" version="1.1.57">
15363 Add missing performance warning to the method entry event.
15364 </change>
15365 <change date="5 May 2005" version="1.1.58">
15366 Remove internal JVMDI support.
15367 </change>
15368 <change date="8 May 2005" version="1.1.59">
15369 Add <functionlink id="RetransformClasses"/>.
15370 Revamp the bytecode instrumentation documentation.
15371 Change <functionlink id="IsMethodObsolete"/> to no longer
15372 require the can_redefine_classes capability.
15373 </change>
15374 <change date="11 May 2005" version="1.1.63">
15375 Clarifications for retransformation.
15376 </change>
15377 <change date="11 May 2005" version="1.1.64">
15378 Clarifications for retransformation, per review.
15379 Lock "retransformation (in)capable" at class load enable time.
15380 </change>
15381 <change date="4 June 2005" version="1.1.67">
15382 Add new heap functionity which supports reporting primitive values,
15383 allows setting the referrer tag, and has more powerful filtering:
15384 FollowReferences, IterateThroughHeap, and their associated
15385 callbacks, structs, enums, and constants.
15386 </change>
15387 <change date="4 June 2005" version="1.1.68">
15388 Clarification.
15389 </change>
15390 <change date="6 June 2005" version="1.1.69">
15391 FollowReferences, IterateThroughHeap: Put callbacks in a struct;
15392 Add missing error codes; reduce bits in the visit control flags.
15393 </change>
15394 <change date="14 June 2005" version="1.1.70">
15395 More on new heap functionity: spec clean-up per review.
15396 </change>
15397 <change date="15 June 2005" version="1.1.71">
15398 More on new heap functionity: Rename old heap section to Heap (1.0).
15399 </change>
15400 <change date="21 June 2005" version="1.1.72">
15401 Fix typos.
15402 </change>
15403 <change date="27 June 2005" version="1.1.73">
15404 Make referrer info structure a union.
15405 </change>
15406 <change date="9 September 2005" version="1.1.74">
15407 In new heap functions:
15408 Add missing superclass reference kind.
15409 Use a single scheme for computing field indexes.
15410 Remove outdated references to struct based referrer info.
15411 </change>
15412 <change date="12 September 2005" version="1.1.75">
15413 Don't callback during FollowReferences on frivolous java.lang.Object superclass.
15414 </change>
15415 <change date="13 September 2005" version="1.1.76">
15416 In string primitive callback, length now Unicode length.
15417 In array and string primitive callbacks, value now "const".
15418 Note possible compiler impacts on setting JNI function table.
15419 </change>
15420 <change date="13 September 2005" version="1.1.77">
15421 GetClassVersionNumbers() and GetConstantPool() should return
15422 error on array or primitive class.
15423 </change>
15424 <change date="14 September 2005" version="1.1.78">
15425 Grammar fixes.
15426 </change>
15427 <change date="26 September 2005" version="1.1.79">
15428 Add IsModifiableClass query.
15429 </change>
15430 <change date="9 February 2006" version="1.1.81">
15431 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.
15432 </change>
15433 <change date="13 February 2006" version="1.1.82">
15434 Doc fixes: update can_redefine_any_class to include retransform.
15435 Clarify that exception events cover all Throwables.
15436 In GetStackTrace, no test is done for start_depth too big if start_depth is zero,
15437 Clarify fields reported in Primitive Field Callback -- static vs instance.
15438 Repair confusing names of heap types, including callback names.
15439 Require consistent usage of stack depth in the face of thread launch methods.
15440 Note incompatibility of <jvmti/> memory management with other systems.
15441 </change>
15442 <change date="14 February 2006" version="1.1.85">
15443 Fix typos and missing renames.
15444 </change>
15445 <change date="13 March 2006" version="1.1.86">
15446 Clarify that jmethodIDs and jfieldIDs can be saved.
15447 Clarify that Iterate Over Instances Of Class includes subclasses.
15448 </change>
15449 <change date="14 March 2006" version="1.1.87">
15450 Better phrasing.
15451 </change>
15452 <change date="16 March 2006" version="1.1.88">
15453 Match the referrer_index for static fields in Object Reference Callback
15454 with the Reference Implementation (and all other known implementations);
15455 that is, make it match the definition for instance fields.
15456 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover
15457 an invalid thread in the list; and specify that not started threads
15458 return empty stacks.
15459 </change>
15460 <change date="17 March 2006" version="1.1.89">
15461 Typo.
15462 </change>
15463 <change date="25 March 2006" version="1.1.90">
15464 Typo.
15465 </change>
15466 <change date="6 April 2006" version="1.1.91">
15467 Remove restrictions on AddToBootstrapClassLoaderSearch and
15468 AddToSystemClassLoaderSearch.
15469 </change>
15470 <change date="1 May 2006" version="1.1.93">
15471 Changed spec to return -1 for monitor stack depth for the
15472 implementation which can not determine stack depth.
15473 </change>
15474 <change date="3 May 2006" version="1.1.94">
15475 Corrections for readability and accuracy courtesy of Alan Pratt of IBM.
15476 List the object relationships reported in FollowReferences.
15477 </change>
15478 <change date="5 May 2006" version="1.1.95">
15479 Clarify the object relationships reported in FollowReferences.
15480 </change>
15481 <change date="28 June 2006" version="1.1.98">
15482 Clarify DisposeEnvironment; add warning.
15483 Fix typos in SetLocalXXX "retrieve" => "set".
15484 Clarify that native method prefixes must remain set while used.
15485 Clarify that exactly one Agent_OnXXX is called per agent.
15486 Clarify that library loading is independent from start-up.
15487 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.
15488 </change>
15489 <change date="31 July 2006" version="1.1.99">
15490 Clarify the interaction between functions and exceptions.
15491 Clarify and give examples of field indices.
15492 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.
15493 Update links to point to Java 6.
15494 </change>
15495 <change date="6 August 2006" version="1.1.102">
15496 Add ResourceExhaustedEvent.
15497 </change>
15498 <change date="11 October 2012" version="1.2.2">
15499 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.
15500 </change>
15501 <change date="19 June 2013" version="1.2.3">
15502 Added support for statically linked agents.
15503 </change>
15504 <change date="13 October 2016" version="9.0.0">
15505 Support for modules:
15506 The majorversion is 9 now.
15507 The ClassFileLoadHook events are not sent during the primordial phase anymore.
15508 Allow CompiledMethodLoad events at start phase.
15509 Add new capabilities: can_generate_early_vmstart, can_generate_early_class_hook_events.
15510 Add new functions: GetAllModules, AddModuleReads, AddModuleExports,
15511 AddModuleOpens, AddModuleUses, AddModuleProvides, IsModifiableModule.
15512 Clarified can_redefine_any_classes, can_retransform_any_classes and
15513 IsModifiableClass API to disallow some implementation defined classes.
15514 </change>
15515 <change date="12 February 2017" version="9.0.0">
15516 Minor update for GetCurrentThread function:
15517 The function may return null pointer in the start phase if the
15518 can_generate_early_vmstart capability is enabled.
15519 </change>
15520 <change date="7 February 2018" version="11.0.0">
15521 Minor update for new class file NestHost and NestMembers attributes:
15522 Specify that RedefineClasses and RetransformClasses are not allowed
15523 to change the class file NestHost and NestMembers attributes;
15524 Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED
15525 that can be returned by RedefineClasses and RetransformClasses.
15526 </change>
15527 <change date="15 June 2018" version="11.0.0">
15528 Support for Low Overhead Heap Sampling:
15529 Add new capability: can_generate_sampled_object_alloc_events.
15530 Add new function: SetHeapSamplingInterval.
15531 Add new event type: JVMTI_EVENT_SAMPLED_OBJECT_ALLOC.
15532 </change>
15533 <change date="20 May 2019" version="13.0.0">
15534 Minor spec update for the capability "can_redefine_any_class".
15535 It now says: "RedefineClasses can be called on any modifiable class."
15536 See IsModifiableClass. (can_redefine_classes must also be set)
15537 </change>
15538 <change date="5 June 2019" version="13.0.0">
15539 Minor PopFrame spec update:
15540 The specified thread must be suspended or must be the current thread.
15541 (It was not allowed to be the current thread before.)
15542 </change>
15543 <change date="10 October 2019" version="14.0.0">
15544 Minor update for new class file Record attribute:
15545 Specify that RedefineClasses and RetransformClasses are not allowed
15546 to change the class file Record attribute.
15547 </change>
15548 <change date="13 May 2020" version="15.0.0">
15549 Minor update for new class file PermittedSubclasses attribute:
15550 Specify that RedefineClasses and RetransformClasses are not allowed
15551 to change the class file PermittedSubclasses attribute.
15552 </change>
15553 <change date="15 January 2021" version="17.0.0">
15554 Minor clarification in the section "Agent Shutdown" that says the
15555 implementation may choose to not call the Agent_OnUnload function
15556 if the Agent_OnAttach/Agent_OnAttach_L function reported an error.
15557 </change>
15558 <change date="8 June 2021" version="17.0.0">
15559 Minor update to deprecate Heap functions 1.0.
15560 </change>
15561 <change date="27 April 2022" version="19.0.0">
15562 Support for virtual threads (Preview):
15563 Add new capability: can_support_virtual_threads.
15564 Add new functions: SuspendAllVirtualThreads, ResumeAllVirtualThreads.
15565 Add new event types: JVMTI_EVENT_VIRTUAL_THREAD_START, JVMTI_EVENT_VIRTUAL_THREAD_END.
15566 Add new error code: JVMTI_ERROR_UNSUPPORTED_OPERATION.
15567 </change>
15568 <change date="7 June 2023" version="21.0.0">
15569 Virtual threads finalized to be a permanent feature.
15570 Agent start-up in the live phase now specified to print a warning.
15571 </change>
15572 <change date="10 January 2025" version="25.0.0">
15573 Add new function ClearAllFramePops. Needed to speedup debugger single stepping.
15574 </change>
15575 <change date="30 June 2026" version="28.0.0">
15576 Support for value objects (Preview):
15577 Add new capability: can_support_value_objects which enables
15578 the following events for value objects:
15579 JVMTI_EVENT_VM_OBJECT_ALLOC, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC.
15580 </change>
15581 </changehistory>
15582
15583 </specification>
15584 <!-- Keep this comment at the end of the file
15585 Local variables:
15586 mode: sgml
15587 sgml-omittag:t
15588 sgml-shorttag:t
15589 sgml-namecase-general:t
15590 sgml-general-insert-case:lower
15591 sgml-minimize-attributes:nil
15592 sgml-always-quote-attributes:t
15593 sgml-indent-step:2
15594 sgml-indent-data:t
15595 sgml-parent-document:nil
15596 sgml-exposed-tags:nil
15597 sgml-local-catalogs:nil
15598 sgml-local-ecat-files:nil
15599 End:
15600 -->