Changeset 93068e53
- Timestamp:
- Oct 29, 2020, 4:13:27 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- 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. - Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/proposals/vtable.md
r0b84b15 r93068e53 512 512 possibly like the one used to create the assertion. 513 513 514 ### Extension: Associated Types Use 515 If the `associated_types.md` proposal is accepted the following trait could 516 be added: 517 518 trait is_virtual(dtype T) { 519 dtype table; 520 // An example assertion: 521 const table & get_virtual_table(T &); 522 } 523 524 There may be more assertions but there has to be at least one way to find 525 the (possibly default) virtual table. It is required to construct instances 526 of the type. 527 528 Without 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 534 Which is just a little bit longer to use but becomes more problematic if the 535 user has to explicately provide the table's name as it doesn't really have its 536 own type name. If it does it is probably mangled. 537 514 538 ### Virtual Tables as Types 515 539 Here we consider encoding plus the implementation of functions on it to be a -
libcfa/prelude/builtins.c
r0b84b15 r93068e53 9 9 // Author : Peter A. Buhr 10 10 // Created On : Fri Jul 21 16:21:03 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Oct 9 18:26:19202013 // Update Count : 11 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Oct 27 14:42:00 2020 13 // Update Count : 111 14 14 // 15 16 #define __cforall_builtins__ 15 17 16 18 // 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 24 24 #include <unistd.h> 25 25 #include <sys/mman.h> // mprotect 26 extern "C" {27 // use this define to make unwind.h play nice, definitely a hack28 #define HIDE_EXPORTS29 26 #include <unwind.h> 30 #undef HIDE_EXPORTS31 }32 27 33 28 #include "kernel_private.hfa" 29 #include "exception.hfa" 34 30 35 31 #define __CFA_INVOKE_PRIVATE__ -
libcfa/src/concurrency/exception.cfa
r0b84b15 r93068e53 10 10 // Created On : Mon Aug 17 10:41:00 2020 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Aug 25 14:41:00 202013 // Update Count : 012 // Last Modified On : Wed Oct 28 14:34:00 2020 13 // Update Count : 1 14 14 // 15 15 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__ 21 17 22 extern void __cfactx_thrd_leave(); 23 } 18 #include "exception.hfa" 24 19 25 #include "invoke.h"26 #include "exception.hfa"27 20 #include "coroutine.hfa" 28 21 29 22 extern struct $thread * mainThread; 23 extern "C" { 24 extern void __cfactx_thrd_leave(); 25 } 30 26 31 27 // Common pattern for all the stop functions, wait until the end then act. -
libcfa/src/concurrency/exception.hfa
r0b84b15 r93068e53 18 18 // This is an internal bridge between the two modes and must be C compatable. 19 19 20 #include <unwind.h> 20 21 #include "bits/defs.hfa" 21 22 #include "invoke.h" 23 #include "exception.h" 22 24 23 25 #ifdef __cforall 24 26 extern "C" { 25 26 #define HIDE_EXPORTS27 27 #endif 28 #include "unwind.h"29 28 30 29 struct exception_context_t * this_exception_context(void) OPTIONAL_THREAD; … … 33 32 struct _Unwind_Exception * unwind_exception ) OPTIONAL_THREAD; 34 33 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 46 34 #ifdef __cforall 47 #undef HIDE_EXPORTS48 35 } 49 36 #endif -
libcfa/src/exception.c
r0b84b15 r93068e53 9 9 // Author : Andrew Beach 10 10 // Created On : Mon Jun 26 15:13:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Aug 29 15:52:22202013 // Update Count : 3 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Oct 27 16:27:00 2020 13 // Update Count : 35 14 14 // 15 15 … … 17 17 #include <stddef.h> // for size_t 18 18 19 #include <unwind.h> // for struct _Unwind_Exception {...}; 20 19 21 #include "exception.h" 20 22 21 23 #include <stdlib.h> 22 24 #include <stdio.h> 23 #include <unwind.h>24 25 #include <bits/debug.hfa> 25 26 #include "concurrency/invoke.h" 26 #include "concurrency/exception.hfa"27 27 #include "stdhdr/assert.h" 28 28 -
libcfa/src/exception.h
r0b84b15 r93068e53 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // exception.h -- Builtins for exception handling.7 // exception.h -- Internal exception handling definitions. 8 8 // 9 9 // Author : Andrew Beach 10 10 // Created On : Mon Jun 26 15:11:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue May 19 14:17:00 202013 // Update Count : 1 012 // Last Modified On : Tue Oct 27 14:45:00 2020 13 // Update Count : 11 14 14 // 15 15 16 16 #pragma once 17 17 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. 18 21 19 22 #ifdef __cforall 20 23 extern "C" { 21 24 #endif 25 26 // Included in C code or the built-ins. 27 #if !defined(__cforall) || defined(__cforall_builtins__) 22 28 23 29 struct __cfaehm_base_exception_t; … … 47 53 // Function catches termination exceptions. 48 54 void __cfaehm_try_terminate( 49 50 51 55 void (*try_block)(), 56 void (*catch_block)(int index, exception_t * except), 57 int (*match_block)(exception_t * except)); 52 58 53 59 // Clean-up the exception in catch blocks. … … 56 62 // Data structure creates a list of resume handlers. 57 63 struct __cfaehm_try_resume_node { 58 59 64 struct __cfaehm_try_resume_node * next; 65 _Bool (*handler)(exception_t * except); 60 66 }; 61 67 62 68 // These act as constructor and destructor for the resume node. 63 69 void __cfaehm_try_resume_setup( 64 65 70 struct __cfaehm_try_resume_node * node, 71 _Bool (*handler)(exception_t * except)); 66 72 void __cfaehm_try_resume_cleanup( 67 73 struct __cfaehm_try_resume_node * node); 68 74 69 75 // Check for a standard way to call fake deconstructors. 70 76 struct __cfaehm_cleanup_hook {}; 71 77 78 #endif 79 80 // Included in C code and the library. 81 #if !defined(__cforall) || !defined(__cforall_builtins__) 82 struct __cfaehm_node { 83 struct _Unwind_Exception unwind_exception; 84 struct __cfaehm_node * next; 85 int handler_index; 86 }; 87 88 static 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 72 94 #ifdef __cforall 73 95 } 96 97 // Built-ins not visible in C. 98 #if defined(__cforall_builtins__) 74 99 75 100 // Not all the built-ins can be expressed in C. These can't be … … 124 149 125 150 #endif 151 152 #endif
Note: See TracChangeset
for help on using the changeset viewer.