[project @ 2000-03-14 11:11:40 by simonmar]
[ghc-hetmet.git] / ghc / rts / Prelude.c
1 /* -----------------------------------------------------------------------------
2  * $Id: Prelude.c,v 1.1 2000/03/14 11:11:40 simonmar Exp $
3  *
4  * (c) The GHC Team, 1998-2000
5  *
6  * Prelude identifiers that we sometimes need to refer to in the RTS.
7  *
8  * ---------------------------------------------------------------------------*/
9
10 #include "Rts.h"
11 #include "Prelude.h"
12
13 #if defined(INTERPRETER)
14
15 const StgClosure *ind_True_static_closure;
16 const StgClosure *ind_False_static_closure;
17 const StgClosure *ind_unpackCString_closure;
18 const StgClosure *ind_stackOverflow_closure;
19 const StgClosure *ind_heapOverflow_closure;
20 const StgClosure *ind_PutFullMVar_static_closure;
21 const StgClosure *ind_NonTermination_static_closure;
22 const StgClosure *ind_mainIO_closure;
23
24 const StgInfoTable *ind_Czh_static_info;
25 const StgInfoTable *ind_Izh_static_info;
26 const StgInfoTable *ind_Fzh_static_info;
27 const StgInfoTable *ind_Dzh_static_info;
28 const StgInfoTable *ind_Azh_static_info;
29 const StgInfoTable *ind_Wzh_static_info;
30 const StgInfoTable *ind_Czh_con_info;
31 const StgInfoTable *ind_Izh_con_info;
32 const StgInfoTable *ind_Fzh_con_info;
33 const StgInfoTable *ind_Dzh_con_info;
34 const StgInfoTable *ind_Azh_con_info;
35 const StgInfoTable *ind_Wzh_con_info;
36 const StgInfoTable *ind_I64zh_con_info;
37 const StgInfoTable *ind_W64zh_con_info;
38 const StgInfoTable *ind_StablePtr_static_info;
39 const StgInfoTable *ind_StablePtr_con_info;
40
41 #endif
42
43 void
44 fixupPreludeRefs(void)
45 {
46 #ifdef INTERPRETER
47   ind_True_static_closure           = True_static_closure;
48   ind_False_static_closure          = False_static_closure;
49   ind_unpackCString_closure         = ind_unpackCString_closure;
50   ind_stackOverflow_closure         = stackOverflow_closure;
51   ind_heapOverflow_closure          = heapOverflow_closure;
52   ind_PutFullMVar_static_closure    = PutFullMVar_static_closure;
53   ind_NonTermination_static_closure = NonTermination_static_closure;
54   ind_mainIO_closure                = mainIO_closure;
55
56   ind_Czh_static_info               = Czh_static_info;
57   ind_Izh_static_info               = Izh_static_info;
58   ind_Fzh_static_info               = Fzh_static_info;
59   ind_Dzh_static_info               = Dzh_static_info;
60   ind_Azh_static_info               = Azh_static_info;
61   ind_Wzh_static_info               = Wzh_static_info;
62   ind_Czh_con_info                  = Czh_con_info;
63   ind_Izh_con_info                  = Izh_con_info;
64   ind_Fzh_con_info                  = Fzh_con_info;
65   ind_Dzh_con_info                  = Dzh_con_info;
66   ind_Azh_con_info                  = Azh_con_info;
67   ind_Wzh_con_info                  = Wzh_con_info;
68   ind_I64zh_con_info                = I64zh_con_info;
69   ind_W64zh_con_info                = W64zh_con_info;
70   ind_StablePtr_static_info         = StablePtr_static_info;
71   ind_StablePtr_con_info            = StablePtr_con_info;
72 #endif
73
74   /* When the RTS and Prelude live in separate DLLs,
75      we need to patch up the char- and int-like tables
76      that the RTS keep after both DLLs have been loaded,
77      filling in the tables with references to where the
78      static info tables have been loaded inside the running
79      process.
80   */
81 #if defined(INTERPRETER) || defined(ENABLE_WIN32_DLL_SUPPORT)
82   {
83     int i;
84   
85     for(i=0;i<=255;i++)
86       (CHARLIKE_closure[i]).header.info = Czh_static_info;
87     
88     for(i=0;i<=32;i++)
89       (INTLIKE_closure[i]).header.info = Izh_static_info;
90   }
91 #endif
92 }