Ignore:
Timestamp:
Apr 9, 2021, 2:11:43 PM (10 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
b91bfde
Parents:
e07b589
Message:

Major exception update, seperating type-ids from virtual tables. The major interface changes are done. There is a regression of ?Cancelled(T) to Some?Cancelled. There is some bits of code for the new verion of the ?Cancelled(T) interface already there. Not connected yet but I just reached the limit of what I wanted to do in one commit and then spent over a day cleaning up, so it will replace Some?Cancelled in a future commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/virtual-cast.cfa

    re07b589 recfd758  
    1212#include <assert.h>
    1313
     14
     15
     16// Hand defined alpha virtual type:
     17struct __cfatid_struct_alpha {
     18        __cfa__parent_vtable const * parent;
     19};
     20
     21__attribute__(( section(".gnu.linkonce.__cfatid_alpha") ))
     22struct __cfatid_struct_alpha __cfatid_alpha = {
     23        (__cfa__parent_vtable *)0,
     24};
     25
    1426struct alpha_vtable {
    15         alpha_vtable const * const parent;
     27        struct __cfatid_struct_alpha const * const __cfavir_typeid;
    1628        char (*code)(void);
    1729};
     
    2739
    2840
     41// Hand defined beta virtual type:
     42struct __cfatid_struct_beta {
     43        __cfatid_struct_alpha const * parent;
     44};
     45
     46__attribute__(( section(".gnu.linkonce.__cfatid_beta") ))
     47struct __cfatid_struct_beta __cfatid_beta = {
     48        &__cfatid_alpha,
     49};
     50
    2951struct beta_vtable {
    30         alpha_vtable const * const parent;
     52        struct __cfatid_struct_beta const * const __cfavir_typeid;
    3153        char (*code)(void);
    3254};
     
    4264
    4365
     66// Hand defined gamma virtual type:
     67struct __cfatid_struct_gamma {
     68        __cfatid_struct_beta const * parent;
     69};
     70
     71__attribute__(( section(".gnu.linkonce.__cfatid_gamma") ))
     72struct __cfatid_struct_gamma __cfatid_gamma = {
     73        &__cfatid_beta,
     74};
     75
    4476struct gamma_vtable {
    45         beta_vtable const * const parent;
     77        struct __cfatid_struct_gamma const * const __cfavir_typeid;
    4678        char (*code)(void);
    4779};
     
    5789
    5890extern "C" {
    59         alpha_vtable _alpha_vtable_instance = { 0, ret_a };
    60         beta_vtable _beta_vtable_instance = { &_alpha_vtable_instance, ret_b };
    61         gamma_vtable _gamma_vtable_instance = { &_beta_vtable_instance, ret_g };
     91        alpha_vtable _alpha_vtable_instance = { &__cfatid_alpha, ret_a };
     92        beta_vtable _beta_vtable_instance = { &__cfatid_beta, ret_b };
     93        gamma_vtable _gamma_vtable_instance = { &__cfatid_gamma, ret_g };
    6294}
    6395
Note: See TracChangeset for help on using the changeset viewer.