- Timestamp:
- Mar 13, 2019, 10:20:24 AM (4 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 320e72a2, ab3a69c
- Parents:
- 53bb8f1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/aaron_moss_PhD/phd/resolution-heuristics.tex
r53bb8f1 ra2545593 381 381 The main challenge to implement this approach in \CFACC{} is applying the implicit conversions generated by the resolution process in the code-generation for the thunk functions that \CFACC{} uses to pass type assertions to their requesting functions with the proper signatures. 382 382 383 Though performance of the existing algorithms is promising, some further optimizations do present themselves. 383 One \CFA{} feature that could be added to improve the ergonomics of overload selection is an \emph{ascription cast}; as discussed in Section~\ref{expr-cost-sec}, the semantics of the C cast operator are to choose the cheapest argument interpretation which is convertable to the target type, using the conversion cost as a tie-breaker. 384 An ascription cast would reverse these priorities, choosing the argument interpretation with the cheapest conversion to the target type, only using interpretation cost to break ties\footnote{A possible stricter semantics would be to select the cheapest interpretation with a zero-cost conversion to the target type, reporting a compiler error otherwise.}. 385 This would allow ascription casts to the desired return type to be used for overload selection: 386 387 \begin{cfa} 388 int f$\(_1\)$(int); 389 int f$\(_2\)$(double); 390 int g$\(_1\)$(int); 391 double g$\(_2\)$(long); 392 393 f((double)42); $\C[4.5in]{// select f\(_2\) by parameter cast}$ 394 (as double)g(42); $\C[4.5in]{// select g\(_2\) by return ascription cast}$ 395 (double)g(42); $\C[4.5in]{// select g\(_1\) NOT g\(_2\) because of parameter conversion cost}$ 396 \end{cfa} 397 398 Though performance of the existing resolution algorithms is promising, some further optimizations do present themselves. 384 399 The refined cost model discussed in Section~\ref{conv-cost-sec} is more expressive, but requires more than twice as many fields; it may be fruitful to investigate more tightly-packed in-memory representations of the cost-tuple, as well as comparison operations that require fewer instructions than a full lexicographic comparison. 385 400 Integer or vector operations on a more-packed representation may prove effective, though dealing with the negative-valued $specialization$ field may require some effort.
Note: See TracChangeset
for help on using the changeset viewer.