author | iklam |
Thu, 30 Aug 2018 08:01:13 -0700 | |
changeset 51593 | e6250a870739 |
parent 51551 | e409244ce72e |
child 51774 | 79dc492c00ab |
permissions | -rw-r--r-- |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
1 |
/* |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
2 |
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
4 |
* |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
8 |
* |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
13 |
* accompanied this code). |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
14 |
* |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
18 |
* |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
21 |
* questions. |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
22 |
*/ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
23 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
24 |
#include <string.h> |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
25 |
#include <jvmti.h> |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
26 |
#include "jni_tools.h" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
27 |
#include "jvmti_tools.h" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
28 |
#include "jvmti_FollowRefObjects.h" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
29 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
30 |
#ifdef __cplusplus |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
31 |
extern "C" { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
32 |
#endif |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
33 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
34 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
35 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
36 |
int g_fakeUserData = 0; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
37 |
int g_userDataError = 0; |
51593
e6250a870739
8210194: [TESTBUG] jvmti_FollowRefObjects.cpp missing initializer for member _jvmtiHeapCallbacks::heap_reference_callback
iklam
parents:
51551
diff
changeset
|
38 |
jvmtiHeapCallbacks g_wrongHeapCallbacks; |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
39 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
40 |
/* This array has to be up-to-date with the jvmtiHeapReferenceKind enum */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
41 |
const char * const g_refKindStr[28] = { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
42 |
"unknown_0", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
43 |
"JVMTI_HEAP_REFERENCE_CLASS", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
44 |
"JVMTI_HEAP_REFERENCE_FIELD", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
45 |
"JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
46 |
"JVMTI_HEAP_REFERENCE_CLASS_LOADER", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
47 |
"JVMTI_HEAP_REFERENCE_SIGNERS", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
48 |
"JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
49 |
"JVMTI_HEAP_REFERENCE_INTERFACE", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
50 |
"JVMTI_HEAP_REFERENCE_STATIC_FIELD", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
51 |
"JVMTI_HEAP_REFERENCE_CONSTANT_POOL", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
52 |
"JVMTI_HEAP_REFERENCE_SUPERCLASS", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
53 |
"unknown_11", "unknown_12", "unknown_13", "unknown_14", "unknown_15", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
54 |
"unknown_16", "unknown_17", "unknown_18", "unknown_19", "unknown_20", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
55 |
"JVMTI_HEAP_REFERENCE_JNI_GLOBAL", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
56 |
"JVMTI_HEAP_REFERENCE_SYSTEM_CLASS", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
57 |
"JVMTI_HEAP_REFERENCE_MONITOR", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
58 |
"JVMTI_HEAP_REFERENCE_STACK_LOCAL", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
59 |
"JVMTI_HEAP_REFERENCE_JNI_LOCAL", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
60 |
"JVMTI_HEAP_REFERENCE_THREAD", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
61 |
"JVMTI_HEAP_REFERENCE_OTHER" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
62 |
}; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
63 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
64 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
65 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
66 |
char * g_szTagInfo[MAX_TAG]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
67 |
char g_tagFlags[MAX_TAG]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
68 |
int g_tagVisitCount[MAX_TAG]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
69 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
70 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
71 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
72 |
void markTagSet(jlong tag_val) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
73 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
74 |
if ( tag_val > 0 && tag_val < MAX_TAG ) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
75 |
g_tagFlags[tag_val] |= FLAG_TAG_SET; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
76 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
77 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
78 |
void markTagVisited(jlong tag_val) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
79 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
80 |
if ( tag_val > 0 && tag_val < MAX_TAG ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
81 |
g_tagVisitCount[tag_val]++; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
82 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
83 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
84 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
85 |
jboolean checkThatAllTagsVisited() |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
86 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
87 |
jboolean ok = JNI_TRUE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
88 |
jlong i; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
89 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
90 |
NSK_DISPLAY0("Checking that all set tags have been visited\n"); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
91 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
92 |
for ( i = 1; i < MAX_TAG; i++ ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
93 |
char flags = g_tagFlags[i]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
94 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
95 |
if ( (g_tagFlags[i] & FLAG_TAG_SET) ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
96 |
if ( g_tagVisitCount[i] == 0 ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
97 |
NSK_COMPLAIN1("Tag %" LL "d has not been visited: %x\n", i); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
98 |
ok = JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
99 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
100 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
101 |
DBG(printf(">>> Tag %" LL "d has been visited %i times: %s\n", i, g_tagVisitCount[i], g_szTagInfo[i])); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
102 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
103 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
104 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
105 |
return ok; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
106 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
107 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
108 |
JNIEXPORT void JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetTags(JNIEnv* jni, jclass klass) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
109 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
110 |
memset(g_szTagInfo, 0, sizeof(g_szTagInfo)); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
111 |
memset(g_tagFlags, 0, sizeof(g_tagFlags)); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
112 |
memset(g_tagVisitCount, 0, sizeof(g_tagVisitCount)); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
113 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
114 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
115 |
JNIEXPORT jboolean JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_setTag(JNIEnv* jni, jclass klass, jobject o, jlong tag, jstring sInfo) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
116 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
117 |
jvmtiEnv * jvmti = nsk_jvmti_getAgentJVMTIEnv(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
118 |
jint hashCode; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
119 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
120 |
if ( ! NSK_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, o, tag) == JVMTI_ERROR_NONE) ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
121 |
NSK_COMPLAIN2("Can't set tag %li for object %lx\n", tag, o); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
122 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
123 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
124 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
125 |
if ( ! NSK_VERIFY(NSK_CPP_STUB3(GetObjectHashCode, jvmti, o, &hashCode) == JVMTI_ERROR_NONE) ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
126 |
NSK_COMPLAIN1("Can't get hash object %lx\n", o); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
127 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
128 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
129 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
130 |
NSK_DISPLAY2("setTag: %08x <- % 3li", hashCode, tag); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
131 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
132 |
if ( tag > 0 && tag < MAX_TAG ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
133 |
jboolean fCopy; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
134 |
const char * s; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
135 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
136 |
if ( ! NSK_VERIFY((s = NSK_CPP_STUB3(GetStringUTFChars, jni, sInfo, &fCopy)) != NULL) ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
137 |
NSK_COMPLAIN1("Can't get string at %#p\n", sInfo); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
138 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
139 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
140 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
141 |
if ( ! s ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
142 |
NSK_COMPLAIN1("Can't get string at %#p: NULL\n", sInfo); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
143 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
144 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
145 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
146 |
g_szTagInfo[tag] = strdup(s); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
147 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
148 |
NSK_CPP_STUB3(ReleaseStringUTFChars, jni, sInfo, s); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
149 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
150 |
NSK_DISPLAY1(" // %s", g_szTagInfo[tag]); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
151 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
152 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
153 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
154 |
markTagSet(tag); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
155 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
156 |
return JNI_TRUE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
157 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
158 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
159 |
JNIEXPORT jlong JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_getTag(JNIEnv* jni, jclass klass, jobject o) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
160 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
161 |
jvmtiEnv * jvmti = nsk_jvmti_getAgentJVMTIEnv(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
162 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
163 |
jlong tag; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
164 |
jvmtiError r; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
165 |
if ( ! NSK_VERIFY((r = NSK_CPP_STUB3(GetTag, jvmti, o, &tag)) == JVMTI_ERROR_NONE) ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
166 |
NSK_COMPLAIN2("Can't GetTag for object %lx. Return code: %i\n", o, r); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
167 |
return -1; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
168 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
169 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
170 |
return tag; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
171 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
172 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
173 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
174 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
175 |
int g_refsToVerifyCnt; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
176 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
177 |
RefToVerify g_refsToVerify[MAX_REFS]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
178 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
179 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
180 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
181 |
JNIEXPORT void JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetRefsToVerify(JNIEnv* jni, jclass klass) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
182 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
183 |
g_refsToVerifyCnt = 0; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
184 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
185 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
186 |
static RefToVerify * findRefToVerify(jlong tagFrom, jlong tagTo, jint refKind) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
187 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
188 |
int i; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
189 |
RefToVerify * pRefRec = g_refsToVerify; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
190 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
191 |
for ( i = g_refsToVerifyCnt; i > 0; i--, pRefRec++ ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
192 |
pRefRec = &g_refsToVerify[i]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
193 |
if ( pRefRec->_tagFrom == tagFrom && pRefRec->_tagTo == tagTo && pRefRec->_refKind == refKind ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
194 |
return pRefRec; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
195 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
196 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
197 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
198 |
return NULL; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
199 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
200 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
201 |
static jboolean addRefToVerify(jlong tagFrom, jlong tagTo, jint refKind, int expectedCount, int actualCount) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
202 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
203 |
RefToVerify * pRefRec; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
204 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
205 |
if ( g_refsToVerifyCnt >= MAX_REFS ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
206 |
NSK_COMPLAIN0("TEST_BUG: Max. number of refs reached!"); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
207 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
208 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
209 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
210 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
211 |
pRefRec = &g_refsToVerify[g_refsToVerifyCnt++]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
212 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
213 |
pRefRec->_tagFrom = tagFrom; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
214 |
pRefRec->_tagTo = tagTo; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
215 |
pRefRec->_refKind = refKind; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
216 |
pRefRec->_expectedCount = expectedCount; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
217 |
pRefRec->_actualCount = actualCount; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
218 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
219 |
return JNI_TRUE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
220 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
221 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
222 |
JNIEXPORT jboolean JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_addRefToVerify(JNIEnv* jni, jclass klass, jobject from, jobject to, jint refKind, jint count) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
223 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
224 |
jvmtiEnv * jvmti = nsk_jvmti_getAgentJVMTIEnv(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
225 |
jvmtiError r; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
226 |
jlong tagFrom, tagTo; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
227 |
RefToVerify * pRefRec; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
228 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
229 |
if ( ! NSK_VERIFY((r = NSK_CPP_STUB3(GetTag, jvmti, from, &tagFrom)) == JVMTI_ERROR_NONE) ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
230 |
NSK_COMPLAIN2("TEST_BUG: Can't GetTag for object %lx. Return code: %i\n", from, r); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
231 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
232 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
233 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
234 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
235 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
236 |
if ( ! NSK_VERIFY((r = NSK_CPP_STUB3(GetTag, jvmti, to, &tagTo)) == JVMTI_ERROR_NONE) ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
237 |
NSK_COMPLAIN2("TEST_BUG: Can't GetTag for object %lx. Return code: %i\n", to, r); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
238 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
239 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
240 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
241 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
242 |
if ( (pRefRec = findRefToVerify(tagFrom, tagTo, refKind)) != NULL ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
243 |
pRefRec->_expectedCount += count; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
244 |
return JNI_TRUE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
245 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
246 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
247 |
return addRefToVerify(tagFrom, tagTo, refKind, count, 0); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
248 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
249 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
250 |
jboolean markRefToVerify(jlong tagFrom, jlong tagTo, int refKind) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
251 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
252 |
RefToVerify * pRefRec; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
253 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
254 |
if ( (pRefRec = findRefToVerify(tagFrom, tagTo, refKind)) != NULL ) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
255 |
pRefRec->_actualCount++; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
256 |
return JNI_TRUE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
257 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
258 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
259 |
return addRefToVerify(tagFrom, tagTo, refKind, 0, 1); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
260 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
261 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
262 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
263 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
264 |
void checkUserData(const char * szFile, const int line, void * user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
265 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
266 |
if (user_data != &g_fakeUserData && !g_userDataError) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
267 |
NSK_COMPLAIN4("%s, %i: Unexpected user_data is passed" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
268 |
" to heapReferenceCallback:\n" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
269 |
" expected: 0x%p\n" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
270 |
" actual: 0x%p\n", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
271 |
szFile, line, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
272 |
&g_fakeUserData, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
273 |
user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
274 |
g_userDataError++; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
275 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
276 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
277 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
278 |
#define CHECK_USER_DATA(p) checkUserData(__FILE__, __LINE__, (p)) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
279 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
280 |
void printHeapRefCallbackInfo( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
281 |
jvmtiHeapReferenceKind reference_kind, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
282 |
const jvmtiHeapReferenceInfo* reference_info, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
283 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
284 |
jlong referrer_class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
285 |
jlong size, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
286 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
287 |
jlong* referrer_tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
288 |
jint length) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
289 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
290 |
const char * szInfo, * szRefInfo; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
291 |
jlong tag_val = tag_ptr ? *tag_ptr : 0; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
292 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
293 |
NSK_DISPLAY1("heapReferenceCallback: %s", g_refKindStr[reference_kind]); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
294 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
295 |
NSK_DISPLAY3(" reference_info: %#lx, class_tag: %#" LL "d, referrer_class_tag: %#" LL "d\n", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
296 |
reference_info, class_tag, referrer_class_tag); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
297 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
298 |
NSK_DISPLAY4(" size: %" LL "d, tag_ptr: %p, referrer_tag_ptr: %p, length: %-ld\n", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
299 |
size, tag_ptr, referrer_tag_ptr, length); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
300 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
301 |
NSK_DISPLAY2(" tag: %" LL "d, referrer_tag: %" LL "d\n", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
302 |
tag_val, DEREF(referrer_tag_ptr)); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
303 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
304 |
szInfo = ( tag_val > 0 && tag_val < MAX_TAG ) ? g_szTagInfo[tag_val] : "<none>"; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
305 |
szRefInfo = ( referrer_tag_ptr && *referrer_tag_ptr > 0 && *referrer_tag_ptr < MAX_TAG ) ? g_szTagInfo[*referrer_tag_ptr] : "<none>"; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
306 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
307 |
NSK_DISPLAY3(" summary: %s: %s <- %s\n", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
308 |
g_refKindStr[reference_kind], szInfo, szRefInfo); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
309 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
310 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
311 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
312 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
313 |
jint JNICALL wrongHeapReferenceCallback( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
314 |
jvmtiHeapReferenceKind reference_kind, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
315 |
const jvmtiHeapReferenceInfo* reference_info, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
316 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
317 |
jlong referrer_class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
318 |
jlong size, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
319 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
320 |
jlong* referrer_tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
321 |
jint length, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
322 |
void* user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
323 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
324 |
CHECK_USER_DATA(user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
325 |
NSK_COMPLAIN0("heap reference callback was called, where it should not be\n"); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
326 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
327 |
printHeapRefCallbackInfo(reference_kind, reference_info, class_tag, referrer_class_tag, size, tag_ptr, referrer_tag_ptr, length); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
328 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
329 |
return JVMTI_VISIT_OBJECTS; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
330 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
331 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
332 |
jint JNICALL wrongPrimitiveFieldCallback( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
333 |
jvmtiHeapReferenceKind reference_kind, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
334 |
const jvmtiHeapReferenceInfo* reference_info, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
335 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
336 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
337 |
jvalue value, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
338 |
jvmtiPrimitiveType value_type, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
339 |
void* user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
340 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
341 |
CHECK_USER_DATA(user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
342 |
NSK_COMPLAIN0("primitive field callback was called, where it should not be\n"); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
343 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
344 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
345 |
return JVMTI_VISIT_OBJECTS; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
346 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
347 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
348 |
jint JNICALL wrongArrayPrimitiveValueCallback( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
349 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
350 |
jlong size, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
351 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
352 |
jint element_count, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
353 |
jvmtiPrimitiveType element_type, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
354 |
const void* elements, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
355 |
void* user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
356 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
357 |
CHECK_USER_DATA(user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
358 |
NSK_COMPLAIN0("array primitive value callback was called, where it should not be\n"); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
359 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
360 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
361 |
return JVMTI_VISIT_OBJECTS; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
362 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
363 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
364 |
jint JNICALL wrongStringPrimitiveValueCallback( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
365 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
366 |
jlong size, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
367 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
368 |
const jchar* value, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
369 |
jint value_length, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
370 |
void* user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
371 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
372 |
CHECK_USER_DATA(user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
373 |
NSK_COMPLAIN0("string primitive value callback was called, where it should not be\n"); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
374 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
375 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
376 |
return JVMTI_VISIT_OBJECTS; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
377 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
378 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
379 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
380 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
381 |
void jvmti_FollowRefObject_init() |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
382 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
383 |
g_wrongHeapCallbacks.heap_iteration_callback = NULL; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
384 |
g_wrongHeapCallbacks.heap_reference_callback = wrongHeapReferenceCallback; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
385 |
g_wrongHeapCallbacks.primitive_field_callback = wrongPrimitiveFieldCallback; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
386 |
g_wrongHeapCallbacks.array_primitive_value_callback = wrongArrayPrimitiveValueCallback; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
387 |
g_wrongHeapCallbacks.string_primitive_value_callback = wrongStringPrimitiveValueCallback; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
388 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
389 |
Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetTags(NULL, NULL); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
390 |
Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetRefsToVerify(NULL, NULL); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
391 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
392 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
393 |
/* ============================================================================= */ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
394 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
395 |
#ifdef __cplusplus |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
396 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
397 |
#endif |