1 <?xml version="1.0"?>
2 <!--
3 Copyright (c) 2002, 2012, 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:param name="trace"></xsl:param>
33 <xsl:param name="interface"></xsl:param>
34
35
36 <xsl:template match="specification">
37 <xsl:call-template name="sourceHeader"/>
38 <xsl:text>
39 # include "precompiled.hpp"
40 # include "prims/jvmtiEnter.hpp"
41 # include "prims/jvmtiRawMonitor.hpp"
42 # include "prims/jvmtiUtil.hpp"
43
44 </xsl:text>
45
46 <xsl:if test="$trace = 'Trace'">
47 <xsl:text>
48 #ifdef JVMTI_TRACE
49 </xsl:text>
50 </xsl:if>
51
52 <xsl:if test="$trace != 'Trace'">
53 <xsl:text>
54
55 // Error names
56 const char* JvmtiUtil::_error_names[] = {
57 </xsl:text>
58 <xsl:call-template name="fillEntityName">
59 <xsl:with-param name="entities" select="errorsection/errorcategory/errorid"/>
230 <xsl:text>
231 extern "C" {
232
233 </xsl:text>
234 <xsl:apply-templates select="category" mode="wrapper"/>
235 <xsl:text>
236 } /* end extern "C" */
237
238 // JVMTI API functions
239 struct jvmtiInterface_1_ jvmti</xsl:text>
240 <xsl:value-of select="$trace"/>
241 <xsl:text>_Interface = {
242 </xsl:text>
243
244 <xsl:call-template name="fillFuncStruct">
245 <xsl:with-param name="funcs" select="category/function[count(@hide)=0]"/>
246 </xsl:call-template>
247
248 <xsl:text>
249 };
250 </xsl:text>
251 </xsl:template>
252
253 <xsl:template match="function" mode="functionid">
254 <xsl:text>jvmti</xsl:text>
255 <xsl:value-of select="$trace"/>
256 <xsl:text>_</xsl:text>
257 <xsl:value-of select="@id"/>
258 </xsl:template>
259
260 <xsl:template name="fillFuncStructDoit">
261 <xsl:param name="func"/>
262 <xsl:param name="index"/>
263 <xsl:text> /* </xsl:text>
264 <xsl:number value="$index" format=" 1"/>
265 <xsl:text> : </xsl:text>
266 <xsl:choose>
267 <xsl:when test="count($func)=1">
268 <xsl:value-of select="$func/synopsis"/>
269 <xsl:text> */
452 }
453 </xsl:text>
454 </xsl:if>
455 <xsl:text> return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
456 }
457 </xsl:text>
458 </xsl:template>
459
460
461 <xsl:template match="function">
462 <xsl:text>
463 static jvmtiError JNICALL
464 </xsl:text>
465 <xsl:apply-templates select="." mode="functionid"/>
466 <xsl:text>(jvmtiEnv* env</xsl:text>
467 <xsl:apply-templates select="parameters" mode="signature"/>
468 <xsl:text>) {
469 </xsl:text>
470
471 <xsl:if test="not(contains(@jkernel,'yes'))">
472 <xsl:text>
#ifdef JVMTI_KERNEL 
</xsl:text>
473 <xsl:text> return JVMTI_ERROR_NOT_AVAILABLE; 
</xsl:text>
474 <xsl:text>#else 
</xsl:text>
475 </xsl:if>
476
477 <xsl:apply-templates select="." mode="traceSetUp"/>
478 <xsl:choose>
479 <xsl:when test="count(@phase)=0 or contains(@phase,'live')">
480 <xsl:text> if(!JvmtiEnv::is_vm_live()) {
481 </xsl:text>
482 <xsl:if test="$trace='Trace'">
483 <xsl:text> if (trace_flags) {
484 tty->print_cr("JVMTI [-] %s %s", func_name,
485 JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
486 }
487 </xsl:text>
488 </xsl:if>
489 <xsl:text> return JVMTI_ERROR_WRONG_PHASE;
490 }</xsl:text>
491
492 <xsl:text>
579 </xsl:with-param>
580 </xsl:apply-templates>
581 <xsl:text>
582 </xsl:text>
583 <xsl:apply-templates select="." mode="doCall"/>
584 <xsl:text> } else {
585 </xsl:text>
586 <!-- we are pre-thread - no thread transition code -->
587 <xsl:apply-templates select="." mode="doCall"/>
588 <xsl:text> }
589 </xsl:text>
590 </xsl:when>
591 <xsl:otherwise>
592 <xsl:apply-templates select="." mode="doCall"/>
593 </xsl:otherwise>
594 </xsl:choose>
595 <xsl:text> return err;
596 </xsl:text>
597
598 <xsl:if test="not(contains(@jkernel,'yes'))">
599 <xsl:text>#endif // JVMTI_KERNEL
</xsl:text>
600 </xsl:if>
601
602 <xsl:text>}
</xsl:text>
603 </xsl:template>
604
605 <xsl:template match="function" mode="doCall">
606 <xsl:apply-templates select="parameters" mode="dochecks"/>
607 <xsl:apply-templates select="." mode="traceBefore"/>
608 <xsl:apply-templates select="." mode="genCall"/>
609 <xsl:apply-templates select="." mode="traceAfter"/>
610 </xsl:template>
611
612 <xsl:template match="function" mode="genCall">
613 <xsl:text> err = jvmti_env-></xsl:text>
614 <xsl:value-of select="@id"/>
615 <xsl:text>(</xsl:text>
616 <xsl:apply-templates select="parameters" mode="HotSpotValue"/>
617 <xsl:text>);
618 </xsl:text>
619 </xsl:template>
|
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:param name="trace"></xsl:param>
33 <xsl:param name="interface"></xsl:param>
34
35
36 <xsl:template match="specification">
37 <xsl:call-template name="sourceHeader"/>
38 <xsl:text>
39 # include "precompiled.hpp"
40 # include "utilities/macros.hpp"
41 #if INCLUDE_JVMTI
42 # include "prims/jvmtiEnter.hpp"
43 # include "prims/jvmtiRawMonitor.hpp"
44 # include "prims/jvmtiUtil.hpp"
45
46 </xsl:text>
47
48 <xsl:if test="$trace = 'Trace'">
49 <xsl:text>
50 #ifdef JVMTI_TRACE
51 </xsl:text>
52 </xsl:if>
53
54 <xsl:if test="$trace != 'Trace'">
55 <xsl:text>
56
57 // Error names
58 const char* JvmtiUtil::_error_names[] = {
59 </xsl:text>
60 <xsl:call-template name="fillEntityName">
61 <xsl:with-param name="entities" select="errorsection/errorcategory/errorid"/>
232 <xsl:text>
233 extern "C" {
234
235 </xsl:text>
236 <xsl:apply-templates select="category" mode="wrapper"/>
237 <xsl:text>
238 } /* end extern "C" */
239
240 // JVMTI API functions
241 struct jvmtiInterface_1_ jvmti</xsl:text>
242 <xsl:value-of select="$trace"/>
243 <xsl:text>_Interface = {
244 </xsl:text>
245
246 <xsl:call-template name="fillFuncStruct">
247 <xsl:with-param name="funcs" select="category/function[count(@hide)=0]"/>
248 </xsl:call-template>
249
250 <xsl:text>
251 };
252 #endif // INCLUDE_JVMTI
253 </xsl:text>
254 </xsl:template>
255
256 <xsl:template match="function" mode="functionid">
257 <xsl:text>jvmti</xsl:text>
258 <xsl:value-of select="$trace"/>
259 <xsl:text>_</xsl:text>
260 <xsl:value-of select="@id"/>
261 </xsl:template>
262
263 <xsl:template name="fillFuncStructDoit">
264 <xsl:param name="func"/>
265 <xsl:param name="index"/>
266 <xsl:text> /* </xsl:text>
267 <xsl:number value="$index" format=" 1"/>
268 <xsl:text> : </xsl:text>
269 <xsl:choose>
270 <xsl:when test="count($func)=1">
271 <xsl:value-of select="$func/synopsis"/>
272 <xsl:text> */
455 }
456 </xsl:text>
457 </xsl:if>
458 <xsl:text> return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
459 }
460 </xsl:text>
461 </xsl:template>
462
463
464 <xsl:template match="function">
465 <xsl:text>
466 static jvmtiError JNICALL
467 </xsl:text>
468 <xsl:apply-templates select="." mode="functionid"/>
469 <xsl:text>(jvmtiEnv* env</xsl:text>
470 <xsl:apply-templates select="parameters" mode="signature"/>
471 <xsl:text>) {
472 </xsl:text>
473
474 <xsl:if test="not(contains(@jkernel,'yes'))">
475 <xsl:text>
#if !INCLUDE_JVMTI 
</xsl:text>
476 <xsl:text> return JVMTI_ERROR_NOT_AVAILABLE; 
</xsl:text>
477 <xsl:text>#else 
</xsl:text>
478 </xsl:if>
479
480 <xsl:apply-templates select="." mode="traceSetUp"/>
481 <xsl:choose>
482 <xsl:when test="count(@phase)=0 or contains(@phase,'live')">
483 <xsl:text> if(!JvmtiEnv::is_vm_live()) {
484 </xsl:text>
485 <xsl:if test="$trace='Trace'">
486 <xsl:text> if (trace_flags) {
487 tty->print_cr("JVMTI [-] %s %s", func_name,
488 JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
489 }
490 </xsl:text>
491 </xsl:if>
492 <xsl:text> return JVMTI_ERROR_WRONG_PHASE;
493 }</xsl:text>
494
495 <xsl:text>
582 </xsl:with-param>
583 </xsl:apply-templates>
584 <xsl:text>
585 </xsl:text>
586 <xsl:apply-templates select="." mode="doCall"/>
587 <xsl:text> } else {
588 </xsl:text>
589 <!-- we are pre-thread - no thread transition code -->
590 <xsl:apply-templates select="." mode="doCall"/>
591 <xsl:text> }
592 </xsl:text>
593 </xsl:when>
594 <xsl:otherwise>
595 <xsl:apply-templates select="." mode="doCall"/>
596 </xsl:otherwise>
597 </xsl:choose>
598 <xsl:text> return err;
599 </xsl:text>
600
601 <xsl:if test="not(contains(@jkernel,'yes'))">
602 <xsl:text>#endif // INCLUDE_JVMTI
</xsl:text>
603 </xsl:if>
604
605 <xsl:text>}
</xsl:text>
606 </xsl:template>
607
608 <xsl:template match="function" mode="doCall">
609 <xsl:apply-templates select="parameters" mode="dochecks"/>
610 <xsl:apply-templates select="." mode="traceBefore"/>
611 <xsl:apply-templates select="." mode="genCall"/>
612 <xsl:apply-templates select="." mode="traceAfter"/>
613 </xsl:template>
614
615 <xsl:template match="function" mode="genCall">
616 <xsl:text> err = jvmti_env-></xsl:text>
617 <xsl:value-of select="@id"/>
618 <xsl:text>(</xsl:text>
619 <xsl:apply-templates select="parameters" mode="HotSpotValue"/>
620 <xsl:text>);
621 </xsl:text>
622 </xsl:template>
|