Make it a fatal error to try to enter a PAP
authorSimon Marlow <simonmar@microsoft.com>
Tue, 14 Mar 2006 11:25:50 +0000 (11:25 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Tue, 14 Mar 2006 11:25:50 +0000 (11:25 +0000)
This is just an assertion, in effect: we should never enter a PAP, but
for convenience we previously attached the PAP apply code to the PAP
info table.  The problem with this was that it makes it harder to track
down bugs that result in entering a PAP...

ghc/includes/StgMiscClosures.h
ghc/rts/Apply.cmm
ghc/utils/genapply/GenApply.hs

index 844c846..62a7ed3 100644 (file)
@@ -424,6 +424,7 @@ RTS_FUN(stg_ap_pppv_fast);
 RTS_FUN(stg_ap_pppp_fast);
 RTS_FUN(stg_ap_ppppp_fast);
 RTS_FUN(stg_ap_pppppp_fast);
 RTS_FUN(stg_ap_pppp_fast);
 RTS_FUN(stg_ap_ppppp_fast);
 RTS_FUN(stg_ap_pppppp_fast);
+RTS_FUN(stg_PAP_apply);
 
 /* standard GC & stack check entry points, all defined in HeapStackCheck.hc */
 
 
 /* standard GC & stack check entry points, all defined in HeapStackCheck.hc */
 
index 58ca18b..6678a63 100644 (file)
@@ -58,6 +58,9 @@ stg_ap_0_fast
    -------------------------------------------------------------------------- */
 
 INFO_TABLE(stg_PAP,/*special layout*/0,0,PAP,"PAP","PAP")
    -------------------------------------------------------------------------- */
 
 INFO_TABLE(stg_PAP,/*special layout*/0,0,PAP,"PAP","PAP")
+{  foreign "C" barf("PAP object entered!"); }
+    
+stg_PAP_apply
 {
   W_ Words;
   W_ pap;
 {
   W_ Words;
   W_ pap;
index a912266..cdde66f 100644 (file)
@@ -457,7 +457,7 @@ genApply regstatus args =
        nest 4 (vcat [
          text "arity = TO_W_(StgPAP_arity(R1));",
          text "ASSERT(arity > 0);",
        nest 4 (vcat [
          text "arity = TO_W_(StgPAP_arity(R1));",
          text "ASSERT(arity > 0);",
-         genMkPAP regstatus "NEW_PAP" "ENTRY_LBL(stg_PAP)" "PAP" "PAP"
+         genMkPAP regstatus "NEW_PAP" "stg_PAP_apply" "PAP" "PAP"
                True{-stack apply-} False{-args on stack-} True{-is a PAP-}
                args all_args_size fun_info_label
         ]),
                True{-stack apply-} False{-args on stack-} True{-is a PAP-}
                args all_args_size fun_info_label
         ]),