src/share/vm/prims/jvmtiEnter.xsl

Sun, 15 Sep 2013 15:28:58 +0200

author
goetz
date
Sun, 15 Sep 2013 15:28:58 +0200
changeset 6470
abe03600372a
parent 4668
3c9db54c2660
child 6198
55fb97c4c58d
permissions
-rw-r--r--

8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
Summary: Implement profiling for c2 jit compilation. Also enable new cppInterpreter features.
Reviewed-by: kvn

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

mercurial