Skip to content

Commit

Permalink
Merge pull request #15310 from ChengJin01/enable_ffi_downcall_upcall_…
Browse files Browse the repository at this point in the history
…tests_jdk17_18_19

Enable downcall & upcall test suites for Java 17/18/19
  • Loading branch information
tajila committed Oct 5, 2022
2 parents 96fe9b8 + c3b12b5 commit 8faf666
Show file tree
Hide file tree
Showing 74 changed files with 40,161 additions and 1,349 deletions.
244 changes: 241 additions & 3 deletions runtime/tests/clinkerffi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
set(OMR_ENHANCED_WARNINGS OFF)
j9vm_add_library(clinkerffitests SHARED
downcall.c
upcall.c
valist.c
)
target_link_libraries(clinkerffitests
PRIVATE
Expand All @@ -42,9 +44,6 @@ omr_add_exports(clinkerffitests
add2Longs
add2Floats
add2Doubles
addIntsFromVaList
addLongsFromVaList
addDoublesFromVaList
addIntAndIntFromPointer
addBoolAndBoolFromPointerWithOr
createNewCharFromCharAndCharFromPointer
Expand Down Expand Up @@ -165,6 +164,245 @@ omr_add_exports(clinkerffitests
add2DoubleStructs_returnStruct
add2DoubleStructs_returnStructPointer
add3DoubleStructs_returnStruct
add2BoolsWithOrByUpcallMH
addBoolAndBoolFromPointerWithOrByUpcallMH
addBoolAndBoolFromNativePtrWithOrByUpcallMH
addBoolAndBoolFromPtrWithOr_RetPtr_ByUpcallMH
createNewCharFrom2CharsByUpcallMH
createNewCharFromCharAndCharFromPointerByUpcallMH
createNewCharFromCharAndCharFromNativePtrByUpcallMH
createNewCharFromCharAndCharFromPtr_RetPtr_ByUpcallMH
add2BytesByUpcallMH
addByteAndByteFromPointerByUpcallMH
addByteAndByteFromNativePtrByUpcallMH
addByteAndByteFromPtr_RetPtr_ByUpcallMH
add2ShortsByUpcallMH
addShortAndShortFromPointerByUpcallMH
addShortAndShortFromNativePtrByUpcallMH
addShortAndShortFromPtr_RetPtr_ByUpcallMH
add2IntsByUpcallMH
addIntAndIntFromPointerByUpcallMH
addIntAndIntFromNativePtrByUpcallMH
addIntAndIntFromPtr_RetPtr_ByUpcallMH
add3IntsByUpcallMH
addIntAndCharByUpcallMH
add2IntsReturnVoidByUpcallMH
add2LongsByUpcallMH
addLongAndLongFromPointerByUpcallMH
addLongAndLongFromNativePtrByUpcallMH
addLongAndLongFromPtr_RetPtr_ByUpcallMH
add2FloatsByUpcallMH
addFloatAndFloatFromPointerByUpcallMH
addFloatAndFloatFromNativePtrByUpcallMH
addFloatAndFloatFromPtr_RetPtr_ByUpcallMH
add2DoublesByUpcallMH
addDoubleAndDoubleFromPointerByUpcallMH
addDoubleAndDoubleFromNativePtrByUpcallMH
addDoubleAndDoubleFromPtr_RetPtr_ByUpcallMH
addBoolAndBoolsFromStructWithXorByUpcallMH
addBoolAnd20BoolsFromStructWithXorByUpcallMH
addBoolFromPointerAndBoolsFromStructWithXorByUpcallMH
addBoolFromPointerAndBoolsFromStructWithXor_returnBoolPointerByUpcallMH
addBoolAndBoolsFromStructPointerWithXorByUpcallMH
addBoolAndBoolsFromNestedStructWithXorByUpcallMH
addBoolAndBoolsFromNestedStructWithXor_reverseOrderByUpcallMH
addBoolAndBoolsFromStructWithNestedBoolArrayByUpcallMH
addBoolAndBoolsFromStructWithNestedBoolArray_reverseOrderByUpcallMH
addBoolAndBoolsFromStructWithNestedStructArrayByUpcallMH
addBoolAndBoolsFromStructWithNestedStructArray_reverseOrderByUpcallMH
add2BoolStructsWithXor_returnStructByUpcallMH
add2BoolStructsWithXor_returnStructPointerByUpcallMH
add3BoolStructsWithXor_returnStructByUpcallMH
addByteAndBytesFromStructByUpcallMH
addByteAnd20BytesFromStructByUpcallMH
addByteFromPointerAndBytesFromStructByUpcallMH
addByteFromPointerAndBytesFromStruct_returnBytePointerByUpcallMH
addByteAndBytesFromStructPointerByUpcallMH
addByteAndBytesFromNestedStructByUpcallMH
addByteAndBytesFromNestedStruct_reverseOrderByUpcallMH
addByteAndBytesFromStructWithNestedByteArrayByUpcallMH
addByteAndBytesFromStructWithNestedByteArray_reverseOrderByUpcallMH
addByteAndBytesFromStructWithNestedStructArrayByUpcallMH
addByteAndBytesFromStructWithNestedStructArray_reverseOrderByUpcallMH
add1ByteStructs_returnStructByUpcallMH
add2ByteStructs_returnStructByUpcallMH
add2ByteStructs_returnStructPointerByUpcallMH
add3ByteStructs_returnStructByUpcallMH
addCharAndCharsFromStructByUpcallMH
addCharFromPointerAndCharsFromStructByUpcallMH
addCharFromPointerAndCharsFromStruct_returnCharPointerByUpcallMH
addCharAndCharsFromStructPointerByUpcallMH
addCharAndCharsFromNestedStructByUpcallMH
addCharAnd10CharsFromStructByUpcallMH
addCharAndCharsFromNestedStruct_reverseOrderByUpcallMH
addCharAndCharsFromStructWithNestedCharArrayByUpcallMH
addCharAndCharsFromStructWithNestedCharArray_reverseOrderByUpcallMH
addCharAndCharsFromStructWithNestedStructArrayByUpcallMH
addCharAndCharsFromStructWithNestedStructArray_reverseOrderByUpcallMH
add2CharStructs_returnStructByUpcallMH
add2CharStructs_returnStructPointerByUpcallMH
add3CharStructs_returnStructByUpcallMH
addShortAndShortsFromStructByUpcallMH
addShortAnd10ShortsFromStructByUpcallMH
addShortFromPointerAndShortsFromStructByUpcallMH
addShortFromPointerAndShortsFromStruct_returnShortPointerByUpcallMH
addShortAndShortsFromStructPointerByUpcallMH
addShortAndShortsFromNestedStructByUpcallMH
addShortAndShortsFromNestedStruct_reverseOrderByUpcallMH
addShortAndShortsFromStructWithNestedShortArrayByUpcallMH
addShortAndShortsFromStructWithNestedShortArray_reverseOrderByUpcallMH
addShortAndShortsFromStructWithNestedStructArrayByUpcallMH
addShortAndShortsFromStructWithNestedStructArray_reverseOrderByUpcallMH
add2ShortStructs_returnStructByUpcallMH
add2ShortStructs_returnStructPointerByUpcallMH
add3ShortStructs_returnStructByUpcallMH
addIntAndIntsFromStructByUpcallMH
addIntAnd5IntsFromStructByUpcallMH
addIntFromPointerAndIntsFromStructByUpcallMH
addIntFromPointerAndIntsFromStruct_returnIntPointerByUpcallMH
addIntAndIntsFromStructPointerByUpcallMH
addIntAndIntsFromNestedStructByUpcallMH
addIntAndIntsFromNestedStruct_reverseOrderByUpcallMH
addIntAndIntsFromStructWithNestedIntArrayByUpcallMH
addIntAndIntsFromStructWithNestedIntArray_reverseOrderByUpcallMH
addIntAndIntsFromStructWithNestedStructArrayByUpcallMH
addIntAndIntsFromStructWithNestedStructArray_reverseOrderByUpcallMH
add2IntStructs_returnStructByUpcallMH
add2IntStructs_returnStructPointerByUpcallMH
add3IntStructs_returnStructByUpcallMH
addLongAndLongsFromStructByUpcallMH
addLongFromPointerAndLongsFromStructByUpcallMH
addLongFromPointerAndLongsFromStruct_returnLongPointerByUpcallMH
addLongAndLongsFromStructPointerByUpcallMH
addLongAndLongsFromNestedStructByUpcallMH
addLongAndLongsFromNestedStruct_reverseOrderByUpcallMH
addLongAndLongsFromStructWithNestedLongArrayByUpcallMH
addLongAndLongsFromStructWithNestedLongArray_reverseOrderByUpcallMH
addLongAndLongsFromStructWithNestedStructArrayByUpcallMH
addLongAndLongsFromStructWithNestedStructArray_reverseOrderByUpcallMH
add2LongStructs_returnStructByUpcallMH
add2LongStructs_returnStructPointerByUpcallMH
add3LongStructs_returnStructByUpcallMH
addFloatAndFloatsFromStructByUpcallMH
addFloatAnd5FloatsFromStructByUpcallMH
addFloatFromPointerAndFloatsFromStructByUpcallMH
addFloatFromPointerAndFloatsFromStruct_returnFloatPointerByUpcallMH
addFloatAndFloatsFromStructPointerByUpcallMH
addFloatAndFloatsFromNestedStructByUpcallMH
addFloatAndFloatsFromNestedStruct_reverseOrderByUpcallMH
addFloatAndFloatsFromStructWithNestedFloatArrayByUpcallMH
addFloatAndFloatsFromStructWithNestedFloatArray_reverseOrderByUpcallMH
addFloatAndFloatsFromStructWithNestedStructArrayByUpcallMH
addFloatAndFloatsFromStructWithNestedStructArray_reverseOrderByUpcallMH
add2FloatStructs_returnStructByUpcallMH
add2FloatStructs_returnStructPointerByUpcallMH
add3FloatStructs_returnStructByUpcallMH
addDoubleAndDoublesFromStructByUpcallMH
addDoubleFromPointerAndDoublesFromStructByUpcallMH
addDoubleFromPointerAndDoublesFromStruct_returnDoublePointerByUpcallMH
addDoubleAndDoublesFromStructPointerByUpcallMH
addDoubleAndDoublesFromNestedStructByUpcallMH
addDoubleAndDoublesFromNestedStruct_reverseOrderByUpcallMH
addDoubleAndDoublesFromStructWithNestedDoubleArrayByUpcallMH
addDoubleAndDoublesFromStructWithNestedDoubleArray_reverseOrderByUpcallMH
addDoubleAndDoublesFromStructWithNestedStructArrayByUpcallMH
addDoubleAndDoublesFromStructWithNestedStructArray_reverseOrderByUpcallMH
add2DoubleStructs_returnStructByUpcallMH
add2DoubleStructs_returnStructPointerByUpcallMH
add3DoubleStructs_returnStructByUpcallMH
addIntAndIntShortFromStructByUpcallMH
addIntAndShortIntFromStructByUpcallMH
addIntAndIntLongFromStructByUpcallMH
addIntAndLongIntFromStructByUpcallMH
addDoubleAndDoubleIntFromStructByUpcallMH
addDoubleAndIntDoubleFromStructByUpcallMH
addDoubleAndFloatDoubleFromStructByUpcallMH
addDoubleAndDoubleFloatFromStructByUpcallMH
addDoubleAnd2FloatsDoubleFromStructByUpcallMH
addDoubleAndDouble2FloatsFromStructByUpcallMH
addFloatAndInt2FloatsFromStructByUpcallMH
addFloatAndFloatIntFloatFromStructByUpcallMH
addDoubleAndIntFloatDoubleFromStructByUpcallMH
addDoubleAndFloatIntDoubleFromStructByUpcallMH
addDoubleAndLongDoubleFromStructByUpcallMH
addFloatAndInt3FloatsFromStructByUpcallMH
addLongAndLong2FloatsFromStructByUpcallMH
addFloatAnd3FloatsIntFromStructByUpcallMH
addLongAndFloatLongFromStructByUpcallMH
addDoubleAndDoubleFloatIntFromStructByUpcallMH
addDoubleAndDoubleLongFromStructByUpcallMH
addLongAnd2FloatsLongFromStructByUpcallMH
addShortAnd3ShortsCharFromStructByUpcallMH
addFloatAndIntFloatIntFloatFromStructByUpcallMH
addDoubleAndIntDoubleFloatFromStructByUpcallMH
addDoubleAndFloatDoubleIntFromStructByUpcallMH
addDoubleAndIntDoubleIntFromStructByUpcallMH
addDoubleAndFloatDoubleFloatFromStructByUpcallMH
addDoubleAndIntDoubleLongFromStructByUpcallMH
return254BytesFromStructByUpcallMH
return4KBytesFromStructByUpcallMH
addIntsFromVaList
addLongsFromVaList
addDoublesFromVaList
addMixedArgsFromVaList
addMoreMixedArgsFromVaList
addIntsByPtrFromVaList
addLongsByPtrFromVaList
addDoublesByPtrFromVaList
add1ByteOfStructsFromVaList
add2BytesOfStructsFromVaList
add3BytesOfStructsFromVaList
add5BytesOfStructsFromVaList
add7BytesOfStructsFromVaList
add1ShortOfStructsFromVaList
add2ShortsOfStructsFromVaList
add3ShortsOfStructsFromVaList
add1IntOfStructsFromVaList
add2IntsOfStructsFromVaList
add3IntsOfStructsFromVaList
add2LongsOfStructsFromVaList
add1FloatOfStructsFromVaList
add2FloatsOfStructsFromVaList
add3FloatsOfStructsFromVaList
add1DoubleOfStructsFromVaList
add2DoublesOfStructsFromVaList
addIntShortOfStructsFromVaList
addShortIntOfStructsFromVaList
addIntLongOfStructsFromVaList
addLongIntOfStructsFromVaList
addFloatDoubleOfStructsFromVaList
addDoubleFloatOfStructsFromVaList
addIntsFromVaListByUpcallMH
addLongsFromVaListByUpcallMH
addDoublesFromVaListByUpcallMH
addMixedArgsFromVaListByUpcallMH
addMoreMixedArgsFromVaListByUpcallMH
addIntsByPtrFromVaListByUpcallMH
addLongsByPtrFromVaListByUpcallMH
addDoublesByPtrFromVaListByUpcallMH
add1ByteOfStructsFromVaListByUpcallMH
add2BytesOfStructsFromVaListByUpcallMH
add3BytesOfStructsFromVaListByUpcallMH
add5BytesOfStructsFromVaListByUpcallMH
add7BytesOfStructsFromVaListByUpcallMH
add1ShortOfStructsFromVaListByUpcallMH
add2ShortsOfStructsFromVaListByUpcallMH
add3ShortsOfStructsFromVaListByUpcallMH
add1IntOfStructsFromVaListByUpcallMH
add2IntsOfStructsFromVaListByUpcallMH
add3IntsOfStructsFromVaListByUpcallMH
add2LongsOfStructsFromVaListByUpcallMH
add1FloatOfStructsFromVaListByUpcallMH
add2FloatsOfStructsFromVaListByUpcallMH
add3FloatsOfStructsFromVaListByUpcallMH
add1DoubleOfStructsFromVaListByUpcallMH
add2DoublesOfStructsFromVaListByUpcallMH
addIntShortOfStructsFromVaListByUpcallMH
addShortIntOfStructsFromVaListByUpcallMH
addIntLongOfStructsFromVaListByUpcallMH
addLongIntOfStructsFromVaListByUpcallMH
addFloatDoubleOfStructsFromVaListByUpcallMH
addDoubleFloatOfStructsFromVaListByUpcallMH
)

install(
Expand Down
63 changes: 6 additions & 57 deletions runtime/tests/clinkerffi/downcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
*******************************************************************************/

/**
* This file contains the native code used by the test cases in
* org.openj9.test.jep389.downcall via a Clinker FFI DownCall.
* This file contains the native code used by the test cases via a Clinker FFI DownCall in java,
* which come from:
* org.openj9.test.jep389.downcall (JDK16/17)
* org.openj9.test.jep419.downcall (JDK18)
* org.openj9.test.jep424.downcall (JDK19+)
*
* Created by jincheng@ca.ibm.com
*/
Expand Down Expand Up @@ -72,24 +75,6 @@ add3Ints(int intArg1, int intArg2, int intArg3)
return intSum;
}

/**
* Add integers from the va_list with the specified count
*
* @param intCount the count of the integers
* @param intArgList the integer va_list
* @return the sum of integers from the va_list
*/
int
addIntsFromVaList(int intCount, va_list intVaList)
{
int intSum = 0;
while (intCount > 0) {
intSum += va_arg(intVaList, int);
intCount--;
}
return intSum;
}

/**
* Add an integer and a character.
*
Expand Down Expand Up @@ -267,24 +252,6 @@ addLongAndLongFromPointer(LONG *longArg1, LONG longArg2)
return longSum;
}

/**
* Add long integers from the va_list with the specified count
*
* @param longCount the count of the long integers
* @param longArgList the long va_list
* @return the sum of long integers from the va_list
*/
LONG
addLongsFromVaList(int longCount, va_list longVaList)
{
LONG longSum = 0;
while (longCount > 0) {
longSum += va_arg(longVaList, LONG);
longCount--;
}
return longSum;
}

/**
* Add two floats.
*
Expand Down Expand Up @@ -341,24 +308,6 @@ addDoubleAndDoubleFromPointer(double *doubleArg1, double doubleArg2)
return doubleSum;
}

/**
* Add doubles from the va_list with the specified count
*
* @param doubleCount the count of the double arguments
* @param doubleArgList the double va_list
* @return the sum of doubles from the va_list
*/
double
addDoublesFromVaList(int doubleCount, va_list doubleVaList)
{
double doubleSum = 0;
while (doubleCount > 0) {
doubleSum += va_arg(doubleVaList, double);
doubleCount--;
}
return doubleSum;
}

/**
* Add a boolean and all boolean elements of a struct with the XOR (^) operator.
*
Expand Down Expand Up @@ -1255,7 +1204,7 @@ addIntAndIntsFromNestedStruct(int arg1, stru_NestedStruct_Int arg2)
*
* @param arg1 an integer
* @param arg2 a struct with an integer and a nested struct
* @return the sum of these ints
* @return the sum of these integers
*/
int
addIntAndIntsFromNestedStruct_reverseOrder(int arg1, stru_Int_NestedStruct arg2)
Expand Down

0 comments on commit 8faf666

Please sign in to comment.