 Timestamp:
 Apr 23, 2019, 11:52:28 AM (5 years ago)
 Branches:
 ADT, aaronthesis, armeh, astexperimental, cleanupdtors, enum, forallpointerdecay, jacob/cs343translation, jenkinssandbox, master, newast, newastuniqueexpr, pthreademulation, qualifiedEnum
 Children:
 c4b5486
 Parents:
 8f55e8e9
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

doc/theses/aaron_moss_PhD/phd/resolutionheuristics.tex
r8f55e8e9 rcf01d0b 6 6 A given matching between identifiers and declarations in an expression is an \emph{interpretation}; an interpretation also includes information about polymorphic type bindings and implicit casts to support the \CFA{} features discussed in Sections~\ref{polyfuncsec} and~\ref{implicitconvsec}, each of which increase the number of valid candidate interpretations. 7 7 To choose among valid interpretations, a \emph{conversion cost} is used to rank interpretations. 8 Hence, the expression resolution problem is to find the unique minimalcost interpretation for an expression, reporting an error if no such interpretation exists.8 Hence, the expression resolution problem is to find the unique minimalcost interpretation for an expression, reporting an error if no such unique interpretation exists. 9 9 10 10 \section{Expression Resolution} … … 48 48 With more specificity, the cost is a lexicographicallyordered tuple, where each element corresponds to a particular kind of conversion. 49 49 In Bilson's design, conversion cost is a 3tuple, $(unsafe, poly, safe)$, where $unsafe$ is the count of unsafe (narrowing) conversions, $poly$ is the count of polymorphic type bindings, and $safe$ is the sum of the degree of safe (widening) conversions. 50 Degree of safe conversion is calculated as path weight in a directed graph of safe conversions between types; Bilson's version and the current version of this graph are in Figures~\ref{bilsonconvfig} and~\ref{extendedconvfig}, respectively.50 Degree of safe conversion is calculated as path weight in a directed graph of safe conversions between types; Bilson's version of this graph is in Figure~\ref{bilsonconvfig}. 51 51 The safe conversion graph is designed such that the common type $c$ of two types $u$ and $v$ is compatible with the C standard definitions from \cite[\S{}6.3.1.8]{C11} and can be calculated as the unique type minimizing the sum of the path weights of $\overrightarrow{uc}$ and $\overrightarrow{vc}$. 52 52 The following example lists the cost in the Bilson model of calling each of the following functions with two !int! parameters, where the interpretation with the minimum total cost will be selected: … … 124 124 In the redesign, for consistency with the approach of the usual arithmetic conversions, which select a common type primarily based on size, but secondarily on sign, arcs in the new graph are annotated with whether they represent a sign change, and such sign changes are summed in a new $sign$ cost element that lexicographically succeeds $safe$. 125 125 This means that sign conversions are approximately the same cost as widening conversions, but slightly more expensive (as opposed to less expensive in Bilson's graph), so maintaining the same signedness is consistently favoured. 126 This refined conversion graph is shown in Figure~\ref{extendedconvfig}. 126 127 127 128 With these modifications, the current \CFA{} cost tuple is as follows: … … 257 258 258 259 Pruning possible interpretations as early as possible is one way to reduce the realworld cost of expression resolution, provided that a sufficient proportion of interpretations are pruned to pay for the cost of the pruning algorithm. 259 One opportunity for interpretation pruning is by the argumentparameter type matching, but the literature provides no clear answers on whether candidate functions should be chosen according to their available arguments, or whether argument resolution should be driven by the available function candidates.260 One opportunity for interpretation pruning is by the argumentparameter type matching, but the literature \cite{Baker82,Bilson03,Cormack81,Ganzinger80,Pennello80,PW:overload} provides no clear answers on whether candidate functions should be chosen according to their available arguments, or whether argument resolution should be driven by the available function candidates. 260 261 For programming languages without implicit conversions, argumentparameter matching is essentially the entirety of the expression resolution problem, and is generally referred to as ``overload resolution'' in the literature. 261 262 All expressionresolution algorithms form a DAG of interpretations, some explicitly, some implicitly; in this DAG, arcs point from functioncall interpretations to argument interpretations, as in Figure~\ref{resdagfig} … … 305 306 The assertion satisfaction algorithm designed by Bilson~\cite{Bilson03} for the original \CFACC{} is the mostrelevant prior work to this project. 306 307 Before accepting any subexpression candidate, Bilson first checks that that candidate's assertions can all be resolved; this is necessary due to Bilson's addition of assertion satisfaction costs to candidate costs (discussed in Section~\ref{convcostsec}). 307 If this subexpression interpretation ends up not being used in the final resolution, th an the (sometimes substantial) work of checking its assertions ends up wasted.308 If this subexpression interpretation ends up not being used in the final resolution, then the (sometimes substantial) work of checking its assertions ends up wasted. 308 309 Bilson's assertion checking function recurses on two lists, !need! and !newNeed!, the current declaration's assertion set and those implied by the assertionsatisfying declarations, respectively, as detailed in the pseudocode below (ancillary aspects of the algorithm are omitted for clarity): 309 310
Note: See TracChangeset
for help on using the changeset viewer.