diff options
author | Austin Seipp <austin@well-typed.com> | 2014-08-20 12:42:08 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-08-20 12:51:30 -0500 |
commit | e183e35b48cac0c7cbfc3359665607ba2938a833 (patch) | |
tree | 697e5c260c9394fa52503011cc6ebdcb4ab14711 /includes/Cmm.h | |
parent | a784afcba03fac7f3f428a15b632792d2e404898 (diff) | |
download | haskell-e183e35b48cac0c7cbfc3359665607ba2938a833.tar.gz |
[ci skip] includes: detabify/dewhitespace Cmm.h
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'includes/Cmm.h')
-rw-r--r-- | includes/Cmm.h | 234 |
1 files changed, 117 insertions, 117 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h index e62e96fcc0..802ab51a5a 100644 --- a/includes/Cmm.h +++ b/includes/Cmm.h @@ -38,19 +38,19 @@ #include "ghcconfig.h" /* ----------------------------------------------------------------------------- - Types + Types The following synonyms for C-- types are declared here: I8, I16, I32, I64 MachRep-style names for convenience W_ is shorthand for the word type (== StgWord) - F_ shorthand for float (F_ == StgFloat == C's float) - D_ shorthand for double (D_ == StgDouble == C's double) + F_ shorthand for float (F_ == StgFloat == C's float) + D_ shorthand for double (D_ == StgDouble == C's double) + + CInt has the same size as an int in C on this platform + CLong has the same size as a long in C on this platform - CInt has the same size as an int in C on this platform - CLong has the same size as a long in C on this platform - --------------------------------------------------------------------------- */ #define I8 bits8 @@ -73,7 +73,7 @@ /* * The RTS must sometimes UNTAG a pointer before dereferencing it. - * See the wiki page Commentary/Rts/HaskellExecution/PointerTagging + * See the wiki page Commentary/Rts/HaskellExecution/PointerTagging */ #define TAG_MASK ((1 << TAG_BITS) - 1) #define UNTAG(p) (p & ~TAG_MASK) @@ -113,10 +113,10 @@ #define NULL (0::W_) -#define STRING(name,str) \ - section "rodata" { \ - name : bits8[] str; \ - } \ +#define STRING(name,str) \ + section "rodata" { \ + name : bits8[] str; \ + } \ #ifdef TABLES_NEXT_TO_CODE #define RET_LBL(f) f##_info @@ -193,11 +193,11 @@ -------------------------------------------------------------------------- */ #ifdef DEBUG -#define ASSERT(predicate) \ - if (predicate) { \ - /*null*/; \ - } else { \ - foreign "C" _assertFail(NULL, __LINE__) never returns; \ +#define ASSERT(predicate) \ + if (predicate) { \ + /*null*/; \ + } else { \ + foreign "C" _assertFail(NULL, __LINE__) never returns; \ } #else #define ASSERT(p) /* nothing */ @@ -212,7 +212,7 @@ /* * The IF_DEBUG macro is useful for debug messages that depend on one * of the RTS debug options. For example: - * + * * IF_DEBUG(RtsFlags_DebugFlags_apply, * foreign "C" fprintf(stderr, stg_ap_0_ret_str)); * @@ -225,7 +225,7 @@ #endif /* ----------------------------------------------------------------------------- - Entering + Entering It isn't safe to "enter" every closure. Functions in particular have no entry code as such; their entry point contains the code to @@ -281,37 +281,37 @@ #define RET_R1(x) jump %ENTRY_CODE(Sp(0)) [R1] #define ENTER_(ret,x) \ - again: \ - W_ info; \ + again: \ + W_ info; \ LOAD_INFO(ret,x) \ - switch [INVALID_OBJECT .. N_CLOSURE_TYPES] \ - (TO_W_( %INFO_TYPE(%STD_INFO(info)) )) { \ - case \ - IND, \ - IND_PERM, \ - IND_STATIC: \ - { \ + switch [INVALID_OBJECT .. N_CLOSURE_TYPES] \ + (TO_W_( %INFO_TYPE(%STD_INFO(info)) )) { \ + case \ + IND, \ + IND_PERM, \ + IND_STATIC: \ + { \ x = StgInd_indirectee(x); \ - goto again; \ - } \ - case \ - FUN, \ - FUN_1_0, \ - FUN_0_1, \ - FUN_2_0, \ - FUN_1_1, \ - FUN_0_2, \ + goto again; \ + } \ + case \ + FUN, \ + FUN_1_0, \ + FUN_0_1, \ + FUN_2_0, \ + FUN_1_1, \ + FUN_0_2, \ FUN_STATIC, \ - BCO, \ - PAP: \ - { \ + BCO, \ + PAP: \ + { \ ret(x); \ - } \ - default: \ - { \ + } \ + default: \ + { \ x = UNTAG_IF_PROF(x); \ jump %ENTRY_CODE(info) (x); \ - } \ + } \ } // The FUN cases almost never happen: a pointer to a non-static FUN @@ -371,11 +371,11 @@ */ #define ALLOC_PRIM(bytes) \ HP_CHK_GEN_TICKY(bytes); \ - TICK_ALLOC_PRIM(SIZEOF_StgHeader,bytes-SIZEOF_StgHeader,0); \ + TICK_ALLOC_PRIM(SIZEOF_StgHeader,bytes-SIZEOF_StgHeader,0); \ CCCS_ALLOC(bytes); #define HEAP_CHECK(bytes,failure) \ - TICK_BUMP(HEAP_CHK_ctr); \ + TICK_BUMP(HEAP_CHK_ctr); \ Hp = Hp + (bytes); \ if (Hp > HpLim) { HpAlloc = (bytes); failure; } \ TICK_ALLOC_HEAP_NOCTR(bytes); @@ -406,8 +406,8 @@ // TODO I'm not seeing where ALLOC_P_TICKY is used; can it be removed? // -NSF March 2013 -#define ALLOC_P_TICKY(bytes, fun, arg) \ - HP_CHK_P(bytes); \ +#define ALLOC_P_TICKY(bytes, fun, arg) \ + HP_CHK_P(bytes); \ TICK_ALLOC_HEAP_NOCTR(bytes); #define CHECK_GC() \ @@ -491,7 +491,7 @@ } #define STK_CHK_LL(n, fun) \ - TICK_BUMP(STK_CHK_ctr); \ + TICK_BUMP(STK_CHK_ctr); \ if (Sp - (n) < SpLim) { \ GC_PRIM_LL(fun) \ } @@ -525,7 +525,7 @@ /* * This is really ugly, since we don't do the rest of StgHeader this - * way. The problem is that values from DerivedConstants.h cannot be + * way. The problem is that values from DerivedConstants.h cannot be * dependent on the way (SMP, PROF etc.). For SIZEOF_StgHeader we get * the value from GHC, but it seems like too much trouble to do that * for StgThunkHeader. @@ -578,7 +578,7 @@ * when TABLES_NEXT_TO_CODE, slow_apply is stored as an offset * instead of the normal pointer. */ - + #define StgFunInfoExtra_slow_apply(fun_info) \ (TO_W_(StgFunInfoExtraRev_slow_apply_offset(fun_info)) \ + (fun_info) + SIZEOF_StgFunInfoExtraRev + SIZEOF_StgInfoTable) @@ -614,7 +614,7 @@ #endif /* ----------------------------------------------------------------------------- - Ticky macros + Ticky macros -------------------------------------------------------------------------- */ #ifdef TICKY_TICKY @@ -625,48 +625,48 @@ #define TICK_BUMP(ctr) TICK_BUMP_BY(ctr,1) -#define TICK_ENT_DYN_IND() TICK_BUMP(ENT_DYN_IND_ctr) -#define TICK_ENT_DYN_THK() TICK_BUMP(ENT_DYN_THK_ctr) -#define TICK_ENT_VIA_NODE() TICK_BUMP(ENT_VIA_NODE_ctr) -#define TICK_ENT_STATIC_IND() TICK_BUMP(ENT_STATIC_IND_ctr) -#define TICK_ENT_PERM_IND() TICK_BUMP(ENT_PERM_IND_ctr) -#define TICK_ENT_PAP() TICK_BUMP(ENT_PAP_ctr) -#define TICK_ENT_AP() TICK_BUMP(ENT_AP_ctr) -#define TICK_ENT_AP_STACK() TICK_BUMP(ENT_AP_STACK_ctr) -#define TICK_ENT_BH() TICK_BUMP(ENT_BH_ctr) -#define TICK_ENT_LNE() TICK_BUMP(ENT_LNE_ctr) -#define TICK_UNKNOWN_CALL() TICK_BUMP(UNKNOWN_CALL_ctr) -#define TICK_UPDF_PUSHED() TICK_BUMP(UPDF_PUSHED_ctr) -#define TICK_CATCHF_PUSHED() TICK_BUMP(CATCHF_PUSHED_ctr) -#define TICK_UPDF_OMITTED() TICK_BUMP(UPDF_OMITTED_ctr) -#define TICK_UPD_NEW_IND() TICK_BUMP(UPD_NEW_IND_ctr) -#define TICK_UPD_NEW_PERM_IND() TICK_BUMP(UPD_NEW_PERM_IND_ctr) -#define TICK_UPD_OLD_IND() TICK_BUMP(UPD_OLD_IND_ctr) -#define TICK_UPD_OLD_PERM_IND() TICK_BUMP(UPD_OLD_PERM_IND_ctr) - -#define TICK_SLOW_CALL_FUN_TOO_FEW() TICK_BUMP(SLOW_CALL_FUN_TOO_FEW_ctr) -#define TICK_SLOW_CALL_FUN_CORRECT() TICK_BUMP(SLOW_CALL_FUN_CORRECT_ctr) -#define TICK_SLOW_CALL_FUN_TOO_MANY() TICK_BUMP(SLOW_CALL_FUN_TOO_MANY_ctr) -#define TICK_SLOW_CALL_PAP_TOO_FEW() TICK_BUMP(SLOW_CALL_PAP_TOO_FEW_ctr) -#define TICK_SLOW_CALL_PAP_CORRECT() TICK_BUMP(SLOW_CALL_PAP_CORRECT_ctr) -#define TICK_SLOW_CALL_PAP_TOO_MANY() TICK_BUMP(SLOW_CALL_PAP_TOO_MANY_ctr) - -#define TICK_SLOW_CALL_fast_v16() TICK_BUMP(SLOW_CALL_fast_v16_ctr) -#define TICK_SLOW_CALL_fast_v() TICK_BUMP(SLOW_CALL_fast_v_ctr) -#define TICK_SLOW_CALL_fast_p() TICK_BUMP(SLOW_CALL_fast_p_ctr) -#define TICK_SLOW_CALL_fast_pv() TICK_BUMP(SLOW_CALL_fast_pv_ctr) -#define TICK_SLOW_CALL_fast_pp() TICK_BUMP(SLOW_CALL_fast_pp_ctr) -#define TICK_SLOW_CALL_fast_ppv() TICK_BUMP(SLOW_CALL_fast_ppv_ctr) -#define TICK_SLOW_CALL_fast_ppp() TICK_BUMP(SLOW_CALL_fast_ppp_ctr) -#define TICK_SLOW_CALL_fast_pppv() TICK_BUMP(SLOW_CALL_fast_pppv_ctr) -#define TICK_SLOW_CALL_fast_pppp() TICK_BUMP(SLOW_CALL_fast_pppp_ctr) -#define TICK_SLOW_CALL_fast_ppppp() TICK_BUMP(SLOW_CALL_fast_ppppp_ctr) -#define TICK_SLOW_CALL_fast_pppppp() TICK_BUMP(SLOW_CALL_fast_pppppp_ctr) -#define TICK_VERY_SLOW_CALL() TICK_BUMP(VERY_SLOW_CALL_ctr) - -/* NOTE: TICK_HISTO_BY and TICK_HISTO +#define TICK_ENT_DYN_IND() TICK_BUMP(ENT_DYN_IND_ctr) +#define TICK_ENT_DYN_THK() TICK_BUMP(ENT_DYN_THK_ctr) +#define TICK_ENT_VIA_NODE() TICK_BUMP(ENT_VIA_NODE_ctr) +#define TICK_ENT_STATIC_IND() TICK_BUMP(ENT_STATIC_IND_ctr) +#define TICK_ENT_PERM_IND() TICK_BUMP(ENT_PERM_IND_ctr) +#define TICK_ENT_PAP() TICK_BUMP(ENT_PAP_ctr) +#define TICK_ENT_AP() TICK_BUMP(ENT_AP_ctr) +#define TICK_ENT_AP_STACK() TICK_BUMP(ENT_AP_STACK_ctr) +#define TICK_ENT_BH() TICK_BUMP(ENT_BH_ctr) +#define TICK_ENT_LNE() TICK_BUMP(ENT_LNE_ctr) +#define TICK_UNKNOWN_CALL() TICK_BUMP(UNKNOWN_CALL_ctr) +#define TICK_UPDF_PUSHED() TICK_BUMP(UPDF_PUSHED_ctr) +#define TICK_CATCHF_PUSHED() TICK_BUMP(CATCHF_PUSHED_ctr) +#define TICK_UPDF_OMITTED() TICK_BUMP(UPDF_OMITTED_ctr) +#define TICK_UPD_NEW_IND() TICK_BUMP(UPD_NEW_IND_ctr) +#define TICK_UPD_NEW_PERM_IND() TICK_BUMP(UPD_NEW_PERM_IND_ctr) +#define TICK_UPD_OLD_IND() TICK_BUMP(UPD_OLD_IND_ctr) +#define TICK_UPD_OLD_PERM_IND() TICK_BUMP(UPD_OLD_PERM_IND_ctr) + +#define TICK_SLOW_CALL_FUN_TOO_FEW() TICK_BUMP(SLOW_CALL_FUN_TOO_FEW_ctr) +#define TICK_SLOW_CALL_FUN_CORRECT() TICK_BUMP(SLOW_CALL_FUN_CORRECT_ctr) +#define TICK_SLOW_CALL_FUN_TOO_MANY() TICK_BUMP(SLOW_CALL_FUN_TOO_MANY_ctr) +#define TICK_SLOW_CALL_PAP_TOO_FEW() TICK_BUMP(SLOW_CALL_PAP_TOO_FEW_ctr) +#define TICK_SLOW_CALL_PAP_CORRECT() TICK_BUMP(SLOW_CALL_PAP_CORRECT_ctr) +#define TICK_SLOW_CALL_PAP_TOO_MANY() TICK_BUMP(SLOW_CALL_PAP_TOO_MANY_ctr) + +#define TICK_SLOW_CALL_fast_v16() TICK_BUMP(SLOW_CALL_fast_v16_ctr) +#define TICK_SLOW_CALL_fast_v() TICK_BUMP(SLOW_CALL_fast_v_ctr) +#define TICK_SLOW_CALL_fast_p() TICK_BUMP(SLOW_CALL_fast_p_ctr) +#define TICK_SLOW_CALL_fast_pv() TICK_BUMP(SLOW_CALL_fast_pv_ctr) +#define TICK_SLOW_CALL_fast_pp() TICK_BUMP(SLOW_CALL_fast_pp_ctr) +#define TICK_SLOW_CALL_fast_ppv() TICK_BUMP(SLOW_CALL_fast_ppv_ctr) +#define TICK_SLOW_CALL_fast_ppp() TICK_BUMP(SLOW_CALL_fast_ppp_ctr) +#define TICK_SLOW_CALL_fast_pppv() TICK_BUMP(SLOW_CALL_fast_pppv_ctr) +#define TICK_SLOW_CALL_fast_pppp() TICK_BUMP(SLOW_CALL_fast_pppp_ctr) +#define TICK_SLOW_CALL_fast_ppppp() TICK_BUMP(SLOW_CALL_fast_ppppp_ctr) +#define TICK_SLOW_CALL_fast_pppppp() TICK_BUMP(SLOW_CALL_fast_pppppp_ctr) +#define TICK_VERY_SLOW_CALL() TICK_BUMP(VERY_SLOW_CALL_ctr) + +/* NOTE: TICK_HISTO_BY and TICK_HISTO currently have no effect. - The old code for it didn't typecheck and I + The old code for it didn't typecheck and I just commented it out to get ticky to work. - krc 1/2007 */ @@ -675,34 +675,34 @@ #define TICK_HISTO(histo,n) TICK_HISTO_BY(histo,n,1) /* An unboxed tuple with n components. */ -#define TICK_RET_UNBOXED_TUP(n) \ - TICK_BUMP(RET_UNBOXED_TUP_ctr++); \ +#define TICK_RET_UNBOXED_TUP(n) \ + TICK_BUMP(RET_UNBOXED_TUP_ctr++); \ TICK_HISTO(RET_UNBOXED_TUP,n) /* * A slow call with n arguments. In the unevald case, this call has * already been counted once, so don't count it again. */ -#define TICK_SLOW_CALL(n) \ - TICK_BUMP(SLOW_CALL_ctr); \ +#define TICK_SLOW_CALL(n) \ + TICK_BUMP(SLOW_CALL_ctr); \ TICK_HISTO(SLOW_CALL,n) /* * This slow call was found to be to an unevaluated function; undo the * ticks we did in TICK_SLOW_CALL. */ -#define TICK_SLOW_CALL_UNEVALD(n) \ - TICK_BUMP(SLOW_CALL_UNEVALD_ctr); \ - TICK_BUMP_BY(SLOW_CALL_ctr,-1); \ +#define TICK_SLOW_CALL_UNEVALD(n) \ + TICK_BUMP(SLOW_CALL_UNEVALD_ctr); \ + TICK_BUMP_BY(SLOW_CALL_ctr,-1); \ TICK_HISTO_BY(SLOW_CALL,n,-1); /* Updating a closure with a new CON */ -#define TICK_UPD_CON_IN_NEW(n) \ - TICK_BUMP(UPD_CON_IN_NEW_ctr); \ +#define TICK_UPD_CON_IN_NEW(n) \ + TICK_BUMP(UPD_CON_IN_NEW_ctr); \ TICK_HISTO(UPD_CON_IN_NEW,n) -#define TICK_ALLOC_HEAP_NOCTR(bytes) \ - TICK_BUMP(ALLOC_RTS_ctr); \ +#define TICK_ALLOC_HEAP_NOCTR(bytes) \ + TICK_BUMP(ALLOC_RTS_ctr); \ TICK_BUMP_BY(ALLOC_RTS_tot,bytes) /* ----------------------------------------------------------------------------- @@ -784,20 +784,20 @@ #define END_INVARIANT_CHECK_QUEUE stg_END_INVARIANT_CHECK_QUEUE_closure #define recordMutableCap(p, gen) \ - W_ __bd; \ - W_ mut_list; \ - mut_list = Capability_mut_lists(MyCapability()) + WDS(gen); \ - __bd = W_[mut_list]; \ - if (bdescr_free(__bd) >= bdescr_start(__bd) + BLOCK_SIZE) { \ - W_ __new_bd; \ - ("ptr" __new_bd) = foreign "C" allocBlock_lock(); \ - bdescr_link(__new_bd) = __bd; \ - __bd = __new_bd; \ - W_[mut_list] = __bd; \ - } \ - W_ free; \ - free = bdescr_free(__bd); \ - W_[free] = p; \ + W_ __bd; \ + W_ mut_list; \ + mut_list = Capability_mut_lists(MyCapability()) + WDS(gen); \ + __bd = W_[mut_list]; \ + if (bdescr_free(__bd) >= bdescr_start(__bd) + BLOCK_SIZE) { \ + W_ __new_bd; \ + ("ptr" __new_bd) = foreign "C" allocBlock_lock(); \ + bdescr_link(__new_bd) = __bd; \ + __bd = __new_bd; \ + W_[mut_list] = __bd; \ + } \ + W_ free; \ + free = bdescr_free(__bd); \ + W_[free] = p; \ bdescr_free(__bd) = free + WDS(1); #define recordMutable(p) \ |