If I discover reflective access calls with native-image-agent and with config-merge-dir
set (so I can instrument multiple inputs) is there an equivalent to config-merge-dir
to merge the trace files necessary for a modified refl to run?
@rickmoynihan I think trace files are just a vector of things, so you could just append them?
yeah was just going to say essentially that
if you have improvements to refl, feel free to raise PRs
Happy to help; but I guess the reason it’s not a library is because it’s not obvious how to extract the reusable bits from a specific build just yet
Right now I’m thinking it might be better to split the run into two phases. 1. a task to generate merged reflect configs with merge-dir set 2. a task to generate separate trace files 3. a final task that generates the cleaned config by iterating over each trace-file
correct, molding this into a library would be too soon as it's probably project-specific how to use this
:thumbsup:
I was more thinking of improvements to filtering out false positives
the merge stuff afaik isn't available in the readily available distribution
only when you build yourself with mx
?
You can use config-merge-dir
without that
The native image configure tool doesn’t appear to work without building with mx though
Though tbh I’m not entirely sure what that tool is, or what it means
but I’ve used config-merge-dir
just fine before
i.e. just set that, run the process a bunch of time with different inputs; then compile to a native image as normal with a merged reflection config; and all the reflective calls for those inputs are bottomed out properly. (With lots of false positives though — hence why I need your refl stuff! 🙂 )
@rickmoynihan but how do you merge the configs?
Simply run multiple times with this:
-agentlib:native-image-agent=config-merge-dir=nativecfg
instead of this:
-agentlib:native-image-agent=config-output-dir=nativecfg
so it just merges the existing configs in the nativecfg dir with existing ones?
I didn't know that
yup
it’s very handy
by the way I’m really enjoying using the bb task runner, it’s really, really nice! 🙇
refl made me finally bite the bullet and start using it for this project
@borkdude: FYI I’ve just modified my usage of refl to do all of the above and I can confirm it works a charm! 🎉 concat traces and merge configs. I’m going afk for a few days though; but if you’re interested I’m happy to discuss pushing back the refactorings necessary, when I’m back next week. Though it’s not really very complicated.
Mainly just moving responsibilities around
@rickmoynihan yes please :)
I think invoking the code with different main arguments will fail for some complex apps. Maybe integration with https://github.com/FieryCod/clojure-graalvm-agent-helper? I do already have the power of refl mixed graalvm-agent-helper, and the results are promising. On the other hand, maybe it's too early to automate the process since not all false positives have been discovered?
@borkdude Would you be interested in resource trimming patch?
yeah
Decided to do this, this evening, I’ve backported most of the changes I made to my project into refl for you. I’ll probably not be able to revise the PR until early next week though https://github.com/borkdude/refl/pull/2 Thanks again for everything 🙇 I hope you find this useful.