author | jcbeyler |
Tue, 11 Dec 2018 10:29:30 -0800 | |
changeset 52949 | c78a17d24618 |
parent 52809 | 7edc56620d42 |
permissions | -rw-r--r-- |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
1 |
/* |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
2 |
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
4 |
* |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
8 |
* |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
13 |
* accompanied this code). |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
14 |
* |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
18 |
* |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
21 |
* questions. |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
22 |
*/ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
23 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
24 |
#include <stdio.h> |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
25 |
#include <string.h> |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
26 |
#include <jvmti.h> |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
27 |
#include "agent_common.h" |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
28 |
#include "JVMTITools.h" |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
29 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
30 |
extern "C" { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
31 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
32 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
33 |
#define METH_NUM 4 /* overall number of methods */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
34 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
35 |
#define STATUS_FAILED 2 |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
36 |
#define PASSED 0 |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
37 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
38 |
typedef struct { /* local variable info */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
39 |
char *v_name; /* a variable name */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
40 |
char *v_sign; /* JVM type signature */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
41 |
} localVar; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
42 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
43 |
/* local variables of redefined methods */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
44 |
static localVar constr_lv[] = { /* constructor's local variables */ |
52809
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
45 |
{ (char*) "this", (char*) "Lnsk/jvmti/RedefineClasses/redefclass009r;" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
46 |
{ (char*) "constr_i", (char*) "I" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
47 |
{ (char*) "constr_l", (char*) "J" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
48 |
{ (char*) "constr_d", (char*) "D" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
49 |
{ (char*) "constr_f", (char*) "F" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
50 |
{ (char*) "constr_c", (char*) "C" } |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
51 |
}; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
52 |
static localVar checkIt_lv[] = { /* checkIt()'s local variables */ |
52809
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
53 |
{ (char*) "this", (char*) "Lnsk/jvmti/RedefineClasses/redefclass009r;" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
54 |
{ (char*) "out", (char*) "Ljava/io/PrintStream;" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
55 |
{ (char*) "DEBUG_MODE", (char*) "Z" } |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
56 |
}; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
57 |
static localVar finMeth_lv[] = { /* finMethod()'s local variables */ |
52809
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
58 |
{ (char*) "this", (char*) "Lnsk/jvmti/RedefineClasses/redefclass009r;" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
59 |
{ (char*) "fin_c", (char*) "C" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
60 |
{ (char*) "fin_i", (char*) "J" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
61 |
{ (char*) "fin_j", (char*) "I" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
62 |
{ (char*) "fin_k", (char*) "J" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
63 |
{ (char*) "fin_l", (char*) "J" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
64 |
{ (char*) "fin_f", (char*) "F" } |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
65 |
}; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
66 |
static localVar statMeth_lv[] = { /* statMethod()'s local variables */ |
52809
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
67 |
{ (char*) "stat_x", (char*) "I" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
68 |
{ (char*) "stat_y", (char*) "I" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
69 |
{ (char*) "stat_z", (char*) "I" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
70 |
{ (char*) "stat_j", (char*) "D" }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
71 |
{ (char*) "stat_i", (char*) "I" } |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
72 |
}; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
73 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
74 |
typedef struct { /* local variables of a method */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
75 |
int inst; /* type of a method: 0- static; 1- instance */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
76 |
char *m_name; /* a method name */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
77 |
char *m_sign; /* JVM signature of a method */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
78 |
int vcount; /* overall number of local variables */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
79 |
localVar *vars; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
80 |
jmethodID mid; /* JNI's method ID */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
81 |
} methInfo; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
82 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
83 |
/* list of original methods with NULL pointers to localVar */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
84 |
static methInfo origMethInfo[] = { |
52809
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
85 |
{ 1, (char*) "<init>", (char*) "()V", 1, NULL, NULL }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
86 |
{ 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 4, NULL, NULL }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
87 |
{ 1, (char*) "finMethod", (char*) "(CJIJ)V", 5, NULL, NULL }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
88 |
{ 0, (char*) "statMethod", (char*) "(III)D", 3, NULL, NULL } |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
89 |
}; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
90 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
91 |
/* list of redefined methods */ |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
92 |
static methInfo redefMethInfo[] = { |
52809
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
93 |
{ 1, (char*) "<init>", (char*) "()V", 6, constr_lv, NULL }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
94 |
{ 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, checkIt_lv, NULL }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
95 |
{ 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, NULL }, |
7edc56620d42
8214502: Add space after/before {} in remaining vmTestbase tests
jcbeyler
parents:
52642
diff
changeset
|
96 |
{ 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, NULL } |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
97 |
}; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
98 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
99 |
static jvmtiEnv *jvmti = NULL; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
100 |
static jvmtiCapabilities caps; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
101 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
102 |
#ifdef STATIC_BUILD |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
103 |
JNIEXPORT jint JNICALL Agent_OnLoad_redefclass009(JavaVM *jvm, char *options, void *reserved) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
104 |
return Agent_Initialize(jvm, options, reserved); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
105 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
106 |
JNIEXPORT jint JNICALL Agent_OnAttach_redefclass009(JavaVM *jvm, char *options, void *reserved) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
107 |
return Agent_Initialize(jvm, options, reserved); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
108 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
109 |
JNIEXPORT jint JNI_OnLoad_redefclass009(JavaVM *jvm, char *options, void *reserved) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
110 |
return JNI_VERSION_1_8; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
111 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
112 |
#endif |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
113 |
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
114 |
jint res; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
115 |
jvmtiError err; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
116 |
|
52642
9cfc8b0c45fd
8214149: Move out assignments when not using NSK*VERIFY macros
jcbeyler
parents:
51870
diff
changeset
|
117 |
res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); |
9cfc8b0c45fd
8214149: Move out assignments when not using NSK*VERIFY macros
jcbeyler
parents:
51870
diff
changeset
|
118 |
if (res != JNI_OK) { |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
119 |
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
120 |
return JNI_ERR; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
121 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
122 |
|
51551 | 123 |
err = jvmti->GetPotentialCapabilities(&caps); |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
124 |
if (err != JVMTI_ERROR_NONE) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
125 |
printf("(GetPotentialCapabilities) unexpected error: %s (%d)\n", |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
126 |
TranslateError(err), err); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
127 |
return JNI_ERR; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
128 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
129 |
|
51551 | 130 |
err = jvmti->AddCapabilities(&caps); |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
131 |
if (err != JVMTI_ERROR_NONE) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
132 |
printf("(AddCapabilities) unexpected error: %s (%d)\n", |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
133 |
TranslateError(err), err); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
134 |
return JNI_ERR; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
135 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
136 |
|
51551 | 137 |
err = jvmti->GetCapabilities(&caps); |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
138 |
if (err != JVMTI_ERROR_NONE) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
139 |
printf("(GetCapabilities) unexpected error: %s (%d)\n", |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
140 |
TranslateError(err), err); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
141 |
return JNI_ERR; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
142 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
143 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
144 |
if (!caps.can_redefine_classes) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
145 |
printf("Warning: RedefineClasses is not implemented\n"); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
146 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
147 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
148 |
if (!caps.can_access_local_variables) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
149 |
printf("Warning: Access to local variables is not implemented\n"); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
150 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
151 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
152 |
return JNI_OK; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
153 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
154 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
155 |
int checkAttr(JNIEnv *env, jclass redefCls, methInfo methodsInfo[], |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
156 |
jint vrb, int full) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
157 |
jvmtiError err; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
158 |
int i, j, k; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
159 |
int totRes = PASSED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
160 |
jint count = -1; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
161 |
jvmtiLocalVariableEntry *lv_table; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
162 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
163 |
if (!caps.can_access_local_variables) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
164 |
return PASSED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
165 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
166 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
167 |
for (i=0; i<METH_NUM; i++) { |
51715
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
168 |
/* get the JNI method ID for a method with name m_name and |
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
169 |
signature m_sign */ |
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
170 |
if (methodsInfo[i].inst) { /* an instance method */ |
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
171 |
methodsInfo[i].mid = env->GetMethodID(redefCls, |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
172 |
methodsInfo[i].m_name, methodsInfo[i].m_sign); |
51715
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
173 |
} else { /* a static method */ |
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
174 |
methodsInfo[i].mid = env->GetStaticMethodID(redefCls, |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
175 |
methodsInfo[i].m_name, methodsInfo[i].m_sign); |
51715
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
176 |
} |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
177 |
if (methodsInfo[i].mid == NULL) { |
51870
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
178 |
printf("%s: Failed to get the method ID for the%s%s method \"%s\", signature \"%s\"\n", |
52949 | 179 |
__FILE__, full ? " " : " original ", methodsInfo[i].inst ? "instance":"static", |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
180 |
methodsInfo[i].m_name, methodsInfo[i].m_sign); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
181 |
return STATUS_FAILED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
182 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
183 |
|
51715
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
184 |
/* get the LocalVariableTable attribute */ |
52642
9cfc8b0c45fd
8214149: Move out assignments when not using NSK*VERIFY macros
jcbeyler
parents:
51870
diff
changeset
|
185 |
err = jvmti->GetLocalVariableTable(methodsInfo[i].mid, &count, &lv_table); |
9cfc8b0c45fd
8214149: Move out assignments when not using NSK*VERIFY macros
jcbeyler
parents:
51870
diff
changeset
|
186 |
if (err != JVMTI_ERROR_NONE) { |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
187 |
printf("%s: Failed to call GetLocalVariableTable(): error=%d: %s\n", |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
188 |
__FILE__, err, TranslateError(err)); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
189 |
printf("\tfor the%s%s method \"%s\", signature \"%s\"\n\n", |
52949 | 190 |
full ? " " : " original ", methodsInfo[i].inst ? "instance":"static", |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
191 |
methodsInfo[i].m_name, methodsInfo[i].m_sign); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
192 |
return STATUS_FAILED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
193 |
} else { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
194 |
if (count != methodsInfo[i].vcount) { |
51870
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
195 |
printf( |
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
196 |
"TEST FAILED: %s%s method \"%s\", signature \"%s\": " |
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
197 |
"found %d vars in the LocalVariableTable, expected %d\n", |
52949 | 198 |
full ? " " : " original ", methodsInfo[i].inst ? "instance":"static", |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
199 |
methodsInfo[i].m_name, methodsInfo[i].m_sign, |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
200 |
count, methodsInfo[i].vcount); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
201 |
totRes = STATUS_FAILED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
202 |
continue; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
203 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
204 |
else if (vrb) |
51870
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
205 |
printf( |
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
206 |
"\nChecking vars in the LocalVariableTable of the %s method \"%s\", " |
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
207 |
"signature \"%s\" ...\n" |
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
208 |
"\tfound %d local vars as expected\n", |
52949 | 209 |
methodsInfo[i].inst ? "instance" : "static", |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
210 |
methodsInfo[i].m_name, methodsInfo[i].m_sign, count); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
211 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
212 |
if (full) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
213 |
for (j=0; j<count; j++) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
214 |
for (k=0; k<count; k++) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
215 |
if (strcmp(lv_table[j].name, methodsInfo[i].vars[k].v_name) == 0) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
216 |
if (strcmp(lv_table[j].signature, methodsInfo[i].vars[k].v_sign) != 0) { |
51870
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
217 |
printf( |
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
218 |
"TEST FAILED: %s method \"%s\", signature \"%s\": var \"%s\" " |
cdfabab3413f
8210689: Remove the multi-line old C style for string literals
jcbeyler
parents:
51715
diff
changeset
|
219 |
"has signature \"%s\" in the LocalVariableTable, expected \"%s\"\n", |
52949 | 220 |
methodsInfo[i].inst ? "instance" : "static", |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
221 |
methodsInfo[i].m_name, methodsInfo[i].m_sign, |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
222 |
lv_table[j].name, lv_table[j].signature, |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
223 |
methodsInfo[i].vars[k].v_sign); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
224 |
totRes = STATUS_FAILED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
225 |
break; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
226 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
227 |
else if (vrb) |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
228 |
printf("\tfound var \"%s\", signature \"%s\" as expected\n", |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
229 |
lv_table[j].name, lv_table[j].signature); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
230 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
231 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
232 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
233 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
234 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
235 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
236 |
return totRes; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
237 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
238 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
239 |
JNIEXPORT jint JNICALL |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
240 |
Java_nsk_jvmti_RedefineClasses_redefclass009_checkOrigAttr(JNIEnv *env, |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
241 |
jclass cls, jobject redefObj) { |
51715
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
242 |
jclass redefCls = env->GetObjectClass(redefObj); |
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
243 |
/* check only the number of local variables */ |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
244 |
return checkAttr(env, redefCls, origMethInfo, 0, 0); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
245 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
246 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
247 |
JNIEXPORT jint JNICALL |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
248 |
Java_nsk_jvmti_RedefineClasses_redefclass009_makeRedefinition(JNIEnv *env, |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
249 |
jclass cls, jint vrb, jclass redefCls, jbyteArray classBytes) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
250 |
jvmtiError err; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
251 |
jvmtiClassDefinition classDef; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
252 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
253 |
if (jvmti == NULL) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
254 |
printf("JVMTI client was not properly loaded!\n"); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
255 |
return STATUS_FAILED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
256 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
257 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
258 |
if (!caps.can_redefine_classes) { |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
259 |
return PASSED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
260 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
261 |
|
51715
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
262 |
/* fill the structure jvmtiClassDefinition */ |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
263 |
classDef.klass = redefCls; |
51715
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
264 |
classDef.class_byte_count = env->GetArrayLength(classBytes); |
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
265 |
classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
266 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
267 |
if (vrb) |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
268 |
printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
269 |
classDef.class_byte_count); |
52642
9cfc8b0c45fd
8214149: Move out assignments when not using NSK*VERIFY macros
jcbeyler
parents:
51870
diff
changeset
|
270 |
err = jvmti->RedefineClasses(1, &classDef); |
9cfc8b0c45fd
8214149: Move out assignments when not using NSK*VERIFY macros
jcbeyler
parents:
51870
diff
changeset
|
271 |
if (err != JVMTI_ERROR_NONE) { |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
272 |
printf("%s: Failed to call RedefineClasses(): error=%d: %s\n", |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
273 |
__FILE__, err, TranslateError(err)); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
274 |
printf("\tFor more info about this error see the JVMTI spec.\n"); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
275 |
return JNI_ERR; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
276 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
277 |
if (vrb) |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
278 |
printf("<<<<<<<< RedefineClasses() is successfully done\n\n"); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
279 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
280 |
return PASSED; |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
281 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
282 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
283 |
JNIEXPORT jint JNICALL |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
284 |
Java_nsk_jvmti_RedefineClasses_redefclass009_getResult(JNIEnv *env, |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
285 |
jclass cls, jint vrb, jobject redefObj) { |
51715
13a63d4a3f8d
8210593: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[N-R] tests
jcbeyler
parents:
51551
diff
changeset
|
286 |
jclass redefCls = env->GetObjectClass(redefObj); |
50260
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
287 |
return checkAttr(env, redefCls, redefMethInfo, vrb, 1); |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
288 |
} |
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
289 |
|
46c67f5e27c2
8199383: [TESTBUG] Open source VM testbase JVMTI tests
iignatyev
parents:
diff
changeset
|
290 |
} |