[project @ 1999-06-25 09:13:37 by simonmar]
authorsimonmar <unknown>
Fri, 25 Jun 1999 09:13:38 +0000 (09:13 +0000)
committersimonmar <unknown>
Fri, 25 Jun 1999 09:13:38 +0000 (09:13 +0000)
New define: TABLES_NEXT_TO_CODE says whether info tables are assumed
to reside just before the code for a function.   We used to use
USE_MINIINTERPRETER for this function, but it makes sense in certain
cases to separate the use of tail-calls from tables-next-to-code.

StgMacros: add a couple of missing macros to support update in place.

ghc/includes/ClosureMacros.h
ghc/includes/InfoMacros.h
ghc/includes/InfoTables.h
ghc/includes/MachRegs.h
ghc/includes/Stg.h
ghc/includes/StgMacros.h

index 6d7d159..34b08c3 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: ClosureMacros.h,v 1.16 1999/05/13 17:31:06 simonm Exp $
+ * $Id: ClosureMacros.h,v 1.17 1999/06/25 09:13:37 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
 #define SET_INFO(c,i) ((c)->header.info = (i))
 #define GET_INFO(c)   ((c)->header.info)
 
-#if USE_MINIINTERPRETER
-#define INIT_ENTRY(e)    entry : (F_)(e)
-#define GET_ENTRY(c)     ((c)->header.info->entry)
-#define ENTRY_CODE(info) (((StgInfoTable *)info)->entry)
-#define INFO_PTR_TO_STRUCT(info) ((StgInfoTable *)info)
-#define get_itbl(c)      ((c)->header.info)
-static __inline__ StgFunPtr get_entry(const StgInfoTable *itbl) {
-    return itbl->entry;
-}
-#else
+#ifdef TABLES_NEXT_TO_CODE
 #define INIT_ENTRY(e)    code : {}
 #define GET_ENTRY(c)     ((StgFunPtr)((c)->header.info))
 #define ENTRY_CODE(info) (info)
@@ -78,6 +69,15 @@ static __inline__ StgFunPtr get_entry(const StgInfoTable *itbl) {
 static __inline__ StgFunPtr get_entry(const StgInfoTable *itbl) {
     return (StgFunPtr)(itbl+1);
 }
+#else
+#define INIT_ENTRY(e)    entry : (F_)(e)
+#define GET_ENTRY(c)     ((c)->header.info->entry)
+#define ENTRY_CODE(info) (((StgInfoTable *)info)->entry)
+#define INFO_PTR_TO_STRUCT(info) ((StgInfoTable *)info)
+#define get_itbl(c)      ((c)->header.info)
+static __inline__ StgFunPtr get_entry(const StgInfoTable *itbl) {
+    return itbl->entry;
+}
 #endif
 
 /* -----------------------------------------------------------------------------
@@ -164,16 +164,10 @@ extern int is_heap_alloced(const void* x);
 #define IS_HUGS_CONSTR_INFO(info) 0 /* ToDo: more than mildly bogus */
 #endif
 
-#ifdef USE_MINIINTERPRETER
-/* in the mininterpreter, we put infotables on closures */
-#define LOOKS_LIKE_GHC_INFO(info) IS_CODE_PTR(info)
+#ifdef HAVE_WIN32_DLL_SUPPORT
+# define LOOKS_LIKE_GHC_INFO(info) (!HEAP_ALLOCED(info) && !LOOKS_LIKE_STATIC_CLOSURE(info))
 #else
-/* otherwise we have entry pointers on closures */
-# ifdef HAVE_WIN32_DLL_SUPPORT
-#  define LOOKS_LIKE_GHC_INFO(info) (!HEAP_ALLOCED(info) && !LOOKS_LIKE_STATIC_CLOSURE(info))
-# else
-#  define LOOKS_LIKE_GHC_INFO(info) IS_CODE_PTR(info)
-# endif
+# define LOOKS_LIKE_GHC_INFO(info) IS_CODE_PTR(info)
 #endif
 
 /* -----------------------------------------------------------------------------
index a503d4a..270842f 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: InfoMacros.h,v 1.6 1999/05/13 17:31:06 simonm Exp $
+ * $Id: InfoMacros.h,v 1.7 1999/06/25 09:13:37 simonmar Exp $
  * 
  * (c) The GHC Team, 1998-1999
  *
@@ -110,7 +110,7 @@ INFO_TABLE_CONSTR(info, entry, ptrs, nptrs, tag_,type_,info_class,  \
  * layout field, so we only need one macro for these.
  */
 
-#ifndef USE_MINIINTERPRETER
+#ifdef TABLES_NEXT_TO_CODE
 
 typedef struct {
   StgFunPtr vec[2];
@@ -373,7 +373,7 @@ typedef struct {
                        alt_5, alt_6, alt_7, alt_8 }            \
        }
 
-#endif /* MINI_INTERPRETER */
+#endif /* TABLES_NEXT_TO_CODE */
 
 /* For polymorphic activation records, we need both a direct return
  * address and a return vector:
@@ -381,7 +381,7 @@ typedef struct {
 
 typedef vec_info_8 StgPolyInfoTable;
 
-#ifdef USE_MINIINTERPRETER
+#ifndef TABLES_NEXT_TO_CODE
 
 #define VEC_POLY_INFO_TABLE(nm, bitmap_,                       \
                           srt_, srt_off_, srt_len_,            \
index 92e957c..6e3908d 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: InfoTables.h,v 1.15 1999/05/13 17:31:07 simonm Exp $
+ * $Id: InfoTables.h,v 1.16 1999/06/25 09:13:37 simonmar Exp $
  * 
  * (c) The GHC Team, 1998-1999
  *
@@ -173,11 +173,11 @@ typedef struct _StgInfoTable {
     StgWord         type : 16; /* } These 2 elements fit into 32 bits */
     StgWord         srt_len : 16; /* }                                   */
 #endif
-#if USE_MINIINTERPRETER
+#ifdef TABLES_NEXT_TO_CODE
+    StgCode         code[0];
+#else
     StgFunPtr       entry;
     StgFunPtr       vector[0];
-#else
-    StgCode         code[0];
 #endif
 } StgInfoTable;
 
