Changes between Version 22 and Version 23 of ExplicitCallStack/StackTraceExperience


Ignore:
Timestamp:
Feb 12, 2007 11:41:59 AM (7 years ago)
Author:
bjpop
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExplicitCallStack/StackTraceExperience

    v22 v23  
    123123Not very helpful! 
    124124 
     125Simon M correctly points out that the problem is that the exception is raised inside a CAF. Here is the way div is defined (for Int32, but the other types are similar): 
     126{{{ 
     127    div     x@(I32# x#) y@(I32# y#) 
     128        | y == 0                  = divZeroError 
     129        | x == minBound && y == (-1) = overflowError 
     130        | otherwise               = I32# (x# `divInt32#` y#) 
     131}}} 
     132Note the reference to ''divZeroError'' in the first guarded equation. This is defined as: 
     133{{{ 
     134divZeroError :: a 
     135divZeroError = throw (ArithException DivideByZero) 
     136}}} 
     137Hence it is a CAF. This is exactly the CAF that ''GHC.Err.CAF'' is refering to in the output from the cost centre stacks above.  
     138 
     139Now, we get muich better results if we raise the exception inside the user's code. For instance, if we change the definition of the local variable ''k\''' like so: 
     140{{{ 
     141k'   = error "bjpop crash" 
     142}}} 
     143We get the following output from running the program with ''-xc'': 
     144{{{ 
     145<Utils.utRandomInts,FrontierDATAFN2.fdFs2,FrontierDATAFN2.fdFind,FrontierGENERIC2.fsMakeFrontierRep,StrictAn6.saNonRecSearch,StrictAn6.saNonRecStartup,StrictAn6.saGroups,StrictAn6.saMain,Main.maStrictAn,Main.main,Main.CAF>Main: bjpop crash 
     146}} 
     147 
    125148=== Stack passing transformation === 
    126149