Changes in / [0477127:f93d7fc]
- Location:
- doc/theses/andrew_beach_MMath
- Files:
-
- 5 edited
-
code/resume-fixup-empty-f.cfa (modified) (2 diffs)
-
code/resume-fixup-empty-r.cfa (modified) (1 diff)
-
features.tex (modified) (7 diffs)
-
implement.tex (modified) (8 diffs)
-
resumption-marking.fig (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/resume-fixup-empty-f.cfa
r0477127 rf93d7fc 4 4 #include <stdlib.hfa> // strto 5 5 6 voidnounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) {6 int nounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) { 7 7 if (frames) { 8 nounwind_fixup(frames - 1, raised_rtn); 8 int rtn = nounwind_fixup(frames - 1, raised_rtn); 9 if ( rtn == 42 ) printf( "42" ); // make non-tail recursive 10 return rtn; 11 9 12 } else { 10 13 int fixup = 17; 11 14 raised_rtn(fixup); 15 return fixup; 12 16 } 13 17 } … … 25 29 void raised(int & fixup) { 26 30 fixup = total_frames + 42; // use local scope => lexical link 31 if ( total_frames == 42 ) printf( "42" ); 27 32 } 28 33 -
doc/theses/andrew_beach_MMath/code/resume-fixup-empty-r.cfa
r0477127 rf93d7fc 10 10 vtable(fixup_exception) fixup_vt; 11 11 12 voidnounwind_empty(unsigned int frames) {12 int nounwind_empty(unsigned int frames) { 13 13 if (frames) { 14 nounwind_empty(frames - 1); 14 int rtn = nounwind_empty(frames - 1); 15 if ( rtn == 42 ) printf( "42" ); // make non-tail recursive 16 return rtn; 15 17 } else { 16 18 int fixup = 17; 17 19 throwResume (fixup_exception){&fixup_vt, fixup}; // change bad fixup 20 return fixup; 18 21 } 19 22 } -
doc/theses/andrew_beach_MMath/features.tex
r0477127 rf93d7fc 152 152 % A type's descendants are its children and its children's descendants. 153 153 154 For the purposes of ill istration, a proposed -- but unimplemented syntax --155 will be used. Each virtual type is rep ersented by a trait with an annotation154 For the purposes of illustration, a proposed -- but unimplemented syntax -- 155 will be used. Each virtual type is represented by a trait with an annotation 156 156 that makes it a virtual type. This annotation is empty for a root type, which 157 157 creates a new tree: … … 192 192 As @child_type@ is a child of @root_type@ it has the virtual members of 193 193 @root_type@ (@to_string@ and @size@) as well as the one it declared 194 (@irrel ivant_function@).194 (@irrelevant_function@). 195 195 196 196 It is important to note that these are virtual members, and may contain … … 282 282 283 283 Fields are filled in the same way as a structure as well. However an extra 284 field is added , this fieldcontains the pointer to the virtual table.285 It must be explicitly initiali sed by the user when the exception is284 field is added that contains the pointer to the virtual table. 285 It must be explicitly initialized by the user when the exception is 286 286 constructed. 287 287 … … 310 310 311 311 %\subsection{Exception Details} 312 If one is only raising and handling exceptions, that is the only interface 313 that is needed.However it is actually a short hand for a more complex312 This is the only interface needed when raising and handling exceptions. 313 However it is actually a short hand for a more complex 314 314 trait based interface. 315 315 316 The language views exceptions through a series of traits ,317 if a type satisfies them, then it can be used as an exception. The following316 The language views exceptions through a series of traits. 317 If a type satisfies them, then it can be used as an exception. The following 318 318 is the base trait all exceptions need to match. 319 319 \begin{cfa} … … 322 322 }; 323 323 \end{cfa} 324 The trait is defined over two types ,the exception type and the virtual table324 The trait is defined over two types: the exception type and the virtual table 325 325 type. Each exception type should have a single virtual table type. 326 326 There are no actual assertions in this trait because the trait system … … 347 347 }; 348 348 \end{cfa} 349 Both traits ensure a pair of types arean exception type, its virtual table349 Both traits ensure a pair of types is an exception type, its virtual table 350 350 type 351 351 and defines one of the two default handlers. The default handlers are used … … 393 393 394 394 The differences between the two operations include how propagation is 395 performed, where ex cecution after an exception is handler395 performed, where execution after an exception is handler 396 396 and which default handler is run. 397 397 -
doc/theses/andrew_beach_MMath/implement.tex
r0477127 rf93d7fc 51 51 The problem is that a type id may appear in multiple TUs that compose a 52 52 program (see \autoref{ss:VirtualTable}); so the initial solution would seem 53 to be make it external in each translation unit. Ho never, the type id must53 to be make it external in each translation unit. However, the type id must 54 54 have a declaration in (exactly) one of the TUs to create the storage. 55 55 No other declaration related to the virtual type has this property, so doing … … 183 183 The second section are all the virtual members of the parent, in the same 184 184 order as they appear in the parent's virtual table. Note that the type may 185 change slightly as references to the ``this" willchange. This is limited to185 change slightly as references to the ``this" change. This is limited to 186 186 inside pointers/references and via function pointers so that the size (and 187 187 hence the offsets) are the same. … … 216 216 type's alignment, is set using an @alignof@ expression. 217 217 218 Most of these tools are already inside the compiler. Using the isa simple219 code transformation early on in compilation allows most of thatwork to be218 Most of these tools are already inside the compiler. Using a simple 219 code transformation early on in compilation, allows most of the work to be 220 220 handed off to the existing tools. \autoref{f:VirtualTableTransformation} 221 221 shows an example transformation, this example shows an exception virtual table. 222 It also shows the transformation on the full declaration ,223 for a forward declarationthe @extern@ keyword is preserved and the222 It also shows the transformation on the full declaration. 223 For a forward declaration, the @extern@ keyword is preserved and the 224 224 initializer is not added. 225 225 … … 333 333 the exceptions themselves and the virtual system interactions. 334 334 335 Creating an exception type is just a matter of prep pending the field335 Creating an exception type is just a matter of prepending the field 336 336 with the virtual table pointer to the list of the fields 337 337 (see \autoref{f:ExceptionTypeTransformation}). … … 364 364 the types of the virtual table and the type id, 365 365 are generated when the virtual type (the exception) is first found. 366 The type id (the instance) is generated with the exception if it is366 The type id (the instance) is generated with the exception, if it is 367 367 a monomorphic type. 368 However if the exception is polymorphicthen a different type id has to369 be generated for every instance. In this case generation is delayed368 However, if the exception is polymorphic, then a different type id has to 369 be generated for every instance. In this case, generation is delayed 370 370 until a virtual table is created. 371 371 % There are actually some problems with this, which is why it is not used 372 372 % for monomorphic types. 373 When a virtual table is created and initialized two functions are created373 When a virtual table is created and initialized, two functions are created 374 374 to fill in the list of virtual members. 375 The first is a copy function whichadapts the exception's copy constructor375 The first is a copy function that adapts the exception's copy constructor 376 376 to work with pointers, avoiding some issues with the current copy constructor 377 377 interface. 378 Second is the msg function , whichreturns a C-string with the type's name,378 Second is the msg function that returns a C-string with the type's name, 379 379 including any polymorphic parameters. 380 380 … … 405 405 Unwinding across multiple stack frames is more complex because that 406 406 information is no longer contained within the current function. 407 With sep erate compilation,407 With separate compilation, 408 408 a function does not know its callers nor their frame layout. 409 409 Even using the return address, that information is encoded in terms of … … 479 479 480 480 To get full unwinding support, all of these features must be handled directly 481 in assembly and assembler directives; parti ularly the cfi directives481 in assembly and assembler directives; particularly the cfi directives 482 482 \snake{.cfi_lsda} and \snake{.cfi_personality}. 483 483 … … 894 894 895 895 \autoref{f:ResumptionTransformation} shows the pattern used to transform 896 a \CFA try statement with catch clauses into the appropr ate C functions.896 a \CFA try statement with catch clauses into the appropriate C functions. 897 897 \todo{Explain the Resumption Transformation figure.} 898 898 -
doc/theses/andrew_beach_MMath/resumption-marking.fig
r0477127 rf93d7fc 70 70 4 1 0 50 -1 0 12 0.0000 0 180 795 4905 3600 Try block\001 71 71 4 0 0 50 -1 0 12 0.0000 0 135 390 2295 1665 head\001 72 4 0 0 50 -1 0 12 0.0000 0 135 390 2295 1395 head\001
Note:
See TracChangeset
for help on using the changeset viewer.