1 <?xml version="1.0"?> 
   2 <!--
   3  Copyright (c) 2002, 2006, 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 # include "incls/_precompiled.incl"
  40 # include "incls/_jvmtiEnv.cpp.incl"
  41 
  42 // end file prefix - do not modify or remove this line
  43 </xsl:text>
  44   <xsl:apply-templates select="functionsection"/>
  45 </xsl:template>
  46 
  47 <xsl:template match="functionsection">
  48   <xsl:apply-templates select="category"/>
  49 </xsl:template>
  50 
  51 <xsl:template match="category">
  52   <xsl:text>
  53   //
  54   // </xsl:text><xsl:value-of select="@label"/><xsl:text> functions
  55   // 
  56 </xsl:text>
  57   <xsl:apply-templates select="function[not(contains(@impl,'unimpl'))]"/>
  58 </xsl:template>
  59 
  60 <xsl:template match="function">
  61   <xsl:apply-templates select="parameters" mode="advice"/>
  62   <xsl:text>
  63 jvmtiError
  64 JvmtiEnv::</xsl:text>
  65   <xsl:if test="count(@hide)=1">
  66     <xsl:value-of select="@hide"/>
  67   </xsl:if>
  68   <xsl:value-of select="@id"/>
  69   <xsl:text>(</xsl:text>
  70   <xsl:apply-templates select="parameters" mode="HotSpotSig"/>
  71   <xsl:text>) {</xsl:text>
  72   <xsl:for-each select="parameters/param/jclass">
  73     <xsl:if test="count(@method|@field)=0">
  74 <xsl:text>
  75   if (java_lang_Class::is_primitive(k_mirror)) {
  76     // DO PRIMITIVE CLASS PROCESSING
  77     return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
  78   }
  79   klassOop k_oop = java_lang_Class::as_klassOop(k_mirror);
  80   if (k_oop == NULL) {
  81     return JVMTI_ERROR_INVALID_CLASS;
  82   }</xsl:text>
  83     </xsl:if>
  84   </xsl:for-each>
  85 <xsl:text>
  86   return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
  87 } /* end </xsl:text>
  88   <xsl:if test="count(@hide)=1">
  89     <xsl:value-of select="@hide"/>
  90   </xsl:if>
  91   <xsl:value-of select="@id"/>
  92   <xsl:text> */
  93 
  94 </xsl:text>
  95 </xsl:template>
  96 
  97 
  98 <!-- ======== ADVICE ======== -->
  99 
 100 <xsl:template match="parameters" mode="advice">
 101   <xsl:apply-templates select="param" mode="advice"/>
 102 </xsl:template>
 103 
 104 <xsl:template match="param" mode="advice">
 105   <xsl:apply-templates select="child::*[position()=1]" mode="advice">
 106     <xsl:with-param name="name" select="@id"/>
 107   </xsl:apply-templates>
 108 </xsl:template>
 109 
 110 <xsl:template match="jthread" mode="advice">
 111   <xsl:param name="name"/>
 112   <xsl:choose>
 113     <xsl:when test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
 114       <xsl:text>
 115 // Threads_lock NOT held, java_thread not protected by lock
 116 // java_thread - pre-checked</xsl:text>
 117     </xsl:when>
 118     <xsl:otherwise>
 119       <xsl:text>
 120 // Threads_lock NOT held
 121 // </xsl:text>
 122       <xsl:value-of select="$name"/>
 123       <xsl:text> - NOT pre-checked</xsl:text>
 124     </xsl:otherwise>
 125   </xsl:choose>
 126 </xsl:template>
 127 
 128 <xsl:template match="jrawMonitorID" mode="advice">
 129   <xsl:param name="name"/>
 130   <xsl:text>
 131 // rmonitor - pre-checked for validity</xsl:text>
 132 </xsl:template>
 133 
 134 <xsl:template match="jframeID" mode="advice">
 135   <xsl:param name="name"/>
 136   <xsl:text>
 137 // java_thread - unchecked 
 138 // depth - pre-checked as non-negative</xsl:text>
 139 </xsl:template>
 140 
 141 <xsl:template match="jmethodID" mode="advice">
 142   <xsl:param name="name"/>
 143   <xsl:text>
 144 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method</xsl:text>
 145 </xsl:template>
 146 
 147 <xsl:template match="jfieldID" mode="advice">
 148   <xsl:param name="name"/>
 149 </xsl:template>
 150 
 151 <xsl:template match="jclass" mode="advice">
 152   <xsl:param name="name"/>
 153   <!--
 154     classes passed as part of a class/method or class/field pair are used
 155     by the wrapper to get the internal type but are not needed by nor 
 156     passed to the implementation layer.
 157   -->
 158   <xsl:if test="count(@method|@field)=0">
 159     <xsl:text>
 160 // k_mirror - may be primitive, this must be checked</xsl:text>
 161   </xsl:if>
 162 </xsl:template>
 163 
 164 <xsl:template match="nullok" mode="advice">
 165 </xsl:template>
 166 
 167 <xsl:template match="outptr|outbuf|allocfieldbuf|ptrtype|inptr|inbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="advice">
 168   <xsl:param name="name"/>
 169   <xsl:choose>
 170     <xsl:when test="count(nullok)=0">
 171       <xsl:text>
 172 // </xsl:text>
 173       <xsl:value-of select="$name"/>
 174       <xsl:text> - pre-checked for NULL</xsl:text>
 175     </xsl:when>
 176     <xsl:otherwise>
 177       <xsl:text>
 178 // </xsl:text>
 179       <xsl:value-of select="$name"/>
 180       <xsl:text> - NULL is a valid value, must be checked</xsl:text>
 181     </xsl:otherwise>
 182   </xsl:choose>
 183 </xsl:template>
 184 
 185 <xsl:template match="jint" mode="advice">
 186   <xsl:param name="name"/>
 187   <xsl:if test="count(@min)=1">
 188     <xsl:text>
 189 // </xsl:text>
 190     <xsl:value-of select="$name"/>
 191     <xsl:text> - pre-checked to be greater than or equal to </xsl:text>
 192     <xsl:value-of select="@min"/>
 193   </xsl:if>
 194 </xsl:template>
 195 
 196 <xsl:template match="jobject|jvalue|jthreadGroup|enum|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct" mode="advice">
 197   <xsl:param name="name"/>
 198 </xsl:template>
 199 
 200 </xsl:stylesheet>