index d69b7b5..35db1c0 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: MachRegs.h,v 1.4 1999/02/05 16:02:23 simonm Exp $
+ * $Id: MachRegs.h,v 1.5 1999/06/25 09:13:38 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
 #endif /* hppa */
 
 /* -----------------------------------------------------------------------------
-   The Intel iX86 register mapping
+   The x86 register mapping
 
    Ok, we've only got 6 general purpose registers, a frame pointer and a
    stack pointer.  \tr{%eax} and \tr{%edx} are return values from C functions,
 
 #define REG(x) __asm__("%" #x)
 
+#ifndef not_doing_dynamic_linking
 #define REG_Base    ebx
+#endif
 #define REG_Sp     ebp
 
 #if STOLEN_X86_REGS >= 3
index 932b4ec..3aa583e 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Stg.h,v 1.12 1999/05/11 16:46:20 keithw Exp $
+ * $Id: Stg.h,v 1.13 1999/06/25 09:13:38 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
 #define COMPILER 1
 #endif
 
+#ifndef USE_MINIINTERPRETER
+#define TABLES_NEXT_TO_CODE
+#endif
+
 /* bit macros
  */
 #define BITS_PER_BYTE 8
index 419ad7d..c4b1e52 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgMacros.h,v 1.11 1999/05/13 17:31:07 simonm Exp $
+ * $Id: StgMacros.h,v 1.12 1999/06/25 09:13:38 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -404,10 +404,10 @@ EDI_(stg_gen_chk_info);
    The extra subtraction of one word is because tags start at zero.
    -------------------------------------------------------------------------- */
 
-#ifdef USE_MINIINTERPRETER
-#define RET_VEC(p,t) (((StgInfoTable *)p)->vector[t])
-#else
+#ifdef TABLES_NEXT_TO_CODE
 #define RET_VEC(p,t) (*((P_)(p) - sizeofW(StgInfoTable) - t - 1))
+#else
+#define RET_VEC(p,t) (((StgInfoTable *)p)->vector[t])
 #endif
 
 /* -----------------------------------------------------------------------------
@@ -429,6 +429,9 @@ EDI_(stg_gen_chk_info);
 #  define UPD_BH_SINGLE_ENTRY(thunk) /* nothing */
 #endif /* EAGER_BLACKHOLING */
 
+#define UPD_FRAME_UPDATEE(p)  (((StgUpdateFrame *)(p))->updatee)
+#define UPDATE_SU_FROM_UPD_FRAME(p) (Su=((StgUpdateFrame *)(p))->link)
+
 /* -----------------------------------------------------------------------------
    Moving Floats and Doubles