X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=doc%2Finternals%2Fcalling-convention.texinfo;h=f390521edfd1c16d97a9f62714ffaf036141794c;hb=f961fda4e87e79aacc6c61172303106d3e9522de;hp=bf5b2f37a385b04ebf0e5cf2edc5fcbc19027ea1;hpb=2973941cf214a5ea274cd0381a651ce0e1a7fab2;p=sbcl.git diff --git a/doc/internals/calling-convention.texinfo b/doc/internals/calling-convention.texinfo index bf5b2f3..f390521 100644 --- a/doc/internals/calling-convention.texinfo +++ b/doc/internals/calling-convention.texinfo @@ -119,7 +119,39 @@ frame to include sufficient space for its local variables, after possibly converting any @code{&rest} arguments to a proper list. The above scheme was changed in 1.0.27 on x86 and x86-64 by swapping -the old frame pointer and the return address. +the old frame pointer with the return address and making EBP point two +words later: + +On x86/x86-64 the stack now looks like this (stack grows downwards): + +@verbatim +---------- +RETURN PC +---------- +OLD FP +---------- <- FP points here +EMPTY SLOT +---------- +FIRST ARG +---------- +@end verbatim + +just as if the function had been CALLed and upon entry executed the +standard prologue: PUSH EBP; MOV EBP, ESP. On other architectures the +stack looks like this (stack grows upwards): + +@verbatim +---------- +FIRST ARG +---------- +EMPTY SLOT +---------- +RETURN PC +---------- +OLD FP +---------- <- FP points here +@end verbatim + @node Unknown-Values Returns @comment node-name, next, previous, up @@ -180,9 +212,11 @@ the case of an entry point for a full call). @comment node-name, next, previous, up @section Additional Notes -The low-hanging fruit here is going to be changing every call and -return to use @code{CALL} and @code{RETURN} instructions instead of -@code{JMP} instructions. +The low-hanging fruit is going to be changing every call and return to +use @code{CALL} and @code{RETURN} instructions instead of @code{JMP} +instructions which is partly done on x86oids: a trampoline is +@code{CALL}ed and that @code{JMP}s to the target which is sufficient +to negate (most of?) the penalty. A more involved change would be to reduce the number of argument passing registers from three to two, which may be beneficial in terms