Fork me on GitHub
#graalvm
<
2021-06-16
>
rickmoynihan14:06:47

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?

borkdude14:06:33

@rickmoynihan I think trace files are just a vector of things, so you could just append them?

rickmoynihan14:06:46

yeah was just going to say essentially that

borkdude14:06:05

if you have improvements to refl, feel free to raise PRs

rickmoynihan14:06:56

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

rickmoynihan14:06:09

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

borkdude14:06:30

correct, molding this into a library would be too soon as it's probably project-specific how to use this

borkdude14:06:49

I was more thinking of improvements to filtering out false positives

borkdude14:06:07

the merge stuff afaik isn't available in the readily available distribution

borkdude14:06:14

only when you build yourself with mx ?

rickmoynihan14:06:34

You can use config-merge-dir without that

rickmoynihan14:06:21

The native image configure tool doesn’t appear to work without building with mx though

rickmoynihan14:06:33

Though tbh I’m not entirely sure what that tool is, or what it means

rickmoynihan14:06:56

but I’ve used config-merge-dir just fine before

rickmoynihan14:06:18

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! 🙂 )

borkdude14:06:20

@rickmoynihan but how do you merge the configs?

rickmoynihan14:06:27

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

borkdude14:06:18

so it just merges the existing configs in the nativecfg dir with existing ones?

borkdude14:06:21

I didn't know that

rickmoynihan14:06:22

it’s very handy

rickmoynihan14:06:30

by the way I’m really enjoying using the bb task runner, it’s really, really nice! 🙇

🙂 3
rickmoynihan14:06:19

refl made me finally bite the bullet and start using it for this project

rickmoynihan17:06:49

@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.

rickmoynihan17:06:36

Mainly just moving responsibilities around

borkdude17:06:01

@rickmoynihan yes please :)

👍 3
rickmoynihan23:06:31

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.

Karol Wójcik08:06:02

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?

Karol Wójcik15:06:16

@borkdude Would you be interested in resource trimming patch?