Changes between Version 12 and Version 13 of Commentary/Rts/HaskellExecution


Ignore:
Timestamp:
Oct 17, 2006 1:50:35 PM (8 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Rts/HaskellExecution

    v12 v13  
    5555 
    5656When compiling a call, there are several cases to consider, which are treated separately.   
    57   * '''Known function, saturated call'''.   The function is applied to exactly the right number of arguments to satisfy its arity.  In that case, we simply load the arguments according to the standard entry convention, and tail-call (jump to) the function's entry point. 
     57 
     58  * '''Unknown function''';  a call in which we do not statically know what the function is.  In that case we must do a "generic apply".  This is so exciting that it deserves its [wiki:Commentary/Rts/HaskellExecution#Genericapply own section]. 
     59 
     60  * '''Known function, saturated call'''.   The function is applied to exactly the right number of arguments to satisfy its arity.  In that case, we simply load the arguments according to the standard entry convention, and tail-call (jump to) the function's entry point.  On average, about 80% of all calls fall into this category (see the eval/apply paper for measurements). 
    5861 
    5962  * '''Known function, too few arguments'''.  In this case, we want to build a partial application (PAP), and return with a pointer to the PAP in the return register.  Since building a PAP is a complicated business, instead we just behave as for an unknown function call, which will end up calling into the [[ref(Generic apply)]] code, which will build the PAP for us. 
    6063 
    6164  * '''Known function, too many arguments'''.  We want to save the extra arguments on the stack, push a return address, and then behave just like a saturated call.  When the result comes back, we should behave like "unknown call".  However, to avoid needing to generate code for a new continuation here, the return address that we push on the stack is that of an appropriate [[ref(Generic apply)]] function, which will perform the application of the extra arguments to the (unknown) function returned by the saturated call. 
    62  
    63   * '''Unknown function''';  a call in which we do not statically know what the function is.  In that case we must do a "generic apply".  This is so exciting that it deserves its [wiki:Commentary/Rts/HaskellExecution#Genericapply own section]. 
    6465 
    6566=== Generic apply ===