[project @ 1999-12-07 15:52:40 by simonmar]
[ghc-hetmet.git] / ghc / rts / HeapStackCheck.hc
index 2584c68..fc29ba7 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: HeapStackCheck.hc,v 1.3 1999/02/05 16:02:43 simonm Exp $
+ * $Id: HeapStackCheck.hc,v 1.10 1999/11/09 15:46:51 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -159,6 +159,18 @@ EXTFUN(stg_gc_enter_1)
   FE_
 }
 
+EXTFUN(stg_gc_enter_1_hponly)
+{
+  FB_
+  Sp -= 1;
+  Sp[0] = R1.w;
+  R1.i = HeapOverflow;
+  SaveThreadState();
+  CurrentTSO->whatNext = ThreadEnterGHC;
+  JMP_(StgReturn);
+  FE_
+}
+
 /*- 2 Regs--------------------------------------------------------------------*/
 
 EXTFUN(stg_gc_enter_2)
@@ -293,11 +305,28 @@ EXTFUN(stg_gc_seq_1)
    cases are covered below.
    -------------------------------------------------------------------------- */
 
-/*-- No regsiters live, return address already on the stack: ---------------- */
+/*-- No regsiters live (probably a void return) ----------------------------- */
+
+/* If we change the policy for thread startup to *not* remove the
+ * return address from the stack, we can get rid of this little
+ * function/info table...  
+ */
+INFO_TABLE_SRT_BITMAP(stg_gc_noregs_ret_info, stg_gc_noregs_ret, 0/*BITMAP*/, 
+                     0/*SRT*/, 0/*SRT_OFF*/, 0/*SRT_LEN*/, 
+                     RET_SMALL,, EF_, 0, 0);
+
+EXTFUN(stg_gc_noregs_ret)
+{
+  FB_
+  JMP_(ENTRY_CODE(Sp[0]));
+  FE_
+}
 
 EXTFUN(stg_gc_noregs)
 {
   FB_
+  Sp -= 1;
+  Sp[0] = (W_)&stg_gc_noregs_ret_info;
   GC_GENERIC
   FE_
 }
@@ -306,7 +335,7 @@ EXTFUN(stg_gc_noregs)
 
 INFO_TABLE_SRT_BITMAP(stg_gc_unpt_r1_info, stg_gc_unpt_r1_entry, 0/*BITMAP*/, 
                      0/*SRT*/, 0/*SRT_OFF*/, 0/*SRT_LEN*/, 
-                     RET_SMALL, const, EF_, 0, 0);
+                     RET_SMALL,, EF_, 0, 0);
 
 EXTFUN(stg_gc_unpt_r1_entry)
 {
@@ -331,7 +360,7 @@ EXTFUN(stg_gc_unpt_r1)
 
 INFO_TABLE_SRT_BITMAP(stg_gc_unbx_r1_info, stg_gc_unbx_r1_entry, 1/*BITMAP*/,
                      0/*SRT*/, 0/*SRT_OFF*/, 0/*SRT_LEN*/, 
-                     RET_SMALL, const, EF_, 0, 0);
+                     RET_SMALL,, EF_, 0, 0);
 /* the 1 is a bitmap - i.e. 1 non-pointer word on the stack. */
 
 EXTFUN(stg_gc_unbx_r1_entry)
