Allow --keepfuncs and --splitfuncs to be use alongside a profile data
There are times after collecting a profile, we wish to manually include specific functions into the primary module. It could be due to non-deterministic profiling or functions for error scenarios (e.g. _trap).
This PR helps to unlock this workflow by honoring both the --keep-funcs flag as well as the --profile flag
@tlively Can you see if this is a suitable improvement that we can include for wasm-split?
If so, do we wish to expand it to the --split-funcs flag as well?
This makes sense to me! I think we do want to extend it to the --split-funcs flag as well. That way the user can explicitly keep some functions, explicitly split some functions, and depend on the profile to decide what to do for the rest. It would also be good to report a warning if the profile contradicts --split-funcs.
Thanks!
I've expanded this usage to the --split-funcs flag as well. The functions in --split-funcs will supersede the other split options and show a warning if it contradicts with the profile data or the keep-funcs
@tlively Thanks for your review and the comments! Could you help me see if there's anything else I should add in this PR?
@tlively Fixed comment and the newline at the eof.
Looks like there are some formatting issues to fix. You can ignore the failing Emscripten tests, though.
@tlively sorry for the delayed response. I'm still interested to get this in if possible. I'll need some help to trigger the CI so that I can look at the errors
I restarted the tests now.
I've attempted to fix the linting and the test failures. Please help to trigger the CI again 🙏
@tlively @kripken 1 last trigger I hope, before we can land this PR
(tests restarted)