Changeset 02a43ff for libcfa


Ignore:
Timestamp:
May 17, 2021, 9:29:43 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
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.
Message:

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

Location:
libcfa/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/alarm.cfa

    r6312b1c r02a43ff  
    5555        this.period  = period;
    5656        this.thrd = thrd;
     57        this.timeval = __kernel_get_time() + alarm;
    5758        set = false;
    5859        type = User;
     
    6364        this.period  = period;
    6465        this.proc = proc;
     66        this.timeval = __kernel_get_time() + alarm;
    6567        set = false;
    6668        type = Kernel;
    6769}
    6870void ?{}( alarm_node_t & this, Alarm_Callback callback, Duration alarm, Duration period ) with( this ) {
     71        this.callback = callback;
    6972        this.initial = alarm;
    7073        this.period  = period;
    71         this.callback = callback;
     74        this.timeval = __kernel_get_time() + alarm;
    7275        set = false;
    7376        type = Callback;
     
    110113        lock( event_kernel->lock __cfaabi_dbg_ctx2 );
    111114        {
    112                 Time curr = __kernel_get_time();
    113                 this->timeval = curr + this->initial;
    114 
    115115                /* paranoid */ verify( validate( alarms ) );
    116116
     117                Time curr = __kernel_get_time();
    117118                __cfadbg_print_safe( preemption, " KERNEL: alarm inserting %p (%lu -> %lu).\n", this, curr.tn, this->timeval.tn );
    118119                insert( &alarms, this );
    119                 __kernel_set_timer( this->initial );
     120                __kernel_set_timer( this->timeval - curr);
    120121                this->set = true;
    121122        }
  • libcfa/src/concurrency/locks.cfa

    r6312b1c r02a43ff  
    188188                alarm_node_t alarm_node;
    189189                condition_variable(L) * cond;
    190                 info_thread(L) * i;
     190                info_thread(L) * info_thd;
    191191        };
    192192
     
    194194                this.alarm_node{ callback, alarm, period };
    195195                this.cond = c;
    196                 this.i = i;
     196                this.info_thd = i;
    197197        }
    198198
     
    206206                //      may still be called after a thread has been removed from the queue but
    207207                //      before the alarm is unregistered
    208                 if ( listed(i) ) {      // is thread on queue
    209                         i->signalled = false;
     208                if ( listed(info_thd) ) {       // is thread on queue
     209                        info_thd->signalled = false;
    210210                        // remove this thread O(1)
    211                         remove( cond->blocked_threads, *i );
     211                        remove( cond->blocked_threads, *info_thd );
    212212                        cond->count--;
    213                         if( i->lock ) {
     213                        if( info_thd->lock ) {
    214214                                // 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);
    216216                        } else {
    217217                                // otherwise wake thread
    218                                 unpark( i->t );
     218                                unpark( info_thd->t );
    219219                        }
    220220                }
  • libcfa/src/exception.c

    r6312b1c r02a43ff  
    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

    r6312b1c r02a43ff  
    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

    r6312b1c r02a43ff  
    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/iostream.cfa

    r6312b1c r02a43ff  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 27 18:01:03 2021
    13 // Update Count     : 1330
     12// Last Modified On : Sat May 15 09:39:21 2021
     13// Update Count     : 1342
    1414//
    1515
     
    659659                        int exp10, len2; \
    660660                        eng( f.val, f.pc, exp10 );                                      /* changes arguments */ \
     661                        /* printf( "%g %d %d %d %s\n", f.val, f.wd, f.pc, exp10, format ); */ \
    661662                        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; \
    664665                                if ( f.wd < 1 ) f.wd = 1; \
    665666                        } /* if */ \
     
    708709                if ( ! f.flags.pc ) {                                                   /* no precision */ \
    709710                        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] ); */ \
    711712                        PrintWithDP2( os, &fmtstr[star], f.wd, f.val ) \
    712713                } else {                                                                                /* precision */ \
  • libcfa/src/virtual.c

    r6312b1c r02a43ff  
    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

    r6312b1c r02a43ff  
    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
Note: See TracChangeset for help on using the changeset viewer.