Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/prims/jvmtiH.xsl
32285 views
1
<?xml version="1.0" encoding="utf-8"?>
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"
27
version="1.0">
28
29
<xsl:import href="jvmtiLib.xsl"/>
30
31
<xsl:output method="text" omit-xml-declaration="yes"/>
32
33
<xsl:template match="/">
34
<xsl:apply-templates select="specification"/>
35
</xsl:template>
36
37
<xsl:template match="specification">
38
39
<xsl:call-template name="intro"/>
40
41
<xsl:text>/* Derived Base Types */
42
</xsl:text>
43
<xsl:apply-templates select="//basetype"/>
44
45
<xsl:text>
46
47
/* Constants */
48
</xsl:text>
49
<xsl:apply-templates select="//constants"/>
50
51
<xsl:text>
52
53
/* Errors */
54
55
typedef enum {
56
</xsl:text>
57
<xsl:for-each select="//errorid">
58
<xsl:sort select="@num" data-type="number"/>
59
<xsl:apply-templates select="." mode="enum"/>
60
<xsl:text>,
61
</xsl:text>
62
<xsl:if test="position() = last()">
63
<xsl:text> JVMTI_ERROR_MAX = </xsl:text>
64
<xsl:value-of select="@num"/>
65
</xsl:if>
66
</xsl:for-each>
67
<xsl:text>
68
} jvmtiError;
69
</xsl:text>
70
<xsl:apply-templates select="eventsection" mode="enum"/>
71
72
<xsl:text>
73
/* Pre-Declarations */
74
</xsl:text>
75
<xsl:apply-templates select="//typedef|//uniontypedef" mode="early"/>
76
77
<xsl:text>
78
/* Function Types */
79
</xsl:text>
80
<xsl:apply-templates select="//callback"/>
81
82
<xsl:text>
83
84
/* Structure Types */
85
</xsl:text>
86
<xsl:apply-templates select="//typedef|//uniontypedef" mode="body"/>
87
<xsl:apply-templates select="//capabilitiestypedef"/>
88
89
<xsl:apply-templates select="eventsection" mode="body"/>
90
91
<xsl:apply-templates select="functionsection"/>
92
93
<xsl:call-template name="outro"/>
94
95
</xsl:template>
96
97
<xsl:template name="intro">
98
<xsl:call-template name="includeHeader"/>
99
<xsl:text>
100
/* Include file for the Java(tm) Virtual Machine Tool Interface */
101
102
#ifndef _JAVA_JVMTI_H_
103
#define _JAVA_JVMTI_H_
104
105
#include "jni.h"
106
107
#ifdef __cplusplus
108
extern "C" {
109
#endif
110
111
enum {
112
JVMTI_VERSION_1 = 0x30010000,
113
JVMTI_VERSION_1_0 = 0x30010000,
114
JVMTI_VERSION_1_1 = 0x30010100,
115
JVMTI_VERSION_1_2 = 0x30010200,
116
117
JVMTI_VERSION = 0x30000000 + (</xsl:text>
118
<xsl:value-of select="//specification/@majorversion"/>
119
<xsl:text> * 0x10000) + (</xsl:text>
120
<xsl:value-of select="//specification/@minorversion"/>
121
<xsl:text> * 0x100)</xsl:text>
122
<xsl:variable name="micro">
123
<xsl:call-template name="microversion"/>
124
</xsl:variable>
125
<xsl:choose>
126
<xsl:when test="string($micro)='dev'">
127
<xsl:text> /* checked out - </xsl:text>
128
</xsl:when>
129
<xsl:otherwise>
130
<xsl:text> + </xsl:text>
131
<xsl:value-of select="$micro"/>
132
<xsl:text> /* </xsl:text>
133
</xsl:otherwise>
134
</xsl:choose>
135
<xsl:text>version: </xsl:text>
136
<xsl:call-template name="showversion"/>
137
<xsl:text> */
138
};
139
140
JNIEXPORT jint JNICALL
141
Agent_OnLoad(JavaVM *vm, char *options, void *reserved);
142
143
JNIEXPORT jint JNICALL
144
Agent_OnAttach(JavaVM* vm, char* options, void* reserved);
145
146
JNIEXPORT void JNICALL
147
Agent_OnUnload(JavaVM *vm);
148
149
/* Forward declaration of the environment */
150
151
struct _jvmtiEnv;
152
153
struct jvmtiInterface_1_;
154
155
#ifdef __cplusplus
156
typedef _jvmtiEnv jvmtiEnv;
157
#else
158
typedef const struct jvmtiInterface_1_ *jvmtiEnv;
159
#endif /* __cplusplus */
160
161
</xsl:text>
162
</xsl:template>
163
164
<xsl:template name="outro">
165
<xsl:text>
166
167
#ifdef __cplusplus
168
} /* extern "C" */
169
#endif /* __cplusplus */
170
171
#endif /* !_JAVA_JVMTI_H_ */
172
173
</xsl:text>
174
</xsl:template>
175
176
<xsl:template match="eventsection" mode="enum">
177
<xsl:text>
178
/* Event IDs */
179
180
typedef enum {
181
</xsl:text>
182
<xsl:for-each select="event">
183
<xsl:sort select="@num" data-type="number"/>
184
<xsl:if test="position()=1">
185
<xsl:text> JVMTI_MIN_EVENT_TYPE_VAL = </xsl:text>
186
<xsl:value-of select="@num"/>
187
<xsl:text>,
188
</xsl:text>
189
</xsl:if>
190
<xsl:apply-templates select="." mode="enum"/>
191
<xsl:text>,
192
</xsl:text>
193
<xsl:if test="position()=last()">
194
<xsl:text> JVMTI_MAX_EVENT_TYPE_VAL = </xsl:text>
195
<xsl:value-of select="@num"/>
196
</xsl:if>
197
</xsl:for-each>
198
<xsl:text>
199
} jvmtiEvent;
200
201
</xsl:text>
202
</xsl:template>
203
204
<xsl:template match="eventsection" mode="body">
205
<xsl:text>
206
207
/* Event Definitions */
208
209
typedef void (JNICALL *jvmtiEventReserved)(void);
210
211
</xsl:text>
212
<xsl:apply-templates select="event" mode="definition">
213
<xsl:sort select="@id"/>
214
</xsl:apply-templates>
215
216
<xsl:text>
217
/* Event Callback Structure */
218
219
typedef struct {
220
</xsl:text>
221
<xsl:call-template name="eventStruct">
222
<xsl:with-param name="events" select="event"/>
223
<xsl:with-param name="index" select="0"/>
224
<xsl:with-param name="started" select="false"/>
225
<xsl:with-param name="comment" select="'Yes'"/>
226
</xsl:call-template>
227
<xsl:text>} jvmtiEventCallbacks;
228
</xsl:text>
229
230
</xsl:template>
231
232
233
<xsl:template match="event" mode="definition">
234
<xsl:text>
235
typedef void (JNICALL *jvmtiEvent</xsl:text>
236
<xsl:value-of select="@id"/>
237
<xsl:text>)
238
(jvmtiEnv *jvmti_env</xsl:text>
239
<xsl:apply-templates select="parameters" mode="signature">
240
<xsl:with-param name="comma">
241
<xsl:text>,
242
</xsl:text>
243
</xsl:with-param>
244
</xsl:apply-templates>
245
<xsl:text>);
246
</xsl:text>
247
</xsl:template>
248
249
<xsl:template match="functionsection">
250
<xsl:text>
251
252
/* Function Interface */
253
254
typedef struct jvmtiInterface_1_ {
255
256
</xsl:text>
257
<xsl:call-template name="funcStruct">
258
<xsl:with-param name="funcs" select="category/function[count(@hide)=0]"/>
259
<xsl:with-param name="index" select="1"/>
260
</xsl:call-template>
261
262
<xsl:text>} jvmtiInterface_1;
263
264
struct _jvmtiEnv {
265
const struct jvmtiInterface_1_ *functions;
266
#ifdef __cplusplus
267
268
</xsl:text>
269
<xsl:apply-templates select="category" mode="cppinline"/>
270
<xsl:text>
271
#endif /* __cplusplus */
272
};
273
</xsl:text>
274
275
</xsl:template>
276
277
<xsl:template name="funcStruct">
278
<xsl:param name="funcs"/>
279
<xsl:param name="index"/>
280
<xsl:variable name="thisFunction" select="$funcs[@num=$index]"/>
281
<xsl:text> /* </xsl:text>
282
<xsl:number value="$index" format=" 1"/>
283
<xsl:text> : </xsl:text>
284
<xsl:choose>
285
<xsl:when test="count($thisFunction)=1">
286
<xsl:value-of select="$thisFunction/synopsis"/>
287
<xsl:text> */
288
jvmtiError (JNICALL *</xsl:text>
289
<xsl:value-of select="$thisFunction/@id"/>
290
<xsl:text>) (jvmtiEnv* env</xsl:text>
291
<xsl:apply-templates select="$thisFunction/parameters" mode="signature">
292
<xsl:with-param name="comma">
293
<xsl:text>,
294
</xsl:text>
295
</xsl:with-param>
296
</xsl:apply-templates>
297
<xsl:text>)</xsl:text>
298
</xsl:when>
299
<xsl:otherwise>
300
<xsl:text> RESERVED */
301
void *reserved</xsl:text>
302
<xsl:value-of select="$index"/>
303
</xsl:otherwise>
304
</xsl:choose>
305
<xsl:text>;
306
307
</xsl:text>
308
<xsl:if test="count($funcs[@num &gt; $index]) &gt; 0">
309
<xsl:call-template name="funcStruct">
310
<xsl:with-param name="funcs" select="$funcs"/>
311
<xsl:with-param name="index" select="1+$index"/>
312
</xsl:call-template>
313
</xsl:if>
314
</xsl:template>
315
316
317
<xsl:template match="function">
318
<xsl:text> jvmtiError (JNICALL *</xsl:text>
319
<xsl:value-of select="@id"/>
320
<xsl:text>) (jvmtiEnv* env</xsl:text>
321
<xsl:apply-templates select="parameters" mode="signature"/>
322
<xsl:text>);
323
324
</xsl:text>
325
</xsl:template>
326
327
<xsl:template match="category" mode="cppinline">
328
<xsl:apply-templates select="function[count(@hide)=0]" mode="cppinline"/>
329
</xsl:template>
330
331
<xsl:template match="function" mode="cppinline">
332
<xsl:text>
333
jvmtiError </xsl:text>
334
<xsl:value-of select="@id"/>
335
<xsl:text>(</xsl:text>
336
<xsl:apply-templates select="parameters" mode="signaturenoleadcomma"/>
337
<xsl:text>) {
338
return functions-></xsl:text>
339
<xsl:value-of select="@id"/>
340
<xsl:text>(this</xsl:text>
341
<xsl:for-each select="parameters">
342
<xsl:for-each select="param">
343
<xsl:if test="@id != '...' and count(jclass/@method) = 0">
344
<xsl:text>, </xsl:text>
345
<xsl:value-of select="@id"/>
346
</xsl:if>
347
</xsl:for-each>
348
</xsl:for-each>
349
<xsl:text>);
350
}
351
</xsl:text>
352
</xsl:template>
353
354
355
<xsl:template match="basetype">
356
<xsl:if test="count(definition)!=0">
357
<xsl:text>
358
</xsl:text>
359
<xsl:apply-templates select="definition"/>
360
</xsl:if>
361
</xsl:template>
362
363
<xsl:template match="constants">
364
<xsl:text>
365
366
/* </xsl:text>
367
<xsl:value-of select="@label"/>
368
<xsl:text> */
369
</xsl:text>
370
<xsl:choose>
371
<xsl:when test="@kind='enum'">
372
<xsl:apply-templates select="." mode="enum"/>
373
</xsl:when>
374
<xsl:otherwise>
375
<xsl:apply-templates select="." mode="constants"/>
376
</xsl:otherwise>
377
</xsl:choose>
378
</xsl:template>
379
380
<xsl:template match="callback">
381
<xsl:text>
382
typedef </xsl:text>
383
<xsl:apply-templates select="child::*[position()=1]" mode="signature"/>
384
<xsl:text> (JNICALL *</xsl:text>
385
<xsl:value-of select="@id"/>
386
<xsl:text>)
387
(</xsl:text>
388
<xsl:for-each select="parameters">
389
<xsl:apply-templates select="param[position()=1]" mode="signature"/>
390
<xsl:for-each select="param[position()>1]">
391
<xsl:text>, </xsl:text>
392
<xsl:apply-templates select="." mode="signature"/>
393
</xsl:for-each>
394
</xsl:for-each>
395
<xsl:text>);
396
</xsl:text>
397
</xsl:template>
398
399
<xsl:template match="capabilitiestypedef">
400
<xsl:text>
401
</xsl:text>
402
<xsl:apply-templates select="." mode="genstruct"/>
403
<xsl:text>
404
</xsl:text>
405
</xsl:template>
406
407
<xsl:template match="typedef" mode="early">
408
<xsl:text>struct _</xsl:text>
409
<xsl:value-of select="@id"/>
410
<xsl:text>;
411
</xsl:text>
412
<xsl:text>typedef struct _</xsl:text>
413
<xsl:value-of select="@id"/>
414
<xsl:text> </xsl:text>
415
<xsl:value-of select="@id"/>
416
<xsl:text>;
417
</xsl:text>
418
</xsl:template>
419
420
<xsl:template match="typedef" mode="body">
421
<xsl:text>struct _</xsl:text>
422
<xsl:value-of select="@id"/>
423
<xsl:text> {
424
</xsl:text>
425
<xsl:apply-templates select="field" mode="signature"/>
426
<xsl:text>};
427
</xsl:text>
428
</xsl:template>
429
430
<xsl:template match="uniontypedef" mode="early">
431
<xsl:text>union _</xsl:text>
432
<xsl:value-of select="@id"/>
433
<xsl:text>;
434
</xsl:text>
435
<xsl:text>typedef union _</xsl:text>
436
<xsl:value-of select="@id"/>
437
<xsl:text> </xsl:text>
438
<xsl:value-of select="@id"/>
439
<xsl:text>;
440
</xsl:text>
441
</xsl:template>
442
443
<xsl:template match="uniontypedef" mode="body">
444
<xsl:text>union _</xsl:text>
445
<xsl:value-of select="@id"/>
446
<xsl:text> {
447
</xsl:text>
448
<xsl:apply-templates select="field" mode="signature"/>
449
<xsl:text>};
450
</xsl:text>
451
</xsl:template>
452
453
</xsl:stylesheet>
454
455