+/* -----------------------------------------------------------------------------
+ SRTs (Static Reference Tables)
+
+ These tables are used to keep track of the static objects referred
+ to by the code for a closure or stack frame, so that we can follow
+ static data references from code and thus accurately
+ garbage-collect CAFs.
+ -------------------------------------------------------------------------- */
+
+/* An SRT is just an array of closure pointers: */
+typedef StgClosure* StgSRT[];
+
+/*
+ * Each info table refers to some subset of the closure pointers in an
+ * SRT. It does this using a pair of an StgSRT pointer and a
+ * half-word bitmap. If the half-word bitmap isn't large enough, then
+ * we fall back to a large SRT, including an unbounded bitmap. If the
+ * half-word bitmap is set to all ones (0xffff), then the StgSRT
+ * pointer instead points to an StgLargeSRT:
+ */
+typedef struct StgLargeSRT_ {
+ StgSRT *srt;
+ StgLargeBitmap l;
+} StgLargeSRT;
+
+/* ----------------------------------------------------------------------------
+ Relative pointers
+
+ Several pointer fields in info tables are expressed as offsets
+ relative to the info pointer, so that we can generate
+ position-independent code.
+
+ There is a complication on the x86_64 platform, where pointeres are
+ 64 bits, but the tools don't support 64-bit relative relocations.
+ However, the default memory model (small) ensures that all symbols
+ have values in the lower 2Gb of the address space, so offsets all
+ fit in 32 bits. Hence we can use 32-bit offset fields.
+ ------------------------------------------------------------------------- */
+
+#if x86_64_TARGET_ARCH
+#define OFFSET_FIELD(n) StgHalfInt n; StgHalfWord __pad_##n;
+#else
+#define OFFSET_FIELD(n) StgInt n;
+#endif
+