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