src/share/vm/prims/jvmtiEnter.xsl

Mon, 10 Jan 2011 17:14:53 -0500

author
kamg
date
Mon, 10 Jan 2011 17:14:53 -0500
changeset 2445
7246a374a9f2
parent 2314
f95d63e2154a
child 3241
a6eef545f1a2
permissions
-rw-r--r--

6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
Summary: Make JvmtiGCMark safe to run non-safepoint and instrument CMS
Reviewed-by: ysr, dcubed

     1 <?xml version="1.0"?> 
     2 <!--
     3  Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
     4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     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.
    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).
    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.
    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.
    24 -->
    26 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    28 <xsl:import href="jvmtiLib.xsl"/>
    30 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
    32 <xsl:param name="trace"></xsl:param>
    33 <xsl:param name="interface"></xsl:param>
    36 <xsl:template match="specification">
    37   <xsl:call-template name="sourceHeader"/>
    38   <xsl:text>
    39 # include "precompiled.hpp"
    40 # include "prims/jvmtiEnter.hpp"
    41 # include "prims/jvmtiRawMonitor.hpp"
    42 # include "prims/jvmtiUtil.hpp"
    44 </xsl:text>
    46   <xsl:if test="$trace = 'Trace'">
    47    <xsl:text>
    48 #ifdef JVMTI_TRACE
    49 </xsl:text>
    50   </xsl:if>
    52  <xsl:if test="$trace != 'Trace'">
    53     <xsl:text>
    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 };
    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 };
    74 </xsl:text>
    75     <xsl:call-template name="eventCapabilitiesTest"/>
    76  </xsl:if>
    78  <xsl:if test="$trace = 'Trace'">
    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 &gt; $mynum]) = 0">
    85         <xsl:value-of select="@num"/>
    86       </xsl:if>
    87     </xsl:for-each>    
    88   </xsl:variable>
    90   <xsl:text>jbyte JvmtiTrace::_event_trace_flags[</xsl:text>
    91   <xsl:value-of select="1+$maxEvent"/>
    92   <xsl:text>];
    94 jint JvmtiTrace::_max_event_index = </xsl:text>
    95   <xsl:value-of select="$maxEvent"/>
    96   <xsl:text>;
    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"/>
   111   <xsl:if test="$trace='Trace'">
   112    <xsl:text>
   113 #endif /*JVMTI_TRACE */
   114 </xsl:text>
   115   </xsl:if>
   117 </xsl:template>
   119 <xsl:template match="constants">
   120   <xsl:text>
   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 };
   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 };
   144 </xsl:text>
   145 </xsl:template>
   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>
   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>
   161 <xsl:template name="eventCapabilitiesTest">
   162   <xsl:text>
   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-&gt;</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 }
   185 </xsl:text>
   186 </xsl:template>
   188 <xsl:template match="functionsection">
   189   <xsl:if test="$trace='Trace'">
   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 &gt; $mynum]) = 0">
   196         <xsl:value-of select="@num"/>
   197       </xsl:if>
   198     </xsl:for-each>    
   199   </xsl:variable>
   201   <xsl:text>jbyte JvmtiTrace::_trace_flags[</xsl:text>
   202   <xsl:value-of select="1+$maxFunction"/>
   203   <xsl:text>];
   205 jint JvmtiTrace::_max_function_index = </xsl:text>
   206   <xsl:value-of select="$maxFunction"/>
   207   <xsl:text>;
   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 };
   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 };
   227 </xsl:text>
   228   </xsl:if>
   230   <xsl:text>
   231 extern "C" {
   233 </xsl:text>
   234   <xsl:apply-templates select="category" mode="wrapper"/>
   235   <xsl:text>
   236 } /* end extern "C" */
   238 // JVMTI API functions
   239 struct jvmtiInterface_1_ jvmti</xsl:text>
   240   <xsl:value-of select="$trace"/>
   241   <xsl:text>_Interface = {
   242 </xsl:text>
   244   <xsl:call-template name="fillFuncStruct">
   245     <xsl:with-param name="funcs" select="category/function[count(@hide)=0]"/>
   246   </xsl:call-template>
   248   <xsl:text>
   249 };
   250 </xsl:text>
   251 </xsl:template>
   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>
   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>
   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 &gt; $index]) &gt; 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>
   298 <xsl:template name="fillEntityNameDoit">
   299   <xsl:param name="entity"/>
   300   <xsl:param name="index"/>
   301   <xsl:choose>
   302     <xsl:when test="count($entity) &gt; 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>
   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 &gt; $index]) &gt; 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>
   331 <xsl:template name="fillEventThreadedDoit">
   332   <xsl:param name="entity"/>
   333   <xsl:param name="index"/>
   334   <xsl:choose>
   335     <xsl:when test="count($entity) &gt; 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>
   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 &gt; $index]) &gt; 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>
   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>
   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>
   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"/>
   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() &amp;&amp; !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> 
   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>
   442 <xsl:template match="required">
   443   <xsl:text>
   444   if (jvmti_env-&gt;get_capabilities()-&gt;</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>
   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>
   471   <xsl:if test="not(contains(@jkernel,'yes'))">
   472   <xsl:text>&#xA;#ifdef JVMTI_KERNEL &#xA;</xsl:text>
   473   <xsl:text>  return JVMTI_ERROR_NOT_AVAILABLE; &#xA;</xsl:text>
   474   <xsl:text>#else &#xA;</xsl:text>
   475   </xsl:if>
   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>  
   492       <xsl:text>  
   493   Thread* this_thread = (Thread*)ThreadLocalStorage::thread(); </xsl:text>
   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> &amp;&amp; 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 &amp;&amp; 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>
   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>
   548   <xsl:apply-templates select="capabilities/required"/>
   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>
   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) &amp;&amp; !this_thread->is_VM_thread() &amp;&amp; !this_thread->is_ConcurrentGC_thread());
   568   }
   569   if (transition) {</xsl:text>
   570 	</xsl:otherwise>
   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>
   598   <xsl:if test="not(contains(@jkernel,'yes'))">
   599   <xsl:text>#endif // JVMTI_KERNEL&#xA;</xsl:text>
   600   </xsl:if>
   602   <xsl:text>}&#xA;</xsl:text>
   603 </xsl:template>
   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>
   612 <xsl:template match="function" mode="genCall">
   613   <xsl:text>  err = jvmti_env-&gt;</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>
   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>
   641 <xsl:template match="function" mode="traceBefore">
   642   <xsl:if test="$trace='Trace'">
   643     <xsl:text>
   644   if ((trace_flags &amp; 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>
   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 &amp; JvmtiTrace::SHOW_ERROR) != 0) {
   659         if ((trace_flags &amp; 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>
   683 <xsl:template match="function" mode="traceAfter">
   684   <xsl:if test="$trace='Trace'">
   685     <xsl:text>  if ( err != JVMTI_ERROR_NONE &amp;&amp; (trace_flags &amp; JvmtiTrace::SHOW_ERROR) != 0) {
   686       if ((trace_flags &amp; 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 &amp; 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>
   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>
   713 <xsl:template match="parameters" mode="dochecks">
   714   <xsl:apply-templates select="param" mode="dochecks"/>
   715 </xsl:template>
   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>
   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>
   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>
   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     }
   778     if (!thread_oop-&gt;is_a(SystemDictionary::Thread_klass())) {
   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>
   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>
   831 <xsl:template match="jframeID" mode="dochecks">
   832   <xsl:param name="name"/>
   833   <xsl:text>
   834   if (depth &lt; 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>
   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   }
   862   if (!k_mirror->is_a(SystemDictionary::Class_klass())) {
   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>
   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>);&#xA;</xsl:text>
   904   <xsl:text>  if (method_oop == NULL) {&#xA;</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>&#xA;</xsl:text>
   911   <xsl:text>  }&#xA;</xsl:text>
   912   <xsl:if test="count(@native)=1 and contains(@native,'error')">
   913     <xsl:text>  if (method_oop->is_native()) {&#xA;</xsl:text>   
   914     <xsl:text>    return JVMTI_ERROR_NATIVE_METHOD;&#xA;</xsl:text>   
   915     <xsl:text>  }&#xA;</xsl:text>   
   916   </xsl:if>
   917 </xsl:template>
   920 <xsl:template match="jfieldID" mode="dochecks">
   921   <xsl:param name="name"/>
   922   <xsl:text>  ResourceMark rm_fdesc(current_thread);&#xA;</xsl:text>
   923   <xsl:text>  fieldDescriptor fdesc;&#xA;</xsl:text>
   924   <xsl:text>  if (!JvmtiEnv::get_field_descriptor(k_oop, </xsl:text>
   925   <xsl:value-of select="$name"/>
   926   <xsl:text>, &amp;fdesc)) {&#xA;</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>&#xA;</xsl:text>
   931   <xsl:text>  }&#xA;</xsl:text>
   932 </xsl:template>
   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> &lt; </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>
   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>
   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) &gt; $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>
   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) &gt; $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>
   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>
   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>
  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>
  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>
  1019 <xsl:template match="outptr|outbuf|allocfieldbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="traceInFormat">
  1020 </xsl:template>
  1022 <xsl:template match="outptr|outbuf|allocfieldbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="traceInValue">
  1023 </xsl:template>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  1105 <xsl:template match="jrawMonitorID" mode="traceInValue">
  1106   <xsl:param name="name"/>
  1107   <xsl:text>, rmonitor->get_name()</xsl:text>
  1108 </xsl:template>
  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>
  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>
  1129 <xsl:template match="jframeID" mode="traceInFormat">
  1130   <xsl:param name="name"/>
  1131   <xsl:text>depth=%d</xsl:text>
  1132 </xsl:template>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  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>
  1273 <xsl:template match="jobject|jvalue|jthreadGroup|void|struct" mode="traceInFormat">
  1274 </xsl:template>
  1276 <xsl:template match="jobject|jvalue|jthreadGroup|void|struct" mode="traceInValue">
  1277 </xsl:template>
  1281 </xsl:stylesheet>

mercurial