Move Intermediate Dynamic-dispatch OUT; the name is obtained by applying
the infamous middle-out algorithm on the word
midout.hin the source code and mark removable regions with
- Compile the whole project with macro
- Execute the program on possible inputs to gather trace information on used
blocks. The trace would be written to
midout_trace.<pid>by default, and this output name can be changed via the environment variable
- Generate midout header file by
- Recompile the project and ensure that the header generated in the previous
step is included before
midout.h. Remember to enable LTO.
- Now all the blocks marked in step 1 that are not executed in step 3 have been removed from the final executable; if any of them is indeed used at runtime, a trap would be triggered.
run.sh for a concrete example.