-typedef struct AsmObject_ *AsmObject;
-typedef struct AsmBCO_ *AsmBCO;
-typedef struct AsmCAF_ *AsmCAF;
-typedef struct AsmCon_ *AsmCon;
-typedef StgInfoTable *AsmInfo;
-typedef StgClosure *AsmClosure;
-typedef Instr AsmInstr;
+/* these types are defined in Assembler.c */
+typedef
+ enum {
+ Asm_RefNoOp, /* Pointer which needs no further messing with */
+ Asm_RefObject, /* Reference to malloc'd AsmCAF/AsmBCO/AsmCon */
+ Asm_RefHugs, /* Reference to Hugs name or tycon table */
+
+ Asm_NonPtrWord, /* A non-pointer word */
+ Asm_Insn8, /* One BCO insn byte */
+ }
+ Asm_Kind;
+
+typedef
+ struct {
+ Asm_Kind kind;
+ StgWord val; /* StgWord is allegedly big enough to also hold
+ a pointer, on all platforms */
+ }
+ Asm_Entity;
+
+
+ struct AsmObject_ {
+ unsigned int magic;
+ struct AsmObject_* next;
+ enum { Asm_BCO, Asm_CAF, Asm_Con } kind;
+ int sizeEntities;
+ int usedEntities;
+ Asm_Entity* entities;
+ StgClosure* closure;
+
+ int n_refs; /* number of ptr words */
+ int n_words; /* number of words */
+ int n_insns; /* number of insn BYTES */
+
+ /* AsmCon specifics */
+ StgInfoTable* itbl;
+
+ /* AsmBCO specifics */
+ int /*StgExpr*/ stgexpr; /* stg tree for debugging */
+ AsmSp sp; /* simulated sp */
+ AsmSp max_sp; /* high-tide of sp */
+ Instr lastOpc; /* last opcode, for peephole opt */
+ };
+ /* AsmObject_ is only mentioned in Assembler.c; clients use
+ AsmObject/AsmBCO/AsmCAF/AsmCon.
+ */
+
+typedef StgInfoTable* AsmInfo;
+typedef struct AsmObject_* AsmBCO;
+typedef struct AsmObject_* AsmCAF;
+typedef struct AsmObject_* AsmCon;
+typedef struct AsmObject_* AsmObject;
+typedef Instr AsmInstr;