Jump to content
Posted 21 July 2012 - 04:02 AM
Posted 21 July 2012 - 05:15 AM
Posted 21 July 2012 - 02:09 PM
Assuming you don't have the latter what source code solutions are available to allow for inlining? On a related note, I once read somewhere that if you inline (put implementation in class definition) the compiler will inline the object code, is this true? (I didn't believe it)
A bigger deal is that any optimisations done by the compiler are restricted to that translation unit (e.g. the compiler can't inline a function that's implemented in a different translation unit). However, modern compilers support Link Time Code Generation and Whole Program Optimization, which allows the linking step to act like an optimising compiler and re-write code after/during linking.
Posted 21 July 2012 - 02:33 PM
Just to be sure you are saying a set of instructions (2 or 3) to execute a branch can be rewritten to a single branch instruction (or moreover a branch instruction of size X can be changed to a branch instruction of size Y) and then all the branch targets after said branch will be updated and then all branches in other translation units then get updated with the new branch targets. And this goes round and round till everything 'settles into place'? Wow if so i'm impressed, I never knew linkers' were that complicated.
Branches can be re-written/translated/moved/patched, as long as a 'baked' section of code has some kind of manifest/reflection data with it, describing the locations of pointer/offset values.
Posted 21 July 2012 - 09:16 PM
On a related note, I once read somewhere that if you inline (put implementation in class definition) the compiler will inline the object code, is this true? (I didn't believe it)
Posted 27 July 2012 - 08:52 PM
Edited by Zoner, 27 July 2012 - 08:52 PM.