Path: utzoo!attcan!uunet!cs.utexas.edu!rice!titan.rice.edu!preston From: preston@titan.rice.edu (Preston Briggs) Newsgroups: comp.arch Subject: Re: Inlining subroutines at link time Message-ID: <9629@brazos.Rice.edu> Date: 4 Jul 90 20:26:59 GMT Sender: root@rice.edu Organization: Rice University, Houston Lines: 31 Replying to many people at once... Riordan asked opinions on inlining at link time. Since it's at link time, I assume (!) the linker simply substitutes the procedure body (minus the return) for the call instruction. Hence, 2 instructions saved. Arguments would still be passed in registers or on the stack and registers would be saved and restored as usual. More complex schemes would (possibly) be too complex and expensive for link-time. At any rate, that's all that was promised by his manual. I suggested it was a small savings, especially for Fortran. I didn't mean a dig at Fortran. I meant that since a Fortran routine often represents a fair amount of FP computation, 2 branches aren't going to count. For a languages with many smaller routines, I'd expect more significant improvements. Paging effects and I-cache effects are difficult to determine in advance. You get better locality with inlining, but you also get bulkier code. Consider also the effect of inlining a very small routine (a favorite choice). With the non-inlined version, the routine might remain in cache (or paged in) for extended periods, perhaps being called from many different call sites. In the inlined case, each call site would have it's own copy and require more cache lines or pages. Best seems to be experimentation with your own . -- Preston Briggs looking for the great leap forward preston@titan.rice.edu