1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/prims/jvmtiH.xsl Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,453 @@ 1.4 +<?xml version="1.0" encoding="utf-8"?> 1.5 +<!-- 1.6 + Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 1.7 + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 + 1.9 + This code is free software; you can redistribute it and/or modify it 1.10 + under the terms of the GNU General Public License version 2 only, as 1.11 + published by the Free Software Foundation. 1.12 + 1.13 + This code is distributed in the hope that it will be useful, but WITHOUT 1.14 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.15 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.16 + version 2 for more details (a copy is included in the LICENSE file that 1.17 + accompanied this code). 1.18 + 1.19 + You should have received a copy of the GNU General Public License version 1.20 + 2 along with this work; if not, write to the Free Software Foundation, 1.21 + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.22 + 1.23 + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.24 + or visit www.oracle.com if you need additional information or have any 1.25 + questions. 1.26 + 1.27 +--> 1.28 + 1.29 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 1.30 + version="1.0"> 1.31 + 1.32 + <xsl:import href="jvmtiLib.xsl"/> 1.33 + 1.34 + <xsl:output method="text" omit-xml-declaration="yes"/> 1.35 + 1.36 + <xsl:template match="/"> 1.37 + <xsl:apply-templates select="specification"/> 1.38 + </xsl:template> 1.39 + 1.40 + <xsl:template match="specification"> 1.41 + 1.42 + <xsl:call-template name="intro"/> 1.43 + 1.44 + <xsl:text>/* Derived Base Types */ 1.45 +</xsl:text> 1.46 + <xsl:apply-templates select="//basetype"/> 1.47 + 1.48 + <xsl:text> 1.49 + 1.50 + /* Constants */ 1.51 +</xsl:text> 1.52 + <xsl:apply-templates select="//constants"/> 1.53 + 1.54 + <xsl:text> 1.55 + 1.56 + /* Errors */ 1.57 + 1.58 +typedef enum { 1.59 +</xsl:text> 1.60 + <xsl:for-each select="//errorid"> 1.61 + <xsl:sort select="@num" data-type="number"/> 1.62 + <xsl:apply-templates select="." mode="enum"/> 1.63 + <xsl:text>, 1.64 +</xsl:text> 1.65 + <xsl:if test="position() = last()"> 1.66 + <xsl:text> JVMTI_ERROR_MAX = </xsl:text> 1.67 + <xsl:value-of select="@num"/> 1.68 + </xsl:if> 1.69 + </xsl:for-each> 1.70 + <xsl:text> 1.71 +} jvmtiError; 1.72 +</xsl:text> 1.73 + <xsl:apply-templates select="eventsection" mode="enum"/> 1.74 + 1.75 + <xsl:text> 1.76 + /* Pre-Declarations */ 1.77 +</xsl:text> 1.78 +<xsl:apply-templates select="//typedef|//uniontypedef" mode="early"/> 1.79 + 1.80 + <xsl:text> 1.81 + /* Function Types */ 1.82 +</xsl:text> 1.83 + <xsl:apply-templates select="//callback"/> 1.84 + 1.85 + <xsl:text> 1.86 + 1.87 + /* Structure Types */ 1.88 +</xsl:text> 1.89 + <xsl:apply-templates select="//typedef|//uniontypedef" mode="body"/> 1.90 + <xsl:apply-templates select="//capabilitiestypedef"/> 1.91 + 1.92 + <xsl:apply-templates select="eventsection" mode="body"/> 1.93 + 1.94 + <xsl:apply-templates select="functionsection"/> 1.95 + 1.96 + <xsl:call-template name="outro"/> 1.97 + 1.98 + </xsl:template> 1.99 + 1.100 + <xsl:template name="intro"> 1.101 + <xsl:call-template name="includeHeader"/> 1.102 + <xsl:text> 1.103 + /* Include file for the Java(tm) Virtual Machine Tool Interface */ 1.104 + 1.105 +#ifndef _JAVA_JVMTI_H_ 1.106 +#define _JAVA_JVMTI_H_ 1.107 + 1.108 +#include "jni.h" 1.109 + 1.110 +#ifdef __cplusplus 1.111 +extern "C" { 1.112 +#endif 1.113 + 1.114 +enum { 1.115 + JVMTI_VERSION_1 = 0x30010000, 1.116 + JVMTI_VERSION_1_0 = 0x30010000, 1.117 + JVMTI_VERSION_1_1 = 0x30010100, 1.118 + JVMTI_VERSION_1_2 = 0x30010200, 1.119 + 1.120 + JVMTI_VERSION = 0x30000000 + (</xsl:text> 1.121 + <xsl:value-of select="//specification/@majorversion"/> 1.122 + <xsl:text> * 0x10000) + (</xsl:text> 1.123 + <xsl:value-of select="//specification/@minorversion"/> 1.124 + <xsl:text> * 0x100)</xsl:text> 1.125 + <xsl:variable name="micro"> 1.126 + <xsl:call-template name="microversion"/> 1.127 + </xsl:variable> 1.128 + <xsl:choose> 1.129 + <xsl:when test="string($micro)='dev'"> 1.130 + <xsl:text> /* checked out - </xsl:text> 1.131 + </xsl:when> 1.132 + <xsl:otherwise> 1.133 + <xsl:text> + </xsl:text> 1.134 + <xsl:value-of select="$micro"/> 1.135 + <xsl:text> /* </xsl:text> 1.136 + </xsl:otherwise> 1.137 + </xsl:choose> 1.138 + <xsl:text>version: </xsl:text> 1.139 + <xsl:call-template name="showversion"/> 1.140 + <xsl:text> */ 1.141 +}; 1.142 + 1.143 +JNIEXPORT jint JNICALL 1.144 +Agent_OnLoad(JavaVM *vm, char *options, void *reserved); 1.145 + 1.146 +JNIEXPORT jint JNICALL 1.147 +Agent_OnAttach(JavaVM* vm, char* options, void* reserved); 1.148 + 1.149 +JNIEXPORT void JNICALL 1.150 +Agent_OnUnload(JavaVM *vm); 1.151 + 1.152 + /* Forward declaration of the environment */ 1.153 + 1.154 +struct _jvmtiEnv; 1.155 + 1.156 +struct jvmtiInterface_1_; 1.157 + 1.158 +#ifdef __cplusplus 1.159 +typedef _jvmtiEnv jvmtiEnv; 1.160 +#else 1.161 +typedef const struct jvmtiInterface_1_ *jvmtiEnv; 1.162 +#endif /* __cplusplus */ 1.163 + 1.164 +</xsl:text> 1.165 + </xsl:template> 1.166 + 1.167 + <xsl:template name="outro"> 1.168 + <xsl:text> 1.169 + 1.170 +#ifdef __cplusplus 1.171 +} /* extern "C" */ 1.172 +#endif /* __cplusplus */ 1.173 + 1.174 +#endif /* !_JAVA_JVMTI_H_ */ 1.175 + 1.176 +</xsl:text> 1.177 +</xsl:template> 1.178 + 1.179 +<xsl:template match="eventsection" mode="enum"> 1.180 + <xsl:text> 1.181 + /* Event IDs */ 1.182 + 1.183 +typedef enum { 1.184 +</xsl:text> 1.185 + <xsl:for-each select="event"> 1.186 + <xsl:sort select="@num" data-type="number"/> 1.187 + <xsl:if test="position()=1"> 1.188 + <xsl:text> JVMTI_MIN_EVENT_TYPE_VAL = </xsl:text> 1.189 + <xsl:value-of select="@num"/> 1.190 + <xsl:text>, 1.191 +</xsl:text> 1.192 + </xsl:if> 1.193 + <xsl:apply-templates select="." mode="enum"/> 1.194 + <xsl:text>, 1.195 +</xsl:text> 1.196 + <xsl:if test="position()=last()"> 1.197 + <xsl:text> JVMTI_MAX_EVENT_TYPE_VAL = </xsl:text> 1.198 + <xsl:value-of select="@num"/> 1.199 + </xsl:if> 1.200 + </xsl:for-each> 1.201 + <xsl:text> 1.202 +} jvmtiEvent; 1.203 + 1.204 +</xsl:text> 1.205 +</xsl:template> 1.206 + 1.207 +<xsl:template match="eventsection" mode="body"> 1.208 + <xsl:text> 1.209 + 1.210 + /* Event Definitions */ 1.211 + 1.212 +typedef void (JNICALL *jvmtiEventReserved)(void); 1.213 + 1.214 +</xsl:text> 1.215 + <xsl:apply-templates select="event" mode="definition"> 1.216 + <xsl:sort select="@id"/> 1.217 + </xsl:apply-templates> 1.218 + 1.219 + <xsl:text> 1.220 + /* Event Callback Structure */ 1.221 + 1.222 +typedef struct { 1.223 +</xsl:text> 1.224 + <xsl:call-template name="eventStruct"> 1.225 + <xsl:with-param name="events" select="event"/> 1.226 + <xsl:with-param name="index" select="0"/> 1.227 + <xsl:with-param name="started" select="false"/> 1.228 + <xsl:with-param name="comment" select="'Yes'"/> 1.229 + </xsl:call-template> 1.230 + <xsl:text>} jvmtiEventCallbacks; 1.231 +</xsl:text> 1.232 + 1.233 +</xsl:template> 1.234 + 1.235 + 1.236 +<xsl:template match="event" mode="definition"> 1.237 + <xsl:text> 1.238 +typedef void (JNICALL *jvmtiEvent</xsl:text> 1.239 + <xsl:value-of select="@id"/> 1.240 + <xsl:text>) 1.241 + (jvmtiEnv *jvmti_env</xsl:text> 1.242 + <xsl:apply-templates select="parameters" mode="signature"> 1.243 + <xsl:with-param name="comma"> 1.244 + <xsl:text>, 1.245 + </xsl:text> 1.246 + </xsl:with-param> 1.247 + </xsl:apply-templates> 1.248 + <xsl:text>); 1.249 +</xsl:text> 1.250 +</xsl:template> 1.251 + 1.252 +<xsl:template match="functionsection"> 1.253 + <xsl:text> 1.254 + 1.255 + /* Function Interface */ 1.256 + 1.257 +typedef struct jvmtiInterface_1_ { 1.258 + 1.259 +</xsl:text> 1.260 + <xsl:call-template name="funcStruct"> 1.261 + <xsl:with-param name="funcs" select="category/function[count(@hide)=0]"/> 1.262 + <xsl:with-param name="index" select="1"/> 1.263 + </xsl:call-template> 1.264 + 1.265 + <xsl:text>} jvmtiInterface_1; 1.266 + 1.267 +struct _jvmtiEnv { 1.268 + const struct jvmtiInterface_1_ *functions; 1.269 +#ifdef __cplusplus 1.270 + 1.271 +</xsl:text> 1.272 + <xsl:apply-templates select="category" mode="cppinline"/> 1.273 + <xsl:text> 1.274 +#endif /* __cplusplus */ 1.275 +}; 1.276 +</xsl:text> 1.277 + 1.278 +</xsl:template> 1.279 + 1.280 +<xsl:template name="funcStruct"> 1.281 + <xsl:param name="funcs"/> 1.282 + <xsl:param name="index"/> 1.283 + <xsl:variable name="thisFunction" select="$funcs[@num=$index]"/> 1.284 + <xsl:text> /* </xsl:text> 1.285 + <xsl:number value="$index" format=" 1"/> 1.286 + <xsl:text> : </xsl:text> 1.287 + <xsl:choose> 1.288 + <xsl:when test="count($thisFunction)=1"> 1.289 + <xsl:value-of select="$thisFunction/synopsis"/> 1.290 + <xsl:text> */ 1.291 + jvmtiError (JNICALL *</xsl:text> 1.292 + <xsl:value-of select="$thisFunction/@id"/> 1.293 + <xsl:text>) (jvmtiEnv* env</xsl:text> 1.294 + <xsl:apply-templates select="$thisFunction/parameters" mode="signature"> 1.295 + <xsl:with-param name="comma"> 1.296 + <xsl:text>, 1.297 + </xsl:text> 1.298 + </xsl:with-param> 1.299 + </xsl:apply-templates> 1.300 + <xsl:text>)</xsl:text> 1.301 + </xsl:when> 1.302 + <xsl:otherwise> 1.303 + <xsl:text> RESERVED */ 1.304 + void *reserved</xsl:text> 1.305 + <xsl:value-of select="$index"/> 1.306 + </xsl:otherwise> 1.307 + </xsl:choose> 1.308 + <xsl:text>; 1.309 + 1.310 +</xsl:text> 1.311 + <xsl:if test="count($funcs[@num > $index]) > 0"> 1.312 + <xsl:call-template name="funcStruct"> 1.313 + <xsl:with-param name="funcs" select="$funcs"/> 1.314 + <xsl:with-param name="index" select="1+$index"/> 1.315 + </xsl:call-template> 1.316 + </xsl:if> 1.317 +</xsl:template> 1.318 + 1.319 + 1.320 +<xsl:template match="function"> 1.321 + <xsl:text> jvmtiError (JNICALL *</xsl:text> 1.322 + <xsl:value-of select="@id"/> 1.323 + <xsl:text>) (jvmtiEnv* env</xsl:text> 1.324 + <xsl:apply-templates select="parameters" mode="signature"/> 1.325 + <xsl:text>); 1.326 + 1.327 +</xsl:text> 1.328 +</xsl:template> 1.329 + 1.330 +<xsl:template match="category" mode="cppinline"> 1.331 + <xsl:apply-templates select="function[count(@hide)=0]" mode="cppinline"/> 1.332 +</xsl:template> 1.333 + 1.334 +<xsl:template match="function" mode="cppinline"> 1.335 + <xsl:text> 1.336 + jvmtiError </xsl:text> 1.337 + <xsl:value-of select="@id"/> 1.338 + <xsl:text>(</xsl:text> 1.339 + <xsl:apply-templates select="parameters" mode="signaturenoleadcomma"/> 1.340 + <xsl:text>) { 1.341 + return functions-></xsl:text> 1.342 + <xsl:value-of select="@id"/> 1.343 + <xsl:text>(this</xsl:text> 1.344 + <xsl:for-each select="parameters"> 1.345 + <xsl:for-each select="param"> 1.346 + <xsl:if test="@id != '...' and count(jclass/@method) = 0"> 1.347 + <xsl:text>, </xsl:text> 1.348 + <xsl:value-of select="@id"/> 1.349 + </xsl:if> 1.350 + </xsl:for-each> 1.351 + </xsl:for-each> 1.352 + <xsl:text>); 1.353 + } 1.354 +</xsl:text> 1.355 +</xsl:template> 1.356 + 1.357 + 1.358 + <xsl:template match="basetype"> 1.359 + <xsl:if test="count(definition)!=0"> 1.360 + <xsl:text> 1.361 +</xsl:text> 1.362 + <xsl:apply-templates select="definition"/> 1.363 + </xsl:if> 1.364 + </xsl:template> 1.365 + 1.366 + <xsl:template match="constants"> 1.367 + <xsl:text> 1.368 + 1.369 + /* </xsl:text> 1.370 + <xsl:value-of select="@label"/> 1.371 + <xsl:text> */ 1.372 +</xsl:text> 1.373 + <xsl:choose> 1.374 + <xsl:when test="@kind='enum'"> 1.375 + <xsl:apply-templates select="." mode="enum"/> 1.376 + </xsl:when> 1.377 + <xsl:otherwise> 1.378 + <xsl:apply-templates select="." mode="constants"/> 1.379 + </xsl:otherwise> 1.380 + </xsl:choose> 1.381 + </xsl:template> 1.382 + 1.383 +<xsl:template match="callback"> 1.384 + <xsl:text> 1.385 +typedef </xsl:text> 1.386 + <xsl:apply-templates select="child::*[position()=1]" mode="signature"/> 1.387 + <xsl:text> (JNICALL *</xsl:text> 1.388 + <xsl:value-of select="@id"/> 1.389 + <xsl:text>) 1.390 + (</xsl:text> 1.391 + <xsl:for-each select="parameters"> 1.392 + <xsl:apply-templates select="param[position()=1]" mode="signature"/> 1.393 + <xsl:for-each select="param[position()>1]"> 1.394 + <xsl:text>, </xsl:text> 1.395 + <xsl:apply-templates select="." mode="signature"/> 1.396 + </xsl:for-each> 1.397 + </xsl:for-each> 1.398 + <xsl:text>); 1.399 +</xsl:text> 1.400 +</xsl:template> 1.401 + 1.402 +<xsl:template match="capabilitiestypedef"> 1.403 + <xsl:text> 1.404 +</xsl:text> 1.405 + <xsl:apply-templates select="." mode="genstruct"/> 1.406 + <xsl:text> 1.407 +</xsl:text> 1.408 +</xsl:template> 1.409 + 1.410 +<xsl:template match="typedef" mode="early"> 1.411 + <xsl:text>struct _</xsl:text> 1.412 + <xsl:value-of select="@id"/> 1.413 + <xsl:text>; 1.414 +</xsl:text> 1.415 + <xsl:text>typedef struct _</xsl:text> 1.416 + <xsl:value-of select="@id"/> 1.417 + <xsl:text> </xsl:text> 1.418 + <xsl:value-of select="@id"/> 1.419 + <xsl:text>; 1.420 +</xsl:text> 1.421 +</xsl:template> 1.422 + 1.423 +<xsl:template match="typedef" mode="body"> 1.424 + <xsl:text>struct _</xsl:text> 1.425 + <xsl:value-of select="@id"/> 1.426 + <xsl:text> { 1.427 +</xsl:text> 1.428 +<xsl:apply-templates select="field" mode="signature"/> 1.429 + <xsl:text>}; 1.430 +</xsl:text> 1.431 +</xsl:template> 1.432 + 1.433 +<xsl:template match="uniontypedef" mode="early"> 1.434 + <xsl:text>union _</xsl:text> 1.435 + <xsl:value-of select="@id"/> 1.436 + <xsl:text>; 1.437 +</xsl:text> 1.438 + <xsl:text>typedef union _</xsl:text> 1.439 + <xsl:value-of select="@id"/> 1.440 + <xsl:text> </xsl:text> 1.441 + <xsl:value-of select="@id"/> 1.442 + <xsl:text>; 1.443 +</xsl:text> 1.444 +</xsl:template> 1.445 + 1.446 +<xsl:template match="uniontypedef" mode="body"> 1.447 + <xsl:text>union _</xsl:text> 1.448 + <xsl:value-of select="@id"/> 1.449 + <xsl:text> { 1.450 +</xsl:text> 1.451 +<xsl:apply-templates select="field" mode="signature"/> 1.452 + <xsl:text>}; 1.453 +</xsl:text> 1.454 +</xsl:template> 1.455 + 1.456 +</xsl:stylesheet>