@@ -357,7 +386,7 @@ EXTFUN(stg_gc_unbx_r1)
 
 INFO_TABLE_SRT_BITMAP(stg_gc_f1_info, stg_gc_f1_entry, 1/*BITMAP*/,
                      0/*SRT*/, 0/*SRT_OFF*/, 0/*SRT_LEN*/, 
-                     RET_SMALL, const, EF_, 0, 0);
+                     RET_SMALL,, EF_, 0, 0);
 
 EXTFUN(stg_gc_f1_entry)
 {
@@ -390,7 +419,7 @@ EXTFUN(stg_gc_f1)
 
 INFO_TABLE_SRT_BITMAP(stg_gc_d1_info, stg_gc_d1_entry, DBL_BITMAP,
                      0/*SRT*/, 0/*SRT_OFF*/, 0/*SRT_LEN*/, 
-                     RET_SMALL, const, EF_, 0, 0);
+                     RET_SMALL,, EF_, 0, 0);
 
 EXTFUN(stg_gc_d1_entry)
 {
@@ -443,14 +472,14 @@ EXTFUN(stg_gc_d1)
 
 INFO_TABLE_SRT_BITMAP(stg_gc_ut_1_0_info, stg_gc_ut_1_0_entry, 1/*BITMAP*/, 
                      0/*SRT*/, 0/*SRT_OFF*/, 0/*SRT_LEN*/, 
-                     RET_SMALL, const, EF_, 0, 0);
+                     RET_SMALL,, EF_, 0, 0);
 
 EXTFUN(stg_gc_ut_1_0_entry)
 {
   FB_
   R1.w = Sp[1];
   Sp += 2;
-  JMP_(Sp[-2]);
+  JMP_(ENTRY_CODE(Sp[-2]));
   FE_
 }
 
@@ -469,14 +498,14 @@ EXTFUN(stg_gc_ut_1_0)
 
 INFO_TABLE_SRT_BITMAP(stg_gc_ut_0_1_info, stg_gc_ut_0_1_entry, 3/*BITMAP*/, 
                      0/*SRT*/, 0/*SRT_OFF*/, 0/*SRT_LEN*/, 
-                     RET_SMALL, const, EF_, 0, 0);
+                     RET_SMALL,, EF_, 0, 0);
 
 EXTFUN(stg_gc_ut_0_1_entry)
 {
   FB_
   R1.w = Sp[1];
   Sp += 2;
-  JMP_(Sp[-2]);
+  JMP_(ENTRY_CODE(Sp[-2]));
   FE_
 }
 
@@ -764,7 +793,7 @@ EXTFUN(stg_chk_8)
 
 INFO_TABLE_SRT_BITMAP(stg_gen_chk_info, stg_gen_chk_ret, 0,
                      0/*SRT*/, 0/*SRT_OFF*/, 0/*SRT_LEN*/, 
-                     RET_DYN, const, EF_, 0, 0);
+                     RET_DYN,, EF_, 0, 0);
 
 /* bitmap in the above info table is unused, the real one is on the stack. 
  */
@@ -773,7 +802,7 @@ FN_(stg_gen_chk_ret)
 {
   FB_
   RESTORE_EVERYTHING;
-  JMP_(Sp[RET_OFFSET]);
+  JMP_(Sp[RET_OFFSET]); /* NO ENTRY_CODE() - this is a direct ret address */
   FE_
 }
 
@@ -798,6 +827,10 @@ FN_(stg_gen_hp)
   FE_
 }        
 
+/* -----------------------------------------------------------------------------
+   Yields
+   -------------------------------------------------------------------------- */
+
 FN_(stg_gen_yield)
 {
   FB_
@@ -806,6 +839,15 @@ FN_(stg_gen_yield)
   FE_
 }
 
+FN_(stg_yield_noregs)
+{
+  FB_
+  Sp--;
+  Sp[0] = (W_)&stg_gc_noregs_ret_info;
+  YIELD_GENERIC;
+  FE_
+}
+
 FN_(stg_yield_to_Hugs)
 {
   FB_
@@ -814,6 +856,10 @@ FN_(stg_yield_to_Hugs)
   FE_
 }
 
+/* -----------------------------------------------------------------------------
+   Blocks
+   -------------------------------------------------------------------------- */
+
 FN_(stg_gen_block)
 {
   FB_
@@ -822,6 +868,15 @@ FN_(stg_gen_block)
   FE_
 }
 
+FN_(stg_block_noregs)
+{
+  FB_
+  Sp--;
+  Sp[0] = (W_)&stg_gc_noregs_ret_info;
+  BLOCK_GENERIC;
+  FE_
+}
+
 FN_(stg_block_1)
 {
   FB_