Changes between Version 9 and Version 10 of ExplicitCallStack


Ignore:
Timestamp:
Nov 22, 2006 10:53:07 AM (7 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExplicitCallStack

    v9 v10  
    19192.  But that doesn't help with 'head'.  We want to pass head's ''call site'' to head. That's what jhc does when you give 'head' the a magic [http://repetae.net/john/computer/jhc/jhc.html SRCLOC_ANNOTATE pragma]: 
    2020        * every call to `head` gets replaced with `head_check $currentLocation` 
    21         * you get to write `head_check` yourself, with type 
     21        * in jhc, you get to write `head_check` yourself, with type 
    2222{{{ 
    2323                head_check :: String -> [a] -> a 
    2424}}} 
     25It'd be nicer if you didn't have to write `head_check` yourself, but instead the compiler wrote it. 
    2526 
    26273.  But what about the caller of the function that calls head?  Obviously we'd like to pass that on too! 
     
    3334        foo_check s xs = head_check ("line 5 in Bar.hs" ++ s) xs 
    3435}}} 
    35 Now in effect, we build up a call stack.   
     36Now in effect, we build up a call stack.  Now we ''really'' want the compiler to write `foo_check`. 
    3637 
    37384.  In fact, it's very similar to the "cost-centre stack" that GHC builds for profiling, except that it's explicit rather than implicit.  (Which is good.   Of course the stack should be a proper data type, not a String.) 
     
    4748This selectiveness makes it much less heavyweight than GHC's currrent "recompile everything" story. 
    4849 
    49 5. The dynamic hpc tracer will allow reverse time-travel, from an exception to the call site, 
    50 by keeping a small queue of recently ticked locations. This will make it easier to find out  
    51 what called the error calling function (head, !, !!, etc.), but will require a hpc-trace compiled 
    52 prelude if we want to find places in the prelude that called the error. (A standard prelude 
    53 would find the prelude function that was called that called the error inducing function). 
     505. The dynamic hpc tracer will allow reverse time-travel, from an exception to the call site, by keeping a small queue of recently ticked locations. This will make it easier to find out what called the error calling function (head, !, !!, etc.), but will require a hpc-trace compiled prelude if we want to find places in the prelude that called the error. (A standard prelude would find the prelude function that was called that called the error inducing function). 
    5451 
    5552== Open questions ==