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