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.
   5 
   6  This code is free software; you can redistribute it and/or modify it
   7  under the terms of the GNU General Public License version 2 only, as
   8  published by the Free Software Foundation.
   9 
  10  This code is distributed in the hope that it will be useful, but WITHOUT
  11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  version 2 for more details (a copy is included in the LICENSE file that
  14  accompanied this code).
  15 
  16  You should have received a copy of the GNU General Public License version
  17  2 along with this work; if not, write to the Free Software Foundation,
  18  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 
  20  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  or visit www.oracle.com if you need additional information or have any
  22  questions.
  23   
  24 -->
  25 
  26 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  27 
  28 <xsl:import href="jvmtiLib.xsl"/>
  29 
  30 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
  31 
  32 <xsl:template match="/">
  33   <xsl:apply-templates select="specification"/>
  34 </xsl:template>
  35 
  36 <xsl:template match="specification">
  37   <xsl:call-template name="sourceHeader"/>
  38   <xsl:text>
  39 
  40 // end file prefix - do not modify or remove this line
  41 </xsl:text>
  42   <xsl:apply-templates select="functionsection"/>
  43 </xsl:template>
  44 
  45 <xsl:template match="functionsection">
  46   <xsl:apply-templates select="category"/>
  47 </xsl:template>
  48 
  49 <xsl:template match="category">
  50   <xsl:text>
  51   //
  52   // </xsl:text><xsl:value-of select="@label"/><xsl:text> functions
  53   // 
  54 </xsl:text>
  55   <xsl:apply-templates select="function[not(contains(@impl,'unimpl'))]"/>
  56 </xsl:template>
  57 
  58 <xsl:template match="function">
  59   <xsl:apply-templates select="parameters" mode="advice"/>
  60   <xsl:text>
  61 jvmtiError
  62 JvmtiEnv::</xsl:text>
  63   <xsl:if test="count(@hide)=1">
  64     <xsl:value-of select="@hide"/>
  65   </xsl:if>
  66   <xsl:value-of select="@id"/>
  67   <xsl:text>(</xsl:text>
  68   <xsl:apply-templates select="parameters" mode="HotSpotSig"/>
  69   <xsl:text>) {</xsl:text>
  70   <xsl:for-each select="parameters/param/jclass">
  71     <xsl:if test="count(@method|@field)=0">
  72 <xsl:text>
  73   if (java_lang_Class::is_primitive(k_mirror)) {
  74     // DO PRIMITIVE CLASS PROCESSING
  75     return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
  76   }
  77   klassOop k_oop = java_lang_Class::as_klassOop(k_mirror);
  78   if (k_oop == NULL) {
  79     return JVMTI_ERROR_INVALID_CLASS;
  80   }</xsl:text>
  81     </xsl:if>
  82   </xsl:for-each>
  83 <xsl:text>
  84   return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
  85 } /* end </xsl:text>
  86   <xsl:if test="count(@hide)=1">
  87     <xsl:value-of select="@hide"/>
  88   </xsl:if>
  89   <xsl:value-of select="@id"/>
  90   <xsl:text> */
  91 
  92 </xsl:text>
  93 </xsl:template>
  94 
  95 
  96 <!-- ======== ADVICE ======== -->
  97 
  98 <xsl:template match="parameters" mode="advice">
  99   <xsl:apply-templates select="param" mode="advice"/>
 100 </xsl:template>
 101 
 102 <xsl:template match="param" mode="advice">
 103   <xsl:apply-templates select="child::*[position()=1]" mode="advice">
 104     <xsl:with-param name="name" select="@id"/>
 105   </xsl:apply-templates>
 106 </xsl:template>
 107 
 108 <xsl:template match="jthread" mode="advice">
 109   <xsl:param name="name"/>
 110   <xsl:choose>
 111     <xsl:when test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
 112       <xsl:text>
 113 // Threads_lock NOT held, java_thread not protected by lock
 114 // java_thread - pre-checked</xsl:text>
 115     </xsl:when>
 116     <xsl:otherwise>
 117       <xsl:text>
 118 // Threads_lock NOT held
 119 // </xsl:text>
 120       <xsl:value-of select="$name"/>
 121       <xsl:text> - NOT pre-checked</xsl:text>
 122     </xsl:otherwise>
 123   </xsl:choose>
 124 </xsl:template>
 125 
 126 <xsl:template match="jrawMonitorID" mode="advice">
 127   <xsl:param name="name"/>
 128   <xsl:text>
 129 // rmonitor - pre-checked for validity</xsl:text>
 130 </xsl:template>
 131 
 132 <xsl:template match="jframeID" mode="advice">
 133   <xsl:param name="name"/>
 134   <xsl:text>
 135 // java_thread - unchecked 
 136 // depth - pre-checked as non-negative</xsl:text>
 137 </xsl:template>
 138 
 139 <xsl:template match="jmethodID" mode="advice">
 140   <xsl:param name="name"/>
 141   <xsl:text>
 142 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method</xsl:text>
 143 </xsl:template>
 144 
 145 <xsl:template match="jfieldID" mode="advice">
 146   <xsl:param name="name"/>
 147 </xsl:template>
 148 
 149 <xsl:template match="jclass" mode="advice">
 150   <xsl:param name="name"/>
 151   <!--
 152     classes passed as part of a class/method or class/field pair are used
 153     by the wrapper to get the internal type but are not needed by nor 
 154     passed to the implementation layer.
 155   -->
 156   <xsl:if test="count(@method|@field)=0">
 157     <xsl:text>
 158 // k_mirror - may be primitive, this must be checked</xsl:text>
 159   </xsl:if>
 160 </xsl:template>
 161 
 162 <xsl:template match="nullok" mode="advice">
 163 </xsl:template>
 164 
 165 <xsl:template match="outptr|outbuf|allocfieldbuf|ptrtype|inptr|inbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="advice">
 166   <xsl:param name="name"/>
 167   <xsl:choose>
 168     <xsl:when test="count(nullok)=0">
 169       <xsl:text>
 170 // </xsl:text>
 171       <xsl:value-of select="$name"/>
 172       <xsl:text> - pre-checked for NULL</xsl:text>
 173     </xsl:when>
 174     <xsl:otherwise>
 175       <xsl:text>
 176 // </xsl:text>
 177       <xsl:value-of select="$name"/>
 178       <xsl:text> - NULL is a valid value, must be checked</xsl:text>
 179     </xsl:otherwise>
 180   </xsl:choose>
 181 </xsl:template>
 182 
 183 <xsl:template match="jint" mode="advice">
 184   <xsl:param name="name"/>
 185   <xsl:if test="count(@min)=1">
 186     <xsl:text>
 187 // </xsl:text>
 188     <xsl:value-of select="$name"/>
 189     <xsl:text> - pre-checked to be greater than or equal to </xsl:text>
 190     <xsl:value-of select="@min"/>
 191   </xsl:if>
 192 </xsl:template>
 193 
 194 <xsl:template match="jobject|jvalue|jthreadGroup|enum|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct" mode="advice">
 195   <xsl:param name="name"/>
 196 </xsl:template>
 197 
 198 </xsl:stylesheet>