X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=doc%2Finternals%2Fcalling-convention.texinfo;h=671ea6ce6b874880c8c02be6044672eea4b8ebe7;hb=1471fe66b2159cf5edbee456a34ee14226db2aaa;hp=bf5b2f37a385b04ebf0e5cf2edc5fcbc19027ea1;hpb=2973941cf214a5ea274cd0381a651ce0e1a7fab2;p=sbcl.git diff --git a/doc/internals/calling-convention.texinfo b/doc/internals/calling-convention.texinfo index bf5b2f3..671ea6c 100644 --- a/doc/internals/calling-convention.texinfo +++ b/doc/internals/calling-convention.texinfo @@ -81,7 +81,7 @@ The local (known-values) calling convention is implemented by the @code{known-call-local} and @code{known-return} VOPs. Local unknown-values calls are handled at the call site by the -@code{call-local} and @code{mutiple-call-local} VOPs. The main +@code{call-local} and @code{multiple-call-local} VOPs. The main difference between the full call and local call protocols here is that local calls use a different frame setup protocol, and will tend to not use the normal frame layout for the old frame-pointer and @@ -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 @@ -159,7 +191,7 @@ EBX} instruction. When expecting more than one value, we need to arrange to set up default values when a single-value return happens, so we encode a jump around a stub of code which fakes up the register use convention of a multiple-value return. Again, in the old -convention this was a two-byte unconditionl jump, and in the new +convention this was a two-byte unconditional jump, and in the new convention this is a conditional jump based on the carry flag. @@ -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