Ignore:
Timestamp:
Apr 9, 2021, 2:11:43 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
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-poly.cfa

    re07b589 recfd758  
    88#include <assert.h>
    99
     10
     11struct __cfatid_struct_mono_base {
     12    __cfa__parent_vtable const * parent;
     13};
     14
     15__attribute__(( section(".gnu.linkonce.__cfatid_mono_base") ))
     16struct __cfatid_struct_mono_base __cfatid_mono_base = {
     17    (__cfa__parent_vtable *)0,
     18};
     19
    1020struct mono_base_vtable {
    11         mono_base_vtable const * const parent;
     21        __cfatid_struct_mono_base const * const __cfavir_typeid;
    1222};
    1323
     
    1727
    1828forall(T)
     29struct __cfatid_struct_mono_child {
     30    __cfatid_struct_mono_base const * parent;
     31};
     32
     33forall(T)
    1934struct mono_child_vtable {
    20         mono_base_vtable const * const parent;
     35        __cfatid_struct_mono_child(T) const * const __cfavir_typeid;
    2136};
    2237
     
    2641};
    2742
    28 mono_base_vtable _mono_base_vtable_instance @= { 0 };
     43__cfatid_struct_mono_child(int) __cfatid_mono_child @= {
     44        &__cfatid_mono_base,
     45};
     46
    2947mono_child_vtable(int) _mono_child_vtable_instance @= {
    30         &_mono_base_vtable_instance
     48        &__cfatid_mono_child,
    3149};
    3250
     
    3755}
    3856
     57
     58forall(U)
     59struct __cfatid_struct_poly_base {
     60    __cfa__parent_vtable const * parent;
     61};
     62
    3963forall(U)
    4064struct poly_base_vtable {
    41         poly_base_vtable(U) const * const parent;
     65        __cfatid_struct_poly_base(U) const * const __cfavir_typeid;
    4266};
    4367
     
    4872
    4973forall(V)
     74struct __cfatid_struct_poly_child {
     75    __cfatid_struct_poly_base(V) const * parent;
     76};
     77
     78forall(V)
    5079struct poly_child_vtable {
    51         poly_base_vtable(V) const * const parent;
     80        __cfatid_struct_poly_child(V) const * const __cfavir_typeid;
    5281};
    5382
     
    5786};
    5887
    59 poly_base_vtable(int) _poly_base_vtable_instance @= { 0 };
     88__cfatid_struct_poly_base(int) __cfatid_poly_base @= {
     89        (__cfa__parent_vtable *)0,
     90};
     91__cfatid_struct_poly_child(int) __cfatid_poly_child = {
     92    &__cfatid_poly_base,
     93};
    6094poly_child_vtable(int) _poly_child_vtable_instance @= {
    61         &_poly_base_vtable_instance
     95        &__cfatid_poly_child,
    6296};
    63 /* Resolver bug keeps me from adding these.
    64 poly_base_vtable(char) _poly_base_vtable_instance @= { 0 };
    65 poly_child_vtable(char) _poly_child_vtable_instance @= {
    66         &_poly_base_vtable_instance
    67 };
    68 */
    6997
    7098void poly_poly_test() {
     
    77105        mono_poly_test();
    78106        poly_poly_test();
    79         printf( "done\n" );                             // non-empty .expect file
     107        printf( "done\n" );
    80108}
Note: See TracChangeset for help on using the changeset viewer.