# Changeset f28fdee

Ignore:
Timestamp:
Jan 20, 2021, 5:27:42 PM (20 months ago)
Branches:
arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
09ee131
Parents:
79e261b7
Message:

incorporate uw-thesis macros and CFA common macros

Location:
doc/theses/andrew_beach_MMath
Files:
6 edited

Unmodified
Removed

• ## doc/theses/andrew_beach_MMath/features.tex

 r79e261b7 returns a reference to the virtual table instance. Defining this function also establishes the virtual type and virtual table pair to the resolver and promises that \codeCFA{exceptT} is a virtual type and a child of the and promises that @exceptT@ is a virtual type and a child of the base exception type. One odd thing about \codeCFA{get_exception_vtable} is that it should always One odd thing about @get_exception_vtable@ is that it should always be a constant function, returning the same value regardless of its argument. A pointer or reference to the virtual table instance could be used instead, Also note the use of the word promise" in the trait description. \CFA cannot currently check to see if either \codeCFA{exceptT} or \codeCFA{virtualT} match the layout requirements. Currently this is considered part of \codeCFA{get_exception_vtable}'s correct implementation. cannot currently check to see if either @exceptT@ or @virtualT@ match the layout requirements. Currently this is considered part of @get_exception_vtable@'s correct implementation. \begin{lstlisting} Finally there are three additional macros that can be used to refer to the these traits. They are \codeCFA{IS_EXCEPTION}, \codeCFA{IS_TERMINATION_EXCEPTION} and \codeCFA{IS_RESUMPTION_EXCEPTION}. these traits. They are @IS_EXCEPTION@, @IS_TERMINATION_EXCEPTION@ and @IS_RESUMPTION_EXCEPTION@. Each takes the virtual type's name and, for polymorphic types only, the parenthesized list of polymorphic arguments. These do the name mangling to The expression must evaluate to a reference to a termination exception. A termination exception is any exception with a \codeCFA{void defaultTerminationHandler(T &);} (the default handler) defined @void defaultTerminationHandler(T &);@ (the default handler) defined on it. The handler is taken from the call sight with \CFA's trait system and passed into the exception system along with the exception itself. You can also re-throw the most recent termination exception with \codeCFA{throw;}. % This is terrible and you should never do it. @throw;@. % This is terrible and you should never do it. This can be done in a handler or any function that could be called from a handler. The result of EXPRESSION must be a resumption exception type. A resumption exception type is any type that satisfies the assertion \codeCFA{void defaultResumptionHandler(T &);} (the default handler). When the @void defaultResumptionHandler(T &);@ (the default handler). When the statement is executed the expression is evaluated and the result is thrown. \paragraph{Re-Throwing} You may also re-throw resumptions with a \codeCFA{throwResume;} statement. This can only be done from inside of a \codeCFA{catchResume} block. You may also re-throw resumptions with a @throwResume;@ statement. This can only be done from inside of a @catchResume@ block. Outside of any side effects of any code already run in the handler this will \section{Finally Clauses} A \codeCFA{finally} clause may be placed at the end of a try statement after A @finally@ clause may be placed at the end of a try statement after all the handler clauses. In the simply case, with no handlers, it looks like this: Because of this local control flow out of the finally block is forbidden. The compiler rejects uses of \codeCFA{break}, \codeCFA{continue}, \codeCFA{fallthru} and \codeCFA{return} that would cause control to leave The compiler rejects uses of @break@, @continue@, @fallthru@ and @return@ that would cause control to leave the finally block. Other ways to leave the finally block - such as a long jump or termination - are much harder to check, at best requiring additional There is no special statement for starting a cancellation, instead you call the standard library function \codeCFA{cancel\_stack} which takes an exception. the standard library function @cancel\_stack@ which takes an exception. Unlike in a throw this exception is not used in control flow but is just there to pass information about why the cancellation happened. \item Thread Stack: Thread stacks are those created \codeCFA{thread} or otherwise satisfy the \codeCFA{is\_thread} trait. Thread stacks are those created @thread@ or otherwise satisfy the @is\_thread@ trait. Threads only have two structural points of communication that must happen, and wait for another thread to join with it. The other thread, when it joins, checks for a cancellation. If so it will throw the resumption exception \codeCFA{ThreadCancelled}. There is a difference here in how explicate joins (with the \codeCFA{join} @ThreadCancelled@. There is a difference here in how explicate joins (with the @join@ function) and implicate joins (from a destructor call). Explicate joins will take the default handler (\codeCFA{defaultResumptionHandler}) from the context take the default handler (@defaultResumptionHandler@) from the context and use like a regular through does if the exception is not caught. The implicate join does a program abort instead. \item Coroutine Stack: Coroutine stacks are those created with \codeCFA{coroutine} or otherwise satisfy the \codeCFA{is\_coroutine} trait. Coroutine stacks are those created with @coroutine@ or otherwise satisfy the @is\_coroutine@ trait. A coroutine knows of two other coroutines, its starter and its last resumer. After the stack is unwound control goes to the last resumer. Resume will resume throw a \codeCFA{CoroutineCancelled} exception, which is Resume will resume throw a @CoroutineCancelled@ exception, which is polymorphic over the coroutine type and has a pointer to the coroutine being canceled and the canceling exception. The resume function also has an assertion that the \codeCFA{defaultResumptionHandler} for the exception. So it assertion that the @defaultResumptionHandler@ for the exception. So it will use the default handler like a regular throw.
• ## doc/theses/andrew_beach_MMath/future.tex

 r79e261b7 \section{Additional Throws} Several other kinds of throws, beyond the termination throw (\codeCFA{throw}), the resumption throw (\codeCFA{throwResume}) and the re-throws, were considered. Several other kinds of throws, beyond the termination throw (@throw@), the resumption throw (@throwResume@) and the re-throws, were considered. None were as useful as the core throws but they would likely be worth revising. is no reason not to allow it. It is however a small improvement; giving a bit of flexibility to the user in what style they want to use. \item Enabling local control flow (by \codeCFA{break}, \codeCFA{return} and \item Enabling local control flow (by @break@, @return@ and similar statements) out of a termination handler. The current set-up makes this very difficult but the catch function that runs the handler after it has