Skip to content

Commit

Permalink
[FFI/Jtreg_JDK22] Change the value of the heap address identifier
Browse files Browse the repository at this point in the history
The tiny changes modify the constant used to
identify the heap address in downcall to avoid
any potential conflict with the address value
passed to downcall.

Fixes: eclipse-openj9#18999

Signed-off-by: ChengJin01 <[email protected]>
  • Loading branch information
ChengJin01 committed Feb 23, 2024
1 parent aac21a2 commit b5015d9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class InternalDowncallHandler {
/* The identifier denotes the passed-in argument is a heap segment which helps
* extract the address from the heap argument's base object in native.
*/
private static final long DOWNCALL_HEAP_ARGUMENT_ID = 0x1;
private static final long DOWNCALL_HEAP_ARGUMENT_ID = 0xFFFFFFFFFFFFFFFFL;

/* The ThreadLocal holds the information of the heap argument which includes
* the base object array, the offset array plus the current heap argument index
Expand Down
2 changes: 1 addition & 1 deletion runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -6063,7 +6063,7 @@ typedef struct J9JavaVM {

#if JAVA_SPEC_VERSION >= 16
#if JAVA_SPEC_VERSION >= 22
#define J9_FFI_DOWNCALL_HEAP_ARGUMENT_ID 0x1
#define J9_FFI_DOWNCALL_HEAP_ARGUMENT_ID J9CONST_U64(0xFFFFFFFFFFFFFFFF)
#endif /* JAVA_SPEC_VERSION >= 22 */

/* The mask for the signature type identifier */
Expand Down
2 changes: 1 addition & 1 deletion runtime/vm/BytecodeInterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5288,7 +5288,7 @@ class INTERPRETER_CLASS
/* ffi_call expects the address of the pointer is the address of the stackslot. */
pointerValues[i] = (U_64)ffiArgs[i];
#if JAVA_SPEC_VERSION >= 22
if ((U_64)J9_FFI_DOWNCALL_HEAP_ARGUMENT_ID == pointerValues[i]) {
if (J9_FFI_DOWNCALL_HEAP_ARGUMENT_ID == pointerValues[i]) {
j9object_t heapBase = (j9object_t)J9JAVAARRAYOFOBJECT_LOAD(
_currentThread,
J9_JNI_UNWRAP_REFERENCE(_sp + 11), /* The heap base array. */
Expand Down

0 comments on commit b5015d9

Please sign in to comment.