Skip to content

Commit a412974

Browse files
committed
8212148: Remove remaining NSK_CPP_STUBs
Remove remaining macros Backport-of: a623db2
1 parent 2ea3786 commit a412974

File tree

36 files changed

+474
-787
lines changed

36 files changed

+474
-787
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,28 @@ static jvmtiPhase phase;
4343
/* Check SetVerboseFlag function
4444
*/
4545
static int checkSetVerboseFlag(jvmtiEnv *jvmti) {
46-
if (!NSK_JVMTI_VERIFY(
47-
NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_OTHER, JNI_TRUE)))
46+
if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_OTHER, JNI_TRUE)))
4847
return NSK_FALSE;
4948

50-
if (!NSK_JVMTI_VERIFY(
51-
NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_OTHER, JNI_FALSE)))
49+
if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_OTHER, JNI_FALSE)))
5250
return NSK_FALSE;
5351

54-
if (!NSK_JVMTI_VERIFY(
55-
NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_GC, JNI_TRUE)))
52+
if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_GC, JNI_TRUE)))
5653
return NSK_FALSE;
5754

58-
if (!NSK_JVMTI_VERIFY(
59-
NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_GC, JNI_FALSE)))
55+
if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_GC, JNI_FALSE)))
6056
return NSK_FALSE;
6157

62-
if (!NSK_JVMTI_VERIFY(
63-
NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_CLASS, JNI_TRUE)))
58+
if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_CLASS, JNI_TRUE)))
6459
return NSK_FALSE;
6560

66-
if (!NSK_JVMTI_VERIFY(
67-
NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_CLASS, JNI_FALSE)))
61+
if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_CLASS, JNI_FALSE)))
6862
return NSK_FALSE;
6963

70-
if (!NSK_JVMTI_VERIFY(
71-
NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_JNI, JNI_TRUE)))
64+
if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_JNI, JNI_TRUE)))
7265
return NSK_FALSE;
7366

74-
if (!NSK_JVMTI_VERIFY(
75-
NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_JNI, JNI_FALSE)))
67+
if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_JNI, JNI_FALSE)))
7668
return NSK_FALSE;
7769

7870
return NSK_TRUE;
@@ -83,7 +75,7 @@ static int checkSetVerboseFlag(jvmtiEnv *jvmti) {
8375
void JNICALL
8476
VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
8577

86-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
78+
if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
8779
nsk_jvmti_setFailStatus();
8880

8981
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -105,10 +97,10 @@ ClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni,
10597
unsigned char** new_class_data) {
10698
jvmtiPhase curr_phase;
10799

108-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
100+
if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
109101
nsk_jvmti_setFailStatus();
110102

111-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &curr_phase)))
103+
if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&curr_phase)))
112104
nsk_jvmti_setFailStatus();
113105

114106
if (phase != curr_phase) {
@@ -121,7 +113,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni,
121113
nsk_jvmti_setFailStatus();
122114
}
123115

124-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
116+
if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
125117
nsk_jvmti_setFailStatus();
126118
}
127119

@@ -135,7 +127,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv* jni, void* arg) {
135127
if (!nsk_jvmti_waitForSync(timeout))
136128
return;
137129

138-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
130+
if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
139131
nsk_jvmti_setFailStatus();
140132

141133
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -181,12 +173,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
181173
return JNI_ERR;
182174

183175
/* Create data access lock */
184-
if (!NSK_JVMTI_VERIFY(
185-
NSK_CPP_STUB3(CreateRawMonitor, jvmti,
186-
"_access_lock", &access_lock)))
176+
if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_access_lock", &access_lock)))
187177
return JNI_ERR;
188178

189-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
179+
if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
190180
return JNI_ERR;
191181

192182
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -199,21 +189,17 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
199189
memset(&callbacks, 0, sizeof(callbacks));
200190
callbacks.VMInit = &VMInit;
201191
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
202-
if (!NSK_JVMTI_VERIFY(
203-
NSK_CPP_STUB3(SetEventCallbacks, jvmti,
204-
&callbacks, sizeof(callbacks))))
192+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
205193
return JNI_ERR;
206194

207195
/* enable VMInit event */
208196
if (!NSK_JVMTI_VERIFY(
209-
NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
210-
JVMTI_EVENT_VM_INIT, NULL)))
197+
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
211198
return JNI_ERR;
212199

