Changeset c960331
- Timestamp:
- Oct 28, 2020, 3:40:46 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:
- 936d95c
- Parents:
- 1be1e5a
- Location:
- libcfa
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
r1be1e5a rc960331 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
r1be1e5a rc960331 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
r1be1e5a rc960331 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
r1be1e5a rc960331 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
r1be1e5a rc960331 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
r1be1e5a rc960331 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.