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

Add implementation for new JNI functions in Valhalla #19460

Open
hangshao0 opened this issue May 7, 2024 · 1 comment
Open

Add implementation for new JNI functions in Valhalla #19460

hangshao0 opened this issue May 7, 2024 · 1 comment
Labels
comp:vm project:valhalla Used to track Project Valhalla related work

Comments

@hangshao0
Copy link
Contributor

There are 3 new JNI functions added in Valhalla:

JNIEXPORT jboolean JNICALL
JVM_IsImplicitlyConstructibleClass(JNIEnv *env, jclass cls)

JNIEXPORT jboolean JNICALL
JVM_IsNullRestrictedArray(JNIEnv *env, jobject obj)

JNIEXPORT jarray JNICALL
JVM_NewNullRestrictedArray(JNIEnv *env, jclass cls, jint length)

OpenJ9 needs to add implementation for them.

  1. Support for JVM_IsImplicitlyConstructibleClass()
    We just need to check the ImplicitCreation attribute added in New ImplicitCreation Attribute in project Valhalla #17234

  2. Support for JVM_IsNullRestrictedArray() and JVM_NewNullRestrictedArray()
    Currently, each J9Class has a pointer to its arrayClass and J9arrayClass has a pointer to leafComponentType.
    We need to create 2 array classes for null-restricted value type. One nullable array class and one null restricted array class. The exiting J9Class->arrayClass can be used as nullable arrayClass. We can create a new field in J9Class called nullrestrictedArrayClass, and let it point to null restricted array class(which is created by JVM_NewNullRestrictedArray()). We can use a bit in J9ArrayClass->classFlags to indicate if it is null restricted array (prohibiting storing null to its element). The implementation of JVM_IsNullRestrictedArray() can check this bit. The implementation of JVM_NewNullRestrictedArray() might follow the example JVM_NewArray().

@hangshao0 hangshao0 added comp:vm project:valhalla Used to track Project Valhalla related work labels May 7, 2024
@hangshao0
Copy link
Contributor Author

@theresa-m

theresa-m added a commit to theresa-m/openj9 that referenced this issue May 30, 2024
This change is needed to support @ImplicitlyConstructible and @NullRestricted annotations for functional tests. See eclipse-openj9#19459

In this change:
- J9ROMCLASS_IS_VALUE macro checks for ACC_IDENTITY flag instead of ACC_VALUE
- Remove J9AccValueType from codebase

There is more work to be done to fully remove ACC_VALUE (eclipse-openj9#18829) such as removing CFR_ACC_VALUE and adding runtime class file verification checks. Because functional value type tests are not able to run currently due to a recent update of the extensions repository I am making just a few changes toward getting those working.

I am also removing the assert in JVM_IsNullRestrictedArray which is triggered when building OpenJ9. This method can't be implemented right now because OpenJ9 doesn't have support for null restricted arrays yet. See eclipse-openj9#17340 eclipse-openj9#19460
theresa-m added a commit to theresa-m/openj9 that referenced this issue May 30, 2024
This change is needed to support @ImplicitlyConstructible and @NullRestricted annotations for functional tests. See eclipse-openj9#19459

In this change:
- J9ROMCLASS_IS_VALUE macro checks for ACC_IDENTITY flag instead of ACC_VALUE
- Remove J9AccValueType from codebase

There is more work to be done to fully remove ACC_VALUE (eclipse-openj9#18829) such as removing CFR_ACC_VALUE and adding runtime class file verification checks. Because functional value type tests are not able to run currently due to a recent update of the extensions repository I am making just a few changes toward getting those working.

I am also removing the assert in JVM_IsNullRestrictedArray which is triggered when building OpenJ9. This method can't be implemented right now because OpenJ9 doesn't have support for null restricted arrays yet. See eclipse-openj9#17340 eclipse-openj9#19460
theresa-m added a commit to theresa-m/openj9 that referenced this issue May 30, 2024
This change is needed to support @ImplicitlyConstructible and @NullRestricted annotations for functional tests. See eclipse-openj9#19459

In this change:
- J9ROMCLASS_IS_VALUE macro checks for ACC_IDENTITY flag instead of ACC_VALUE
- Remove J9AccValueType from codebase

There is more work to be done to fully remove ACC_VALUE (eclipse-openj9#18829) such as removing CFR_ACC_VALUE and adding runtime class file verification checks. Because functional value type tests are not able to run currently due to a recent update of the extensions repository I am making just a few changes toward getting those working.

I am also removing the assert in JVM_IsNullRestrictedArray which is triggered when building OpenJ9. This method can't be implemented right now because OpenJ9 doesn't have support for null restricted arrays yet. See eclipse-openj9#17340 eclipse-openj9#19460
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm project:valhalla Used to track Project Valhalla related work
Projects
None yet
Development

No branches or pull requests

1 participant