"Dmitry Olshansky" <[email protected]> wrote in message news:[email protected]... > > The refinement is merging prefixes and suffixes of course. > And for that one needs to calculate hashes for all of prefixes and all of > suffixes. I will define _all_ later on. >
I think you'll find that this is better done in the compiler instead of the linker. Merging prefixes is problematic because at some point you will need to work out which tail to execute, so you'll always need to modify the generated code. Merging suffixes is easier, you can merge all returning blocks with identical code, and then merge all blocks that always jump to the same blocks, etc. This will need to happen after code generation if you want to merge int/uint code, which would be difficult in dmd's back end. Merging functions with identical bodies is of course much easier, and can be done in the linker without needing to modify any code (just the relocations).
