Changeset 93068e53


Ignore:
Timestamp:
Oct 29, 2020, 4:13:27 PM (12 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
7a2a3af, c6c682cf
Parents:
0b84b15 (diff), 936d95c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • doc/proposals/vtable.md

    r0b84b15 r93068e53  
    512512possibly like the one used to create the assertion.
    513513
     514### Extension: Associated Types Use
     515If the `associated_types.md` proposal is accepted the following trait could
     516be added:
     517
     518    trait is_virtual(dtype T) {
     519        dtype table;
     520        // An example assertion:
     521        const table & get_virtual_table(T &);
     522    }
     523
     524There may be more assertions but there has to be at least one way to find
     525the (possibly default) virtual table. It is required to construct instances
     526of the type.
     527
     528Without the assotiated type it would look like this:
     529
     530    trait is_virtual(dtype T, dtype table) {
     531        const table & get_virtual_table(T &);
     532    }
     533
     534Which is just a little bit longer to use but becomes more problematic if the
     535user has to explicately provide the table's name as it doesn't really have its
     536own type name. If it does it is probably mangled.
     537
    514538### Virtual Tables as Types
    515539Here we consider encoding plus the implementation of functions on it to be a
  • libcfa/prelude/builtins.c

    r0b84b15 r93068e53  
    99// Author           : Peter A. Buhr
    1010// Created On       : Fri Jul 21 16:21:03 2017
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Oct  9 18:26:19 2020
    13 // Update Count     : 110
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tue Oct 27 14:42:00 2020
     13// Update Count     : 111
    1414//
     15
     16#define __cforall_builtins__
    1517
    1618// type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions
  • libcfa/src/concurrency/coroutine.cfa

    r0b84b15 r93068e53  
    2424#include <unistd.h>
    2525#include <sys/mman.h>                                                                   // mprotect
    26 extern "C" {
    27 // use this define to make unwind.h play nice, definitely a hack
    28 #define HIDE_EXPORTS
    2926#include <unwind.h>
    30 #undef HIDE_EXPORTS
    31 }
    3227
    3328#include "kernel_private.hfa"
     29#include "exception.hfa"
    3430
    3531#define __CFA_INVOKE_PRIVATE__
  • libcfa/src/concurrency/exception.cfa

    r0b84b15 r93068e53  
    1010// Created On       : Mon Aug 17 10:41:00 2020
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Aug 25 14:41:00 2020
    13 // Update Count     : 0
     12// Last Modified On : Wed Oct 28 14:34:00 2020
     13// Update Count     : 1
    1414//
    1515
    16 extern "C" {
    17 // use this define to make unwind.h play nice, definitely a hack
    18 #define HIDE_EXPORTS
    19 #include <unwind.h>
    20 #undef HIDE_EXPORTS
     16#define __cforall_thread__
    2117
    22 extern void __cfactx_thrd_leave();
    23 }
     18#include "exception.hfa"
    2419
    25 #include "invoke.h"
    26 #include "exception.hfa"
    2720#include "coroutine.hfa"
    2821
    2922extern struct $thread * mainThread;
     23extern "C" {
     24extern void __cfactx_thrd_leave();
     25}
    3026
    3127// Common pattern for all the stop functions, wait until the end then act.
  • libcfa/src/concurrency/exception.hfa

    r0b84b15 r93068e53  
    1818// This is an internal bridge between the two modes and must be C compatable.
    1919
     20#include <unwind.h>
    2021#include "bits/defs.hfa"
    2122#include "invoke.h"
     23#include "exception.h"
    2224
    2325#ifdef __cforall
    2426extern "C" {
    25 
    26 #define HIDE_EXPORTS
    2727#endif
    28 #include "unwind.h"
    2928
    3029struct exception_context_t * this_exception_context(void) OPTIONAL_THREAD;
     
    3332                struct _Unwind_Exception * unwind_exception ) OPTIONAL_THREAD;
    3433
    35 struct __cfaehm_node {
    36         struct _Unwind_Exception unwind_exception;
    37         struct __cfaehm_node * next;
    38         int handler_index;
    39 };
    40 
    41 static inline exception_t * __cfaehm_cancellation_exception(
    42                 struct _Unwind_Exception * unwind_exception ) {
    43         return (exception_t *)(1 + (struct __cfaehm_node *)unwind_exception);
    44 }
    45 
    4634#ifdef __cforall
    47 #undef HIDE_EXPORTS
    4835}
    4936#endif
  • libcfa/src/exception.c

    r0b84b15 r93068e53  
    99// Author           : Andrew Beach
    1010// Created On       : Mon Jun 26 15:13:00 2017
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 29 15:52:22 2020
    13 // Update Count     : 34
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tue Oct 27 16:27:00 2020
     13// Update Count     : 35
    1414//
    1515
     
    1717#include <stddef.h> // for size_t
    1818
     19#include <unwind.h> // for struct _Unwind_Exception {...};
     20
    1921#include "exception.h"
    2022
    2123#include <stdlib.h>
    2224#include <stdio.h>
    23 #include <unwind.h>
    2425#include <bits/debug.hfa>
    2526#include "concurrency/invoke.h"
    26 #include "concurrency/exception.hfa"
    2727#include "stdhdr/assert.h"
    2828
  • libcfa/src/exception.h

    r0b84b15 r93068e53  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // exception.h -- Builtins for exception handling.
     7// exception.h -- Internal exception handling definitions.
    88//
    99// Author           : Andrew Beach
    1010// Created On       : Mon Jun 26 15:11:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue May 19 14:17:00 2020
    13 // Update Count     : 10
     12// Last Modified On : Tue Oct 27 14:45:00 2020
     13// Update Count     : 11
    1414//
    1515
    1616#pragma once
    1717
     18// This could be considered several headers. All are internal to the exception
     19// system but needed to depending on whether they are C/Cforall code and
     20// whether or not they are part of the builtins.
    1821
    1922#ifdef __cforall
    2023extern "C" {
    2124#endif
     25
     26// Included in C code or the built-ins.
     27#if !defined(__cforall) || defined(__cforall_builtins__)
    2228
    2329struct __cfaehm_base_exception_t;
     
    4753// Function catches termination exceptions.
    4854void __cfaehm_try_terminate(
    49     void (*try_block)(),
    50     void (*catch_block)(int index, exception_t * except),
    51     int (*match_block)(exception_t * except));
     55        void (*try_block)(),
     56        void (*catch_block)(int index, exception_t * except),
     57        int (*match_block)(exception_t * except));
    5258
    5359// Clean-up the exception in catch blocks.
     
    5662// Data structure creates a list of resume handlers.
    5763struct __cfaehm_try_resume_node {
    58     struct __cfaehm_try_resume_node * next;
    59     _Bool (*handler)(exception_t * except);
     64        struct __cfaehm_try_resume_node * next;
     65        _Bool (*handler)(exception_t * except);
    6066};
    6167
    6268// These act as constructor and destructor for the resume node.
    6369void __cfaehm_try_resume_setup(
    64     struct __cfaehm_try_resume_node * node,
    65     _Bool (*handler)(exception_t * except));
     70        struct __cfaehm_try_resume_node * node,
     71        _Bool (*handler)(exception_t * except));
    6672void __cfaehm_try_resume_cleanup(
    67     struct __cfaehm_try_resume_node * node);
     73        struct __cfaehm_try_resume_node * node);
    6874
    6975// Check for a standard way to call fake deconstructors.
    7076struct __cfaehm_cleanup_hook {};
    7177
     78#endif
     79
     80// Included in C code and the library.
     81#if !defined(__cforall) || !defined(__cforall_builtins__)
     82struct __cfaehm_node {
     83        struct _Unwind_Exception unwind_exception;
     84        struct __cfaehm_node * next;
     85        int handler_index;
     86};
     87
     88static inline exception_t * __cfaehm_cancellation_exception(
     89                struct _Unwind_Exception * unwind_exception ) {
     90        return (exception_t *)(1 + (struct __cfaehm_node *)unwind_exception);
     91}
     92#endif
     93
    7294#ifdef __cforall
    7395}
     96
     97// Built-ins not visible in C.
     98#if defined(__cforall_builtins__)
    7499
    75100// Not all the built-ins can be expressed in C. These can't be
     
    124149
    125150#endif
     151
     152#endif
Note: See TracChangeset for help on using the changeset viewer.