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 "oops/oop.inline.hpp"
43 # include "prims/jvmtiEnter.hpp"
44 # include "prims/jvmtiRawMonitor.hpp"
45 # include "prims/jvmtiUtil.hpp"
46
47 // There are known-bad format/arg pairings in the code generated by this file.
48 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
49
50 </xsl:text>
51
52 <xsl:if test="$trace = 'Trace'">
53 <xsl:text>
54 #ifdef JVMTI_TRACE
55 </xsl:text>
56 </xsl:if>
57
58 <xsl:if test="$trace != 'Trace'">
59 <xsl:text>
60
61 // Error names
62 const char* JvmtiUtil::_error_names[] = {
63 </xsl:text>
64 <xsl:call-template name="fillEntityName">
65 <xsl:with-param name="entities" select="errorsection/errorcategory/errorid"/>
66 </xsl:call-template>
67 <xsl:text>
68 };
69
526 <xsl:text> if (trace_flags) {
527 tty->print_cr("JVMTI [-] %s %s", func_name,
528 JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
529 }
530 </xsl:text>
531 </xsl:if>
532 <xsl:text> return JVMTI_ERROR_WRONG_PHASE;
533 }
534 Thread* this_thread = (Thread*)ThreadLocalStorage::thread(); </xsl:text>
535 <xsl:apply-templates select="." mode="transition"/>
536 </xsl:if>
537 </xsl:otherwise>
538 </xsl:choose>
539
540 <xsl:text>
541 JvmtiEnv* jvmti_env = JvmtiEnv::JvmtiEnv_from_jvmti_env(env);
542 if (!jvmti_env->is_valid()) {
543 </xsl:text>
544 <xsl:if test="$trace='Trace'">
545 <xsl:text> if (trace_flags) {
546 tty->print_cr("JVMTI [%s] %s %s env=%d", curr_thread_name, func_name,
547 JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), env);
548 }
549 </xsl:text>
550 </xsl:if>
551 <xsl:text> return JVMTI_ERROR_INVALID_ENVIRONMENT;
552 }
553 </xsl:text>
554
555 <xsl:apply-templates select="capabilities/required"/>
556
557 <xsl:text> jvmtiError err;
558 </xsl:text>
559 <xsl:choose>
560 <xsl:when test="count(@phase)=1 and not(contains(@phase,'live')) and not(contains(@phase,'start'))">
561 <xsl:choose>
562 <xsl:when test="count(@callbacksafe)=0 or not(contains(@callbacksafe,'safe'))">
563 <xsl:text> if (Threads::number_of_threads() != 0) {
564 Thread* this_thread = (Thread*)ThreadLocalStorage::thread();</xsl:text>
565 </xsl:when>
566 <xsl:otherwise>
567
743 </xsl:if>
744 </xsl:template>
745
746 <xsl:template match="jrawMonitorID" mode="dochecks">
747 <xsl:param name="name"/>
748 <xsl:text> JvmtiRawMonitor *rmonitor = (JvmtiRawMonitor *)</xsl:text>
749 <xsl:value-of select="$name"/>
750 <xsl:text>;
751 if (rmonitor == NULL) {
752 </xsl:text>
753 <xsl:apply-templates select=".." mode="traceError">
754 <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
755 <xsl:with-param name="comment"> - raw monitor is NULL</xsl:with-param>
756 </xsl:apply-templates>
757 <xsl:text>
758 }
759 if (!rmonitor->is_valid()) {
760 </xsl:text>
761 <xsl:apply-templates select=".." mode="traceError">
762 <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
763 <xsl:with-param name="comment"> - not a raw monitor 0x%x</xsl:with-param>
764 <xsl:with-param name="extraValue">, rmonitor</xsl:with-param>
765 </xsl:apply-templates>
766 <xsl:text>
767 }
768 </xsl:text>
769 </xsl:template>
770
771 <xsl:template match="jthread" mode="dochecksbody">
772 <xsl:param name="name"/>
773 <xsl:text> oop thread_oop = JNIHandles::resolve_external_guard(</xsl:text>
774 <xsl:value-of select="$name"/>
775 <xsl:text>);
776 if (thread_oop == NULL) {
777 </xsl:text>
778 <xsl:apply-templates select=".." mode="traceError">
779 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param>
780 <xsl:with-param name="comment"> - jthread resolved to NULL - jthread = 0x%x</xsl:with-param>
781 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
782 </xsl:apply-templates>
783 <xsl:text>
784 }
785 if (!thread_oop->is_a(SystemDictionary::Thread_klass())) {
786 </xsl:text>
787 <xsl:apply-templates select=".." mode="traceError">
788 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param>
789 <xsl:with-param name="comment"> - oop is not a thread - jthread = 0x%x</xsl:with-param>
790 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
791 </xsl:apply-templates>
792 <xsl:text>
793 }
794 java_thread = java_lang_Thread::thread(thread_oop);
795 if (java_thread == NULL) {
796 </xsl:text>
797 <xsl:apply-templates select=".." mode="traceError">
798 <xsl:with-param name="err">
799 <xsl:text>JVMTI_ERROR_THREAD_NOT_ALIVE</xsl:text>
800 </xsl:with-param>
801 <xsl:with-param name="comment"> - not a Java thread - jthread = 0x%x</xsl:with-param>
802 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
803 </xsl:apply-templates>
804 <xsl:text>
805 }
806 </xsl:text>
807 </xsl:template>
808
809 <xsl:template match="jthread" mode="dochecks">
810 <xsl:param name="name"/>
811 <!-- If we convert and test threads -->
812 <xsl:if test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
813 <xsl:text> JavaThread* java_thread;
814 </xsl:text>
815 <xsl:choose>
816 <xsl:when test="count(@null)=0">
817 <xsl:apply-templates select="." mode="dochecksbody">
818 <xsl:with-param name="name" select="$name"/>
819 </xsl:apply-templates>
820 </xsl:when>
821 <xsl:otherwise>
822 <xsl:text> if (</xsl:text>
825 java_thread = current_thread;
826 } else {
827 </xsl:text>
828 <xsl:apply-templates select="." mode="dochecksbody">
829 <xsl:with-param name="name" select="$name"/>
830 </xsl:apply-templates>
831 <xsl:text> }
832 </xsl:text>
833 </xsl:otherwise>
834 </xsl:choose>
835 </xsl:if>
836 </xsl:template>
837
838 <xsl:template match="jframeID" mode="dochecks">
839 <xsl:param name="name"/>
840 <xsl:text>
841 if (depth < 0) {
842 </xsl:text>
843 <xsl:apply-templates select=".." mode="traceError">
844 <xsl:with-param name="err">JVMTI_ERROR_ILLEGAL_ARGUMENT</xsl:with-param>
845 <xsl:with-param name="comment"> - negative depth - jthread = 0x%x</xsl:with-param>
846 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
847 </xsl:apply-templates>
848 <xsl:text>
849 }
850 </xsl:text>
851 </xsl:template>
852
853 <xsl:template match="jclass" mode="dochecks">
854 <xsl:param name="name"/>
855 <!-- for JVMTI a jclass/jmethodID becomes just jmethodID -->
856 <xsl:if test="count(@method)=0">
857 <xsl:text> oop k_mirror = JNIHandles::resolve_external_guard(</xsl:text>
858 <xsl:value-of select="$name"/>
859 <xsl:text>);
860 if (k_mirror == NULL) {
861 </xsl:text>
862 <xsl:apply-templates select=".." mode="traceError">
863 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
864 <xsl:with-param name="comment"> - resolved to NULL - jclass = 0x%x</xsl:with-param>
865 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
866 </xsl:apply-templates>
867 <xsl:text>
868 }
869 if (!k_mirror->is_a(SystemDictionary::Class_klass())) {
870 </xsl:text>
871 <xsl:apply-templates select=".." mode="traceError">
872 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
873 <xsl:with-param name="comment"> - not a class - jclass = 0x%x</xsl:with-param>
874 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
875 </xsl:apply-templates>
876 <xsl:text>
877 }
878 </xsl:text>
879 <xsl:if test="count(@method|@field)=1">
880 <xsl:text>
881 if (java_lang_Class::is_primitive(k_mirror)) {
882 </xsl:text>
883 <xsl:apply-templates select=".." mode="traceError">
884 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
885 <xsl:with-param name="comment"> - is a primitive class - jclass = 0x%x</xsl:with-param>
886 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
887 </xsl:apply-templates>
888 <xsl:text>
889 }
890 Klass* k_oop = java_lang_Class::as_Klass(k_mirror);
891 if (k_oop == NULL) {
892 </xsl:text>
893 <xsl:apply-templates select=".." mode="traceError">
894 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
895 <xsl:with-param name="comment"> - no Klass* - jclass = 0x%x</xsl:with-param>
896 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
897 </xsl:apply-templates>
898 <xsl:text>
899 }
900 </xsl:text>
901 </xsl:if>
902 </xsl:if>
903 </xsl:template>
904
905
906 <xsl:template match="jmethodID" mode="dochecks">
907 <xsl:param name="name"/>
908 <xsl:text> Method* method_oop = Method::checked_resolve_jmethod_id(</xsl:text>
909 <xsl:value-of select="$name"/>
910 <xsl:text>);
</xsl:text>
911 <xsl:text> if (method_oop == NULL) {
</xsl:text>
912 <xsl:apply-templates select=".." mode="traceError">
913 <xsl:with-param name="err">JVMTI_ERROR_INVALID_METHODID</xsl:with-param>
914 <xsl:with-param name="comment"></xsl:with-param>
915 <xsl:with-param name="extraValue"></xsl:with-param>
916 </xsl:apply-templates>
1017 </xsl:apply-templates>
1018 </xsl:template>
1019
1020 <xsl:template match="param" mode="traceInValue">
1021 <xsl:apply-templates select="child::*[position()=1]" mode="traceInValue">
1022 <xsl:with-param name="name" select="@id"/>
1023 </xsl:apply-templates>
1024 </xsl:template>
1025
1026 <xsl:template match="outptr|outbuf|allocfieldbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="traceInFormat">
1027 </xsl:template>
1028
1029 <xsl:template match="outptr|outbuf|allocfieldbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="traceInValue">
1030 </xsl:template>
1031
1032 <xsl:template match="inbuf" mode="traceInFormat">
1033 <xsl:param name="name"/>
1034 <xsl:text> </xsl:text>
1035 <xsl:value-of select="$name"/>
1036 <xsl:variable name="child" select="child::*[position()=1]"/>
1037 <xsl:choose>
1038 <xsl:when test="name($child)='char'">
1039 <xsl:text>='%s'</xsl:text>
1040 </xsl:when>
1041 <xsl:otherwise>
1042 <xsl:text>=0x%x</xsl:text>
1043 </xsl:otherwise>
1044 </xsl:choose>
1045 </xsl:template>
1046
1047 <xsl:template match="inbuf" mode="traceInValue">
1048 <xsl:param name="name"/>
1049 <xsl:text>, </xsl:text>
1050 <xsl:value-of select="$name"/>
1051 </xsl:template>
1052
1053 <xsl:template match="ptrtype" mode="traceInFormat">
1054 <xsl:param name="name"/>
1055 <xsl:variable name="child" select="child::*[position()=1]"/>
1056 <xsl:choose>
1057 <xsl:when test="name($child)='jclass'">
1058 <xsl:text> </xsl:text>
1059 <xsl:value-of select="$name"/>
1060 <xsl:text>=0x%x</xsl:text>
1061 </xsl:when>
1062 <xsl:otherwise>
1063 <xsl:apply-templates select="$child" mode="traceInFormat"/>
1064 </xsl:otherwise>
1065 </xsl:choose>
1066 </xsl:template>
1067
1068 <xsl:template match="ptrtype" mode="traceInValue">
1069 <xsl:param name="name"/>
1070 <xsl:variable name="child" select="child::*[position()=1]"/>
1071 <xsl:choose>
1072 <xsl:when test="name($child)='jclass'">
1073 <xsl:text>, </xsl:text>
1074 <xsl:value-of select="$name"/>
1075 </xsl:when>
1076 <xsl:otherwise>
1077 <xsl:apply-templates select="$child" mode="traceInValue"/>
1078 </xsl:otherwise>
1079 </xsl:choose>
1080 </xsl:template>
1081
1082 <xsl:template match="inptr" mode="traceInFormat">
1083 <xsl:param name="name"/>
1084 <xsl:text> </xsl:text>
1085 <xsl:value-of select="$name"/>
1086 <xsl:text>=0x%x</xsl:text>
1087 </xsl:template>
1088
1089 <xsl:template match="inptr" mode="traceInValue">
1090 <xsl:param name="name"/>
1091 <xsl:text>, </xsl:text>
1092 <xsl:value-of select="$name"/>
1093 </xsl:template>
1094
1095 <xsl:template match="jrawMonitorID|jfieldID" mode="traceInFormat">
1096 <xsl:param name="name"/>
1097 <xsl:text> </xsl:text>
1098 <xsl:value-of select="$name"/>
1099 <xsl:text>=%s</xsl:text>
1100 </xsl:template>
1101
1102 <xsl:template match="jclass" mode="traceInFormat">
1103 <xsl:param name="name"/>
1104 <!-- for JVMTI a jclass/jmethodID becomes just jmethodID -->
1105 <xsl:if test="count(@method)=0">
1106 <xsl:text> </xsl:text>
1107 <xsl:value-of select="$name"/>
1108 <xsl:text>=%s</xsl:text>
1109 </xsl:if>
1110 </xsl:template>
1111
1112 <xsl:template match="jrawMonitorID" mode="traceInValue">
1197 <xsl:when test=".='jvmtiEvent'">
1198 <xsl:text>JvmtiTrace::event_name(</xsl:text>
1199 <xsl:value-of select="$name"/>
1200 <xsl:text>)
1201 </xsl:text>
1202 </xsl:when>
1203 <xsl:otherwise>
1204 <xsl:text>JvmtiTrace::enum_name(</xsl:text>
1205 <xsl:value-of select="."/>
1206 <xsl:text>ConstantNames, </xsl:text>
1207 <xsl:value-of select="."/>
1208 <xsl:text>ConstantValues, </xsl:text>
1209 <xsl:value-of select="$name"/>
1210 <xsl:text>)</xsl:text>
1211 </xsl:otherwise>
1212 </xsl:choose>
1213 </xsl:otherwise>
1214 </xsl:choose>
1215 </xsl:template>
1216
1217 <xsl:template match="jint|jlocation" mode="traceInFormat">
1218 <xsl:param name="name"/>
1219 <xsl:text> </xsl:text>
1220 <xsl:value-of select="$name"/>
1221 <xsl:text>=%d</xsl:text>
1222 </xsl:template>
1223
1224 <xsl:template match="jlong" mode="traceInFormat">
1225 <xsl:param name="name"/>
1226 <xsl:text> </xsl:text>
1227 <xsl:value-of select="$name"/>
1228 <xsl:text>=%ld</xsl:text>
1229 </xsl:template>
1230
1231 <xsl:template match="size_t" mode="traceInFormat">
1232 <xsl:param name="name"/>
1233 <xsl:text> </xsl:text>
1234 <xsl:value-of select="$name"/>
1235 <xsl:text>=0x%zx</xsl:text>
1236 </xsl:template>
1237
1238 <xsl:template match="jfloat|jdouble" mode="traceInFormat">
1239 <xsl:param name="name"/>
1240 <xsl:text> </xsl:text>
1241 <xsl:value-of select="$name"/>
1242 <xsl:text>=%f</xsl:text>
1243 </xsl:template>
1244
1245 <xsl:template match="char" mode="traceInFormat">
1246 <xsl:param name="name"/>
1247 <xsl:text> </xsl:text>
1248 <xsl:value-of select="$name"/>
|
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 "oops/oop.inline.hpp"
43 # include "prims/jvmtiEnter.hpp"
44 # include "prims/jvmtiRawMonitor.hpp"
45 # include "prims/jvmtiUtil.hpp"
46
47 </xsl:text>
48
49 <xsl:if test="$trace = 'Trace'">
50 <xsl:text>
51 #ifdef JVMTI_TRACE
52 </xsl:text>
53 </xsl:if>
54
55 <xsl:if test="$trace != 'Trace'">
56 <xsl:text>
57
58 // Error names
59 const char* JvmtiUtil::_error_names[] = {
60 </xsl:text>
61 <xsl:call-template name="fillEntityName">
62 <xsl:with-param name="entities" select="errorsection/errorcategory/errorid"/>
63 </xsl:call-template>
64 <xsl:text>
65 };
66
523 <xsl:text> if (trace_flags) {
524 tty->print_cr("JVMTI [-] %s %s", func_name,
525 JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
526 }
527 </xsl:text>
528 </xsl:if>
529 <xsl:text> return JVMTI_ERROR_WRONG_PHASE;
530 }
531 Thread* this_thread = (Thread*)ThreadLocalStorage::thread(); </xsl:text>
532 <xsl:apply-templates select="." mode="transition"/>
533 </xsl:if>
534 </xsl:otherwise>
535 </xsl:choose>
536
537 <xsl:text>
538 JvmtiEnv* jvmti_env = JvmtiEnv::JvmtiEnv_from_jvmti_env(env);
539 if (!jvmti_env->is_valid()) {
540 </xsl:text>
541 <xsl:if test="$trace='Trace'">
542 <xsl:text> if (trace_flags) {
543 tty->print_cr("JVMTI [%s] %s %s env=" PTR_FORMAT, curr_thread_name, func_name,
544 JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), p2i(env));
545 }
546 </xsl:text>
547 </xsl:if>
548 <xsl:text> return JVMTI_ERROR_INVALID_ENVIRONMENT;
549 }
550 </xsl:text>
551
552 <xsl:apply-templates select="capabilities/required"/>
553
554 <xsl:text> jvmtiError err;
555 </xsl:text>
556 <xsl:choose>
557 <xsl:when test="count(@phase)=1 and not(contains(@phase,'live')) and not(contains(@phase,'start'))">
558 <xsl:choose>
559 <xsl:when test="count(@callbacksafe)=0 or not(contains(@callbacksafe,'safe'))">
560 <xsl:text> if (Threads::number_of_threads() != 0) {
561 Thread* this_thread = (Thread*)ThreadLocalStorage::thread();</xsl:text>
562 </xsl:when>
563 <xsl:otherwise>
564
740 </xsl:if>
741 </xsl:template>
742
743 <xsl:template match="jrawMonitorID" mode="dochecks">
744 <xsl:param name="name"/>
745 <xsl:text> JvmtiRawMonitor *rmonitor = (JvmtiRawMonitor *)</xsl:text>
746 <xsl:value-of select="$name"/>
747 <xsl:text>;
748 if (rmonitor == NULL) {
749 </xsl:text>
750 <xsl:apply-templates select=".." mode="traceError">
751 <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
752 <xsl:with-param name="comment"> - raw monitor is NULL</xsl:with-param>
753 </xsl:apply-templates>
754 <xsl:text>
755 }
756 if (!rmonitor->is_valid()) {
757 </xsl:text>
758 <xsl:apply-templates select=".." mode="traceError">
759 <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
760 <xsl:with-param name="comment"> - not a raw monitor " PTR_FORMAT "</xsl:with-param>
761 <xsl:with-param name="extraValue">, p2i(rmonitor)</xsl:with-param>
762 </xsl:apply-templates>
763 <xsl:text>
764 }
765 </xsl:text>
766 </xsl:template>
767
768 <xsl:template match="jthread" mode="dochecksbody">
769 <xsl:param name="name"/>
770 <xsl:text> oop thread_oop = JNIHandles::resolve_external_guard(</xsl:text>
771 <xsl:value-of select="$name"/>
772 <xsl:text>);
773 if (thread_oop == NULL) {
774 </xsl:text>
775 <xsl:apply-templates select=".." mode="traceError">
776 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param>
777 <xsl:with-param name="comment"> - jthread resolved to NULL - jthread = " PTR_FORMAT "</xsl:with-param>
778 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
779 </xsl:apply-templates>
780 <xsl:text>
781 }
782 if (!thread_oop->is_a(SystemDictionary::Thread_klass())) {
783 </xsl:text>
784 <xsl:apply-templates select=".." mode="traceError">
785 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param>
786 <xsl:with-param name="comment"> - oop is not a thread - jthread = " PTR_FORMAT "</xsl:with-param>
787 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
788 </xsl:apply-templates>
789 <xsl:text>
790 }
791 java_thread = java_lang_Thread::thread(thread_oop);
792 if (java_thread == NULL) {
793 </xsl:text>
794 <xsl:apply-templates select=".." mode="traceError">
795 <xsl:with-param name="err">
796 <xsl:text>JVMTI_ERROR_THREAD_NOT_ALIVE</xsl:text>
797 </xsl:with-param>
798 <xsl:with-param name="comment"> - not a Java thread - jthread = " PTR_FORMAT "</xsl:with-param>
799 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
800 </xsl:apply-templates>
801 <xsl:text>
802 }
803 </xsl:text>
804 </xsl:template>
805
806 <xsl:template match="jthread" mode="dochecks">
807 <xsl:param name="name"/>
808 <!-- If we convert and test threads -->
809 <xsl:if test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
810 <xsl:text> JavaThread* java_thread;
811 </xsl:text>
812 <xsl:choose>
813 <xsl:when test="count(@null)=0">
814 <xsl:apply-templates select="." mode="dochecksbody">
815 <xsl:with-param name="name" select="$name"/>
816 </xsl:apply-templates>
817 </xsl:when>
818 <xsl:otherwise>
819 <xsl:text> if (</xsl:text>
822 java_thread = current_thread;
823 } else {
824 </xsl:text>
825 <xsl:apply-templates select="." mode="dochecksbody">
826 <xsl:with-param name="name" select="$name"/>
827 </xsl:apply-templates>
828 <xsl:text> }
829 </xsl:text>
830 </xsl:otherwise>
831 </xsl:choose>
832 </xsl:if>
833 </xsl:template>
834
835 <xsl:template match="jframeID" mode="dochecks">
836 <xsl:param name="name"/>
837 <xsl:text>
838 if (depth < 0) {
839 </xsl:text>
840 <xsl:apply-templates select=".." mode="traceError">
841 <xsl:with-param name="err">JVMTI_ERROR_ILLEGAL_ARGUMENT</xsl:with-param>
842 <xsl:with-param name="comment"> - negative depth - jthread = " INT32_FORMAT "</xsl:with-param>
843 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param>
844 </xsl:apply-templates>
845 <xsl:text>
846 }
847 </xsl:text>
848 </xsl:template>
849
850 <xsl:template match="jclass" mode="dochecks">
851 <xsl:param name="name"/>
852 <!-- for JVMTI a jclass/jmethodID becomes just jmethodID -->
853 <xsl:if test="count(@method)=0">
854 <xsl:text> oop k_mirror = JNIHandles::resolve_external_guard(</xsl:text>
855 <xsl:value-of select="$name"/>
856 <xsl:text>);
857 if (k_mirror == NULL) {
858 </xsl:text>
859 <xsl:apply-templates select=".." mode="traceError">
860 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
861 <xsl:with-param name="comment"> - resolved to NULL - jclass = " PTR_FORMAT "</xsl:with-param>
862 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
863 </xsl:apply-templates>
864 <xsl:text>
865 }
866 if (!k_mirror->is_a(SystemDictionary::Class_klass())) {
867 </xsl:text>
868 <xsl:apply-templates select=".." mode="traceError">
869 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
870 <xsl:with-param name="comment"> - not a class - jclass = " PTR_FORMAT "</xsl:with-param>
871 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
872 </xsl:apply-templates>
873 <xsl:text>
874 }
875 </xsl:text>
876 <xsl:if test="count(@method|@field)=1">
877 <xsl:text>
878 if (java_lang_Class::is_primitive(k_mirror)) {
879 </xsl:text>
880 <xsl:apply-templates select=".." mode="traceError">
881 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
882 <xsl:with-param name="comment"> - is a primitive class - jclass = " PTR_FORMAT "</xsl:with-param>
883 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
884 </xsl:apply-templates>
885 <xsl:text>
886 }
887 Klass* k_oop = java_lang_Class::as_Klass(k_mirror);
888 if (k_oop == NULL) {
889 </xsl:text>
890 <xsl:apply-templates select=".." mode="traceError">
891 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
892 <xsl:with-param name="comment"> - no Klass* - jclass = " PTR_FORMAT "</xsl:with-param>
893 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
894 </xsl:apply-templates>
895 <xsl:text>
896 }
897 </xsl:text>
898 </xsl:if>
899 </xsl:if>
900 </xsl:template>
901
902
903 <xsl:template match="jmethodID" mode="dochecks">
904 <xsl:param name="name"/>
905 <xsl:text> Method* method_oop = Method::checked_resolve_jmethod_id(</xsl:text>
906 <xsl:value-of select="$name"/>
907 <xsl:text>);
</xsl:text>
908 <xsl:text> if (method_oop == NULL) {
</xsl:text>
909 <xsl:apply-templates select=".." mode="traceError">
910 <xsl:with-param name="err">JVMTI_ERROR_INVALID_METHODID</xsl:with-param>
911 <xsl:with-param name="comment"></xsl:with-param>
912 <xsl:with-param name="extraValue"></xsl:with-param>
913 </xsl:apply-templates>
1014 </xsl:apply-templates>
1015 </xsl:template>
1016
1017 <xsl:template match="param" mode="traceInValue">
1018 <xsl:apply-templates select="child::*[position()=1]" mode="traceInValue">
1019 <xsl:with-param name="name" select="@id"/>
1020 </xsl:apply-templates>
1021 </xsl:template>
1022
1023 <xsl:template match="outptr|outbuf|allocfieldbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="traceInFormat">
1024 </xsl:template>
1025
1026 <xsl:template match="outptr|outbuf|allocfieldbuf|vmbuf|allocbuf|agentbuf|allocallocbuf" mode="traceInValue">
1027 </xsl:template>
1028
1029 <xsl:template match="inbuf" mode="traceInFormat">
1030 <xsl:param name="name"/>
1031 <xsl:text> </xsl:text>
1032 <xsl:value-of select="$name"/>
1033 <xsl:variable name="child" select="child::*[position()=1]"/>
1034 <xsl:choose>g
1035 <xsl:when test="name($child)='char'">
1036 <xsl:text>='%s'</xsl:text>
1037 </xsl:when>
1038 <xsl:otherwise>
1039 <xsl:text>=" PTR_FORMAT "</xsl:text>
1040 </xsl:otherwise>
1041 </xsl:choose>
1042 </xsl:template>
1043
1044 <xsl:template match="inbuf" mode="traceInValue">
1045 <xsl:param name="name"/>
1046 <xsl:text>, </xsl:text>
1047 <xsl:variable name="child" select="child::*[position()=1]"/>
1048 <xsl:choose>
1049 <xsl:when test="name($child)='char'">
1050 <xsl:value-of select="$name"/>
1051 </xsl:when>
1052 <xsl:otherwise>
1053 p2i(<xsl:value-of select="$name"/>)
1054 </xsl:otherwise>
1055 </xsl:choose>
1056 </xsl:template>
1057
1058 <xsl:template match="ptrtype" mode="traceInFormat">
1059 <xsl:param name="name"/>
1060 <xsl:variable name="child" select="child::*[position()=1]"/>
1061 <xsl:choose>
1062 <xsl:when test="name($child)='jclass'">
1063 <xsl:text> </xsl:text>
1064 <xsl:value-of select="$name"/>
1065 <xsl:text>=" PTR_FORMAT "</xsl:text>
1066 </xsl:when>
1067 <xsl:otherwise>
1068 <xsl:apply-templates select="$child" mode="traceInFormat"/>
1069 </xsl:otherwise>
1070 </xsl:choose>
1071 </xsl:template>
1072
1073 <xsl:template match="ptrtype" mode="traceInValue">
1074 <xsl:param name="name"/>
1075 <xsl:variable name="child" select="child::*[position()=1]"/>
1076 <xsl:choose>
1077 <xsl:when test="name($child)='jclass'">
1078 <xsl:text>, </xsl:text>
1079 p2i(<xsl:value-of select="$name"/>)
1080 </xsl:when>
1081 <xsl:otherwise>
1082 <xsl:apply-templates select="$child" mode="traceInValue"/>
1083 </xsl:otherwise>
1084 </xsl:choose>
1085 </xsl:template>
1086
1087 <xsl:template match="inptr" mode="traceInFormat">
1088 <xsl:param name="name"/>
1089 <xsl:text> </xsl:text>
1090 <xsl:value-of select="$name"/>
1091 <xsl:text>=" PTR_FORMAT "</xsl:text>
1092 </xsl:template>
1093
1094 <xsl:template match="inptr" mode="traceInValue">
1095 <xsl:param name="name"/>
1096 <xsl:text>, </xsl:text>
1097 p2i(<xsl:value-of select="$name"/>)
1098 </xsl:template>
1099
1100 <xsl:template match="jrawMonitorID|jfieldID" mode="traceInFormat">
1101 <xsl:param name="name"/>
1102 <xsl:text> </xsl:text>
1103 <xsl:value-of select="$name"/>
1104 <xsl:text>=%s</xsl:text>
1105 </xsl:template>
1106
1107 <xsl:template match="jclass" mode="traceInFormat">
1108 <xsl:param name="name"/>
1109 <!-- for JVMTI a jclass/jmethodID becomes just jmethodID -->
1110 <xsl:if test="count(@method)=0">
1111 <xsl:text> </xsl:text>
1112 <xsl:value-of select="$name"/>
1113 <xsl:text>=%s</xsl:text>
1114 </xsl:if>
1115 </xsl:template>
1116
1117 <xsl:template match="jrawMonitorID" mode="traceInValue">
1202 <xsl:when test=".='jvmtiEvent'">
1203 <xsl:text>JvmtiTrace::event_name(</xsl:text>
1204 <xsl:value-of select="$name"/>
1205 <xsl:text>)
1206 </xsl:text>
1207 </xsl:when>
1208 <xsl:otherwise>
1209 <xsl:text>JvmtiTrace::enum_name(</xsl:text>
1210 <xsl:value-of select="."/>
1211 <xsl:text>ConstantNames, </xsl:text>
1212 <xsl:value-of select="."/>
1213 <xsl:text>ConstantValues, </xsl:text>
1214 <xsl:value-of select="$name"/>
1215 <xsl:text>)</xsl:text>
1216 </xsl:otherwise>
1217 </xsl:choose>
1218 </xsl:otherwise>
1219 </xsl:choose>
1220 </xsl:template>
1221
1222 <xsl:template match="jint" mode="traceInFormat">
1223 <xsl:param name="name"/>
1224 <xsl:text> </xsl:text>
1225 <xsl:value-of select="$name"/>
1226 <xsl:text>=" INT32_FORMAT "</xsl:text>
1227 </xsl:template>
1228
1229 <xsl:template match="jlocation" mode="traceInFormat">
1230 <xsl:param name="name"/>
1231 <xsl:text> </xsl:text>
1232 <xsl:value-of select="$name"/>
1233 <xsl:text>=" INT64_FORMAT "</xsl:text>
1234 </xsl:template>
1235
1236 <xsl:template match="jlong" mode="traceInFormat">
1237 <xsl:param name="name"/>
1238 <xsl:text> </xsl:text>
1239 <xsl:value-of select="$name"/>
1240 <xsl:text>=" INT64_FORMAT "</xsl:text>
1241 </xsl:template>
1242
1243 <xsl:template match="size_t" mode="traceInFormat">
1244 <xsl:param name="name"/>
1245 <xsl:text> </xsl:text>
1246 <xsl:value-of select="$name"/>
1247 <xsl:text>=0x%zx</xsl:text>
1248 </xsl:template>
1249
1250 <xsl:template match="jfloat|jdouble" mode="traceInFormat">
1251 <xsl:param name="name"/>
1252 <xsl:text> </xsl:text>
1253 <xsl:value-of select="$name"/>
1254 <xsl:text>=%f</xsl:text>
1255 </xsl:template>
1256
1257 <xsl:template match="char" mode="traceInFormat">
1258 <xsl:param name="name"/>
1259 <xsl:text> </xsl:text>
1260 <xsl:value-of select="$name"/>
|