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