Changeset c65b930 for doc/theses/andrew_beach_MMath/implement.tex
- Timestamp:
- May 25, 2021, 4:15:06 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 375fb46, 82f4063
- Parents:
- b984d54 (diff), 887fc79 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/implement.tex
rb984d54 rc65b930 16 16 Virtual types only have one change to their structure: the addition of a 17 17 pointer to the virtual table, which is called the \emph{virtual-table pointer}. 18 Internally, the field is called @virtual_table@.18 Internally, the field is called \snake{virtual_table}. 19 19 The field is fixed after construction. It is always the first field in the 20 20 structure so that its location is always known. … … 124 124 125 125 \begin{figure} 126 \begin{cfa} 127 type_id 128 parent_field0 129 ... 130 parent_fieldN 131 child_field0 132 ... 133 child_fieldN 134 \end{cfa} 126 \input{vtable-layout} 135 127 \caption{Virtual Table Layout} 136 128 \label{f:VirtualTableLayout} … … 171 163 coroutine Example { 172 164 // fields 173 } 165 }; 174 166 \end{cfa} 175 167 … … 329 321 To get full unwinding support all of this has to be done directly with 330 322 assembly and assembler directives. Partiularly the cfi directives 331 \ texttt{.cfi\_lsda} and \texttt{.cfi\_personality}.323 \snake{.cfi_lsda} and \snake{.cfi_personality}. 332 324 333 325 \subsection{Personality Functions} … … 337 329 A personality function can preform different actions depending on how it is 338 330 called. 339 \begin{lstlisting}[language=C,{moredelim=**[is][\color{red}]{@}{@}}] 340 typedef _Unwind_Reason_Code (*@_Unwind_Personality_Fn@) ( 341 _Unwind_Action @action@, 342 _Unwind_Exception_Class @exception_class@, 343 _Unwind_Exception * @exception@, 344 struct _Unwind_Context * @context@ 345 ); 331 \begin{lstlisting} 332 typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) ( 333 _Unwind_Action action, 334 _Unwind_Exception_Class exception_class, 335 _Unwind_Exception * exception, 336 struct _Unwind_Context * context); 346 337 \end{lstlisting} 347 338 The @action@ argument is a bitmask of possible actions: … … 427 418 function and the stop parameter. The stop function has a similar interface as a 428 419 personality function, except it is also passed the stop parameter. 429 \begin{lstlisting} [language=C,{moredelim=**[is][\color{red}]{@}{@}}]430 typedef _Unwind_Reason_Code (* @_Unwind_Stop_Fn@)(431 _Unwind_Action @action@,432 _Unwind_Exception_Class @exception_class@,433 _Unwind_Exception * @exception@,434 struct _Unwind_Context * @context@,435 void * @stop_parameter@);420 \begin{lstlisting} 421 typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)( 422 _Unwind_Action action, 423 _Unwind_Exception_Class exception_class, 424 _Unwind_Exception * exception, 425 struct _Unwind_Context * context, 426 void * stop_parameter); 436 427 \end{lstlisting} 437 428 … … 446 437 \begin{sloppypar} 447 438 Its arguments are the same as the paired personality function. The actions 448 @_UA_CLEANUP_PHASE@ and @_UA_FORCE_UNWIND@are always set when it is439 \snake{_UA_CLEANUP_PHASE} and \snake{_UA_FORCE_UNWIND} are always set when it is 449 440 called. Beyond the libunwind standard, both GCC and Clang add an extra action 450 on the last call at the end of the stack: @_UA_END_OF_STACK@.441 on the last call at the end of the stack: \snake{_UA_END_OF_STACK}. 451 442 \end{sloppypar} 452 443 … … 465 456 466 457 The exception context should be retrieved by calling the function 467 @this_exception_context@. For sequential execution, this function is defined as 458 \snake{this_exception_context}. 459 For sequential execution, this function is defined as 468 460 a weak symbol in the \CFA system-library, @libcfa@. When a \CFA program is 469 461 concurrent, it links with @libcfathread@, where this function is defined with a … … 493 485 494 486 \begin{figure} 495 \begin{verbatim} 496 Fixed Header | _Unwind_Exception <- pointer target 497 | 498 | Cforall storage 499 | 500 Variable Body | the exception <- fixed offset 501 V ... 502 \end{verbatim} 487 \input{exception-layout} 503 488 \caption{Exception Layout} 504 489 \label{f:ExceptionLayout} … … 525 510 \begin{figure} 526 511 \centering 527 % Andrew: Figure out what these do and give them better names. 528 \newsavebox{\myboxA} 529 \newsavebox{\myboxB} 530 \begin{lrbox}{\myboxA} 512 \newsavebox{\codeBox} 513 \newsavebox{\stackBox} 514 \begin{lrbox}{\codeBox} 531 515 \begin{lstlisting}[language=CFA,{moredelim=**[is][\color{red}]{@}{@}}] 532 516 unsigned num_exceptions = 0; … … 551 535 \end{lrbox} 552 536 553 \begin{lrbox}{\ myboxB}537 \begin{lrbox}{\stackBox} 554 538 \begin{lstlisting} 539 | try-finally 540 | try-catch (Example) 541 throws() 542 | try-finally 543 | try-catch (Example) 544 throws() 545 | try-finally 546 | try-catch (Example) 547 throws() 548 main() 555 549 \end{lstlisting} 556 550 \end{lrbox} 557 551 558 {\usebox\ myboxA}552 {\usebox\codeBox} 559 553 \hspace{25pt} 560 {\usebox\ myboxB}554 {\usebox\stackBox} 561 555 562 556 \caption{Multiple Exceptions} … … 647 641 { 648 642 Exception1 * name1; 649 if (name1 = (virtual Exception1 *)__exception_inst && check(name1)) { 643 if (name1 = (virtual Exception1 *)__exception_inst 644 && check(name1)) { 650 645 return 1; 651 646 } … … 732 727 { 733 728 Exception1 * name1; 734 if (name1 = (virtual Exception1 *)__exception_inst && check(name1)) { 729 if (name1 = (virtual Exception1 *)__exception_inst 730 && check(name1)) { 735 731 // CATCH BLOCK 1 736 732 return 1; … … 775 771 776 772 \begin{figure} 777 \begin{minipage}[l][][b]{0,2\textwidth} 778 \begin{verbatim} 779 780 781 X <- 782 | 783 V 784 X 785 | 786 V 787 X 788 \end{verbatim} 789 Initial State 790 \end{minipage} 791 \begin{minipage}[l][][b]{0,2\textwidth} 792 \begin{verbatim} 793 794 795 X 796 | 797 V 798 X <- 799 | 800 V 801 X 802 \end{verbatim} 803 Handler Found 804 \end{minipage} 805 \begin{minipage}[l][][b]{0,2\textwidth} 806 \begin{verbatim} 807 X <- 808 / 809 / X 810 | | 811 \ V 812 X 813 | 814 V 815 X 816 \end{verbatim} 817 Try Block Added 818 \end{minipage} 819 \begin{minipage}[l][][b]{0,2\textwidth} 820 \begin{verbatim} 821 822 823 X <- 824 | 825 V 826 X 827 | 828 V 829 X 830 \end{verbatim} 831 Handler Done 832 \end{minipage} 773 \input{resumption-marking} 833 774 \caption{Resumption Marking} 834 775 \label{f:ResumptionMarking}
Note: See TracChangeset
for help on using the changeset viewer.