On Thu, 14 May 2026 02:23:09 GMT, Serguei Spitsyn <[email protected]> wrote:
>> The JVMTI code that sends events is intentionally racy. The agents can do
>> their own synchronization if necessary.
>>
>> The fragment below is kind of strange:
>>
>> 494 agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
>> 495
>> 496 int i;
>> 497
>> 498 for (i = 1; i <= STEP_AMOUNT; i++) {
>> 499
>> 500 if (!nsk_jvmti_waitForSync(timeout))
>> 501 return;
>> 502
>> 503 NSK_DISPLAY0("Check received events\n");
>> 504
>> 505 if (i < STEP_AMOUNT) {
>> 506 showEventStatistics(i);
>> 507 if (!checkEvents(i))
>> 508 nsk_jvmti_setFailStatus();
>> 509
>> 510 if (!setCallBacks(i + 1)) { <== ???
>> 511 return;
>> 512 }
>> 513 }
>> 514
>> 515 if (!nsk_jvmti_resumeSync())
>> 516 return;
>> 517 }
>> . . .
>>
>>
>> The `setCallBacks()` is never called with the step 1 from the `agentProc()`
>> but called with step 1 from `Agent_Initialize()`. It is kind of unusual. It
>> is not clear what was a reason for that.
>
> Also, why the steps are not numbered starting from 0?
setCallBacks(1) is called in Agent_Initialize.
The setCallBack is called for next step.
Might be more convenient to count steps from 1? I am not sure
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/31128#discussion_r3268175230