Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/prims/jvmtiH.xsl
32285 views
<?xml version="1.0" encoding="utf-8"?>1<!--2Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.3DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.45This code is free software; you can redistribute it and/or modify it6under the terms of the GNU General Public License version 2 only, as7published by the Free Software Foundation.89This code is distributed in the hope that it will be useful, but WITHOUT10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12version 2 for more details (a copy is included in the LICENSE file that13accompanied this code).1415You should have received a copy of the GNU General Public License version162 along with this work; if not, write to the Free Software Foundation,17Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.1819Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20or visit www.oracle.com if you need additional information or have any21questions.2223-->2425<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"26version="1.0">2728<xsl:import href="jvmtiLib.xsl"/>2930<xsl:output method="text" omit-xml-declaration="yes"/>3132<xsl:template match="/">33<xsl:apply-templates select="specification"/>34</xsl:template>3536<xsl:template match="specification">3738<xsl:call-template name="intro"/>3940<xsl:text>/* Derived Base Types */41</xsl:text>42<xsl:apply-templates select="//basetype"/>4344<xsl:text>4546/* Constants */47</xsl:text>48<xsl:apply-templates select="//constants"/>4950<xsl:text>5152/* Errors */5354typedef enum {55</xsl:text>56<xsl:for-each select="//errorid">57<xsl:sort select="@num" data-type="number"/>58<xsl:apply-templates select="." mode="enum"/>59<xsl:text>,60</xsl:text>61<xsl:if test="position() = last()">62<xsl:text> JVMTI_ERROR_MAX = </xsl:text>63<xsl:value-of select="@num"/>64</xsl:if>65</xsl:for-each>66<xsl:text>67} jvmtiError;68</xsl:text>69<xsl:apply-templates select="eventsection" mode="enum"/>7071<xsl:text>72/* Pre-Declarations */73</xsl:text>74<xsl:apply-templates select="//typedef|//uniontypedef" mode="early"/>7576<xsl:text>77/* Function Types */78</xsl:text>79<xsl:apply-templates select="//callback"/>8081<xsl:text>8283/* Structure Types */84</xsl:text>85<xsl:apply-templates select="//typedef|//uniontypedef" mode="body"/>86<xsl:apply-templates select="//capabilitiestypedef"/>8788<xsl:apply-templates select="eventsection" mode="body"/>8990<xsl:apply-templates select="functionsection"/>9192<xsl:call-template name="outro"/>9394</xsl:template>9596<xsl:template name="intro">97<xsl:call-template name="includeHeader"/>98<xsl:text>99/* Include file for the Java(tm) Virtual Machine Tool Interface */100101#ifndef _JAVA_JVMTI_H_102#define _JAVA_JVMTI_H_103104#include "jni.h"105106#ifdef __cplusplus107extern "C" {108#endif109110enum {111JVMTI_VERSION_1 = 0x30010000,112JVMTI_VERSION_1_0 = 0x30010000,113JVMTI_VERSION_1_1 = 0x30010100,114JVMTI_VERSION_1_2 = 0x30010200,115116JVMTI_VERSION = 0x30000000 + (</xsl:text>117<xsl:value-of select="//specification/@majorversion"/>118<xsl:text> * 0x10000) + (</xsl:text>119<xsl:value-of select="//specification/@minorversion"/>120<xsl:text> * 0x100)</xsl:text>121<xsl:variable name="micro">122<xsl:call-template name="microversion"/>123</xsl:variable>124<xsl:choose>125<xsl:when test="string($micro)='dev'">126<xsl:text> /* checked out - </xsl:text>127</xsl:when>128<xsl:otherwise>129<xsl:text> + </xsl:text>130<xsl:value-of select="$micro"/>131<xsl:text> /* </xsl:text>132</xsl:otherwise>133</xsl:choose>134<xsl:text>version: </xsl:text>135<xsl:call-template name="showversion"/>136<xsl:text> */137};138139JNIEXPORT jint JNICALL140Agent_OnLoad(JavaVM *vm, char *options, void *reserved);141142JNIEXPORT jint JNICALL143Agent_OnAttach(JavaVM* vm, char* options, void* reserved);144145JNIEXPORT void JNICALL146Agent_OnUnload(JavaVM *vm);147148/* Forward declaration of the environment */149150struct _jvmtiEnv;151152struct jvmtiInterface_1_;153154#ifdef __cplusplus155typedef _jvmtiEnv jvmtiEnv;156#else157typedef const struct jvmtiInterface_1_ *jvmtiEnv;158#endif /* __cplusplus */159160</xsl:text>161</xsl:template>162163<xsl:template name="outro">164<xsl:text>165166#ifdef __cplusplus167} /* extern "C" */168#endif /* __cplusplus */169170#endif /* !_JAVA_JVMTI_H_ */171172</xsl:text>173</xsl:template>174175<xsl:template match="eventsection" mode="enum">176<xsl:text>177/* Event IDs */178179typedef enum {180</xsl:text>181<xsl:for-each select="event">182<xsl:sort select="@num" data-type="number"/>183<xsl:if test="position()=1">184<xsl:text> JVMTI_MIN_EVENT_TYPE_VAL = </xsl:text>185<xsl:value-of select="@num"/>186<xsl:text>,187</xsl:text>188</xsl:if>189<xsl:apply-templates select="." mode="enum"/>190<xsl:text>,191</xsl:text>192<xsl:if test="position()=last()">193<xsl:text> JVMTI_MAX_EVENT_TYPE_VAL = </xsl:text>194<xsl:value-of select="@num"/>195</xsl:if>196</xsl:for-each>197<xsl:text>198} jvmtiEvent;199200</xsl:text>201</xsl:template>202203<xsl:template match="eventsection" mode="body">204<xsl:text>205206/* Event Definitions */207208typedef void (JNICALL *jvmtiEventReserved)(void);209210</xsl:text>211<xsl:apply-templates select="event" mode="definition">212<xsl:sort select="@id"/>213</xsl:apply-templates>214215<xsl:text>216/* Event Callback Structure */217218typedef struct {219</xsl:text>220<xsl:call-template name="eventStruct">221<xsl:with-param name="events" select="event"/>222<xsl:with-param name="index" select="0"/>223<xsl:with-param name="started" select="false"/>224<xsl:with-param name="comment" select="'Yes'"/>225</xsl:call-template>226<xsl:text>} jvmtiEventCallbacks;227</xsl:text>228229</xsl:template>230231232<xsl:template match="event" mode="definition">233<xsl:text>234typedef void (JNICALL *jvmtiEvent</xsl:text>235<xsl:value-of select="@id"/>236<xsl:text>)237(jvmtiEnv *jvmti_env</xsl:text>238<xsl:apply-templates select="parameters" mode="signature">239<xsl:with-param name="comma">240<xsl:text>,241</xsl:text>242</xsl:with-param>243</xsl:apply-templates>244<xsl:text>);245</xsl:text>246</xsl:template>247248<xsl:template match="functionsection">249<xsl:text>250251/* Function Interface */252253typedef struct jvmtiInterface_1_ {254255</xsl:text>256<xsl:call-template name="funcStruct">257<xsl:with-param name="funcs" select="category/function[count(@hide)=0]"/>258<xsl:with-param name="index" select="1"/>259</xsl:call-template>260261<xsl:text>} jvmtiInterface_1;262263struct _jvmtiEnv {264const struct jvmtiInterface_1_ *functions;265#ifdef __cplusplus266267</xsl:text>268<xsl:apply-templates select="category" mode="cppinline"/>269<xsl:text>270#endif /* __cplusplus */271};272</xsl:text>273274</xsl:template>275276<xsl:template name="funcStruct">277<xsl:param name="funcs"/>278<xsl:param name="index"/>279<xsl:variable name="thisFunction" select="$funcs[@num=$index]"/>280<xsl:text> /* </xsl:text>281<xsl:number value="$index" format=" 1"/>282<xsl:text> : </xsl:text>283<xsl:choose>284<xsl:when test="count($thisFunction)=1">285<xsl:value-of select="$thisFunction/synopsis"/>286<xsl:text> */287jvmtiError (JNICALL *</xsl:text>288<xsl:value-of select="$thisFunction/@id"/>289<xsl:text>) (jvmtiEnv* env</xsl:text>290<xsl:apply-templates select="$thisFunction/parameters" mode="signature">291<xsl:with-param name="comma">292<xsl:text>,293</xsl:text>294</xsl:with-param>295</xsl:apply-templates>296<xsl:text>)</xsl:text>297</xsl:when>298<xsl:otherwise>299<xsl:text> RESERVED */300void *reserved</xsl:text>301<xsl:value-of select="$index"/>302</xsl:otherwise>303</xsl:choose>304<xsl:text>;305306</xsl:text>307<xsl:if test="count($funcs[@num > $index]) > 0">308<xsl:call-template name="funcStruct">309<xsl:with-param name="funcs" select="$funcs"/>310<xsl:with-param name="index" select="1+$index"/>311</xsl:call-template>312</xsl:if>313</xsl:template>314315316<xsl:template match="function">317<xsl:text> jvmtiError (JNICALL *</xsl:text>318<xsl:value-of select="@id"/>319<xsl:text>) (jvmtiEnv* env</xsl:text>320<xsl:apply-templates select="parameters" mode="signature"/>321<xsl:text>);322323</xsl:text>324</xsl:template>325326<xsl:template match="category" mode="cppinline">327<xsl:apply-templates select="function[count(@hide)=0]" mode="cppinline"/>328</xsl:template>329330<xsl:template match="function" mode="cppinline">331<xsl:text>332jvmtiError </xsl:text>333<xsl:value-of select="@id"/>334<xsl:text>(</xsl:text>335<xsl:apply-templates select="parameters" mode="signaturenoleadcomma"/>336<xsl:text>) {337return functions-></xsl:text>338<xsl:value-of select="@id"/>339<xsl:text>(this</xsl:text>340<xsl:for-each select="parameters">341<xsl:for-each select="param">342<xsl:if test="@id != '...' and count(jclass/@method) = 0">343<xsl:text>, </xsl:text>344<xsl:value-of select="@id"/>345</xsl:if>346</xsl:for-each>347</xsl:for-each>348<xsl:text>);349}350</xsl:text>351</xsl:template>352353354<xsl:template match="basetype">355<xsl:if test="count(definition)!=0">356<xsl:text>357</xsl:text>358<xsl:apply-templates select="definition"/>359</xsl:if>360</xsl:template>361362<xsl:template match="constants">363<xsl:text>364365/* </xsl:text>366<xsl:value-of select="@label"/>367<xsl:text> */368</xsl:text>369<xsl:choose>370<xsl:when test="@kind='enum'">371<xsl:apply-templates select="." mode="enum"/>372</xsl:when>373<xsl:otherwise>374<xsl:apply-templates select="." mode="constants"/>375</xsl:otherwise>376</xsl:choose>377</xsl:template>378379<xsl:template match="callback">380<xsl:text>381typedef </xsl:text>382<xsl:apply-templates select="child::*[position()=1]" mode="signature"/>383<xsl:text> (JNICALL *</xsl:text>384<xsl:value-of select="@id"/>385<xsl:text>)386(</xsl:text>387<xsl:for-each select="parameters">388<xsl:apply-templates select="param[position()=1]" mode="signature"/>389<xsl:for-each select="param[position()>1]">390<xsl:text>, </xsl:text>391<xsl:apply-templates select="." mode="signature"/>392</xsl:for-each>393</xsl:for-each>394<xsl:text>);395</xsl:text>396</xsl:template>397398<xsl:template match="capabilitiestypedef">399<xsl:text>400</xsl:text>401<xsl:apply-templates select="." mode="genstruct"/>402<xsl:text>403</xsl:text>404</xsl:template>405406<xsl:template match="typedef" mode="early">407<xsl:text>struct _</xsl:text>408<xsl:value-of select="@id"/>409<xsl:text>;410</xsl:text>411<xsl:text>typedef struct _</xsl:text>412<xsl:value-of select="@id"/>413<xsl:text> </xsl:text>414<xsl:value-of select="@id"/>415<xsl:text>;416</xsl:text>417</xsl:template>418419<xsl:template match="typedef" mode="body">420<xsl:text>struct _</xsl:text>421<xsl:value-of select="@id"/>422<xsl:text> {423</xsl:text>424<xsl:apply-templates select="field" mode="signature"/>425<xsl:text>};426</xsl:text>427</xsl:template>428429<xsl:template match="uniontypedef" mode="early">430<xsl:text>union _</xsl:text>431<xsl:value-of select="@id"/>432<xsl:text>;433</xsl:text>434<xsl:text>typedef union _</xsl:text>435<xsl:value-of select="@id"/>436<xsl:text> </xsl:text>437<xsl:value-of select="@id"/>438<xsl:text>;439</xsl:text>440</xsl:template>441442<xsl:template match="uniontypedef" mode="body">443<xsl:text>union _</xsl:text>444<xsl:value-of select="@id"/>445<xsl:text> {446</xsl:text>447<xsl:apply-templates select="field" mode="signature"/>448<xsl:text>};449</xsl:text>450</xsl:template>451452</xsl:stylesheet>453454455