Make it a fatal error to try to enter a PAP
[ghc-hetmet.git] / ghc / rts / Apply.cmm
index c627995..6678a63 100644 (file)
 /* ----------------------------------------------------------------------------
  * Evaluate a closure and return it.
  *
- *      stg_ap_0_info   <--- Sp
- *
- * NOTE: this needs to be a polymorphic return point, because we can't
- * be sure that the thing being evaluated is not a function.
+ * There isn't an info table / return address version of stg_ap_0, because
+ * everything being returned is guaranteed evaluated, so it would be a no-op.
  */
 
-#if MAX_VECTORED_RTN > 8
-#error MAX_VECTORED_RTN has changed: please modify stg_ap_0 too.
-#endif
-
 STRING(stg_ap_0_ret_str,"stg_ap_0_ret... ")
 
-INFO_TABLE_RET( stg_ap_0,
-               0/*framsize*/, 0/*bitmap*/, RET_SMALL,
-               RET_LBL(stg_ap_0),      
-               RET_LBL(stg_ap_0),      
-               RET_LBL(stg_ap_0),      
-               RET_LBL(stg_ap_0),      
-               RET_LBL(stg_ap_0),      
-               RET_LBL(stg_ap_0),      
-               RET_LBL(stg_ap_0),      
-               RET_LBL(stg_ap_0) )
+stg_ap_0_fast
 { 
     // fn is in R1, no args on the stack
 
     IF_DEBUG(apply,
-       foreign "C" debugBelch(stg_ap_0_ret_str);
-       foreign "C" printClosure(R1 "ptr"));
+       foreign "C" debugBelch(stg_ap_0_ret_str) [R1];
+       foreign "C" printClosure(R1 "ptr") [R1]);
 
     IF_DEBUG(sanity,
-       foreign "C" checkStackChunk(Sp+WDS(1) "ptr",
-                                   CurrentTSO + OFFSET_StgTSO_stack +
-                                   WDS(StgTSO_stack_size(CurrentTSO)) "ptr"));
+       foreign "C" checkStackChunk(Sp "ptr",
+                                   CurrentTSO + TSO_OFFSET_StgTSO_stack +
+                                   WDS(StgTSO_stack_size(CurrentTSO)) "ptr") [R1]);
 
-    Sp_adj(1);
     ENTER();
 }
 
@@ -74,6 +58,9 @@ INFO_TABLE_RET( stg_ap_0,
    -------------------------------------------------------------------------- */
 
 INFO_TABLE(stg_PAP,/*special layout*/0,0,PAP,"PAP","PAP")
+{  foreign "C" barf("PAP object entered!"); }
+    
+stg_PAP_apply
 {
   W_ Words;
   W_ pap;
@@ -264,7 +251,7 @@ INFO_TABLE(stg_AP_STACK,/*special layout*/0,0,AP_STACK,"AP_STACK","AP_STACK")
   // Reload the stack
   W_ i;
   W_ p;
-  p = ap + SIZEOF_StgThunkHeader + OFFSET_StgAP_STACK_payload;
+  p = ap + SIZEOF_StgHeader + OFFSET_StgAP_STACK_payload;
   i = 0;
 for:
   if (i < Words) {