213200
/* enable ClassFileLoadHook event */
214201
if (!NSK_JVMTI_VERIFY(
215-
NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
216-
JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
202+
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
217203
return JNI_ERR;
218204

219205
/* register agent proc and arg */

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv* jni, void* arg) {
4747

4848
NSK_DISPLAY0("Check on JVMTI_ERROR_ILLEGAL_ARGUMENT\n");
4949
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_ILLEGAL_ARGUMENT,
50-
NSK_CPP_STUB3(SetVerboseFlag, jvmti,
51-
(jvmtiVerboseFlag)(-1), JNI_TRUE)))
50+
jvmti->SetVerboseFlag((jvmtiVerboseFlag)(-1), JNI_TRUE)))
5251
nsk_jvmti_setFailStatus();
5352

5453
/* resume debugee after last sync */

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep001/singlestep001.cpp

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,11 @@ static jrawMonitorID agent_lock;
6363
static void setBP(jvmtiEnv *jvmti_env, JNIEnv *env, jclass klass) {
6464
jmethodID mid;
6565

66-
if (!NSK_JNI_VERIFY(env, (mid = NSK_CPP_STUB4(GetMethodID,
67-
env, klass, METHODS[0], METHOD_SIGS[0])) != NULL))
68-
NSK_CPP_STUB2(FatalError, env,
69-
"failed to get ID for the java method\n");
70-
71-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint,
72-
jvmti_env, mid, 0)))
73-
NSK_CPP_STUB2(FatalError, env,
74-
"failed to set breakpoint\n");
66+
if (!NSK_JNI_VERIFY(env, (mid = env->GetMethodID(klass, METHODS[0], METHOD_SIGS[0])) != NULL))
67+
env->FatalError("failed to get ID for the java method\n");
68+
69+
if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 0)))
70+
env->FatalError("failed to set breakpoint\n");
7571
}
7672

7773
/** callback functions **/
@@ -82,10 +78,8 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) {
8278
jvmti->RawMonitorEnter(agent_lock);
8379

8480
if (vm_started) {
85-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
86-
jvmti_env, klass, &sig, &generic)))
87-
NSK_CPP_STUB2(FatalError, env,
88-
"failed to obtain a class signature\n");
81+
if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic)))
82+
env->FatalError("failed to obtain a class signature\n");
8983

9084
if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
9185
NSK_DISPLAY1(
@@ -106,20 +100,16 @@ Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method,
106100
char *sig, *generic;
107101

108102
NSK_DISPLAY0("Breakpoint event received\n");
109-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
110-
jvmti_env, method, &klass)))
103+
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &klass)))
111104
NSK_COMPLAIN0("TEST FAILURE: unable to get method declaring class\n\n");
112105

113-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
114-
jvmti_env, klass, &sig, &generic)))
115-
NSK_CPP_STUB2(FatalError, env,
116-
"Breakpoint: failed to obtain a class signature\n");
106+
if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic)))
107+
env->FatalError("Breakpoint: failed to obtain a class signature\n");
117108

118109
if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
119110
NSK_DISPLAY1("method declaring class \"%s\"\n\tenabling SingleStep events ...\n",
120111
sig);
121-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
122-
jvmti_env, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr))) {
112+
if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr))) {
123113
result = STATUS_FAILED;
124114
NSK_COMPLAIN0("TEST FAILURE: cannot enable SingleStep events\n\n");
125115
}
@@ -142,20 +132,17 @@ SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
142132

143133
NSK_DISPLAY0(">>>> SingleStep event received\n");
144134

