binary.rst
changeset 1894 2e3bc2435d68
parent 1893 da0024f4f068
child 1895 91e537a35a34
equal deleted inserted replaced
1893:da0024f4f068 1894:2e3bc2435d68
     1 -*- mode: outline; coding: utf-8 -*-
       
     2 
       
     3 * Caller vs callee.
       
     4 
       
     5 If routine A calls routine B then routine A is the caller and routine B is the
       
     6 callee. i.e. the caller is the routine which is calling the callee.
       
     7 
       
     8 The routine that initiates the call is the caller and the routine that is
       
     9 being called is is the callee.
       
    10 
       
    11 * Argument vs parameter.
       
    12 
       
    13 From the perspective of the caller the thing which is passed is an argument.
       
    14 From the perspective of the routine that receives the call, i.e. the callee,
       
    15 the thing which is passed is a parameter.
       
    16 
       
    17 * Linkage convention.
       
    18 
       
    19 A linkage convention is computing term that means an agreement which is made
       
    20 between a caller and a callee. The agreement describes:
       
    21 
       
    22  - how the caller should pass parameters to the callee
       
    23 
       
    24  - what assumptions the callee is allowed to make about the values in the
       
    25    machine registers at the moment of the call
       
    26 
       
    27  - who should preserve registers which are modified by the callee and/or which
       
    28    are important to the caller so that their original values are available
       
    29    when the caller needs them
       
    30 
       
    31  - how and where registers should be preserved
       
    32 
       
    33  - how the callee knows where to return to when it is ready to return to the
       
    34    caller
       
    35 
       
    36  - how the callee returns a value to the caller if the routine is a function
       
    37    (as opposed to a subroutine which has no return value)
       
    38 
       
    39  - how a debugger will find the information necessary to obtain a stack trace