Ignore:
Timestamp:
Apr 27, 2026, 7:17:34 PM (31 hours ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
f1ffc47
Parents:
602cec4
Message:

Apply document-level formatting and rearrange the array-in-struct discussion.

Formatting:

  • add visual separation of figures from text
  • prevent "formula"-style code fragments from page breaking
  • (thereby prevent code formula broken at end of page from mistakenly restarting the reader in a code figure at the top of the next page)
  • give short+long figure captions
  • assure descriptive captions
  • remove Title-Like Captialization in Captions
  • turn a couple figures into tables where the figure visual separator looks bad

Array-in-struct

  • remove lingering use of "accordion"
  • call it Dynamic Array Member
  • oranize discussion as, first explain example, then argue feature is good
Location:
doc/theses/mike_brooks_MMath
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/array.tex

    r602cec4 r9c12dd0  
    3030
    3131A function can be polymorphic over @array@ arguments using the \CFA @forall@ declaration prefix.
     32\begin{minipage}{\linewidth} % forbid page splitting, force
    3233\begin{cfa}
    3334forall( T, @[N]@ )
     
    4041Cforall Runtime error: subscript 1000 exceeds dimension range [0,99) $for$ array 0x555555558020.
    4142\end{cfa}
     43\end{minipage}
    4244Function @g@ takes an arbitrary type parameter @T@ and an unsigned integer \emph{dimension} @N@.
    4345The dimension represents a to-be-determined number of elements, managed by the type system, where 0 represents an empty array.
     
    125127\lstinput{30-43}{hello-array.cfa}
    126128\lstinput{45-48}{hello-array.cfa}
    127 \caption{Example of calling a dimension-generic function.}
     129\caption{Example of calling a dimension-generic function}
    128130\label{f:fExample}
    129131\end{figure}
     
    243245This static check's rules are presented in \VRef[Section]{s:ArrayTypingC}.
    244246
    245 Orthogonally, the \CFA array type works within generic \emph{types}, \ie @forall@-on-@struct@.
    246 The same argument safety and the associated implicit communication of array length occurs.
     247Orthogonally, the \CFA array type also works inside generic \emph{types}.
     248That is, an @array@ as a generic @struct@'s member and an @[N]@ can parameterize a @struct@.
     249The same argument safety, and the associated implicit length communication, occur.
    247250Preexisting \CFA allowed aggregate types to be generalized with type parameters, enabling parameterizing of element types.
    248 This feature is extended to allow parameterizing by dimension.
    249 Doing so gives a refinement of C's ``flexible array member''~\cite[\S~6.7.2.1.18]{C11}:
     251As polymorphism on functions was extended to allow parameterizing over dimensions, so is polymorphism on types.
     252The result has profound consequences for safe memory management.
     253
     254C's Flexible Array Member (FAM) pattern~\cite[\S~6.7.2.1.18]{C11} gives an unsafe way to put an array of dynamic length inside a structure.
    250255\begin{cfa}
    251256struct S {
    252257        ...
    253         double d []; // incomplete array type => flexible array member
    254 } * s = malloc( sizeof( struct S ) + sizeof( double [10] ) );
    255 \end{cfa}
    256 which creates a VLA of size 10 @double@s at the end of the structure.
    257 A C flexible array member can only occur at the end of a structure;
    258 \CFA allows length-parameterized array members to be nested at arbitrary locations, with intervening member declarations.
    259 \lstinput{10-15}{hello-accordion.cfa}
    260 The structure has course- and student-level metadata (their respective field names) and a position-based preferences' matrix.
    261 The structure's layout is dynamic; the starting offset of @student_ids@ varies according to the generic parameter @C@; the offset of @preferences@ varies by both.
    262 
    263 \VRef[Figure]{f:checkExample} shows a program main using @School@ and results with different array sizes.
     258        double d[]; // incomplete array type => flexible array member
     259};
     260struct S * s = malloc( sizeof( struct S ) + sizeof( double [10] ) );
     261\end{cfa}
     262This type-@S@ declaration defines a quasi-VLA named @d@ as the last structure member.
     263The variable-@s@ initialization sizes this particular array at 10 elements.
     264The choice of @malloc@ here is the common-case FAM idiom, but @alloca@ can be substituted, resulting in stack allocation.
     265A \CFA @[N]@-parameterized structure improves on this pattern.
     266
     267\begin{figure}
     268        \lstinput{10-15}{hello-accordion.cfa}
     269        \caption{\CFA Dynamic Array Member (DAM) declaration}
     270        \label{DAM-declaration}
     271\end{figure}
     272
     273\CFA allows length-parameterized array members to be nested at arbitrary locations, with further member declarations interleaved.
     274The result is a \newterm{Dynamic Array Member (DAM)}
     275% \footnote{
     276%       To keep the names straight, it may help to think of C's flexible array member as ``too flexible,'' where the discussion that follows makes the case that a FAM is weakly typed.
     277% },
     278as illustrated in \VRef[Figure]{DAM-declaration}.  The example's @School@ structure has course- and student-level metadata (in the respectively named fields) and a position-based preferences' matrix.
     279The structure's layout is dynamic; the starting offset of @student_ids@ varies according to the generic parameter @C@, which affects the size of the @course_codes@ field.
     280Similarly, the offset of @preferences@ varies by both parameters.
     281
     282\VRef[Figure]{f:DAM-example} shows a program main using the @School@ type, along with results at different array sizes.
    264283The @school@ variable holds many students' course-preference forms.
    265284It is on the stack and its initialization does not use any casting or size arithmetic.
    266 Both of these points are impossible with a C flexible array member.
    267 When heap allocation is preferred, the original pattern still applies.
     285When heap allocation is preferred, the original pattern still applies, with the same qualities.
    268286\begin{cfa}
    269287School( classes, students ) * sp = alloc();
    270288\end{cfa}
    271 This ability to avoid casting and size arithmetic improves safety and usability over C flexible array members.
    272289The example program prints the courses in each student's preferred order, all using the looked-up display names.
    273 When a function operates on a @School@ structure, the type system handles its memory layout transparently.
    274 In the example, function @getPref@ returns, for the student at position @is@, what is the position of their @pref@\textsuperscript{th}-favoured class.
    275 Finally, inputs and outputs are given on the right for different sized schools.
     290In the example, function @getPref@ returns, for the student at position @is@, the position of their @pref@\textsuperscript{th}-favoured class.
     291This function helps the program to output each student's ordered preferences.
     292The program's inputs and outputs are given on the right, for two different school sizes.
    276293
    277294\begin{figure}
     
    304321\end{tabular}
    305322
    306 \caption{\lstinline{School} Example, Input and Output}
    307 \label{f:checkExample}
     323
     324\caption[\CFA Dynamic Array Member (DAM) usage]{
     325        \CFA Dynamic Array Member (DAM) usage.
     326        Example program (left) with input and output (right).}
     327\label{f:DAM-example}
    308328\end{figure}
     329
     330Much of these \CFA DAM features are impossible with a C FAM.
     331In C, they can only occur at the end of a structure;
     332\CFA allows them anywhere.
     333As a consequence, \CFA allows several of them, while C is limited to one.
     334The \CFA ability to avoid casting and size arithmetic improves safety and usability over C.
     335While C offers the \emph{VLA} language feature, to eliminate casting and size arithmetic for stack-allocated \emph{simple arrays}, this feature does not extend to stack-allocating a FAM-structure, which makes the user fall back on explicit @alloca@.
     336The \CFA DAM, by contrast, treats every stack allocation as a simple variable declaration.
     337When a function operates on a \CFA DAM structure, the type system handles its memory layout transparently.
     338
    309339
    310340
     
    343373        The ``resolver'' compiler pass, which provides argument values for a declaration's type-system parameters, gathered from type information in scope at the usage site.
    344374\item
    345         The ``box'' compiler pass, which encodes information about type parameters into ``extra'' regular parameters on declarations and and arguments on calls.
     375        The ``box'' compiler pass, which encodes information about type parameters into ``extra'' regular parameters on declarations, and corresponding arguments on calls.
    346376        Notably, it conveys the size of a type @foo@ as a @__sizeof_foo@ parameter, and rewrites the @sizeof(foo)@ expression as @__sizeof_foo@, \ie a use of the parameter.
    347377\end{itemize}
     
    690720        \end{itemize}
    691721
    692         \caption{Case comparison for array type compatibility, given pairs of dimension expressions.}
     722        \caption[Case comparison for array type compatibility]{Case comparison for array type compatibility, given pairs of dimension expressions.}
    693723        \label{f:DimexprRuleCompare}
    694724\end{figure}
     
    946976\begin{figure}
    947977\includegraphics{measuring-like-layout}
    948 \caption{Visualization of subscripting by value and by \lstinline[language=CFA]{all}, for \lstinline{x} of type \lstinline{array( float, 5, 7 )} understood as 5 rows by 7 columns.
    949 The horizontal layout represents contiguous memory addresses while the vertical layout is conceptual.
    950 The vertical shaded band highlights the location of the targeted element, 2.3.
    951 Any such vertical slice contains various interpretations of a single address.}
     978\caption[Visualization of subscripting by value and by `all']{
     979        Visualization of subscripting by value and by `\lstinline[language=CFA]{all}.'
     980        Uses example variable \lstinline{x} of type \lstinline{array( float, 5, 7 )}, understood as 5 rows by 7 columns.
     981        The horizontal layout represents contiguous memory addresses while the vertical layout is conceptual.
     982        The vertical shaded band highlights the location of the targeted element, 2.3.
     983        Any such vertical slice contains various interpretations of a single address.
     984}
    952985\label{fig:subscr-all}
    953986\end{figure}
     
    10071040% \noindent END: Paste looking for a home
    10081041
    1009 The new-array library defines types and operations that ensure proper elements are accessed soundly in spite of the overlapping.
    1010 The @arpk@ structure and its @-[i]@ operator are defined as:
     1042\begin{figure}
    10111043\begin{cfa}
    10121044forall(
     
    10261058}
    10271059\end{cfa}
     1060\caption{Definition of structure `\lstinline{arpk},' which underlies the \CFA array}
     1061\label{f:arpk}
     1062\end{figure}
     1063
     1064The new-array library defines types and operations that ensure proper elements are accessed soundly in spite of the overlapping.
     1065The @arpk@ structure and its @-[i]@ operator are defined in \VRef[Figure]{f:arpk}.
    10281066The private @arpk@ structure (array with explicit packing) is generic over four types: dimension length, masquerading-as, ...
    10291067This structure's public interface is hidden behind the @array(...)@ macro and the subscript operator.
     
    11011139\multicolumn{1}{c}{(i)}
    11021140\end{tabular}
    1103 \caption{Overhead comparison, control case.
    1104 All three programs/compilers generate equally performant code when the programmer ``self-checks'' bounds via a loop's condition.
    1105 Yet both \CFA and \CC versions generate code that is slower and safer than C's when the programmer might overrun the bounds.}
     1141\caption[Bound-check overhead comparison, control case]{
     1142        Bound-check overhead comparison, control case.
     1143        All three programs/compilers generate equally performant code when the programmer ``self-checks'' bounds via a loop's condition.
     1144        Yet both \CFA and \CC versions generate code that is slower and safer than C's when the programmer might overrun the bounds.
     1145}
    11061146\label{f:ovhd-ctl}
    11071147\end{figure}
     
    13441384\end{cfa}
    13451385\end{tabular}
    1346 \caption{Exponential thunk generation under the otype-recursion pattern.
     1386\caption[Exponential thunk generation under the otype-recursion pattern]{
     1387        Exponential thunk generation under the otype-recursion pattern.
    13471388        Each time one type's function (\eg ctor) uses another type's function, the \CFA compiler generates a thunk, to capture the used function's dependencies, presented according to the using function's need.
    13481389        So, each non-leaf line represents a generated thunk and every line represents a search request for the resolver to find a satisfying function.}
     
    16401681\hspace{6pt}
    16411682
    1642 \caption{Triangular Matrix}
     1683\caption{Triangular matrix in Java and C}
    16431684\label{f:JavaVsCTriangularMatrix}
    16441685\end{figure}
     
    16841725
    16851726Thus, these options do not offer an allocation with a dynamically given fixed size.
    1686 And furthermore, they do not provide any improvement to the C flexible array member pattern, for making a dynamic amount of storage contiguous with its header, as do \CFA's accordions.
     1727And furthermore, they do not provide any improvement to the C flexible array member pattern, for making a dynamic amount of storage contiguous with its header, as do \CFA's new dynamic array members.
    16871728
    16881729
  • doc/theses/mike_brooks_MMath/background.tex

    r602cec4 r9c12dd0  
    491491\end{cfa}
    492492\end{tabular}
    493 \caption{Pre-VLA Fixed \vs Variable Contiguous Matrix Styles}
     493\caption{Pre-VLA contiguous matrix styles, fixed \vs variable}
    494494\label{f:FixedVariable}
    495495\end{figure}
     
    580580\end{cfa}
    581581\end{tabular}
    582 \caption{C99 Contiguous \vs Non-contiguous Matrix Styles}
     582\caption{C99 matrix styles, contiguous \vs non-contiguous }
    583583\label{f:ContiguousNon-contiguous}
    584584\end{figure}
     
    672672\end{cfa}
    673673\end{tabular}
    674 \caption{Multiple ways to declare an array parameter.
     674\caption[Multiple ways to declare an array parameter]{
     675Multiple ways to declare an array parameter.
    675676Across a valid row, every declaration is equivalent.
    676677Each column gives a declaration style, where the style for that column is read from the first row.
     
    955956\subfloat[Wrapped value]{\label{f:WrappedValue}\usebox\myboxC}
    956957
    957 \caption{
    958                 Three styles of link attachment:
     958\caption[Three styles of link attachment]{
     959                Three styles of link attachment.
    959960                % \protect\subref*{f:Intrusive}~intrusive, \protect\subref*{f:WrappedRef}~wrapped reference, and \protect\subref*{f:WrappedValue}~wrapped value.
    960961                The diagrams show the memory layouts that result after the code runs, eliding the head object \lstinline{reqs};
     
    10121013        \lstinput[language=C++]{100-117}{lst-issues-attach-reduction.hpp}
    10131014        \lstinput[language=C++]{150-150}{lst-issues-attach-reduction.hpp}
    1014         \caption{
     1015        \caption[Simulation of wrapped using intrusive]{
    10151016                Simulation of wrapped using intrusive.
    10161017                Illustrated by pseudocode implementation of an STL-compatible API fragment using LQ as the underlying implementation.
     
    10481049                \hspace*{1.5in}\includegraphics[page=2]{lst-issues-direct.pdf}
    10491050        }
    1050         \caption{
     1051        \caption[Example of simultaneity using LQ lists]{
    10511052                Example of simultaneity using LQ lists.
    10521053                The zoomed-out diagram (right/top) shows the complete multi-linked data structure.
     
    12141215        \centering
    12151216        \includegraphics[width=\textwidth]{lst-issues-ident.pdf}
    1216         \caption{
     1217        \caption[Comparison of headed and ad-hoc list identities]{
    12171218                Comparison of headed and ad-hoc list identities, for various list lengths.
    12181219                Pointers are logical, meaning that no claim is intended about which part of an object is being targeted.
     
    12561257        \centering
    12571258        \includegraphics[width=0.55\textwidth]{lst-issues-end.pdf}
    1258         \caption{
    1259                 LQ sub-object-level representation of links and ends.
     1259        \caption[LQ field-level representation of links and ends]{
     1260                LQ field-level representation of links and ends.
    12601261                Each object's memory is pictured as a vertical strip.
    12611262                The location, within a strip, at which an arrow points, is significant.
  • doc/theses/mike_brooks_MMath/list.tex

    r602cec4 r9c12dd0  
    4343g( s, &s ); $\C{// value, pointer}$
    4444\end{cfa}
    45 \caption{Plan-9 Polymorphism}
     45\caption{Plan-9 polymorphism}
    4646\label{f:Plan9Polymorphism}
    4747\end{figure}
     
    7979\end{cfa}
    8080\end{tabular}
    81 \caption{Diamond Non-Virtual Inheritance Pattern}
     81\caption{Diamond non-virtual inheritance pattern}
    8282\label{f:DiamondInheritancePattern}
    8383\end{figure}
     
    127127}
    128128\end{cfa}
    129 \caption{\lstinline{dlisk} / \lstinline{dlist} Outline}
     129\caption[Sketch of the dlink and dlist type definitions]{Sketch of the \lstinline{dlink} and \lstinline{dlist} type definitions }
    130130\label{f:dlistOutline}
    131131\end{figure}
     
    154154\end{tabular}
    155155
    156 \caption{
    157         Demonstration of multiple static link axes done in the \CFA list library.
     156\caption[Demonstration of multiple static link axes in \CFA]{
     157        Demonstration of multiple static link axes in \CFA.
    158158        The right example is from \VRef[Figure]{fig:lst-issues-multi-static}.
    159159        The left \CFA example does the same job.
     
    278278E & remove_first( dlist( E ) & list );
    279279E & remove_last( dlist( E ) & list );
    280 void transfer( dlist( E ) & to, dlist( E ) & from ) {
    281 void split( dlist( E ) & to, dlist( E ) & from, E & node ) {
    282 \end{cfa}
    283 \caption{\CFA List API}
     280void transfer( dlist( E ) & to, dlist( E ) & from );
     281void split( dlist( E ) & to, dlist( E ) & from, E & node );
     282\end{cfa}
     283\caption{\CFA list API}
    284284\label{f:ListAPI}
    285285\end{figure}
     
    309309}
    310310\end{cfa}
    311 \caption{Iterator Driver}
     311\caption{Iterator driver}
    312312\label{f:IteratorDriver}
    313313\end{figure}
     
    586586\end{cfa}
    587587\end{tabular}
    588 \caption{\CC \vs \CFA List Issues}
     588\caption{Obtaining a linked-list iterator in \CC \vs \CFA}
    589589\label{f:CCvsCFAListIssues}
    590590\end{figure}
     
    627627        \includegraphics[width=\textwidth]{lst-impl-links.pdf}
    628628        \caption{
    629                 \CFA list library representations for headed and headless lists.
     629                \CFA list library representations for headed and headless lists
    630630        }
    631631        \label{fig:lst-impl-links}
     
    717717\end{tabular}
    718718\caption{
    719         Glossary of terms used in the list performance evaluation.
     719        Glossary of terms used in the list performance evaluation
    720720}
    721721\label{f:ListPerfGlossary}
     
    969969all hd & ins-e & rem-e & all hd & ins-e & rem-e
    970970\end{tabular}
    971 \caption{Experiment use cases, numbered.}
     971\caption{Experiment use cases, numbered}
    972972\label{f:ExperimentOperations}
    973973\end{figure}
     
    10411041        }
    10421042  \end{tabular}
    1043   \caption{Variety of IR duration \vs list length, at small--medium lengths.  Two example use cases are shown: I, stack movement with head-only access (plot a); VIII, queue movement with element-oriented removal access (plot b); both use cases have insert-first polarity.  One example is run on each machine: UC-I on AMD (ploat a); UC-VIII on Intel (plot b).  Lower is better.}
     1043  \caption[Variety of IR duration responses to list length, at small--medium lengths]{Variety of IR duration responses to list length, at small--medium lengths.  Two example use cases are shown: I, stack movement with head-only access (plot a); VIII, queue movement with element-oriented removal access (plot b); both use cases have insert-first polarity.  One example is run on each machine: UC-I on AMD (ploat a); UC-VIII on Intel (plot b).  Lower is better.}
    10441044  \label{fig:plot-list-zoomin-abs}
    10451045\end{figure}
     
    11471147        }
    11481148  \end{tabular}
    1149   \caption{IR duration, transformed for general anaysis.  The analysis follows the single example setup of \VRef[Figure]{f:zoomin-abs-i-swift}, \ie Use Case I on AMD, where IR is given as absolute duration.  Plot (a) transforms the source dataset by conditioning on specific size.  Plot (b) takes the results from only the identified size zones, discards their specific-size information, and shows the resulting distribution.  Lower is better.}
     1149  \caption[IR duration, transformed for general anaysis]{
     1150        IR duration, transformed for general anaysis.
     1151        The analysis follows the single example setup of \VRef[Figure]{f:zoomin-abs-i-swift}, \ie Use Case I on AMD, where IR is given as absolute duration.
     1152        Plot (a) transforms the source dataset by conditioning on specific size.
     1153        Plot (b) takes the results from only the identified size zones, discards their specific-size information, and shows the resulting distribution.
     1154        Lower is better.}
    11501155  \label{fig:plot-list-rel}
    11511156\end{figure}
     
    12581263  } % subfigure
    12591264  \end{tabular}
    1260   \caption{Insert/remove duration \vs list length.
     1265        \caption[IR duration \vs list length, all sizes]{IR duration \vs list length, all sizes.
    12611266  Lengths go as large possible without error.
    12621267  One example use case is shown: stack movement, insert-first polarity and head-mediated access. Lower is better.}
     
    13481353  \includegraphics{plot-list-1ord.pdf}
    13491354  \small{\textsuperscript{\textdagger} LQ-@list@ is (/48) by its incomplete (25\%) use case coverage.  Its bars are scaled to match.}
    1350   \caption{Histogram of IR durations, decomposed by all first-order effects.
    1351   Each of the three breakdowns divides the entire population of test results into its mutually disjoint constituents. Lower is better.
     1355  \caption[IR duration, decomposed by all first-order effects]{
     1356        IR duration, decomposed by all first-order effects.
     1357        Each of the three breakdowns divides the entire population of test results into its mutually disjoint constituents.
     1358        Lower is better.
    13521359  }
    13531360  \label{fig:plot-list-1ord}
     
    13961403        \textsuperscript{*} The full population of 192 individual configurations applies (48 for LQ-@list@), but this analysis summarizes pairs of them, giving each histogram's 96 contributions (24 for LQ-@list@).
    13971404        }
    1398         \caption{Histogram of IR durations, illustrating interactions with framework.
    1399         Higher favours top option; lower favours bottom option.
     1405        \caption[IR duration where framework selection interacts with other factors]{
     1406                IR duration where framework selection interacts with other factors.
     1407                Higher favours top option; lower favours bottom option.
    14001408        }
    14011409        \label{fig:plot-list-2ord}
  • doc/theses/mike_brooks_MMath/string.tex

    r602cec4 r9c12dd0  
    1414The over-arching commonality is that operations work on groups of characters for assigning, copying, scanning, and updating.
    1515
    16 \begin{figure}[h]
     16%\begin{figure}[h]
     17\begin{figure}
    1718\begin{cquote}
    1819\begin{tabular}{@{}l|l|l|l@{}}
     
    3435\end{tabular}
    3536\end{cquote}
    36 \caption{Language comparison of string API}
     37\caption{Inter-language comparison of string APIs}
    3738\label{f:StrApiCompare}
    3839\end{figure}
     
    620621\end{tabular}
    621622\end{cquote}
    622 \caption{Extracting Words from Line of Text}
     623\caption{Simplification by \CFA API for extracting words from a line of text}
    623624\label{f:ExtractingWordsText}
    624625\end{figure}
     
    812813As well, the operations are asymmetric, \eg @String@ has @replace@ by text but not replace by position and vice versa for @StringBuffer@.
    813814
    814 More significant operational differences relate to storage management, often appearing through assignment (@target = source@), and are summarized in \VRef[Figure]{f:StrSemanticCompare}, which defines properties type abstraction, state, symmetry, and referent.
    815 The following discussion justifies the figure's yes/no entries per language.
    816 
    817 \begin{figure}
     815More significant operational differences relate to storage management, often appearing through assignment (@target = source@), and are summarized in \VRef[Table]{f:StrSemanticCompare}, which defines properties type abstraction, state, symmetry, and referent.
     816The following discussion justifies the table's yes/no entries per language.
     817
     818\begin{table}
     819\caption{Comparison of languages' strings, storage management perspective}
     820\label{f:StrSemanticCompare}
    818821\setlength{\extrarowheight}{2pt}
    819822\setlength{\tabcolsep}{5pt}
     
    860863        The Java @String@ class is analyzed; its @StringBuffer@ class behaves similarly to \CC.
    861864\end{itemize}
    862 \caption{Comparison of languages' strings, storage management perspective.}
    863 \label{f:StrSemanticCompare}
    864 \end{figure}
     865\end{table}
    865866
    866867In C, these declarations are very different.
     
    943944$\texttt{\small abcde abcde abcde abcde bc c}$
    944945\end{cfa}
    945 % all helpful criteria of \VRef[Figure]{f:StrSemanticCompare} are satisfied.
     946% all helpful criteria of \VRef[Table]{f:StrSemanticCompare} are satisfied.
    946947The \CFA string manages storage, handles all assignments, including those of fragment referents with fast initialization, provides the choice between snapshot and alias semantics, and does so symmetrically with one type (which assures text validity according to the lifecycles of the string variables).
    947948The @s1@ case is the same in \CFA as in \CC.
     
    956957\subsection{Logical Overlap}
    957958
    958 It may be unfamiliar to combine \VRef[Figure]{f:StrSemanticCompare}'s alias state and fragment referent in one API, or at the same time.
     959It may be unfamiliar to combine \VRef[Table]{f:StrSemanticCompare}'s alias state and fragment referent in one API, or at the same time.
    959960This section shows the capability in action.
    960961
     
    10761077}
    10771078\end{cfa}
    1078 \caption{Parameter Passing}
     1079\caption{Passing substrings as parameters, program}
    10791080\label{f:ParameterPassing}
    10801081\end{figure}
     
    13331334\end{multicols}
    13341335
    1335 \caption{Execution of Function \lstinline{test}}
     1336\caption{Passing substrings as parameters, execution}
    13361337\label{f:ParametersPassingResults}
    13371338\end{figure}
     
    15641565\end{tabular}
    15651566
    1566 \caption{Code Lowering for RAII}
     1567\caption{Code lowering by RAII implementation}
    15671568\label{f:CodeLoweringRAII}
    15681569\end{figure}
     
    16181619To use LL, a programmer rewrites invocations using pass-by-value APIs into invocations where resourcing is more explicit.
    16191620Many invocations are unaffected, notably assignment and comparison.
    1620 \VRef[Figure]{f:HL_LL_Lowering} shows, of the capabilities listed in \VRef[Figure]{f:StrApiCompare}, only three cases need revisions.
     1621\VRef[Table]{f:HL_LL_Lowering} shows, of the capabilities listed in \VRef[Figure]{f:StrApiCompare}, only three cases need revisions.
    16211622The actual HL workaround wraps @string@ as a pointer to a uniquely owned, heap-allocated @string_res@.
    16221623This arrangement has @string@ using style-\ref{p:feature1} RAII, which is compatible with pass-by-value.
    16231624
    1624 \begin{figure}
     1625\begin{table}
     1626\caption{HL to LL \CFA string-API lowering}
     1627\label{f:HL_LL_Lowering}
    16251628\centering
    16261629\begin{tabular}{@{}ll@{}}
     
    16661669\end{tabular}
    16671670
    1668 \caption{HL to LL Lowering}
    1669 \label{f:HL_LL_Lowering}
    1670 \end{figure}
     1671\end{table}
    16711672
    16721673
     
    17381739                \raisebox{-0.17\totalheight}{\includegraphics{string-sharectx.pdf}} % lower
    17391740        \end{tabular}
    1740         \caption{Controlling copying vs sharing of strings using \lstinline{string_sharectx}.}
     1741        \caption[Controlling copying \vs sharing of strings]{Controlling copying \vs sharing of strings using \lstinline{string_sharectx}.}
    17411742        \label{fig:string-sharectx}
    17421743\end{figure}
     
    18851886        \includegraphics{plot-string-peq-cppemu.pdf}
    18861887%       \includegraphics[width=\textwidth]{string-graph-peq-cppemu.png}
    1887         \caption{Fresh vs Reuse in \CC, Emulation Baseline.
    1888         Average time per iteration with one \lstinline{x += y} invocation (lower is better).
    1889         Comparing \CFA's STL emulation mode with STL implementations, and comparing the fresh with reused reset styles.}
     1888        \caption[Fresh \vs reuse in \CC, emulation baseline]{
     1889                Fresh \vs reuse in \CC, emulation baseline.
     1890                Average time per iteration with one \lstinline{x += y} invocation (lower is better).
     1891                Comparing \CFA's STL emulation mode with STL implementations, and comparing the fresh with reused reset styles.}
    18901892        \label{fig:string-graph-peq-cppemu}
    18911893        \bigskip
     
    18931895        \includegraphics{plot-string-peq-sharing.pdf}
    18941896%       \includegraphics[width=\textwidth]{string-graph-peq-sharing.png}
    1895         \caption{\CFA Compromise for Fresh \vs Reuse.
    1896         Average time per iteration with one \lstinline{x += y} invocation (lower is better).
    1897         Comparing \CFA's sharing mode with STL, and comparing the fresh with reused reset styles.
    1898         The \CC results are repeated from \VRef[Figure]{fig:string-graph-peq-cppemu}.}
     1897        \caption[\CFA compromise for fresh \vs reuse]{
     1898                \CFA compromise for fresh \vs reuse.
     1899                Average time per iteration with one \lstinline{x += y} invocation (lower is better).
     1900                Comparing \CFA's sharing mode with STL, and comparing the fresh with reused reset styles.
     1901                The \CC results are repeated from \VRef[Figure]{fig:string-graph-peq-cppemu}.
     1902        }
    18991903        \label{fig:string-graph-peq-sharing}
    19001904\end{figure}
     
    20152019        \includegraphics{plot-string-pta-sharing.pdf}
    20162020%       \includegraphics[width=\textwidth]{string-graph-pta-sharing.png}
    2017         \caption{CFA's low overhead for misusing concatenation.  Average time per iteration with one \lstinline{x += y} invocation (lower is better). Comparing \CFA (having implicit sharing activated) with STL, and comparing the \lstinline{+}-then-\lstinline{=} with the \lstinline{+=} append styles.  The \lstinline{+=} results are repeated from \VRef[Figure]{fig:string-graph-peq-sharing}.}
     2021        \caption[\CFA's low overhead for misusing concatenation]{
     2022                \CFA's low overhead for misusing concatenation.
     2023                Average time per iteration with one \lstinline{x += y} invocation (lower is better).
     2024                Comparing \CFA (having implicit sharing activated) with STL, and comparing the \lstinline{+}-then-\lstinline{=} with the \lstinline{+=} append styles.
     2025                The \lstinline{+=} results are repeated from \VRef[Figure]{fig:string-graph-peq-sharing}.}
    20182026        \label{fig:string-graph-pta-sharing}
    20192027\end{figure}
     
    20742082%       \includegraphics[width=\textwidth]{string-graph-pbv.png}
    20752083        \begin{tabularx}{\linewidth}{>{\centering\arraybackslash}X >{\centering\arraybackslash}X} (a) & (b) \end{tabularx}
    2076         \caption{Average time per iteration (lower is better) with one call to a function that takes a by-value string argument, comparing \CFA (having implicit sharing activated) with STL.
    2077 (a) With \emph{Varying 1 and up} corpus construction, in which the STL-only benefit of SSO optimization occurs, in varying degrees, at all string sizes.
    2078 (b) With \emph{Fixed-size} corpus construction, in which this benefit applies exactly to strings with length below 16.}
     2084        \caption[Impact of \CC small-string optimization on experimental timings]{
     2085                Impact of \CC small-string optimization on experimental timings.
     2086                Average time per iteration (lower is better) with one call to a function that takes a by-value string argument, comparing \CFA (having implicit sharing activated) with STL.
     2087                (a) With \emph{Varying 1 and up} corpus construction, in which the STL-only benefit of SSO optimization occurs, in varying degrees, at all string sizes.
     2088                (b) With \emph{Fixed-size} corpus construction, in which this benefit applies exactly to strings with length below 16.}
    20792089        \label{fig:string-graph-pbv}
    20802090\end{figure}
     
    21222132\centering
    21232133  \includegraphics{string-perf-alloc.pdf}
    2124   \caption{Memory-allocation test's harness and its resulting pattern of memory usage under a bump-pointer-only scheme.}
     2134  \caption[Memory-allocation test harness and its usage pattern]{
     2135        Memory-allocation test harness and its usage pattern.
     2136        The pattern is shown early in a test run, when only bump-pointer allocation has occurred so far.}
    21252137  \label{fig:string-perf-alloc}
    21262138\end{figure}
     
    21542166  \includegraphics{plot-string-allocn.pdf}
    21552167  \begin{tabularx}{\linewidth}{>{\centering\arraybackslash}X >{\centering\arraybackslash}X} (a) Vertical, Lower is better. \\ Horizontal, leftward is better. & (b) \hspace*{5pt} STL CFA \hspace*{20pt} STL \hspace*{10pt} CFA \hspace*{10pt} \end{tabularx}
    2156   \caption{Space and time performance, under varying fraction-live targets, for the five string lengths shown, at \emph{Varying 16 and up} corpus construction.}
     2168  \caption[String allocation space and time performance]{
     2169        String allocation space and time performance.
     2170        The experiment varies the fraction-live target, at the five string lengths shown, under \emph{Varying 16 and up} corpus construction.}
    21572171  \label{fig:string-graph-allocn}
    21582172\end{figure}
  • doc/theses/mike_brooks_MMath/uw-ethesis.tex

    r602cec4 r9c12dd0  
    9393\usepackage{multirow}
    9494\usepackage[labelformat=simple,aboveskip=0pt,farskip=0pt,font=normalsize]{subfig}
     95\usepackage{caption}
     96\usepackage{etoolbox}
    9597\renewcommand\thesubfigure{(\alph{subfigure})}
    9698
     
    122124\newcommand{\PAB}[1]{{\color{magenta}PAB: #1}}
    123125\newcommand{\MLB}[1]{{\color{red}MLB: #1}}
     126
     127% Mike's figure-framing look
     128
     129\let\oldfigure\figure
     130\let\endoldfigure\endfigure
     131
     132\renewenvironment{figure}
     133{%
     134  \oldfigure
     135  \centering
     136  \rule{\linewidth}{0.4pt}\par\vskip4pt
     137}
     138{%
     139  \endoldfigure
     140}
     141
     142\DeclareCaptionFormat{ruled}{
     143  \rule{\linewidth}{0.4pt}\par
     144  #1#2#3\par
     145  \kern-\dp\strutbox
     146  \rule{\linewidth}{0.4pt}%
     147}
     148\captionsetup[figure]{
     149  font=footnotesize,
     150  labelfont=bf,
     151  format=ruled
     152}
     153\captionsetup[subfigure]{
     154    format=plain,
     155    font=normalsize,
     156    labelfont=normalfont
     157}
     158
     159% Mike forbids breaking "equation" style code blocks across pages
     160
     161\AtBeginEnvironment{cfa}{%
     162\interlinepenalty=10000%
     163\clubpenalty=10000%
     164\widowpenalty=10000%
     165\displaywidowpenalty=10000%
     166}
     167
     168
    124169
    125170% Hyperlinks make it very easy to navigate an electronic document.
Note: See TracChangeset for help on using the changeset viewer.