145-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
146-
jvmti_env, method, &methNam, &methSig, NULL))) {
135+
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
147136
result = STATUS_FAILED;
148137
NSK_COMPLAIN0("TEST FAILED: unable to get method name during SingleStep callback\n\n");
149138
return;
150139
}
151-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
152-
jvmti_env, method, &klass))) {
140+
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &klass))) {
153141
result = STATUS_FAILED;
154142
NSK_COMPLAIN0("TEST FAILED: unable to get method declaring class during SingleStep callback\n\n");
155143
return;
156144
}
157-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
158-
jvmti_env, klass, &sig, &generic))) {
145+
if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) {
159146
result = STATUS_FAILED;
160147
NSK_COMPLAIN0("TEST FAILED: unable to obtain a class signature during SingleStep callback\n\n");
161148
return;
@@ -187,21 +174,18 @@ SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
187174
"CHECK PASSED: SingleStep event received for the method \"%s\" as expected\n"
188175
"\tdisabling the event generation\n",
189176
methNam);
190-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
191-
jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, thread))) {
177+
if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, thread))) {
192178
result = STATUS_FAILED;
193179
NSK_COMPLAIN0("TEST FAILED: cannot disable SingleStep events\n\n");
194180
}
195181
}
196182
}
197183

198-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
199-
jvmti_env, (unsigned char*) methNam))) {
184+
if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
200185
result = STATUS_FAILED;
201186
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
202187
}
203-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
204-
jvmti_env, (unsigned char*) methSig))) {
188+
if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
205189
result = STATUS_FAILED;
206190
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
207191
}
@@ -261,12 +245,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
261245
memset(&caps, 0, sizeof(jvmtiCapabilities));
262246
caps.can_generate_breakpoint_events = 1;
263247
caps.can_generate_single_step_events = 1;
264-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
265-
jvmti, &caps)))
248+
if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
266249
return JNI_ERR;
267250

268-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
269-
jvmti, &caps)))
251+
if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
270252
return JNI_ERR;
271253

272254
if (!caps.can_generate_single_step_events)
@@ -279,24 +261,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
279261
callbacks.Breakpoint = &Breakpoint;
280262
callbacks.SingleStep = &SingleStep;
281263
callbacks.VMStart = &VMStart;
282-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
283-
jvmti, &callbacks, sizeof(callbacks))))
264+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
284265
return JNI_ERR;
285266

286267
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
287-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
288-
jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
268+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
289269
return JNI_ERR;
290-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
291-
jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
270+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
292271
return JNI_ERR;
293-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
294-
jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
272+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
295273
return JNI_ERR;
296274
NSK_DISPLAY0("enabling the events done\n\n");
297275

298-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
299-
jvmti, "agent lock", &agent_lock)))
276+
if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("agent lock", &agent_lock)))
300277
return JNI_ERR;
301278

302279
return JNI_OK;

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep002/singlestep002.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
5050
jmethodID method, jlocation location) {
5151
jvmtiPhase phase;
5252

53-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase,
54-
jvmti_env, &phase))) {
53+
if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
5554
result = STATUS_FAILED;
5655
NSK_COMPLAIN0("TEST FAILED: unable to obtain phase of the VM execution during SingleStep callback\n\n");
5756
}
@@ -105,12 +104,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
105104
/* add capability to generate compiled method events */
106105
memset(&caps, 0, sizeof(jvmtiCapabilities));
107106
caps.can_generate_single_step_events = 1;
108-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
109-
jvmti, &caps)))
107+
if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
110108
return JNI_ERR;
111109

112-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
113-
jvmti, &caps)))
110+
if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
114111
return JNI_ERR;
115112

116113
if (!caps.can_generate_single_step_events)
@@ -121,16 +118,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
121118
(void) memset(&callbacks, 0, sizeof(callbacks));
122119
callbacks.SingleStep = &SingleStep;
123120
callbacks.VMDeath = &VMDeath;
124-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
125-
jvmti, &callbacks, sizeof(callbacks))))
121+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
126122
return JNI_ERR;
127123

128124
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
129-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
130-
jvmti, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL)))
125+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL)))
131126
return JNI_ERR;
132-
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
133-
jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
127+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
134128
return JNI_ERR;
135129
NSK_DISPLAY0("enabling the events done\n\n");
136130

0 commit comments

Comments
 (0)