Changeset 8f910430


Ignore:
Timestamp:
May 17, 2021, 11:43:49 AM (4 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:
90a10e8
Parents:
fc1347d0
Message:

Updated the virtual module to prefix the names with the new convention and change the parent_vtable into type_info.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/exception.c

    rfc1347d0 r8f910430  
    4848
    4949// Base Exception type id:
    50 struct __cfa__parent_vtable __cfatid_exception_t = {
     50struct __cfavir_type_info __cfatid_exception_t = {
    5151        NULL,
    5252};
  • libcfa/src/exception.h

    rfc1347d0 r8f910430  
    2929struct __cfaehm_base_exception_t;
    3030typedef struct __cfaehm_base_exception_t exception_t;
    31 struct __cfa__parent_vtable;
     31struct __cfavir_type_info;
    3232struct __cfaehm_base_exception_t_vtable {
    33         const struct __cfa__parent_vtable * __cfavir_typeid;
     33        const struct __cfavir_type_info * __cfavir_typeid;
    3434        size_t size;
    3535        void (*copy)(struct __cfaehm_base_exception_t *this,
     
    4141        struct __cfaehm_base_exception_t_vtable const * virtual_table;
    4242};
    43 extern struct __cfa__parent_vtable __cfatid_exception_t;
     43extern struct __cfavir_type_info __cfatid_exception_t;
    4444
    4545
  • libcfa/src/exception.hfa

    rfc1347d0 r8f910430  
    157157#define _EHM_TYPE_ID_STRUCT(exception_name, forall_clause) \
    158158        forall_clause _EHM_TYPE_ID_TYPE(exception_name) { \
    159                 __cfa__parent_vtable const * parent; \
     159                __cfavir_type_info const * parent; \
    160160        }
    161161
  • libcfa/src/virtual.c

    rfc1347d0 r8f910430  
    1010// Created On       : Tus Jul 11 15:10:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jul 26 14:24:00 2017
    13 // Update Count     : 1
     12// Last Modified On : Mon May 17 11:01:00 2021
     13// Update Count     : 2
    1414//
    1515
     
    1717#include "assert.h"
    1818
    19 int __cfa__is_parent( struct __cfa__parent_vtable const * parent,
    20         struct __cfa__parent_vtable const * child ) {
     19int __cfavir_is_parent(
     20                __cfavir_type_id parent,
     21                __cfavir_type_id child ) {
    2122        assert( child );
    2223        do {
     
    2829}
    2930
    30 void * __cfa__virtual_cast( struct __cfa__parent_vtable const * parent,
    31         struct __cfa__parent_vtable const * const * child ) {
     31void * __cfavir_virtual_cast(
     32                __cfavir_type_id parent,
     33                __cfavir_type_id const * child ) {
    3234        assert( child );
    33         return (__cfa__is_parent(parent, *child)) ? (void *)child : (void *)0;
     35        return (__cfavir_is_parent(parent, *child)) ? (void *)child : (void *)0;
    3436}
  • libcfa/src/virtual.h

    rfc1347d0 r8f910430  
    1010// Created On       : Tus Jul 11 15:08:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jul 26 14:18:00 2017
    13 // Update Count     : 1
     12// Last Modified On : Mon May 17 11:03:00 2021
     13// Update Count     : 2
    1414//
    1515
     
    2020#endif
    2121
    22 // All strict/explicate vtables should have this head, showing their parent.
    23 struct __cfa__parent_vtable {
    24     struct __cfa__parent_vtable const * const parent;
     22// Information on a type for the virtual system.
     23// There should be exactly one instance per type and there should be a
     24// pointer to it at the head of every virtual table.
     25struct __cfavir_type_info {
     26        // Type id of parent type, null if this is a root type.
     27    struct __cfavir_type_info const * const parent;
    2528};
    2629
    27 // Takes in two non-null pointers to type_objects.
    28 int __cfa__is_parent( struct __cfa__parent_vtable const * parent,
    29                 struct __cfa__parent_vtable const * child );
     30// A pointer to type information acts as the type id.
     31typedef struct __cfavir_type_info const * __cfavir_type_id;
     32
     33// Takes in two non-null type ids.
     34int __cfavir_is_parent(
     35                __cfavir_type_id parent, __cfavir_type_id child );
    3036
    3137// If parent is a parent of child then return child, otherwise return NULL.
    3238// Input pointers are none-null, child's first level should be an object with
    3339// a vtable
    34 void * __cfa__virtual_cast( struct __cfa__parent_vtable const * parent,
    35                 struct __cfa__parent_vtable const * const * child );
     40void * __cfavir_virtual_cast(
     41                __cfavir_type_id parent, __cfavir_type_id const * child );
    3642
    3743#ifdef __cforall
  • src/Virtual/ExpandCasts.cc

    rfc1347d0 r8f910430  
    105105        void VirtualCastCore::premutate( FunctionDecl * functionDecl ) {
    106106                if ( (! vcast_decl) &&
    107                      functionDecl->get_name() == "__cfa__virtual_cast" ) {
     107                     functionDecl->get_name() == "__cfavir_virtual_cast" ) {
    108108                        vcast_decl = functionDecl;
    109109                }
     
    113113                if ( pvt_decl || ! structDecl->has_body() ) {
    114114                        return;
    115                 } else if ( structDecl->get_name() == "__cfa__parent_vtable" ) {
     115                } else if ( structDecl->get_name() == "__cfavir_type_info" ) {
    116116                        pvt_decl = structDecl;
    117117                }
  • tests/exceptions/virtual-cast.cfa

    rfc1347d0 r8f910430  
    1616// Hand defined alpha virtual type:
    1717struct __cfatid_struct_alpha {
    18         __cfa__parent_vtable const * parent;
     18        __cfavir_type_info parent;
    1919};
    2020
    21 __attribute__(( section(".gnu.linkonce.__cfatid_alpha") ))
     21__attribute__(( cfa_linkonce ))
    2222struct __cfatid_struct_alpha __cfatid_alpha = {
    23         (__cfa__parent_vtable *)0,
     23        (__cfavir_type_info *)0,
    2424};
    2525
  • tests/exceptions/virtual-poly.cfa

    rfc1347d0 r8f910430  
    1010
    1111struct __cfatid_struct_mono_base {
    12     __cfa__parent_vtable const * parent;
     12    __cfavir_type_info const * parent;
    1313};
    1414
    15 __attribute__(( section(".gnu.linkonce.__cfatid_mono_base") ))
     15__attribute__(( cfa_linkonce ))
    1616struct __cfatid_struct_mono_base __cfatid_mono_base = {
    17     (__cfa__parent_vtable *)0,
     17    (__cfavir_type_info *)0,
    1818};
    1919
     
    5858forall(U)
    5959struct __cfatid_struct_poly_base {
    60     __cfa__parent_vtable const * parent;
     60    __cfavir_type_info const * parent;
    6161};
    6262
     
    8787
    8888__cfatid_struct_poly_base(int) __cfatid_poly_base @= {
    89         (__cfa__parent_vtable *)0,
     89        (__cfavir_type_info *)0,
    9090};
    9191__cfatid_struct_poly_child(int) __cfatid_poly_child = {
Note: See TracChangeset for help on using the changeset viewer.