Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/runtime/gc/ml-heap-image.h
ViewVC logotype

Annotation of /sml/trunk/src/runtime/gc/ml-heap-image.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download) (as text)

1 : monnier 249 /* ml-heap-image.h
2 :     *
3 :     * COPYRIGHT (c) 1992 by AT&T Bell Laboratories.
4 :     *
5 :     * The definitions and typedefs that describe the layout of an ML
6 :     * heap image in a file. This can be either an exported heap, or
7 :     * a blasted object.
8 :     *
9 :     * These files have the following basic layout:
10 :     *
11 :     * Image header
12 :     * Heap/Blast header
13 :     * External reference table
14 :     * Image
15 :     *
16 :     * where the format of Image depends on the kind (heap vs. blast).
17 :     */
18 :    
19 :     #ifndef _ML_IMAGE_
20 :     #define _ML_IMAGE_
21 :    
22 :     #ifndef _ML_SIZES_
23 :     #include "ml-sizes.h"
24 :     #endif
25 :    
26 :     #ifndef _ML_STATE_
27 :     #include "ml-state.h"
28 :     #endif
29 :    
30 :     #ifndef _HEAP_
31 :     #include "heap.h"
32 :     #endif
33 :    
34 :     /* tag to identify image byte order */
35 :     #define ORDER 0x00112233
36 :    
37 :     /* heap image version identifier (date in 00mmddyy form) */
38 :     #define IMAGE_MAGIC 0x00022499
39 :    
40 :     /* blasted heap image version identifier (date in 00mmddyy form) */
41 :     #define BLAST_MAGIC 0x00070995
42 :    
43 :     /* the kind of heap image */
44 :     #define EXPORT_HEAP_IMAGE 1
45 :     #define EXPORT_FN_IMAGE 2
46 :     #define BLAST_IMAGE 3
47 :     #define BLAST_UNBOXED 4 /* a blasted unboxed value */
48 :    
49 :     typedef struct { /* The magic number, and other version info */
50 :     Unsigned32_t byteOrder; /* ORDER tag */
51 :     Unsigned32_t magic; /* magic number */
52 :     Unsigned32_t kind; /* EXPORT_HEAP_IMAGE, etc. */
53 :     char arch[12]; /* the exporting machine's architecture */
54 :     char opsys[12]; /* the exporting machine's operating system */
55 :     } ml_image_hdr_t;
56 :    
57 :    
58 :     typedef struct { /* The header for a heap image */
59 :     int numVProcs; /* The number of virtual processors */
60 :     int numGens; /* The number of heap generations */
61 :     int numArenas; /* The number of small-object arenas (one per kind) */
62 :     int numBOKinds; /* The number of big-object kinds */
63 :     int numBORegions; /* The number of big-object regions in the */
64 :     /* exporting address space. */
65 :     int cacheGen; /* The oldest cached generation */
66 :     Addr_t allocSzB; /* The size of the allocation arena */
67 :     /* heap objects that are referred to by the runtime */
68 :     ml_val_t pervStruct; /* the contents of PervStruct */
69 :     ml_val_t runTimeCompUnit; /* The run-time system compilation unit root */
70 :     ml_val_t mathVec; /* The Math structure root (if defined) */
71 :     } ml_heap_hdr_t;
72 :    
73 :     typedef struct { /* The header for a blasted object image */
74 :     Unsigned32_t numArenas; /* The number of small-object arenas (one per kind) */
75 :     Unsigned32_t numBOKinds; /* The number of big-object kinds */
76 :     Unsigned32_t numBORegions;/* The number of big-object regions in the */
77 :     /* exporting address space. */
78 :     bool_t hasCode; /* true, if the blasted object contains code */
79 :     ml_val_t rootObj; /* The root object */
80 :     } ml_blast_hdr_t;
81 :    
82 :     typedef struct { /* The header for the extern table */
83 :     int numExterns; /* The number of external symbols */
84 :     int externSzB; /* The size (in bytes) of the string table area. */
85 :     } extern_tbl_hdr_t;
86 :    
87 :    
88 :     typedef struct { /* The image of an ML virtual processor. The live */
89 :     /* registers are those specified by RET_MASK, plus */
90 :     /* the varReg, exnCont and pc. */
91 :     ml_val_t sigHandler; /* the contents of MLSignalHandler */
92 :     ml_val_t stdArg;
93 :     ml_val_t stdCont;
94 :     ml_val_t stdClos;
95 :     ml_val_t pc;
96 :     ml_val_t exnCont;
97 :     ml_val_t varReg;
98 :     ml_val_t calleeSave[CALLEESAVE];
99 :     } ml_vproc_image_t;
100 :    
101 :    
102 :     /* The heap header consists of numGens generation descriptions, each of which
103 :     * consists of (numArenas+numBOKinds) heap_arena_hdr_t records. After the
104 :     * generation descriptors, there are numBORegions bo_region_info_t records,
105 :     * which are followed by the page aligned heap image follows the heap header.
106 :     */
107 :    
108 :     typedef struct { /* An arena header. This is used for both the regular */
109 :     /* arenas and the big-object arena of a generation. */
110 :     int gen; /* the generation of this arena */
111 :     int objKind; /* the kind of objects in this arena */
112 :     Unsigned32_t offset; /* the file position at which this arena starts. */
113 :     union { /* additional info */
114 :     struct { /* info for regular arenas */
115 :     Addr_t baseAddr; /* the base address of this arena in the */
116 :     /* exporting address space. */
117 :     Addr_t sizeB; /* the size of the live data in this arena */
118 :     Addr_t roundedSzB; /* the padded size of this arena in the */
119 :     /* image file */
120 :     } o;
121 :     struct { /* info for the big-object arena */
122 :     int numBigObjs; /* the number of big-objects in this */
123 :     /* generation. */
124 :     int numBOPages; /* the number of big-object pages required. */
125 :     } bo;
126 :     } info;
127 :     } heap_arena_hdr_t;
128 :    
129 :     typedef struct { /* a descriptor of a big-object region in the */
130 :     /* exporting address space */
131 :     Addr_t baseAddr; /* the base address of this big-object region in */
132 :     /* the exporting address space. Note that this */
133 :     /* is the address of the header, not of the */
134 :     /* first page. */
135 :     Addr_t firstPage; /* the address of the first page of the region in */
136 :     /* the exporting address space. */
137 :     Addr_t sizeB; /* the total size of this big-object region */
138 :     /* (including the header). */
139 :     } bo_region_info_t;
140 :    
141 :     typedef struct { /* a header for a big-object */
142 :     int gen; /* the generation of this big-object */
143 :     int objKind; /* the class of this big-object */
144 :     Addr_t baseAddr; /* the base address of this big-object in the */
145 :     /* exporting address space */
146 :     Addr_t sizeB; /* the size of this big-object */
147 :     } bigobj_hdr_t;
148 :    
149 :    
150 :     /** external references **/
151 :     #define isEXTERNTAG(w) (isDESC(w) && (GET_TAG(w) == DTAG_extern))
152 :     #define EXTERNID(w) GET_LEN(w)
153 :    
154 :     /** Pointer tagging operations **/
155 :     #define HIO_ID_BITS 8
156 :     #define HIO_ADDR_BITS (BITS_PER_WORD-HIO_ID_BITS)
157 :     #define HIO_ADDR_MASK ((1 << HIO_ADDR_BITS) - 1)
158 :    
159 :     #define HIO_TAG_PTR(id,offset) PTR_CtoML(((id)<<HIO_ADDR_BITS)|(Addr_t)(offset))
160 :     #define HIO_GET_ID(p) (PTR_MLtoADDR(p)>>HIO_ADDR_BITS)
161 :     #define HIO_GET_OFFSET(p) (PTR_MLtoADDR(p) & HIO_ADDR_MASK)
162 :    
163 :     #endif /* !_ML_IMAGE_ */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0