@@ -38,7 +38,8 @@ which is a constant that describes the kind of closure, for example, a
38
38
which the garbage collector requires to collect :term: `CAF `'s. Lastly, the info
39
39
table will hold the :term: `entry code ` pointer for the heap object if one exists
40
40
[# ]_ . For more see :ghcSource: `InfoTables.h
41
- <rts/include/rts/storage/InfoTables.h> ` for exact details and other variants.
41
+ <rts/include/rts/storage/InfoTables.h> ` and :ghcSource: `Closures.h
42
+ <rts/include/rts/storage/Storage.h> ` for exact details and variants.
42
43
43
44
Here is a depiction of the heap object layout without |TNTC | enabled. Code is
44
45
represented in orange and data in blue. Boxes which have a dashed outline change
@@ -83,14 +84,15 @@ depending on the type of heap object and build:
83
84
\d raw[->, thick] (ip.south) |- (ecp.north west) node[midway] {};
84
85
\draw[->, thick] (ecp.east) |- (ec.west) node[midway] {};
85
86
86
- Tables-next-to-code does two things: first it removes the entry code pointer
87
- from the info table and second, it moves the entry code itself to the address
88
- immediately after the info table and sets the info table pointer itself to the
89
- address of the entry code. This setup allows the runtime system to save a
90
- pointer indirection because the info table pointer now points to the entry code.
91
- Thus, when jumping to the entry code, which is a common operation, the runtime
92
- system saves a single indirection, but can still reference the fields of the
93
- info table through a negative memory offset from the info table pointer.
87
+ Tables-next-to-code does two things: first it removes the entry code pointer and
88
+ places the type specific fields before the ``Closure Type ``, and second, it
89
+ moves the entry code itself to the address immediately after the info table and
90
+ sets the info table pointer to the address of the entry code. This setup allows
91
+ the runtime system to save a pointer indirection because the info table pointer
92
+ now points to the entry code. Thus, when jumping to the entry code, which is a
93
+ common operation, the runtime system saves a single indirection, but can still
94
+ reference the fields of the info table through a negative memory offset from
95
+ the info table pointer.
94
96
95
97
Here is a depiction with |TNTC | enabled:
96
98
@@ -111,19 +113,19 @@ Here is a depiction with |TNTC| enabled:
111
113
(6,2.25)--node[rotate=0, yshift=7mm](header){Object Header} (14,2.25);
112
114
113
115
\n ode[below of=ip, draw,rectangle, thick, fill=blue!10,
114
- minimum width=4cm, minimum height=2cm, xshift=5cm, yshift=-3cm] (layout) {Layout};
116
+ minimum width=4cm, minimum height=2cm, xshift=5cm, yshift=-5cm] (layout) {Layout};
117
+
118
+ \n ode[above of=layout, draw,rectangle, thick, dashed, fill=blue!10,
119
+ minimum width=4cm, minimum height=2cm, yshift=1cm] (other) {Type Specific
120
+ Fields};
115
121
116
122
\n ode[below of=layout, draw,rectangle, thick, fill=blue!10,
117
123
minimum width=4cm, minimum height=2cm, yshift=-1cm] (ct) {Closure Type};
118
124
119
125
\n ode[below of=ct, draw,rectangle, thick, fill=blue!10,
120
126
minimum width=4cm, minimum height=2cm, yshift=-1cm] (srt) {SRT Bitmap};
121
127
122
- \n ode[below of=srt, draw,rectangle, thick, dashed, fill=blue!10,
123
- minimum width=4cm, minimum height=2cm, yshift=-1cm] (other) {Type Specific
124
- Fields};
125
-
126
- \n ode[below of=other, draw,rectangle, thick, fill=orange!20,
128
+ \n ode[below of=srt, draw,rectangle, thick, fill=orange!20,
127
129
minimum width=4cm, minimum height=2cm, yshift=-1cm] (ec) {Entry Code};
128
130
129
131
\d raw[->, thick] (ip.south) |- (ec.north west) node[midway] {};
0 commit comments