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

[Core] Enhance jni signature with a more readable way #5890

Open
Donvi opened this issue May 28, 2024 · 1 comment
Open

[Core] Enhance jni signature with a more readable way #5890

Donvi opened this issue May 28, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Donvi
Copy link
Contributor

Donvi commented May 28, 2024

Description

Current the method signature is set with current plain text, which is not so good to maintain and read like "(J[J[II[B)V" and confusing for onboarding and in maintenance.
The signature is generated by the parameter type list and the return value type.
A better way is like below :

  1. Build a map from type, which is via typeid in cpp, to signature
  2. Create a method to generate the signature by the parameters type list and return type
  3. Update the getMethodIdOrError from current signature to the parameter list and return type and call the method above
  4. To make the above more readable and a better comprehensibility and encapsulation, we can declare a series variables to show the detailed meaning and pass it to the getMethodIdOrError.
  5. Currently a draft PR for 1 and 2 are https://github.com/apache/incubator-gluten/pull/5888/files. I'll update the PR for step 3 and 4.
    cc: @zhouyuan , @zhztheplayer , @FelixYBW
@Donvi Donvi added the enhancement New feature or request label May 28, 2024
@Donvi
Copy link
Contributor Author

Donvi commented May 28, 2024

A good example is splitResultConstructor, which seems not matched with java definition.
There are 6 long variables in its java code, while the signature contains 7.

@zhli1142015 zhli1142015 changed the title The optimization for the method signature [Core] The optimization for the method signature May 28, 2024
@zhli1142015 zhli1142015 changed the title [Core] The optimization for the method signature [Core] Optimize JNI method signatures May 28, 2024
@zhli1142015 zhli1142015 changed the title [Core] Optimize JNI method signatures [Core] Enhance jni signature with a more readable way May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant