Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RealtimeAccessBarrier to use common apis for copy arrayCritical #20651

Merged

Conversation

LinHu2016
Copy link
Contributor

  • Update RealtimeAccessBarrier to use opyArrayCritical, copyBackArrayCritical, copyStringCritical and freeStringCritical common functions (in ObjectAccessBarrier baseclass) to replace similar code in class RealtimeAccessBarrier.
  • output warning message if off-heap is enabled in gcpolicy:metronome.

depends on : #20648

@LinHu2016 LinHu2016 force-pushed the off-heap-incremental8 branch from a347839 to 028341a Compare November 20, 2024 23:15
@amicic amicic added the comp:gc label Nov 21, 2024
bool shouldCopy = false;
if((javaVM->runtimeFlags & J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) == J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) {
if ((vmThread->javaVM->runtimeFlags & J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) == J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please put constant first
if (J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL == ((vmThread->javaVM->runtimeFlags & J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL))

}
}
vmThread->jniCriticalCopyCount += 1;
arrayObject = (J9IndexableObject *)J9_JNI_UNWRAP_REFERENCE(array);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have this call already in line 452?

Copy link
Contributor

@amicic amicic Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a general case, object might have moved while not having VM access yet, so we have to re-read the address after acquiring VM access
but in RT, object don't move, so this indeed is unnecessary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thank you for clarification

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GC could happens between, we need reload the reference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see Aleks comment above - "in RT, object don't move, so this indeed is unnecessary"

VM_VMAccess::inlineExitVMToJNI(vmThread);
} else {
// acquire access and return a direct pointer
MM_JNICriticalRegion::enterCriticalRegion(vmThread, false);
arrayObject = (J9IndexableObject *)J9_JNI_UNWRAP_REFERENCE(array);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same, see line 452.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GC could happens between, we need reload the reference.

bool shouldCopy = false;
if((javaVM->runtimeFlags & J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) == J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) {
if ((vmThread->javaVM->runtimeFlags & J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) == J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const part first please

Assert_MM_invalidJNICall();
}

arrayObject = (J9IndexableObject *)J9_JNI_UNWRAP_REFERENCE(array);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate, see line 481

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same above

@LinHu2016 LinHu2016 force-pushed the off-heap-incremental8 branch 3 times, most recently from dd82ae1 to 9fdac8d Compare November 21, 2024 16:08
@dmitripivkine
Copy link
Contributor

Jenkins test sanity AIX jdk11

@LinHu2016 LinHu2016 force-pushed the off-heap-incremental8 branch from 9fdac8d to f162fb8 Compare November 21, 2024 16:22
 - Update RealtimeAccessBarrier to use opyArrayCritical,
  copyBackArrayCritical, copyStringCritical and freeStringCritical
  common functions (in ObjectAccessBarrier baseclass) to replace
  similar code in class RealtimeAccessBarrier.
 - output warning message if off-heap is enabled in gcpolicy:metronome.

Signed-off-by: lhu <[email protected]>
@LinHu2016 LinHu2016 force-pushed the off-heap-incremental8 branch from f162fb8 to 7411dc0 Compare November 21, 2024 17:09
@amicic
Copy link
Contributor

amicic commented Nov 21, 2024

Jenkins test sanity AIX jdk11

@dmitripivkine dmitripivkine merged commit c37c7fc into eclipse-openj9:master Nov 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants