Redraw figure 6.1 Accelerated Name Access Diagram in TikZ.
authorAdrian Prantl <aprantl@apple.com>
Fri, 3 Jul 2015 22:54:10 +0000 (15:54 -0700)
committerAdrian Prantl <aprantl@apple.com>
Fri, 3 Jul 2015 22:54:10 +0000 (15:54 -0700)
dwarf5/latexdoc/dwarf5.tex
dwarf5/latexdoc/otherdebugginginformation.tex

index efdbaf1..53a210b 100644 (file)
@@ -65,6 +65,7 @@ escapeinside={\%*}{*)}     % if you want to add a comment within your code
 \usepackage{lscape}        % For landscape mode (Appendix B)
 \usepackage{tikz}         % graphics (Appendix B)
 \usetikzlibrary{shapes.geometric}
 \usepackage{lscape}        % For landscape mode (Appendix B)
 \usepackage{tikz}         % graphics (Appendix B)
 \usetikzlibrary{shapes.geometric}
+\usetikzlibrary{shapes.multipart}
 \usetikzlibrary{arrows,decorations.pathmorphing}
 \usepackage{makeidx}       % For making an index
 % hyperref must be the last package listed.
 \usetikzlibrary{arrows,decorations.pathmorphing}
 \usepackage{makeidx}       % For making an index
 % hyperref must be the last package listed.
index fa7716f..39a51bb 100644 (file)
@@ -170,7 +170,129 @@ Figure \referfol{fig:nameindexlayout}.
 \end{enumerate}
 
 \begin{figure}[t]
 \end{enumerate}
 
 \begin{figure}[t]
-\includegraphics[keepaspectratio=true,scale=0.5]{acceleratednameaccessdiagram}
+  \begin{tikzpicture}[every node/.style={draw, anchor=text,
+        node distance=2.5cm,
+        text width=3.5cm, font=\normalsize},
+        description/.style={
+          draw=none,
+          font=\em\footnotesize,
+          node distance=5cm,
+          text width=5cm
+        },
+        table/.style={
+          font=\scriptsize,
+          draw=black,
+          rectangle split,
+          fill=yellow!10
+        },
+        caption/.style={
+          anchor=south,
+          font=\scriptsize,
+          draw=none
+        }]
+    \node (header) [font=\footnotesize,
+                    fill=blue!10,
+                    rectangle split,
+                    rectangle split allocate boxes=8,
+                    rectangle split parts=8]
+          {Header
+            \nodepart{two}
+            CU list
+            \nodepart{three}
+            Local TU list
+            \nodepart{four}
+            Foreign TU list
+            \nodepart{five}
+            Hash table
+            \nodepart{six}
+            Name table
+            \nodepart{seven}
+            Abbrev table
+            \nodepart{eight}
+            Entry pool
+          };
+    \node (cuofs) [table,
+                   rectangle split allocate boxes=4,
+                   rectangle split parts=4]  at (6,0)
+         {CU 0 offset
+          \nodepart{two}
+          CU 1 offset
+          \nodepart{three}
+          CU 2 offset
+          \nodepart{four}
+          \dots
+         };
+    \node (cusecofs) [description,right of=cuofs] {section offset of CU header} ;
+    \node (tuofs) [below of=cuofs,
+                   table,
+                   rectangle split allocate boxes=4,
+                   rectangle split parts=4]
+         {TU 0 offset
+          \nodepart{two}
+          TU 1 offset
+          \nodepart{three}
+          TU 2 offset
+          \nodepart{four}
+          \dots
+         };
+    \node (tusecofs) [description,right of=tuofs] {section offset of TU header} ;
+    \node (tusigs) [below of=tuofs, table,
+                    rectangle split allocate boxes=4,
+                    rectangle split parts=4]
+         {TU $n$ sig.
+          \nodepart{two}
+          TU $n+1$ sig.
+          \nodepart{three}
+          TU $n+2$ sig.
+          \nodepart{four}
+          \dots
+         };
+   \node (typesigs) [description,right of=tusigs] {type signature of foreign TU} ;
+   \matrix (hashtable) [draw,style=dashed] at (2, -9)
+           {\node (buckets) [style=solid, table, text width=3cm,
+                             rectangle split allocate boxes=4,
+                             rectangle split parts=4]
+                  {index to hashes} ;
+            \draw node [caption] at (buckets.north) {Buckets} ;
+            &
+            \node (hashes) [style=solid, table, text width=3cm,
+                            rectangle split allocate boxes=6,
+                            rectangle split parts=6]
+                  {hash value} ;
+            \draw node [caption] at (hashes.north) {Hashes} ;
+            \\
+           };
+    \node (names) [right of=hashes, node distance=5cm,
+                   style=solid,
+                   table,
+                   rectangle split allocate boxes=6,
+                   rectangle split parts=6]
+          {strp \hspace{4em} entry };
+    \draw node [caption] at (names.north) {Names} ;
+    \path (names.north) edge (names.south) ;
+
+    \path[->]
+    (header.two east)    edge (cuofs.west)
+    (header.three east)  edge (tuofs.west)
+    (header.four east)   edge (tusigs.west)
+    (header.five east)   edge (hashtable)
+    (cuofs)              edge (cusecofs)
+    (tuofs)              edge (tusecofs)
+    (tusigs)             edge (typesigs)
+    (buckets.one east)   edge (hashes.one west)
+    (buckets.two east)   edge (hashes.three west)
+    (buckets.three east) edge (hashes.six west)
+    (hashes.one east)    edge (names.one west)
+    (hashes.two east)    edge (names.two west)
+    (hashes.three east)  edge (names.three west)
+    (hashes.four east)   edge (names.four west)
+    (hashes.five east)   edge (names.five west)
+    (hashes.six east)    edge (names.six west)
+    ;
+    \draw[->] (header.six east)
+      .. controls (buckets.north) and (tusigs.south west) ..
+      (names.north west) ;
+  \end{tikzpicture}
 \caption{Name Index Layout}
 \label{fig:nameindexlayout}
 \end{figure}
 \caption{Name Index Layout}
 \label{fig:nameindexlayout}
 \end{figure}