| 1 | /* $Header: d:/cvsroot/tads/tads3/tcglob.h,v 1.4 1999/07/11 00:46:58 MJRoberts Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 1998, 2002 Michael J. Roberts. All Rights Reserved. |
| 5 | * |
| 6 | * Please see the accompanying license file, LICENSE.TXT, for information |
| 7 | * on using and copying this software. |
| 8 | */ |
| 9 | /* |
| 10 | Name |
| 11 | tcglob.h - TADS 3 Compiler globals |
| 12 | Function |
| 13 | The TADS 3 Compiler uses a number of static variables that are |
| 14 | shared by several subsystems. We define these variables as |
| 15 | global variables for quick access, and to minimize the number |
| 16 | of parameters that are passed around among subsystems. |
| 17 | |
| 18 | Notes |
| 19 | |
| 20 | Modified |
| 21 | 05/01/99 MJRoberts - creation |
| 22 | */ |
| 23 | |
| 24 | #ifndef TCGLOB_H |
| 25 | #define TCGLOB_H |
| 26 | |
| 27 | /* |
| 28 | * If we're not explicitly defining the storage for the globals, define |
| 29 | * them as external - this lets everyone pick up external declarations |
| 30 | * for all of the globals simply by including this file. |
| 31 | */ |
| 32 | #ifndef TC_GLOB_DECLARE |
| 33 | #define TC_GLOB_DECLARE extern |
| 34 | #endif |
| 35 | |
| 36 | /* host system interface */ |
| 37 | TC_GLOB_DECLARE class CTcHostIfc *G_hostifc; |
| 38 | |
| 39 | /* main compiler driver */ |
| 40 | TC_GLOB_DECLARE class CTcMain *G_tcmain; |
| 41 | |
| 42 | /* the parser */ |
| 43 | TC_GLOB_DECLARE class CTcParser *G_prs; |
| 44 | |
| 45 | /* parse tree node list memory manager */ |
| 46 | TC_GLOB_DECLARE class CTcPrsMem *G_prsmem; |
| 47 | |
| 48 | /* the tokenizer */ |
| 49 | TC_GLOB_DECLARE class CTcTokenizer *G_tok; |
| 50 | |
| 51 | /* |
| 52 | * Current code stream - this points to the currently active code stream |
| 53 | * object. The active code stream can vary according to what kind of |
| 54 | * code we're generating. |
| 55 | */ |
| 56 | TC_GLOB_DECLARE class CTcCodeStream *G_cs; |
| 57 | |
| 58 | /* primary generated code stream - for all normal code */ |
| 59 | TC_GLOB_DECLARE class CTcCodeStream *G_cs_main; |
| 60 | |
| 61 | /* static initializer code stream */ |
| 62 | TC_GLOB_DECLARE class CTcCodeStream *G_cs_static; |
| 63 | |
| 64 | /* local variable name stream */ |
| 65 | TC_GLOB_DECLARE class CTcDataStream *G_lcl_stream; |
| 66 | |
| 67 | /* generated data (constant) stream */ |
| 68 | TC_GLOB_DECLARE class CTcDataStream *G_ds; |
| 69 | |
| 70 | /* TADS-Object metaclass data stream */ |
| 71 | TC_GLOB_DECLARE class CTcDataStream *G_os; |
| 72 | |
| 73 | /* Dictionary metaclass data stream */ |
| 74 | TC_GLOB_DECLARE class CTcDataStream *G_dict_stream; |
| 75 | |
| 76 | /* GrammarProduction metaclass data stream */ |
| 77 | TC_GLOB_DECLARE class CTcDataStream *G_gramprod_stream; |
| 78 | |
| 79 | /* BigNumber metaclass data stream */ |
| 80 | TC_GLOB_DECLARE class CTcDataStream *G_bignum_stream; |
| 81 | |
| 82 | /* RexPattern metaclass data stream */ |
| 83 | TC_GLOB_DECLARE class CTcDataStream *G_rexpat_stream; |
| 84 | |
| 85 | /* IntrinsicClass metaclass data stream */ |
| 86 | TC_GLOB_DECLARE class CTcDataStream *G_int_class_stream; |
| 87 | |
| 88 | /* intrinsic class modifier metaclass data stream */ |
| 89 | TC_GLOB_DECLARE class CTcDataStream *G_icmod_stream; |
| 90 | |
| 91 | /* static initializer obj.prop ID stream */ |
| 92 | TC_GLOB_DECLARE class CTcDataStream *G_static_init_id_stream; |
| 93 | |
| 94 | /* target-specific code generator class */ |
| 95 | TC_GLOB_DECLARE class CTcGenTarg *G_cg; |
| 96 | |
| 97 | /* |
| 98 | * Run-time metaclass table. When we're doing dynamic compilation, the |
| 99 | * interpreter will set this to its live metaclass table for the loaded |
| 100 | * program. |
| 101 | */ |
| 102 | TC_GLOB_DECLARE class CVmMetaTable *G_metaclass_tab; |
| 103 | |
| 104 | /* |
| 105 | * object ID fixup list head, and flag indicating whether to keep object |
| 106 | * fixups |
| 107 | */ |
| 108 | TC_GLOB_DECLARE struct CTcIdFixup *G_objfixup; |
| 109 | TC_GLOB_DECLARE int G_keep_objfixups; |
| 110 | |
| 111 | /* |
| 112 | * property ID fixup list head, and flag indicating whether to keep |
| 113 | * property ID fixups |
| 114 | */ |
| 115 | TC_GLOB_DECLARE struct CTcIdFixup *G_propfixup; |
| 116 | TC_GLOB_DECLARE int G_keep_propfixups; |
| 117 | |
| 118 | /* |
| 119 | * enumerator ID fixup list head, and flag indicating whether to keep |
| 120 | * enumerator fixups |
| 121 | */ |
| 122 | TC_GLOB_DECLARE struct CTcIdFixup *G_enumfixup; |
| 123 | TC_GLOB_DECLARE int G_keep_enumfixups; |
| 124 | |
| 125 | |
| 126 | /* |
| 127 | * Debug mode - if this is true, we're compiling for debugging, so we |
| 128 | * must generate additional symbolic information for the debugger. |
| 129 | */ |
| 130 | TC_GLOB_DECLARE int G_debug; |
| 131 | |
| 132 | /* disassembly output stream, if disassembly display is desired */ |
| 133 | TC_GLOB_DECLARE class CTcUnasOut *G_disasm_out; |
| 134 | |
| 135 | /* |
| 136 | * Image file sizes. For the normal compiler, these are fixed quantities |
| 137 | * based on the current VM version we're targeting. For the dynamic |
| 138 | * compiler, these are adjusted to match the data from the loaded image |
| 139 | * file; this is necessary to ensure that code we generate matches static |
| 140 | * code loaded from the image. |
| 141 | */ |
| 142 | struct tc_image_info |
| 143 | { |
| 144 | /* size of the method header */ |
| 145 | int mhdr; |
| 146 | |
| 147 | /* size of the exception table entry */ |
| 148 | int exc_entry; |
| 149 | |
| 150 | /* debugger table header size */ |
| 151 | int dbg_hdr; |
| 152 | |
| 153 | /* debugger line table entry size */ |
| 154 | int dbg_line; |
| 155 | |
| 156 | /* debugger frame record size */ |
| 157 | int dbg_frame; |
| 158 | |
| 159 | /* local symbol header size */ |
| 160 | int lcl_hdr; |
| 161 | |
| 162 | /* debug record format version ID */ |
| 163 | int dbg_fmt_vsn; |
| 164 | }; |
| 165 | TC_GLOB_DECLARE tc_image_info G_sizes; |
| 166 | |
| 167 | /* |
| 168 | * Compiler interface to the live VM. In dynamic compilation mode, the VM |
| 169 | * supplies the compiler with this object to provide the compiler with |
| 170 | * access to VM resources. |
| 171 | */ |
| 172 | TC_GLOB_DECLARE class CTcVMIfc *G_vmifc; |
| 173 | |
| 174 | #endif /* VMGLOB_H */ |
| 175 |