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

Update reflector to support faster invocation methods (e.g. invokevirtual) #8875

Open
hoisie opened this issue Feb 26, 2024 · 3 comments
Open

Comments

@hoisie
Copy link
Contributor

hoisie commented Feb 26, 2024

There are some calls in reflector that do not necessarily need to use reflection.

For instance, if we are trying to invoke a public but hidden API from an older version of Android, in theory reflector can codegen invokevirtual method calls instead of using reflection.

This may be an edge case but it could be interesting to explore.

Perhaps there could be yet another annotation, e.g. @InvokeWith("invokevirtual") to provide reflector a hint.

@hoisie hoisie changed the title Update reflector to support faster invocation (e.g. invokevirtual) Update reflector to support faster invocation methods (e.g. invokevirtual) Feb 26, 2024
@shashankiitbhu
Copy link

@hoisie I think Introducing annotation, @InvokeWith, that allows specifying the desired invocation strategy would enable us to bypass reflection in favor of direct method calls when interacting with APIs that are public but hidden, particularly in older versions of Android.

I have done some preliminary work on this and looking for your feedback and guidance on this:
-> Created a New "InvokeWith" annotation
Screenshot 2024-03-14 at 5 02 49 AM

-> Made some Adjustments to ReflectorClassWriter
Screenshot 2024-03-14 at 5 17 59 AM

Am I going in right direction here ?

@hoisie
Copy link
Contributor Author

hoisie commented Mar 14, 2024

@shashankiitbhu I do like the potential of something like @InvokeWith("invokevirtual"). Seems like that approach could work. Feel free to email me (my email is in git commit history) if you would like to work on this.

@shashankiitbhu
Copy link

@hoisie sent you a mail from shashank.kumar.phe22@itbhu.ac.in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants