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