@@ -38,7 +38,8 @@ which is a constant that describes the kind of closure, for example, a
3838which the garbage collector requires to collect :term: `CAF `'s. Lastly, the info
3939table will hold the :term: `entry code ` pointer for the heap object if one exists
4040[# ]_ . 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.
4243
4344Here is a depiction of the heap object layout without |TNTC | enabled. Code is
4445represented 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:
8384 \d raw[->, thick] (ip.south) |- (ecp.north west) node[midway] {};
8485 \draw[->, thick] (ecp.east) |- (ec.west) node[midway] {};
8586
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.
9496
9597Here is a depiction with |TNTC | enabled:
9698
@@ -111,19 +113,19 @@ Here is a depiction with |TNTC| enabled:
111113 (6,2.25)--node[rotate=0, yshift=7mm](header){Object Header} (14,2.25);
112114
113115 \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};
115121
116122 \n ode[below of=layout, draw,rectangle, thick, fill=blue!10,
117123 minimum width=4cm, minimum height=2cm, yshift=-1cm] (ct) {Closure Type};
118124
119125 \n ode[below of=ct, draw,rectangle, thick, fill=blue!10,
120126 minimum width=4cm, minimum height=2cm, yshift=-1cm] (srt) {SRT Bitmap};
121127
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,
127129 minimum width=4cm, minimum height=2cm, yshift=-1cm] (ec) {Entry Code};
128130
129131 \d raw[->, thick] (ip.south) |- (ec.north west) node[midway] {};
0 commit comments