author | jcbeyler |
Tue, 23 Oct 2018 09:43:16 -0700 | |
changeset 52229 | d8843761f478 |
parent 52215 | 0b0ba3a2fec9 |
child 52642 | 9cfc8b0c45fd |
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 |
extern "C" { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
31 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
32 |
/* ============================================================================= */ |
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 |
int g_fakeUserData = 0; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
35 |
int g_userDataError = 0; |
51593
e6250a870739
8210194: [TESTBUG] jvmti_FollowRefObjects.cpp missing initializer for member _jvmtiHeapCallbacks::heap_reference_callback
iklam
parents:
51551
diff
changeset
|
36 |
jvmtiHeapCallbacks g_wrongHeapCallbacks; |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
37 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
38 |
/* 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
|
39 |
const char * const g_refKindStr[28] = { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
40 |
"unknown_0", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
41 |
"JVMTI_HEAP_REFERENCE_CLASS", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
42 |
"JVMTI_HEAP_REFERENCE_FIELD", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
43 |
"JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
44 |
"JVMTI_HEAP_REFERENCE_CLASS_LOADER", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
45 |
"JVMTI_HEAP_REFERENCE_SIGNERS", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
46 |
"JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
47 |
"JVMTI_HEAP_REFERENCE_INTERFACE", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
48 |
"JVMTI_HEAP_REFERENCE_STATIC_FIELD", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
49 |
"JVMTI_HEAP_REFERENCE_CONSTANT_POOL", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
50 |
"JVMTI_HEAP_REFERENCE_SUPERCLASS", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
51 |
"unknown_11", "unknown_12", "unknown_13", "unknown_14", "unknown_15", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
52 |
"unknown_16", "unknown_17", "unknown_18", "unknown_19", "unknown_20", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
53 |
"JVMTI_HEAP_REFERENCE_JNI_GLOBAL", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
54 |
"JVMTI_HEAP_REFERENCE_SYSTEM_CLASS", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
55 |
"JVMTI_HEAP_REFERENCE_MONITOR", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
56 |
"JVMTI_HEAP_REFERENCE_STACK_LOCAL", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
57 |
"JVMTI_HEAP_REFERENCE_JNI_LOCAL", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
58 |
"JVMTI_HEAP_REFERENCE_THREAD", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
59 |
"JVMTI_HEAP_REFERENCE_OTHER" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
60 |
}; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
61 |
|
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 |
char * g_szTagInfo[MAX_TAG]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
65 |
char g_tagFlags[MAX_TAG]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
66 |
int g_tagVisitCount[MAX_TAG]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
67 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
68 |
/* ============================================================================= */ |
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 |
void markTagSet(jlong tag_val) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
71 |
{ |
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
72 |
if (tag_val > 0 && tag_val < MAX_TAG) |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
73 |
g_tagFlags[tag_val] |= FLAG_TAG_SET; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
74 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
75 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
76 |
void markTagVisited(jlong tag_val) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
77 |
{ |
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
78 |
if (tag_val > 0 && tag_val < MAX_TAG) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
79 |
g_tagVisitCount[tag_val]++; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
80 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
81 |
} |
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 |
jboolean checkThatAllTagsVisited() |
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 ok = JNI_TRUE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
86 |
jlong i; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
87 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
88 |
NSK_DISPLAY0("Checking that all set tags have been visited\n"); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
89 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
90 |
for (i = 1; i < MAX_TAG; i++) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
91 |
char flags = g_tagFlags[i]; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
92 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
93 |
if ((g_tagFlags[i] & FLAG_TAG_SET)) { |
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
94 |
if (g_tagVisitCount[i] == 0) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
95 |
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
|
96 |
ok = JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
97 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
98 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
99 |
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
|
100 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
101 |
} |
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 |
return ok; |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
106 |
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
|
107 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
108 |
memset(g_szTagInfo, 0, sizeof(g_szTagInfo)); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
109 |
memset(g_tagFlags, 0, sizeof(g_tagFlags)); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
110 |
memset(g_tagVisitCount, 0, sizeof(g_tagVisitCount)); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
111 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
112 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
113 |
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
|
114 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
115 |
jvmtiEnv * jvmti = nsk_jvmti_getAgentJVMTIEnv(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
116 |
jint hashCode; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
117 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
118 |
if (!NSK_VERIFY(jvmti->SetTag(o, tag) == JVMTI_ERROR_NONE)) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
119 |
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
|
120 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
121 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
122 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
123 |
if (!NSK_VERIFY(jvmti->GetObjectHashCode(o, &hashCode) == JVMTI_ERROR_NONE)) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
124 |
NSK_COMPLAIN1("Can't get hash object %lx\n", o); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
125 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
126 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
127 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
128 |
NSK_DISPLAY2("setTag: %08x <- % 3li", hashCode, tag); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
129 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
130 |
if (tag > 0 && tag < MAX_TAG) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
131 |
jboolean fCopy; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
132 |
const char * s; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
133 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
134 |
if (!NSK_VERIFY((s = jni->GetStringUTFChars(sInfo, &fCopy)) != NULL)) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
135 |
NSK_COMPLAIN1("Can't get string at %#p\n", sInfo); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
136 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
137 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
138 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
139 |
if (!s) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
140 |
NSK_COMPLAIN1("Can't get string at %#p: NULL\n", sInfo); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
141 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
142 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
143 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
144 |
g_szTagInfo[tag] = strdup(s); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
145 |
|
52215 | 146 |
jni->ReleaseStringUTFChars(sInfo, s); |
50156
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_DISPLAY1(" // %s", g_szTagInfo[tag]); |
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 |
} |
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 |
markTagSet(tag); |
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 |
return JNI_TRUE; |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
157 |
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
|
158 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
159 |
jvmtiEnv * jvmti = nsk_jvmti_getAgentJVMTIEnv(); |
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 |
jlong tag; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
162 |
jvmtiError r; |
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
163 |
if (!NSK_VERIFY((r = jvmti->GetTag(o, &tag)) == JVMTI_ERROR_NONE)) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
164 |
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
|
165 |
return -1; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
166 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
167 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
168 |
return tag; |
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 |
|
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 |
int g_refsToVerifyCnt; |
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 |
RefToVerify g_refsToVerify[MAX_REFS]; |
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 |
/* ============================================================================= */ |
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 |
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
|
180 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
181 |
g_refsToVerifyCnt = 0; |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
184 |
static RefToVerify * findRefToVerify(jlong tagFrom, jlong tagTo, jint refKind) |
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 |
int i; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
187 |
RefToVerify * pRefRec = g_refsToVerify; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
188 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
189 |
for (i = g_refsToVerifyCnt; i > 0; i--, pRefRec++) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
190 |
pRefRec = &g_refsToVerify[i]; |
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
191 |
if (pRefRec->_tagFrom == tagFrom && pRefRec->_tagTo == tagTo && pRefRec->_refKind == refKind) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
192 |
return pRefRec; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
193 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
194 |
} |
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 |
return NULL; |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
199 |
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
|
200 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
201 |
RefToVerify * pRefRec; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
202 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
203 |
if (g_refsToVerifyCnt >= MAX_REFS) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
204 |
NSK_COMPLAIN0("TEST_BUG: Max. number of refs reached!"); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
205 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
206 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
207 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
208 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
209 |
pRefRec = &g_refsToVerify[g_refsToVerifyCnt++]; |
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->_tagFrom = tagFrom; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
212 |
pRefRec->_tagTo = tagTo; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
213 |
pRefRec->_refKind = refKind; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
214 |
pRefRec->_expectedCount = expectedCount; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
215 |
pRefRec->_actualCount = actualCount; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
216 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
217 |
return JNI_TRUE; |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
220 |
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
|
221 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
222 |
jvmtiEnv * jvmti = nsk_jvmti_getAgentJVMTIEnv(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
223 |
jvmtiError r; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
224 |
jlong tagFrom, tagTo; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
225 |
RefToVerify * pRefRec; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
226 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
227 |
if (!NSK_VERIFY((r = jvmti->GetTag(from, &tagFrom)) == JVMTI_ERROR_NONE)) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
228 |
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
|
229 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
230 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
231 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
232 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
233 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
234 |
if (!NSK_VERIFY((r = jvmti->GetTag(to, &tagTo)) == JVMTI_ERROR_NONE)) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
235 |
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
|
236 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
237 |
return JNI_FALSE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
238 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
239 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
240 |
if ((pRefRec = findRefToVerify(tagFrom, tagTo, refKind)) != NULL) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
241 |
pRefRec->_expectedCount += count; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
242 |
return JNI_TRUE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
243 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
244 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
245 |
return addRefToVerify(tagFrom, tagTo, refKind, count, 0); |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
248 |
jboolean markRefToVerify(jlong tagFrom, jlong tagTo, int refKind) |
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 |
RefToVerify * pRefRec; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
251 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
252 |
if ((pRefRec = findRefToVerify(tagFrom, tagTo, refKind)) != NULL) { |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
253 |
pRefRec->_actualCount++; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
254 |
return JNI_TRUE; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
255 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
256 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
257 |
return addRefToVerify(tagFrom, tagTo, refKind, 0, 1); |
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 |
|
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 |
void checkUserData(const char * szFile, const int line, void * user_data) |
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 |
if (user_data != &g_fakeUserData && !g_userDataError) { |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
265 |
NSK_COMPLAIN4("%s, %i: Unexpected user_data is passed" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
266 |
" to heapReferenceCallback:\n" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
267 |
" expected: 0x%p\n" |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
268 |
" actual: 0x%p\n", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
269 |
szFile, line, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
270 |
&g_fakeUserData, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
271 |
user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
272 |
g_userDataError++; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
273 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
274 |
} |
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 |
#define CHECK_USER_DATA(p) checkUserData(__FILE__, __LINE__, (p)) |
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 |
void printHeapRefCallbackInfo( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
279 |
jvmtiHeapReferenceKind reference_kind, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
280 |
const jvmtiHeapReferenceInfo* reference_info, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
281 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
282 |
jlong referrer_class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
283 |
jlong size, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
284 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
285 |
jlong* referrer_tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
286 |
jint length) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
287 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
288 |
const char * szInfo, * szRefInfo; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
289 |
jlong tag_val = tag_ptr ? *tag_ptr : 0; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
290 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
291 |
NSK_DISPLAY1("heapReferenceCallback: %s", g_refKindStr[reference_kind]); |
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_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
|
294 |
reference_info, class_tag, referrer_class_tag); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
295 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
296 |
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
|
297 |
size, tag_ptr, referrer_tag_ptr, length); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
298 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
299 |
NSK_DISPLAY2(" tag: %" LL "d, referrer_tag: %" LL "d\n", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
300 |
tag_val, DEREF(referrer_tag_ptr)); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
301 |
|
52229
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
302 |
szInfo = (tag_val > 0 && tag_val < MAX_TAG) ? g_szTagInfo[tag_val] : "<none>"; |
d8843761f478
8212771: Remove remaining spaces before/after () for vmTestbase
jcbeyler
parents:
52215
diff
changeset
|
303 |
szRefInfo = (referrer_tag_ptr && *referrer_tag_ptr > 0 && *referrer_tag_ptr < MAX_TAG) ? g_szTagInfo[*referrer_tag_ptr] : "<none>"; |
50156
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
304 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
305 |
NSK_DISPLAY3(" summary: %s: %s <- %s\n", |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
306 |
g_refKindStr[reference_kind], szInfo, szRefInfo); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
307 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
308 |
|
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 |
jint JNICALL wrongHeapReferenceCallback( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
312 |
jvmtiHeapReferenceKind reference_kind, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
313 |
const jvmtiHeapReferenceInfo* reference_info, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
314 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
315 |
jlong referrer_class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
316 |
jlong size, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
317 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
318 |
jlong* referrer_tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
319 |
jint length, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
320 |
void* user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
321 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
322 |
CHECK_USER_DATA(user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
323 |
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
|
324 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
325 |
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
|
326 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
327 |
return JVMTI_VISIT_OBJECTS; |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
330 |
jint JNICALL wrongPrimitiveFieldCallback( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
331 |
jvmtiHeapReferenceKind reference_kind, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
332 |
const jvmtiHeapReferenceInfo* reference_info, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
333 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
334 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
335 |
jvalue value, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
336 |
jvmtiPrimitiveType value_type, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
337 |
void* user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
338 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
339 |
CHECK_USER_DATA(user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
340 |
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
|
341 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
342 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
343 |
return JVMTI_VISIT_OBJECTS; |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
346 |
jint JNICALL wrongArrayPrimitiveValueCallback( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
347 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
348 |
jlong size, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
349 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
350 |
jint element_count, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
351 |
jvmtiPrimitiveType element_type, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
352 |
const void* elements, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
353 |
void* user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
354 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
355 |
CHECK_USER_DATA(user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
356 |
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
|
357 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
358 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
359 |
return JVMTI_VISIT_OBJECTS; |
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 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
362 |
jint JNICALL wrongStringPrimitiveValueCallback( |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
363 |
jlong class_tag, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
364 |
jlong size, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
365 |
jlong* tag_ptr, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
366 |
const jchar* value, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
367 |
jint value_length, |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
368 |
void* user_data) |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
369 |
{ |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
370 |
CHECK_USER_DATA(user_data); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
371 |
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
|
372 |
nsk_jvmti_setFailStatus(); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
373 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
374 |
return JVMTI_VISIT_OBJECTS; |
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 |
|
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 |
void jvmti_FollowRefObject_init() |
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 |
g_wrongHeapCallbacks.heap_iteration_callback = NULL; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
382 |
g_wrongHeapCallbacks.heap_reference_callback = wrongHeapReferenceCallback; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
383 |
g_wrongHeapCallbacks.primitive_field_callback = wrongPrimitiveFieldCallback; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
384 |
g_wrongHeapCallbacks.array_primitive_value_callback = wrongArrayPrimitiveValueCallback; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
385 |
g_wrongHeapCallbacks.string_primitive_value_callback = wrongStringPrimitiveValueCallback; |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
386 |
|
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
387 |
Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetTags(NULL, NULL); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
388 |
Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetRefsToVerify(NULL, NULL); |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
389 |
} |
6d6fe9416864
8199384: [TESTBUG] Open source VM testbase MLVM tests
iignatyev
parents:
diff
changeset
|
390 |
|
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 |
} |