Changeset 1c1c180 for doc/theses/andrew_beach_MMath/features.tex
- Timestamp:
- Feb 1, 2021, 4:59:45 PM (2 years ago)
- Branches:
- arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 3b402339
- Parents:
- 85871478
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/features.tex
r85871478 r1c1c180 7 7 Virtual types and casts are not required for a basic exception-system but are 8 8 useful for advanced exception features. However, \CFA is not object-oriented so 9 there is no obvious concept of virtuals. 9 there is no obvious concept of virtuals. Hence, to create advanced exception 10 10 features for this work, I needed to designed and implemented a virtual-like 11 11 system for \CFA. … … 30 30 \end{center} 31 31 The hierarchy provides the ability to handle an exception at different degrees 32 of specificity (left to right). 32 of specificity (left to right). Hence, it is possible to catch a more general 33 33 exception-type in higher-level code where the implementation details are 34 34 unknown, which reduces tight coupling to the lower-level implementation. … … 78 78 79 79 Exceptions are defined by the trait system; there are a series of traits, and 80 if a type satisfies them, then it can be used as an exception. 80 if a type satisfies them, then it can be used as an exception. The following 81 81 is the base trait all exceptions need to match. 82 82 \begin{cfa} … … 92 92 \PAB{I do not understand this paragraph.} 93 93 One odd thing about @get_exception_vtable@ is that it should always be a 94 constant function, returning the same value regardless of its argument. 94 constant function, returning the same value regardless of its argument. A 95 95 pointer or reference to the virtual table instance could be used instead, 96 96 however using a function has some ease of implementation advantages and allows 97 97 for easier disambiguation because the virtual type name (or the address of an 98 98 instance that is in scope) can be used instead of the mangled virtual table 99 name. 99 name. Also note the use of the word ``promise'' in the trait 100 100 description. Currently, \CFA cannot check to see if either @exceptT@ or 101 101 @virtualT@ match the layout requirements. This is considered part of … … 126 126 127 127 Finally there are three convenience macros for referring to the these traits: 128 @IS_EXCEPTION@, @IS_TERMINATION_EXCEPTION@ and @IS_RESUMPTION_EXCEPTION@. 128 @IS_EXCEPTION@, @IS_TERMINATION_EXCEPTION@ and @IS_RESUMPTION_EXCEPTION@. Each 129 129 takes the virtual type's name, and for polymorphic types only, the 130 130 parenthesized list of polymorphic arguments. These macros do the name mangling … … 212 212 expression has a type with a @void defaultResumptionHandler(T &)@ (default 213 213 handler) defined, where the handler is found at the call site by the type 214 system. 214 system. At runtime, a representation of the exception type and an instance of 215 215 the exception type is \emph{not} copied because the stack is maintained during 216 216 the handler search. … … 306 306 exception matches, @CONDITION@ is executed. The condition expression may 307 307 reference all names in scope at the beginning of the try block and @NAME@ 308 introduced in the handler clause. 308 introduced in the handler clause. If the condition is true, then the handler 309 309 matches. Otherwise, the exception search continues at the next appropriate kind 310 310 of handler clause in the try block. … … 359 359 the end of the block. This requirement ensures always continues as if the 360 360 finally clause is not present, \ie finally is for cleanup not changing control 361 flow. 362 is forbidden. 361 flow. Because of this requirement, local control flow out of the finally block 362 is forbidden. The compiler precludes any @break@, @continue@, @fallthru@ or 363 363 @return@ that causes control to leave the finally block. Other ways to leave 364 364 the finally block, such as a long jump or termination are much harder to check, … … 371 371 372 372 There is no special statement for starting a cancellation; instead the standard 373 library function @cancel_stack@ is called passing an exception. 373 library function @cancel_stack@ is called passing an exception. Unlike a 374 374 raise, this exception is not used in matching only to pass information about 375 375 the cause of the cancellation. … … 379 379 \item[Main Stack:] 380 380 The main stack is the one used by the program main at the start of execution, 381 and is the only stack in a sequential program. 381 and is the only stack in a sequential program. Hence, when cancellation is 382 382 forwarded to the main stack, there is no other forwarding stack, so after the 383 383 stack is unwound, there is a program-level abort. … … 385 385 \item[Thread Stack:] 386 386 A thread stack is created for a @thread@ object or object that satisfies the 387 @is_thread@ trait. 387 @is_thread@ trait. A thread only has two points of communication that must 388 388 happen: start and join. As the thread must be running to perform a 389 389 cancellation, it must occur after start and before join, so join is a 390 cancellation point. 390 cancellation point. After the stack is unwound, the thread halts and waits for 391 391 another thread to join with it. The joining thread, checks for a cancellation, 392 392 and if present, resumes exception @ThreadCancelled@. … … 408 408 409 409 \item[Coroutine Stack:] A coroutine stack is created for a @coroutine@ object 410 or object that satisfies the @is_coroutine@ trait. 411 two other coroutines, its starter and its last resumer. 412 the tightest coupling to the coroutine it activated. 410 or object that satisfies the @is_coroutine@ trait. A coroutine only knows of 411 two other coroutines, its starter and its last resumer. The last resumer has 412 the tightest coupling to the coroutine it activated. Hence, cancellation of 413 413 the active coroutine is forwarded to the last resumer after the stack is 414 414 unwound, as the last resumer has the most precise knowledge about the current
Note: See TracChangeset
for help on using the changeset viewer.