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