Fri, 10 Jul 2009 11:10:00 -0700
6857194: Add hotspot perf counters to aid class loading performance measurement
Summary: Add new jvmstat counters to measure detailed class loading time
Reviewed-by: acorn, kamg
1 <?xml version="1.0"?>
2 <!--
3 Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 This code is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License version 2 only, as
8 published by the Free Software Foundation.
10 This code is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 version 2 for more details (a copy is included in the LICENSE file that
14 accompanied this code).
16 You should have received a copy of the GNU General Public License version
17 2 along with this work; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 CA 95054 USA or visit www.sun.com if you need additional information or
22 have any questions.
24 -->
26 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
28 <xsl:import href="jvmtiLib.xsl"/>
30 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
32 <xsl:param name="trace"></xsl:param>
33 <xsl:param name="interface"></xsl:param>
36 <xsl:template match="specification">
37 <xsl:call-template name="sourceHeader"/>
38 <xsl:text>
39 # include "incls/_precompiled.incl"
40 # include "incls/_jvmtiEnter.cpp.incl"
42 </xsl:text>
44 <xsl:if test="$trace = 'Trace'">
45 <xsl:text>
46 #ifdef JVMTI_TRACE
47 </xsl:text>
48 </xsl:if>
50 <xsl:if test="$trace != 'Trace'">
51 <xsl:text>
53 // Error names
54 const char* JvmtiUtil::_error_names[] = {
55 </xsl:text>
56 <xsl:call-template name="fillEntityName">
57 <xsl:with-param name="entities" select="errorsection/errorcategory/errorid"/>
58 </xsl:call-template>
59 <xsl:text>
60 };
63 // Event threaded
64 const bool JvmtiUtil::_event_threaded[] = {
65 </xsl:text>
66 <xsl:call-template name="fillEventThreaded">
67 <xsl:with-param name="entities" select="eventsection/event"/>
68 </xsl:call-template>
69 <xsl:text>
70 };
72 </xsl:text>
73 <xsl:call-template name="eventCapabilitiesTest"/>
74 </xsl:if>
76 <xsl:if test="$trace = 'Trace'">
78 <!-- all this just to return the highest event number -->
79 <xsl:variable name="maxEvent">
80 <xsl:for-each select="eventsection/event">
81 <xsl:variable name="mynum" select="@num"/>
82 <xsl:if test="count(../../eventsection/event[@num > $mynum]) = 0">
83 <xsl:value-of select="@num"/>
84 </xsl:if>
85 </xsl:for-each>
86 </xsl:variable>
88 <xsl:text>jbyte JvmtiTrace::_event_trace_flags[</xsl:text>
89 <xsl:value-of select="1+$maxEvent"/>
90 <xsl:text>];
92 jint JvmtiTrace::_max_event_index = </xsl:text>
93 <xsl:value-of select="$maxEvent"/>
94 <xsl:text>;
96 // Event names
97 const char* JvmtiTrace::_event_names[] = {
98 </xsl:text>
99 <xsl:call-template name="fillEntityName">
100 <xsl:with-param name="entities" select="eventsection/event"/>
101 </xsl:call-template>
102 <xsl:text>
103 };
104 </xsl:text>
105 <xsl:apply-templates select="//constants[@kind='enum']"/>
106 </xsl:if>
107 <xsl:apply-templates select="functionsection"/>
109 <xsl:if test="$trace='Trace'">
110 <xsl:text>
111 #endif /*JVMTI_TRACE */
112 </xsl:text>
113 </xsl:if>
115 </xsl:template>
117 <xsl:template match="constants">
118 <xsl:text>
120 // </xsl:text>
121 <xsl:value-of select="@label"/>
122 <xsl:text> names
123 const char* </xsl:text>
124 <xsl:value-of select="@id"/>
125 <xsl:text>ConstantNames[] = {
126 </xsl:text>
127 <xsl:apply-templates select="constant" mode="constname"/>
128 <xsl:text> NULL
129 };
131 // </xsl:text>
132 <xsl:value-of select="@label"/>
133 <xsl:text> value
134 jint </xsl:text>
135 <xsl:value-of select="@id"/>
136 <xsl:text>ConstantValues[] = {
137 </xsl:text>
138 <xsl:apply-templates select="constant" mode="constvalue"/>
139 <xsl:text> 0
140 };
142 </xsl:text>
143 </xsl:template>
145 <xsl:template match="constant" mode="constname">
146 <xsl:text> "</xsl:text>
147 <xsl:value-of select="@id"/>
148 <xsl:text>",
149 </xsl:text>
150 </xsl:template>
152 <xsl:template match="constant" mode="constvalue">
153 <xsl:text> </xsl:text>
154 <xsl:value-of select="@num"/>
155 <xsl:text>,
156 </xsl:text>
157 </xsl:template>
159 <xsl:template name="eventCapabilitiesTest">
160 <xsl:text>
162 // Check Event Capabilities
163 const bool JvmtiUtil::has_event_capability(jvmtiEvent event_type, const jvmtiCapabilities* capabilities_ptr) {
164 switch (event_type) {
165 </xsl:text>
166 <xsl:for-each select="//eventsection/event">
167 <xsl:variable name="capa" select="capabilities/required"/>
168 <xsl:if test="count($capa)">
169 <xsl:text> case </xsl:text>
170 <xsl:value-of select="@const"/>
171 <xsl:text>:
172 return capabilities_ptr-></xsl:text>
173 <xsl:value-of select="$capa/@id"/>
174 <xsl:text> != 0;
175 </xsl:text>
176 </xsl:if>
177 </xsl:for-each>
178 <xsl:text> }
179 // if it does not have a capability it is required
180 return JNI_TRUE;
181 }
183 </xsl:text>
184 </xsl:template>
186 <xsl:template match="functionsection">
187 <xsl:if test="$trace='Trace'">
189 <!-- all this just to return the highest function number -->
190 <xsl:variable name="maxFunction">
191 <xsl:for-each select="category/function">
192 <xsl:variable name="mynum" select="@num"/>
193 <xsl:if test="count(../../category/function[@num > $mynum]) = 0">
194 <xsl:value-of select="@num"/>
195 </xsl:if>
196 </xsl:for-each>
197 </xsl:variable>
199 <xsl:text>jbyte JvmtiTrace::_trace_flags[</xsl:text>
200 <xsl:value-of select="1+$maxFunction"/>
201 <xsl:text>];
203 jint JvmtiTrace::_max_function_index = </xsl:text>
204 <xsl:value-of select="$maxFunction"/>
205 <xsl:text>;
207 // Function names
208 const char* JvmtiTrace::_function_names[] = {
209 </xsl:text>
210 <xsl:call-template name="fillEntityName">
211 <xsl:with-param name="entities" select="category/function"/>
212 </xsl:call-template>
213 <xsl:text>
214 };
216 // Exclude list
217 short JvmtiTrace::_exclude_functions[] = {
218 </xsl:text>
219 <xsl:apply-templates select="category/function" mode="notrace">
220 <xsl:sort select="@num"/>
221 </xsl:apply-templates>
222 <xsl:text>0
223 };
225 </xsl:text>
226 </xsl:if>
228 <xsl:text>
229 extern "C" {
231 </xsl:text>
232 <xsl:apply-templates select="category" mode="wrapper"/>
233 <xsl:text>
234 } /* end extern "C" */
236 // JVMTI API functions
237 struct jvmtiInterface_1_ jvmti</xsl:text>
238 <xsl:value-of select="$trace"/>
239 <xsl:text>_Interface = {
240 </xsl:text>
242 <xsl:call-template name="fillFuncStruct">
243 <xsl:with-param name="funcs" select="category/function[count(@hide)=0]"/>
244 </xsl:call-template>
246 <xsl:text>
247 };
248 </xsl:text>
249 </xsl:template>
251 <xsl:template match="function" mode="functionid">
252 <xsl:text>jvmti</xsl:text>
253 <xsl:value-of select="$trace"/>
254 <xsl:text>_</xsl:text>
255 <xsl:value-of select="@id"/>
256 </xsl:template>
258 <xsl:template name="fillFuncStructDoit">
259 <xsl:param name="func"/>
260 <xsl:param name="index"/>
261 <xsl:text> /* </xsl:text>
262 <xsl:number value="$index" format=" 1"/>
263 <xsl:text> : </xsl:text>
264 <xsl:choose>
265 <xsl:when test="count($func)=1">
266 <xsl:value-of select="$func/synopsis"/>
267 <xsl:text> */
268 </xsl:text>
269 <xsl:apply-templates select="$func" mode="functionid"/>
270 </xsl:when>
271 <xsl:otherwise>
272 <xsl:text> RESERVED */
273 NULL</xsl:text>
274 </xsl:otherwise>
275 </xsl:choose>
276 </xsl:template>
278 <!-- generic function iterator applied to the function structure -->
279 <xsl:template name="fillFuncStruct">
280 <xsl:param name="funcs"/>
281 <xsl:param name="index" select="1"/>
282 <xsl:call-template name="fillFuncStructDoit">
283 <xsl:with-param name="func" select="$funcs[@num=$index]"/>
284 <xsl:with-param name="index" select="$index"/>
285 </xsl:call-template>
286 <xsl:if test="count($funcs[@num > $index]) > 0">
287 <xsl:text>,
288 </xsl:text>
289 <xsl:call-template name="fillFuncStruct">
290 <xsl:with-param name="funcs" select="$funcs"/>
291 <xsl:with-param name="index" select="1+$index"/>
292 </xsl:call-template>
293 </xsl:if>
294 </xsl:template>
296 <xsl:template name="fillEntityNameDoit">
297 <xsl:param name="entity"/>
298 <xsl:param name="index"/>
299 <xsl:choose>
300 <xsl:when test="count($entity) > 0">
301 <xsl:text> "</xsl:text>
302 <xsl:value-of select="$entity[position()=1]/@id"/>
303 <xsl:text>"</xsl:text>
304 </xsl:when>
305 <xsl:otherwise>
306 <xsl:text> NULL</xsl:text>
307 </xsl:otherwise>
308 </xsl:choose>
309 </xsl:template>
311 <!-- generic entity (with id and num) iterator applied to entity names -->
312 <xsl:template name="fillEntityName">
313 <xsl:param name="entities"/>
314 <xsl:param name="index" select="0"/>
315 <xsl:call-template name="fillEntityNameDoit">
316 <xsl:with-param name="entity" select="$entities[@num=$index]"/>
317 <xsl:with-param name="index" select="$index"/>
318 </xsl:call-template>
319 <xsl:if test="count($entities[@num > $index]) > 0">
320 <xsl:text>,
321 </xsl:text>
322 <xsl:call-template name="fillEntityName">
323 <xsl:with-param name="entities" select="$entities"/>
324 <xsl:with-param name="index" select="1+$index"/>
325 </xsl:call-template>
326 </xsl:if>
327 </xsl:template>
329 <xsl:template name="fillEventThreadedDoit">
330 <xsl:param name="entity"/>
331 <xsl:param name="index"/>
332 <xsl:choose>
333 <xsl:when test="count($entity) > 0">
334 <xsl:choose>
335 <xsl:when test="count($entity[position()=1]/@filtered)=0">
336 <xsl:text> false</xsl:text>
337 </xsl:when>
338 <xsl:otherwise>
339 <xsl:text> true</xsl:text>
340 </xsl:otherwise>
341 </xsl:choose>
342 </xsl:when>
343 <xsl:otherwise>
344 <xsl:text> false</xsl:text>
345 </xsl:otherwise>
346 </xsl:choose>
347 </xsl:template>
350 <xsl:template name="fillEventThreaded">
351 <xsl:param name="entities"/>
352 <xsl:param name="index" select="0"/>
353 <xsl:call-template name="fillEventThreadedDoit">
354 <xsl:with-param name="entity" select="$entities[@num=$index]"/>
355 <xsl:with-param name="index" select="$index"/>
356 </xsl:call-template>
357 <xsl:if test="count($entities[@num > $index]) > 0">
358 <xsl:text>,
359 </xsl:text>
360 <xsl:call-template name="fillEventThreaded">
361 <xsl:with-param name="entities" select="$entities"/>
362 <xsl:with-param name="index" select="1+$index"/>
363 </xsl:call-template>
364 </xsl:if>
365 </xsl:template>
367 <xsl:template match="function" mode="notrace">
368 <xsl:if test="count(@impl)=1 and contains(@impl,'notrace')">
369 <xsl:value-of select="@num"/>
370 <xsl:text>,
371 </xsl:text>
372 </xsl:if>
373 </xsl:template>
375 <xsl:template match="category" mode="wrapper">
376 <xsl:text>
377 //
378 // </xsl:text><xsl:value-of select="@label"/><xsl:text> functions
379 //
380 </xsl:text>
381 <xsl:apply-templates select="function[count(@hide)=0]"/>
382 </xsl:template>
384 <xsl:template match="function" mode="transition">
385 <xsl:param name="space">
386 <xsl:text>
387 </xsl:text>
388 </xsl:param>
389 <xsl:value-of select="$space"/>
391 <xsl:choose>
392 <xsl:when test="count(@callbacksafe)=0 or not(contains(@callbacksafe,'safe'))">
393 <xsl:text>if (this_thread == NULL || !this_thread->is_Java_thread()) {</xsl:text>
394 </xsl:when>
395 <xsl:otherwise>
396 <xsl:choose>
397 <xsl:when test="count(@phase)=0 or contains(@phase,'live') or contains(@phase,'start')">
398 <xsl:text>if (this_thread == NULL || (!this_thread->is_Java_thread() && !this_thread->is_VM_thread())) {</xsl:text>
399 </xsl:when>
400 <xsl:otherwise>
401 <xsl:text>if (!this_thread->is_Java_thread()) {</xsl:text>
402 </xsl:otherwise>
403 </xsl:choose>
404 </xsl:otherwise>
405 </xsl:choose>
407 <xsl:if test="$trace='Trace'">
408 <xsl:value-of select="$space"/>
409 <xsl:text> if (trace_flags) {</xsl:text>
410 <xsl:value-of select="$space"/>
411 <xsl:text> tty->print_cr("JVMTI [non-attached thread] %s %s", func_name,</xsl:text>
412 <xsl:value-of select="$space"/>
413 <xsl:text> JvmtiUtil::error_name(JVMTI_ERROR_UNATTACHED_THREAD));</xsl:text>
414 <xsl:value-of select="$space"/>
415 <xsl:text> }</xsl:text>
416 </xsl:if>
417 <xsl:value-of select="$space"/>
418 <xsl:text> return JVMTI_ERROR_UNATTACHED_THREAD;</xsl:text>
419 <xsl:value-of select="$space"/>
420 <xsl:text>}</xsl:text>
421 <xsl:value-of select="$space"/>
422 <xsl:if test="count(@impl)=0 or not(contains(@impl,'innative'))">
423 <xsl:text>JavaThread* current_thread = (JavaThread*)this_thread;</xsl:text>
424 <xsl:value-of select="$space"/>
425 <xsl:text>ThreadInVMfromNative __tiv(current_thread);</xsl:text>
426 <xsl:value-of select="$space"/>
427 <xsl:text>__ENTRY(jvmtiError, </xsl:text>
428 <xsl:apply-templates select="." mode="functionid"/>
429 <xsl:text> , current_thread)</xsl:text>
430 <xsl:value-of select="$space"/>
431 <xsl:text>debug_only(VMNativeEntryWrapper __vew;)</xsl:text>
432 <xsl:if test="count(@callbacksafe)=0 or not(contains(@callbacksafe,'safe'))">
433 <xsl:value-of select="$space"/>
434 <xsl:text>CautiouslyPreserveExceptionMark __em(this_thread);</xsl:text>
435 </xsl:if>
436 </xsl:if>
437 </xsl:template>
440 <xsl:template match="required">
441 <xsl:text>
442 if (jvmti_env->get_capabilities()-></xsl:text>
443 <xsl:value-of select="@id"/>
444 <xsl:text> == 0) {
445 </xsl:text>
446 <xsl:if test="$trace='Trace'">
447 <xsl:text> if (trace_flags) {
448 tty->print_cr("JVMTI [%s] %s %s", curr_thread_name, func_name,
449 JvmtiUtil::error_name(JVMTI_ERROR_MUST_POSSESS_CAPABILITY));
450 }
451 </xsl:text>
452 </xsl:if>
453 <xsl:text> return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
454 }
455 </xsl:text>
456 </xsl:template>
459 <xsl:template match="function">
460 <xsl:text>
461 static jvmtiError JNICALL
462 </xsl:text>
463 <xsl:apply-templates select="." mode="functionid"/>
464 <xsl:text>(jvmtiEnv* env</xsl:text>
465 <xsl:apply-templates select="parameters" mode="signature"/>
466 <xsl:text>) {
467 </xsl:text>
469 <xsl:if test="not(contains(@jkernel,'yes'))">
470 <xsl:text>
#ifdef JVMTI_KERNEL 
</xsl:text>
471 <xsl:text> return JVMTI_ERROR_NOT_AVAILABLE; 
</xsl:text>
472 <xsl:text>#else 
</xsl:text>
473 </xsl:if>
475 <xsl:apply-templates select="." mode="traceSetUp"/>
476 <xsl:choose>
477 <xsl:when test="count(@phase)=0 or contains(@phase,'live')">
478 <xsl:text> if(!JvmtiEnv::is_vm_live()) {
479 </xsl:text>
480 <xsl:if test="$trace='Trace'">
481 <xsl:text> if (trace_flags) {
482 tty->print_cr("JVMTI [-] %s %s", func_name,
483 JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
484 }
485 </xsl:text>
486 </xsl:if>
487 <xsl:text> return JVMTI_ERROR_WRONG_PHASE;
488 }</xsl:text>
490 <xsl:text>
491 Thread* this_thread = (Thread*)ThreadLocalStorage::thread(); </xsl:text>
493 <xsl:apply-templates select="." mode="transition"/>
494 </xsl:when>
495 <xsl:otherwise>
496 <xsl:if test="contains(@phase,'onload')">
497 <xsl:text> if(JvmtiEnv::get_phase()!=JVMTI_PHASE_ONLOAD</xsl:text>
498 <xsl:if test="not(contains(@phase,'onloadOnly'))">
499 <xsl:text> && JvmtiEnv::get_phase()!=JVMTI_PHASE_LIVE</xsl:text>
500 </xsl:if>
501 <xsl:text>) {
502 </xsl:text>
503 <xsl:if test="$trace='Trace'">
504 <xsl:text> if (trace_flags) {
505 tty->print_cr("JVMTI [-] %s %s", func_name,
506 JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
507 }
508 </xsl:text>
509 </xsl:if>
510 <xsl:text> return JVMTI_ERROR_WRONG_PHASE;
511 }</xsl:text>
512 </xsl:if>
513 <xsl:if test="contains(@phase,'start')">
514 <xsl:text> if(JvmtiEnv::get_phase()!=JVMTI_PHASE_START && JvmtiEnv::get_phase()!=JVMTI_PHASE_LIVE) {
515 </xsl:text>
516 <xsl:if test="$trace='Trace'">
517 <xsl:text> if (trace_flags) {
518 tty->print_cr("JVMTI [-] %s %s", func_name,
519 JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
520 }
521 </xsl:text>
522 </xsl:if>
523 <xsl:text> return JVMTI_ERROR_WRONG_PHASE;
524 }
525 Thread* this_thread = (Thread*)ThreadLocalStorage::thread(); </xsl:text>
526 <xsl:apply-templates select="." mode="transition"/>
527 </xsl:if>
528 </xsl:otherwise>
529 </xsl:choose>
531 <xsl:text>
532 JvmtiEnv* jvmti_env = JvmtiEnv::JvmtiEnv_from_jvmti_env(env);
533 if (!jvmti_env->is_valid()) {
534 </xsl:text>
535 <xsl:if test="$trace='Trace'">
536 <xsl:text> if (trace_flags) {
537 tty->print_cr("JVMTI [%s] %s %s env=%d", curr_thread_name, func_name,
538 JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), env);
539 }
540 </xsl:text>
541 </xsl:if>
542 <xsl:text> return JVMTI_ERROR_INVALID_ENVIRONMENT;
543 }
544 </xsl:text>
546 <xsl:apply-templates select="capabilities/required"/>
548 <xsl:text> jvmtiError err;
549 </xsl:text>
550 <xsl:choose>
551 <xsl:when test="count(@phase)=1 and not(contains(@phase,'live')) and not(contains(@phase,'start'))">
552 <xsl:choose>
553 <xsl:when test="count(@callbacksafe)=0 or not(contains(@callbacksafe,'safe'))">
554 <xsl:text> if (Threads::number_of_threads() != 0) {
555 Thread* this_thread = (Thread*)ThreadLocalStorage::thread();</xsl:text>
556 </xsl:when>
557 <xsl:otherwise>
559 <xsl:text> Thread* this_thread = NULL;
560 bool transition;
561 if (Threads::number_of_threads() == 0) {
562 transition = false;
563 } else {
564 this_thread = (Thread*)ThreadLocalStorage::thread();
565 transition = ((this_thread != NULL) && !this_thread->is_VM_thread() && !this_thread->is_ConcurrentGC_thread());
566 }
567 if (transition) {</xsl:text>
568 </xsl:otherwise>
570 </xsl:choose>
571 <!-- we allow use in early phases but there are threads now, -->
572 <!-- so do thread transition -->
573 <xsl:apply-templates select="." mode="transition">
574 <xsl:with-param name="space">
575 <xsl:text>
576 </xsl:text>
577 </xsl:with-param>
578 </xsl:apply-templates>
579 <xsl:text>
580 </xsl:text>
581 <xsl:apply-templates select="." mode="doCall"/>
582 <xsl:text> } else {
583 </xsl:text>
584 <!-- we are pre-thread - no thread transition code -->
585 <xsl:apply-templates select="." mode="doCall"/>
586 <xsl:text> }
587 </xsl:text>
588 </xsl:when>
589 <xsl:otherwise>
590 <xsl:apply-templates select="." mode="doCall"/>
591 </xsl:otherwise>
592 </xsl:choose>
593 <xsl:text> return err;
594 </xsl:text>
596 <xsl:if test="not(contains(@jkernel,'yes'))">
597 <xsl:text>#endif // JVMTI_KERNEL
</xsl:text>
598 </xsl:if>
600 <xsl:text>}
</xsl:text>
601 </xsl:template>
603 <xsl:template match="function" mode="doCall">
604 <xsl:apply-templates select="parameters" mode="dochecks"/>
605 <xsl:apply-templates select="." mode="traceBefore"/>
606 <xsl:apply-templates select="." mode="genCall"/>
607 <xsl:apply-templates select="." mode="traceAfter"/>
608 </xsl:template>
610 <xsl:template match="function" mode="genCall">
611 <xsl:text> err = jvmti_env-></xsl:text>
612 <xsl:value-of select="@id"/>
613 <xsl:text>(</xsl:text>
614 <xsl:apply-templates select="parameters" mode="HotSpotValue"/>
615 <xsl:text>);
616 </xsl:text>
617 </xsl:template>
620 <xsl:template match="function" mode="traceSetUp">
621 <xsl:if test="$trace='Trace'">
622 <xsl:text> SafeResourceMark rm;
623 jint trace_flags = JvmtiTrace::trace_flags(</xsl:text>
624 <xsl:value-of select="@num"/>
625 <xsl:text>);
626 const char *func_name;
627 const char *curr_thread_name;
628 if (trace_flags) {
629 func_name = JvmtiTrace::function_name(</xsl:text>
630 <xsl:value-of select="@num"/>
631 <xsl:text>);
632 curr_thread_name = JvmtiTrace::safe_get_current_thread_name();
633 }
634 </xsl:text>
635 </xsl:if>
636 </xsl:template>
639 <xsl:template match="function" mode="traceBefore">
640 <xsl:if test="$trace='Trace'">
641 <xsl:text>
642 if ((trace_flags & JvmtiTrace::SHOW_IN) != 0) {
643 </xsl:text>
644 <xsl:apply-templates select="." mode="traceIn"/>
645 <xsl:text> }
646 </xsl:text>
647 </xsl:if>
648 </xsl:template>
651 <xsl:template match="param" mode="traceError">
652 <xsl:param name="err"/>
653 <xsl:param name="comment"></xsl:param>
654 <xsl:param name="extraValue"></xsl:param>
655 <xsl:if test="$trace='Trace'">
656 <xsl:text> if ((trace_flags & JvmtiTrace::SHOW_ERROR) != 0) {
657 if ((trace_flags & JvmtiTrace::SHOW_IN) == 0) {
658 </xsl:text>
659 <xsl:apply-templates select="../.." mode="traceIn">
660 <xsl:with-param name="endParam" select="."/>
661 </xsl:apply-templates>
662 <xsl:text> }
663 tty->print_cr("JVMTI [%s] %s } %s - erroneous arg is </xsl:text>
664 <xsl:value-of select="@id"/>
665 <xsl:value-of select="$comment"/>
666 <xsl:text>", curr_thread_name, func_name,
667 JvmtiUtil::error_name(</xsl:text>
668 <xsl:value-of select="$err"/>
669 <xsl:text>)</xsl:text>
670 <xsl:value-of select="$extraValue"/>
671 <xsl:text>);
672 }
673 </xsl:text>
674 </xsl:if>
675 <xsl:text> return </xsl:text>
676 <xsl:value-of select="$err"/>
677 <xsl:text>;</xsl:text>
678 </xsl:template>
681 <xsl:template match="function" mode="traceAfter">
682 <xsl:if test="$trace='Trace'">
683 <xsl:text> if ( err != JVMTI_ERROR_NONE && (trace_flags & JvmtiTrace::SHOW_ERROR) != 0) {
684 if ((trace_flags & JvmtiTrace::SHOW_IN) == 0) {
685 </xsl:text>
686 <xsl:apply-templates select="." mode="traceIn"/>
687 <xsl:text> }
688 tty->print_cr("JVMTI [%s] %s } %s", curr_thread_name, func_name,
689 JvmtiUtil::error_name(err));
690 } else if ((trace_flags & JvmtiTrace::SHOW_OUT) != 0) {
691 tty->print_cr("JVMTI [%s] %s }", curr_thread_name, func_name);
692 }
693 </xsl:text>
694 </xsl:if>
695 </xsl:template>
697 <xsl:template match="function" mode="traceIn">
698 <xsl:param name="endParam"></xsl:param>
699 <xsl:text> tty->print_cr("JVMTI [%s] %s { </xsl:text>
700 <xsl:apply-templates select="parameters" mode="traceInFormat">
701 <xsl:with-param name="endParam" select="$endParam"/>
702 </xsl:apply-templates>
703 <xsl:text>", curr_thread_name, func_name</xsl:text>
704 <xsl:apply-templates select="parameters" mode="traceInValue">
705 <xsl:with-param name="endParam" select="$endParam"/>
706 </xsl:apply-templates>
707 <xsl:text>);
708 </xsl:text>
709 </xsl:template>
711 <xsl:template match="parameters" mode="dochecks">
712 <xsl:apply-templates select="param" mode="dochecks"/>
713 </xsl:template>
715 <xsl:template match="param" mode="dochecks">
716 <xsl:apply-templates select="child::*[position()=1]" mode="dochecks">
717 <xsl:with-param name="name" select="@id"/>
718 </xsl:apply-templates>
719 </xsl:template>
721 <xsl:template match="outptr|outbuf|allocfieldbuf|ptrtype|inptr|inbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="dochecks">
722 <xsl:param name="name"/>
723 <xsl:if test="count(nullok)=0">
724 <xsl:text> if (</xsl:text>
725 <xsl:value-of select="$name"/>
726 <xsl:text> == NULL) {
727 </xsl:text>
728 <xsl:apply-templates select=".." mode="traceError">
729 <xsl:with-param name="err">JVMTI_ERROR_NULL_POINTER</xsl:with-param>
730 </xsl:apply-templates>
731 <xsl:text>
732 }
733 </xsl:text>
734 </xsl:if>
735 </xsl:template>
737 <xsl:template match="jrawMonitorID" mode="dochecks">
738 <xsl:param name="name"/>
739 <xsl:text> JvmtiRawMonitor *rmonitor = (JvmtiRawMonitor *)</xsl:text>
740 <xsl:value-of select="$name"/>
741 <xsl:text>;
742 if (rmonitor == NULL) {
743 </xsl:text>
744 <xsl:apply-templates select=".." mode="traceError">
745 <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
746 <xsl:with-param name="comment"> - raw monitor is NULL</xsl:with-param>
747 </xsl:apply-templates>
748 <xsl:text>
749 }
750 if (!rmonitor->is_valid()) {
751 </xsl:text>
752 <xsl:apply-templates select=".." mode="traceError">
753 <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
754 <xsl:with-param name="comment"> - not a raw monitor 0x%x</xsl:with-param>
755 <xsl:with-param name="extraValue">, rmonitor</xsl:with-param>
756 </xsl:apply-templates>
757 <xsl:text>
758 }
759 </xsl:text>
760 </xsl:template>
762 <xsl:template match="jthread" mode="dochecksbody">
763 <xsl:param name="name"/>
764 <xsl:text> oop thread_oop = JNIHandles::resolve_external_guard(</xsl:text>
765 <xsl:value-of select="$name"/>
766 <xsl:text>);
767 if (thread_oop == NULL) {
768 </xsl:text>
769 <xsl:apply-templates select=".." mode="traceError">
770 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param>
771 <xsl:with-param name="comment"> - jthread resolved to NULL - jthread = %0x%x</xsl:with-param>
772 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
773 </xsl:apply-templates>
774 <xsl:text>
775 }
776 if (!thread_oop->is_a(SystemDictionary::thread_klass())) {
777 </xsl:text>
778 <xsl:apply-templates select=".." mode="traceError">
779 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param>
780 <xsl:with-param name="comment"> - oop is not a thread - jthread = %0x%x</xsl:with-param>
781 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
782 </xsl:apply-templates>
783 <xsl:text>
784 }
785 java_thread = java_lang_Thread::thread(thread_oop);
786 if (java_thread == NULL) {
787 </xsl:text>
788 <xsl:apply-templates select=".." mode="traceError">
789 <xsl:with-param name="err">
790 <xsl:text>JVMTI_ERROR_THREAD_NOT_ALIVE</xsl:text>
791 </xsl:with-param>
792 <xsl:with-param name="comment"> - not a Java thread - jthread = %0x%x</xsl:with-param>
793 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
794 </xsl:apply-templates>
795 <xsl:text>
796 }
797 </xsl:text>
798 </xsl:template>
800 <xsl:template match="jthread" mode="dochecks">
801 <xsl:param name="name"/>
802 <!-- If we convert and test threads -->
803 <xsl:if test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
804 <xsl:text> JavaThread* java_thread;
805 </xsl:text>
806 <xsl:choose>
807 <xsl:when test="count(@null)=0">
808 <xsl:apply-templates select="." mode="dochecksbody">
809 <xsl:with-param name="name" select="$name"/>
810 </xsl:apply-templates>
811 </xsl:when>
812 <xsl:otherwise>
813 <xsl:text> if (</xsl:text>
814 <xsl:value-of select="$name"/>
815 <xsl:text> == NULL) {
816 java_thread = current_thread;
817 } else {
818 </xsl:text>
819 <xsl:apply-templates select="." mode="dochecksbody">
820 <xsl:with-param name="name" select="$name"/>
821 </xsl:apply-templates>
822 <xsl:text> }
823 </xsl:text>
824 </xsl:otherwise>
825 </xsl:choose>
826 </xsl:if>
827 </xsl:template>
829 <xsl:template match="jframeID" mode="dochecks">
830 <xsl:param name="name"/>
831 <xsl:text>
832 if (depth < 0) {
833 </xsl:text>
834 <xsl:apply-templates select=".." mode="traceError">
835 <xsl:with-param name="err">JVMTI_ERROR_ILLEGAL_ARGUMENT</xsl:with-param>
836 <xsl:with-param name="comment"> - negative depth - jthread = %0x%x</xsl:with-param>
837 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
838 </xsl:apply-templates>
839 <xsl:text>
840 }
841 </xsl:text>
842 </xsl:template>
844 <xsl:template match="jclass" mode="dochecks">
845 <xsl:param name="name"/>
846 <!-- for JVMTI a jclass/jmethodID becomes just jmethodID -->
847 <xsl:if test="count(@method)=0">
848 <xsl:text> oop k_mirror = JNIHandles::resolve_external_guard(</xsl:text>
849 <xsl:value-of select="$name"/>
850 <xsl:text>);
851 if (k_mirror == NULL) {
852 </xsl:text>
853 <xsl:apply-templates select=".." mode="traceError">
854 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
855 <xsl:with-param name="comment"> - resolved to NULL - jclass = 0x%x</xsl:with-param>
856 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
857 </xsl:apply-templates>
858 <xsl:text>
859 }
860 if (!k_mirror->is_a(SystemDictionary::class_klass())) {
861 </xsl:text>
862 <xsl:apply-templates select=".." mode="traceError">
863 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
864 <xsl:with-param name="comment"> - not a class - jclass = 0x%x</xsl:with-param>
865 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
866 </xsl:apply-templates>
867 <xsl:text>
868 }
869 </xsl:text>
870 <xsl:if test="count(@method|@field)=1">
871 <xsl:text>
872 if (java_lang_Class::is_primitive(k_mirror)) {
873 </xsl:text>
874 <xsl:apply-templates select=".." mode="traceError">
875 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
876 <xsl:with-param name="comment"> - is a primitive class - jclass = 0x%x</xsl:with-param>
877 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
878 </xsl:apply-templates>
879 <xsl:text>
880 }
881 klassOop k_oop = java_lang_Class::as_klassOop(k_mirror);
882 if (k_oop == NULL) {
883 </xsl:text>
884 <xsl:apply-templates select=".." mode="traceError">
885 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
886 <xsl:with-param name="comment"> - no klassOop - jclass = 0x%x</xsl:with-param>
887 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
888 </xsl:apply-templates>
889 <xsl:text>
890 }
891 </xsl:text>
892 </xsl:if>
893 </xsl:if>
894 </xsl:template>
897 <xsl:template match="jmethodID" mode="dochecks">
898 <xsl:param name="name"/>
899 <xsl:text> methodOop method_oop = JNIHandles::checked_resolve_jmethod_id(</xsl:text>
900 <xsl:value-of select="$name"/>
901 <xsl:text>);
</xsl:text>
902 <xsl:text> if (method_oop == NULL) {
</xsl:text>
903 <xsl:apply-templates select=".." mode="traceError">
904 <xsl:with-param name="err">JVMTI_ERROR_INVALID_METHODID</xsl:with-param>
905 <xsl:with-param name="comment"></xsl:with-param>
906 <xsl:with-param name="extraValue"></xsl:with-param>
907 </xsl:apply-templates>
908 <xsl:text>
</xsl:text>
909 <xsl:text> }
</xsl:text>
910 <xsl:if test="count(@native)=1 and contains(@native,'error')">
911 <xsl:text> if (method_oop->is_native()) {
</xsl:text>
912 <xsl:text> return JVMTI_ERROR_NATIVE_METHOD;
</xsl:text>
913 <xsl:text> }
</xsl:text>
914 </xsl:if>
915 </xsl:template>
918 <xsl:template match="jfieldID" mode="dochecks">
919 <xsl:param name="name"/>
920 <xsl:text> ResourceMark rm_fdesc(current_thread);
</xsl:text>
921 <xsl:text> fieldDescriptor fdesc;
</xsl:text>
922 <xsl:text> if (!JvmtiEnv::get_field_descriptor(k_oop, </xsl:text>
923 <xsl:value-of select="$name"/>
924 <xsl:text>, &fdesc)) {
</xsl:text>
925 <xsl:apply-templates select=".." mode="traceError">
926 <xsl:with-param name="err">JVMTI_ERROR_INVALID_FIELDID</xsl:with-param>
927 </xsl:apply-templates>
928 <xsl:text>
</xsl:text>
929 <xsl:text> }
</xsl:text>
930 </xsl:template>
933 <xsl:template match="jint" mode="dochecks">
934 <xsl:param name="name"/>
935 <xsl:if test="count(@min)=1">
936 <xsl:text> if (</xsl:text>
937 <xsl:value-of select="$name"/>
938 <xsl:text> < </xsl:text>
939 <xsl:value-of select="@min"/>
940 <xsl:text>) {
941 </xsl:text>
942 <xsl:apply-templates select=".." mode="traceError">
943 <xsl:with-param name="err">JVMTI_ERROR_ILLEGAL_ARGUMENT</xsl:with-param>
944 </xsl:apply-templates>
945 <xsl:text>
946 }
947 </xsl:text>
948 </xsl:if>
949 </xsl:template>
951 <xsl:template match="jobject|jvalue|jthreadGroup|enum|jchar|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|struct" mode="dochecks">
952 </xsl:template>
954 <!-- iterate over parameters, stopping if specified is encountered -->
955 <xsl:template name="traceInValueParamsUpTo">
956 <xsl:param name="params"/>
957 <xsl:param name="endParam"></xsl:param>
958 <xsl:param name="index" select="1"/>
959 <xsl:variable name="cParam" select="$params[position()=$index]"/>
960 <xsl:if test="$cParam!=$endParam">
961 <xsl:apply-templates select="$cParam" mode="traceInValue"/>
962 <xsl:if test="count($params) > $index">
963 <xsl:call-template name="traceInValueParamsUpTo">
964 <xsl:with-param name="params" select="$params"/>
965 <xsl:with-param name="endParam" select="$endParam"/>
966 <xsl:with-param name="index" select="1+$index"/>
967 </xsl:call-template>
968 </xsl:if>
969 </xsl:if>
970 </xsl:template>
972 <xsl:template name="traceInFormatParamsUpTo">
973 <xsl:param name="params"/>
974 <xsl:param name="endParam"></xsl:param>
975 <xsl:param name="index" select="1"/>
976 <xsl:variable name="cParam" select="$params[position()=$index]"/>
977 <xsl:if test="$cParam!=$endParam">
978 <xsl:apply-templates select="$cParam" mode="traceInFormat"/>
979 <xsl:if test="count($params) > $index">
980 <xsl:call-template name="traceInFormatParamsUpTo">
981 <xsl:with-param name="params" select="$params"/>
982 <xsl:with-param name="endParam" select="$endParam"/>
983 <xsl:with-param name="index" select="1+$index"/>
984 </xsl:call-template>
985 </xsl:if>
986 </xsl:if>
987 </xsl:template>
989 <xsl:template match="parameters" mode="traceInFormat">
990 <xsl:param name="endParam"></xsl:param>
991 <xsl:call-template name="traceInFormatParamsUpTo">
992 <xsl:with-param name="params" select="param"/>
993 <xsl:with-param name="endParam" select="$endParam"/>
994 </xsl:call-template>
995 </xsl:template>
997 <xsl:template match="parameters" mode="traceInValue">
998 <xsl:param name="endParam"></xsl:param>
999 <xsl:call-template name="traceInValueParamsUpTo">
1000 <xsl:with-param name="params" select="param"/>
1001 <xsl:with-param name="endParam" select="$endParam"/>
1002 </xsl:call-template>
1003 </xsl:template>
1005 <xsl:template match="param" mode="traceInFormat">
1006 <xsl:apply-templates select="child::*[position()=1]" mode="traceInFormat">
1007 <xsl:with-param name="name" select="@id"/>
1008 </xsl:apply-templates>
1009 </xsl:template>
1011 <xsl:template match="param" mode="traceInValue">
1012 <xsl:apply-templates select="child::*[position()=1]" mode="traceInValue">
1013 <xsl:with-param name="name" select="@id"/>
1014 </xsl:apply-templates>
1015 </xsl:template>
1017 <xsl:template match="outptr|outbuf|allocfieldbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="traceInFormat">
1018 </xsl:template>
1020 <xsl:template match="outptr|outbuf|allocfieldbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="traceInValue">
1021 </xsl:template>
1023 <xsl:template match="inbuf" mode="traceInFormat">
1024 <xsl:param name="name"/>
1025 <xsl:text> </xsl:text>
1026 <xsl:value-of select="$name"/>
1027 <xsl:variable name="child" select="child::*[position()=1]"/>
1028 <xsl:choose>
1029 <xsl:when test="name($child)='char'">
1030 <xsl:text>='%s'</xsl:text>
1031 </xsl:when>
1032 <xsl:otherwise>
1033 <xsl:text>=0x%x</xsl:text>
1034 </xsl:otherwise>
1035 </xsl:choose>
1036 </xsl:template>
1038 <xsl:template match="inbuf" mode="traceInValue">
1039 <xsl:param name="name"/>
1040 <xsl:text>, </xsl:text>
1041 <xsl:value-of select="$name"/>
1042 </xsl:template>
1044 <xsl:template match="ptrtype" mode="traceInFormat">
1045 <xsl:param name="name"/>
1046 <xsl:variable name="child" select="child::*[position()=1]"/>
1047 <xsl:choose>
1048 <xsl:when test="name($child)='jclass'">
1049 <xsl:text> </xsl:text>
1050 <xsl:value-of select="$name"/>
1051 <xsl:text>=0x%x</xsl:text>
1052 </xsl:when>
1053 <xsl:otherwise>
1054 <xsl:apply-templates select="$child" mode="traceInFormat"/>
1055 </xsl:otherwise>
1056 </xsl:choose>
1057 </xsl:template>
1059 <xsl:template match="ptrtype" mode="traceInValue">
1060 <xsl:param name="name"/>
1061 <xsl:variable name="child" select="child::*[position()=1]"/>
1062 <xsl:choose>
1063 <xsl:when test="name($child)='jclass'">
1064 <xsl:text>, </xsl:text>
1065 <xsl:value-of select="$name"/>
1066 </xsl:when>
1067 <xsl:otherwise>
1068 <xsl:apply-templates select="$child" mode="traceInValue"/>
1069 </xsl:otherwise>
1070 </xsl:choose>
1071 </xsl:template>
1073 <xsl:template match="inptr" mode="traceInFormat">
1074 <xsl:param name="name"/>
1075 <xsl:text> </xsl:text>
1076 <xsl:value-of select="$name"/>
1077 <xsl:text>=0x%x</xsl:text>
1078 </xsl:template>
1080 <xsl:template match="inptr" mode="traceInValue">
1081 <xsl:param name="name"/>
1082 <xsl:text>, </xsl:text>
1083 <xsl:value-of select="$name"/>
1084 </xsl:template>
1086 <xsl:template match="jrawMonitorID|jfieldID" mode="traceInFormat">
1087 <xsl:param name="name"/>
1088 <xsl:text> </xsl:text>
1089 <xsl:value-of select="$name"/>
1090 <xsl:text>=%s</xsl:text>
1091 </xsl:template>
1093 <xsl:template match="jclass" mode="traceInFormat">
1094 <xsl:param name="name"/>
1095 <!-- for JVMTI a jclass/jmethodID becomes just jmethodID -->
1096 <xsl:if test="count(@method)=0">
1097 <xsl:text> </xsl:text>
1098 <xsl:value-of select="$name"/>
1099 <xsl:text>=%s</xsl:text>
1100 </xsl:if>
1101 </xsl:template>
1103 <xsl:template match="jrawMonitorID" mode="traceInValue">
1104 <xsl:param name="name"/>
1105 <xsl:text>, rmonitor->get_name()</xsl:text>
1106 </xsl:template>
1108 <xsl:template match="jthread" mode="traceInFormat">
1109 <xsl:param name="name"/>
1110 <!-- If we convert and test threads -->
1111 <xsl:if test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
1112 <xsl:text> </xsl:text>
1113 <xsl:value-of select="$name"/>
1114 <xsl:text>=%s</xsl:text>
1115 </xsl:if>
1116 </xsl:template>
1118 <xsl:template match="jthread" mode="traceInValue">
1119 <xsl:param name="name"/>
1120 <!-- If we convert and test threads -->
1121 <xsl:if test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
1122 <xsl:text>,
1123 JvmtiTrace::safe_get_thread_name(java_thread)</xsl:text>
1124 </xsl:if>
1125 </xsl:template>
1127 <xsl:template match="jframeID" mode="traceInFormat">
1128 <xsl:param name="name"/>
1129 <xsl:text>depth=%d</xsl:text>
1130 </xsl:template>
1132 <xsl:template match="jframeID" mode="traceInValue">
1133 <xsl:param name="name"/>
1134 <xsl:text>, </xsl:text>
1135 <xsl:value-of select="$name"/>
1136 </xsl:template>
1138 <xsl:template match="jclass" mode="traceInValue">
1139 <!-- for JVMTI a jclass/jmethodID becomes just jmethodID -->
1140 <xsl:if test="count(@method)=0">
1141 <xsl:text>,
1142 JvmtiTrace::get_class_name(k_mirror)</xsl:text>
1143 </xsl:if>
1144 </xsl:template>
1146 <xsl:template match="jmethodID" mode="traceInFormat">
1147 <xsl:param name="name"/>
1148 <xsl:text> </xsl:text>
1149 <xsl:value-of select="$name"/>
1150 <xsl:text>=%s.%s</xsl:text>
1151 </xsl:template>
1153 <xsl:template match="jmethodID" mode="traceInValue">
1154 <xsl:param name="name"/>
1155 <xsl:text>,
1156 method_oop == NULL? "NULL" : method_oop->klass_name()->as_C_string(),
1157 method_oop == NULL? "NULL" : method_oop->name()->as_C_string()
1158 </xsl:text>
1159 </xsl:template>
1161 <xsl:template match="jfieldID" mode="traceInValue">
1162 <xsl:param name="name"/>
1163 <xsl:text>, fdesc.name()->as_C_string()</xsl:text>
1164 </xsl:template>
1166 <xsl:template match="enum" mode="traceInFormat">
1167 <xsl:param name="name"/>
1168 <xsl:text> </xsl:text>
1169 <xsl:value-of select="$name"/>
1170 <xsl:text>=%d:%s</xsl:text>
1171 </xsl:template>
1173 <xsl:template match="enum" mode="traceInValue">
1174 <xsl:param name="name"/>
1175 <xsl:text>, </xsl:text>
1176 <xsl:value-of select="$name"/>
1177 <xsl:text>,
1178 </xsl:text>
1179 <xsl:choose>
1180 <xsl:when test=".='jvmtiError'">
1181 <xsl:text>JvmtiUtil::error_name(</xsl:text>
1182 <xsl:value-of select="$name"/>
1183 <xsl:text>)
1184 </xsl:text>
1185 </xsl:when>
1186 <xsl:otherwise>
1187 <xsl:choose>
1188 <xsl:when test=".='jvmtiEvent'">
1189 <xsl:text>JvmtiTrace::event_name(</xsl:text>
1190 <xsl:value-of select="$name"/>
1191 <xsl:text>)
1192 </xsl:text>
1193 </xsl:when>
1194 <xsl:otherwise>
1195 <xsl:text>JvmtiTrace::enum_name(</xsl:text>
1196 <xsl:value-of select="."/>
1197 <xsl:text>ConstantNames, </xsl:text>
1198 <xsl:value-of select="."/>
1199 <xsl:text>ConstantValues, </xsl:text>
1200 <xsl:value-of select="$name"/>
1201 <xsl:text>)</xsl:text>
1202 </xsl:otherwise>
1203 </xsl:choose>
1204 </xsl:otherwise>
1205 </xsl:choose>
1206 </xsl:template>
1208 <xsl:template match="jint|jlocation" mode="traceInFormat">
1209 <xsl:param name="name"/>
1210 <xsl:text> </xsl:text>
1211 <xsl:value-of select="$name"/>
1212 <xsl:text>=%d</xsl:text>
1213 </xsl:template>
1215 <xsl:template match="jlong" mode="traceInFormat">
1216 <xsl:param name="name"/>
1217 <xsl:text> </xsl:text>
1218 <xsl:value-of select="$name"/>
1219 <xsl:text>=%ld</xsl:text>
1220 </xsl:template>
1222 <xsl:template match="size_t" mode="traceInFormat">
1223 <xsl:param name="name"/>
1224 <xsl:text> </xsl:text>
1225 <xsl:value-of select="$name"/>
1226 <xsl:text>=0x%zx</xsl:text>
1227 </xsl:template>
1229 <xsl:template match="jfloat|jdouble" mode="traceInFormat">
1230 <xsl:param name="name"/>
1231 <xsl:text> </xsl:text>
1232 <xsl:value-of select="$name"/>
1233 <xsl:text>=%f</xsl:text>
1234 </xsl:template>
1236 <xsl:template match="char" mode="traceInFormat">
1237 <xsl:param name="name"/>
1238 <xsl:text> </xsl:text>
1239 <xsl:value-of select="$name"/>
1240 <xsl:text>=%c</xsl:text>
1241 </xsl:template>
1243 <xsl:template match="uchar|jchar" mode="traceInFormat">
1244 <xsl:param name="name"/>
1245 <xsl:text> </xsl:text>
1246 <xsl:value-of select="$name"/>
1247 <xsl:text>=0x%x</xsl:text>
1248 </xsl:template>
1250 <xsl:template match="jint|jlocation|jchar|jlong|jfloat|jdouble|char|uchar|size_t" mode="traceInValue">
1251 <xsl:param name="name"/>
1252 <xsl:text>, </xsl:text>
1253 <xsl:value-of select="$name"/>
1254 </xsl:template>
1257 <xsl:template match="jboolean" mode="traceInFormat">
1258 <xsl:param name="name"/>
1259 <xsl:text> </xsl:text>
1260 <xsl:value-of select="$name"/>
1261 <xsl:text>=%s</xsl:text>
1262 </xsl:template>
1264 <xsl:template match="jboolean" mode="traceInValue">
1265 <xsl:param name="name"/>
1266 <xsl:text>, </xsl:text>
1267 <xsl:value-of select="$name"/>
1268 <xsl:text>? "true" : "false"</xsl:text>
1269 </xsl:template>
1271 <xsl:template match="jobject|jvalue|jthreadGroup|void|struct" mode="traceInFormat">
1272 </xsl:template>
1274 <xsl:template match="jobject|jvalue|jthreadGroup|void|struct" mode="traceInValue">
1275 </xsl:template>
1279 </xsl:stylesheet>