- Timestamp:
- May 17, 2021, 9:29:43 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:
- c2794b2
- Parents:
- 6312b1c (diff), 1eb222ff (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. - Location:
- libcfa/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/alarm.cfa
r6312b1c r02a43ff 55 55 this.period = period; 56 56 this.thrd = thrd; 57 this.timeval = __kernel_get_time() + alarm; 57 58 set = false; 58 59 type = User; … … 63 64 this.period = period; 64 65 this.proc = proc; 66 this.timeval = __kernel_get_time() + alarm; 65 67 set = false; 66 68 type = Kernel; 67 69 } 68 70 void ?{}( alarm_node_t & this, Alarm_Callback callback, Duration alarm, Duration period ) with( this ) { 71 this.callback = callback; 69 72 this.initial = alarm; 70 73 this.period = period; 71 this. callback = callback;74 this.timeval = __kernel_get_time() + alarm; 72 75 set = false; 73 76 type = Callback; … … 110 113 lock( event_kernel->lock __cfaabi_dbg_ctx2 ); 111 114 { 112 Time curr = __kernel_get_time();113 this->timeval = curr + this->initial;114 115 115 /* paranoid */ verify( validate( alarms ) ); 116 116 117 Time curr = __kernel_get_time(); 117 118 __cfadbg_print_safe( preemption, " KERNEL: alarm inserting %p (%lu -> %lu).\n", this, curr.tn, this->timeval.tn ); 118 119 insert( &alarms, this ); 119 __kernel_set_timer( this-> initial);120 __kernel_set_timer( this->timeval - curr); 120 121 this->set = true; 121 122 } -
libcfa/src/concurrency/locks.cfa
r6312b1c r02a43ff 188 188 alarm_node_t alarm_node; 189 189 condition_variable(L) * cond; 190 info_thread(L) * i ;190 info_thread(L) * info_thd; 191 191 }; 192 192 … … 194 194 this.alarm_node{ callback, alarm, period }; 195 195 this.cond = c; 196 this.i = i;196 this.info_thd = i; 197 197 } 198 198 … … 206 206 // may still be called after a thread has been removed from the queue but 207 207 // before the alarm is unregistered 208 if ( listed(i ) ) { // is thread on queue209 i ->signalled = false;208 if ( listed(info_thd) ) { // is thread on queue 209 info_thd->signalled = false; 210 210 // remove this thread O(1) 211 remove( cond->blocked_threads, *i );211 remove( cond->blocked_threads, *info_thd ); 212 212 cond->count--; 213 if( i ->lock ) {213 if( info_thd->lock ) { 214 214 // call lock's on_notify if a lock was passed 215 on_notify(*i ->lock, i->t);215 on_notify(*info_thd->lock, info_thd->t); 216 216 } else { 217 217 // otherwise wake thread 218 unpark( i ->t );218 unpark( info_thd->t ); 219 219 } 220 220 } -
libcfa/src/exception.c
r6312b1c r02a43ff 48 48 49 49 // Base Exception type id: 50 struct __cfa __parent_vtable__cfatid_exception_t = {50 struct __cfavir_type_info __cfatid_exception_t = { 51 51 NULL, 52 52 }; -
libcfa/src/exception.h
r6312b1c r02a43ff 29 29 struct __cfaehm_base_exception_t; 30 30 typedef struct __cfaehm_base_exception_t exception_t; 31 struct __cfa __parent_vtable;31 struct __cfavir_type_info; 32 32 struct __cfaehm_base_exception_t_vtable { 33 const struct __cfa __parent_vtable* __cfavir_typeid;33 const struct __cfavir_type_info * __cfavir_typeid; 34 34 size_t size; 35 35 void (*copy)(struct __cfaehm_base_exception_t *this, … … 41 41 struct __cfaehm_base_exception_t_vtable const * virtual_table; 42 42 }; 43 extern struct __cfa __parent_vtable__cfatid_exception_t;43 extern struct __cfavir_type_info __cfatid_exception_t; 44 44 45 45 -
libcfa/src/exception.hfa
r6312b1c r02a43ff 157 157 #define _EHM_TYPE_ID_STRUCT(exception_name, forall_clause) \ 158 158 forall_clause _EHM_TYPE_ID_TYPE(exception_name) { \ 159 __cfa __parent_vtableconst * parent; \159 __cfavir_type_info const * parent; \ 160 160 } 161 161 -
libcfa/src/iostream.cfa
r6312b1c r02a43ff 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Apr 27 18:01:03202113 // Update Count : 13 3012 // Last Modified On : Sat May 15 09:39:21 2021 13 // Update Count : 1342 14 14 // 15 15 … … 659 659 int exp10, len2; \ 660 660 eng( f.val, f.pc, exp10 ); /* changes arguments */ \ 661 /* printf( "%g %d %d %d %s\n", f.val, f.wd, f.pc, exp10, format ); */ \ 661 662 if ( ! f.flags.left && f.wd > 1 ) { \ 662 /* Exponent size (number of digits, 'e', optional minus sign)*/ \663 f.wd -= lrint( floor( log10( abs( exp10 ) ) ) ) + 1 + 1 + (exp10 < 0 ? 1 : 0); \663 /* Exponent size: 'e', optional minus sign, number of digits: log10(0) => undefined */ \ 664 f.wd -= 1 + (exp10 < 0 ? 1 : 0) + lrint( floor( exp10 == 0 ? 0 : log10( abs( exp10 ) ) ) ) + 1; \ 664 665 if ( f.wd < 1 ) f.wd = 1; \ 665 666 } /* if */ \ … … 708 709 if ( ! f.flags.pc ) { /* no precision */ \ 709 710 fmtstr[sizeof(DFMTNP)-2] = f.base; /* sizeof includes '\0' */ \ 710 /* printf( "%g %d %s\n", f.val, f.wd, &fmtstr[star] ); */ \711 /* printf( "%g %d %s\n", f.val, f.wd, &fmtstr[star] ); */ \ 711 712 PrintWithDP2( os, &fmtstr[star], f.wd, f.val ) \ 712 713 } else { /* precision */ \ -
libcfa/src/virtual.c
r6312b1c r02a43ff 10 10 // Created On : Tus Jul 11 15:10:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jul 26 14:24:00 201713 // Update Count : 112 // Last Modified On : Mon May 17 11:01:00 2021 13 // Update Count : 2 14 14 // 15 15 … … 17 17 #include "assert.h" 18 18 19 int __cfa__is_parent( struct __cfa__parent_vtable const * parent, 20 struct __cfa__parent_vtable const * child ) { 19 int __cfavir_is_parent( 20 __cfavir_type_id parent, 21 __cfavir_type_id child ) { 21 22 assert( child ); 22 23 do { … … 28 29 } 29 30 30 void * __cfa__virtual_cast( struct __cfa__parent_vtable const * parent, 31 struct __cfa__parent_vtable const * const * child ) { 31 void * __cfavir_virtual_cast( 32 __cfavir_type_id parent, 33 __cfavir_type_id const * child ) { 32 34 assert( child ); 33 return (__cfa __is_parent(parent, *child)) ? (void *)child : (void *)0;35 return (__cfavir_is_parent(parent, *child)) ? (void *)child : (void *)0; 34 36 } -
libcfa/src/virtual.h
r6312b1c r02a43ff 10 10 // Created On : Tus Jul 11 15:08:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jul 26 14:18:00 201713 // Update Count : 112 // Last Modified On : Mon May 17 11:03:00 2021 13 // Update Count : 2 14 14 // 15 15 … … 20 20 #endif 21 21 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. 25 struct __cfavir_type_info { 26 // Type id of parent type, null if this is a root type. 27 struct __cfavir_type_info const * const parent; 25 28 }; 26 29 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. 31 typedef struct __cfavir_type_info const * __cfavir_type_id; 32 33 // Takes in two non-null type ids. 34 int __cfavir_is_parent( 35 __cfavir_type_id parent, __cfavir_type_id child ); 30 36 31 37 // If parent is a parent of child then return child, otherwise return NULL. 32 38 // Input pointers are none-null, child's first level should be an object with 33 39 // a vtable 34 void * __cfa __virtual_cast( struct __cfa__parent_vtable const * parent,35 struct __cfa__parent_vtable const *const * child );40 void * __cfavir_virtual_cast( 41 __cfavir_type_id parent, __cfavir_type_id const * child ); 36 42 37 43 #ifdef __cforall
Note:
See TracChangeset
for help on using the changeset viewer.