-
Notifications
You must be signed in to change notification settings - Fork 729
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
FFI Upcall: Recognizing certain unions as J9_FFI_UPCALL_SIG_TYPE_STRUCT_AGGREGATE_ALL_SP
is inconsistent with z/OS ABI
#19952
Labels
Comments
ChengJin01
added
comp:vm
project:panama
Used to track Project Panama related work
os:zos
labels
Jul 31, 2024
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 19, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 23, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 23, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 24, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 24, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 24, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 26, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 26, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
ChengJin01
pushed a commit
to ChengJin01/openj9
that referenced
this issue
Aug 26, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
rmnattas
pushed a commit
to rmnattas/openj9
that referenced
this issue
Sep 5, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
luke-li-2003
pushed a commit
to luke-li-2003/openj9
that referenced
this issue
Sep 23, 2024
The changes resolve the issue with the register mapping for the struct FF/DD or its variants in upcall on z/OS by categorizing them into ALL_SP/ALL_DP placed on FPRs while other non-complex type are categorized into AGGREGATE_OTHER placed on GPRs. Fixes: eclipse-openj9#19952 Signed-off-by: ChengJin01 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As part of the FFI Upcall implementation work, I have encountered a scenario where certain unions get mapped to what z/OS calls "complex" types.
Background
As per z/OS ABI, all struct arguments except for the following cases below are passed in GPRs.
To put it another way, all struct arguments are passed in GPRs except for the following two:
struct{float, float}
// size is always 8 bytesstruct{double, double}
// size is always 16 bytesFFI recognizes type of structure's datatype as:
J9_FFI_UPCALL_SIG_TYPE_STRUCT_AGGREGATE_ALL_SP
/J9_FFI_UPCALL_SIG_TYPE_STRUCT_AGGREGATE_ALL_DP
. We can then check the size of the argument to see if one of the above two cases is encountered. If that case is encountered, then we must access arguments from FPRs instead of GPRs.There is however another scenario where FFI will recognize a struct with datatype
J9_FFI_UPCALL_SIG_TYPE_STRUCT_AGGREGATE_ALL_SP
/J9_FFI_UPCALL_SIG_TYPE_STRUCT_AGGREGATE_ALL_DP
. This struct will also have a size of 8 forfloat
elements, and 16 fordouble
elements. That struct looks like below:This union also has size 8. Unions are passed in GPRs as per the z/OS ABI. So if the above union is recognized as
J9_FFI_UPCALL_SIG_TYPE_STRUCT_AGGREGATE_ALL_SP
, then the upcall thunk routine can't differentiate between a struct argument with 2 elements (passed in FPRs) and a union with size = 8 (passed in GPRs).As a solution, we propose to recognize the above union as
J9_FFI_UPCALL_SIG_TYPE_STRUCT_AGGREGATE_MISC
. In fact, all unions will be passed in GPRs, so they can all be recognized as that type from the perspective of the FFI Upcall routine on z/OS.Searching around, I think this would be the place to make the change:
openj9/runtime/vm/LayoutFFITypeHelpers.hpp
Lines 402 to 441 in 07797d6
The text was updated successfully, but these errors were encountered: