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

(0.40) Add missed check for compressed string #17661

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions runtime/gc_vlhgc/VLHGCAccessBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ MM_VLHGCAccessBarrier::jniGetStringCritical(J9VMThread* vmThread, jstring str, j
J9Object *stringObject = (J9Object*)J9_JNI_UNWRAP_REFERENCE(str);
J9IndexableObject *valueObject = (J9IndexableObject*)J9VMJAVALANGSTRING_VALUE(vmThread, stringObject);
/* If the string bytes are in compressed UNICODE, then we need to copy to decompress */
bool isCompressed = IS_STRING_COMPRESSED(vmThread, stringObject);
bool isCompressed = IS_STRING_COMPRESSION_ENABLED_VM(javaVM) && IS_STRING_COMPRESSED(vmThread, stringObject);

if (NULL != isCopy) {
*isCopy = JNI_FALSE;
Expand Down Expand Up @@ -569,7 +569,9 @@ MM_VLHGCAccessBarrier::jniReleaseStringCritical(J9VMThread* vmThread, jstring st
J9IndexableObject *valueObject = (J9IndexableObject*)J9VMJAVALANGSTRING_VALUE(vmThread, stringObject);

bool alwaysCopyInCritical = (javaVM->runtimeFlags & J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL) == J9_RUNTIME_ALWAYS_COPY_JNI_CRITICAL;
if (alwaysCopyInCritical || IS_STRING_COMPRESSION_ENABLED_VM(javaVM)) {
bool isCompressed = IS_STRING_COMPRESSION_ENABLED_VM(javaVM) && IS_STRING_COMPRESSED(vmThread, stringObject);

if (alwaysCopyInCritical || isCompressed) {
freeStringCritical(vmThread, functions, elems);
} else if (!indexableObjectModel->isInlineContiguousArraylet(valueObject)) {
/* an array having discontiguous extents can use double mapping if enabled in the critical section */
Expand Down