# Changeset b041f11

Ignore:
Timestamp:
Aug 30, 2021, 9:43:40 PM (5 months ago)
Branches:
jacob/cs343-translation, master
Children:
13afd0c
Parents:
f93d7fc
Message:

Andrew MMath: Saved and reverting updates on the new syntax.

Location:
doc/theses/andrew_beach_MMath
Files:
2 edited

### Legend:

Unmodified
 rf93d7fc The problem is that a type id may appear in multiple TUs that compose a program (see \autoref{ss:VirtualTable}); so the initial solution would seem to be make it external in each translation unit. However, the type id must to be make it external in each translation unit. Honever, the type id must have a declaration in (exactly) one of the TUs to create the storage. No other declaration related to the virtual type has this property, so doing The second section are all the virtual members of the parent, in the same order as they appear in the parent's virtual table. Note that the type may change slightly as references to the this" change. This is limited to change slightly as references to the this" will change. This is limited to inside pointers/references and via function pointers so that the size (and hence the offsets) are the same. type's alignment, is set using an @alignof@ expression. Most of these tools are already inside the compiler. Using a simple code transformation early on in compilation, allows most of the work to be Most of these tools are already inside the compiler. Using the is a simple code transformation early on in compilation allows most of that work to be handed off to the existing tools. \autoref{f:VirtualTableTransformation} shows an example transformation, this example shows an exception virtual table. It also shows the transformation on the full declaration. For a forward declaration, the @extern@ keyword is preserved and the It also shows the transformation on the full declaration, for a forward declaration the @extern@ keyword is preserved and the initializer is not added. the exceptions themselves and the virtual system interactions. Creating an exception type is just a matter of prepending the field Creating an exception type is just a matter of preppending the field with the virtual table pointer to the list of the fields (see \autoref{f:ExceptionTypeTransformation}). the types of the virtual table and the type id, are generated when the virtual type (the exception) is first found. The type id (the instance) is generated with the exception, if it is The type id (the instance) is generated with the exception if it is a monomorphic type. However, if the exception is polymorphic, then a different type id has to be generated for every instance. In this case, generation is delayed However if the exception is polymorphic then a different type id has to be generated for every instance. In this case generation is delayed until a virtual table is created. % There are actually some problems with this, which is why it is not used % for monomorphic types. When a virtual table is created and initialized, two functions are created When a virtual table is created and initialized two functions are created to fill in the list of virtual members. The first is a copy function that adapts the exception's copy constructor The first is a copy function which adapts the exception's copy constructor to work with pointers, avoiding some issues with the current copy constructor interface. Second is the msg function that returns a C-string with the type's name, Second is the msg function, which returns a C-string with the type's name, including any polymorphic parameters. Unwinding across multiple stack frames is more complex because that information is no longer contained within the current function. With separate compilation, With seperate compilation, a function does not know its callers nor their frame layout. Even using the return address, that information is encoded in terms of To get full unwinding support, all of these features must be handled directly in assembly and assembler directives; particularly the cfi directives in assembly and assembler directives; partiularly the cfi directives \snake{.cfi_lsda} and \snake{.cfi_personality}. \autoref{f:ResumptionTransformation} shows the pattern used to transform a \CFA try statement with catch clauses into the appropriate C functions. a \CFA try statement with catch clauses into the approprate C functions. \todo{Explain the Resumption Transformation figure.}