Changeset 99cadc60 for libcfa


Ignore:
Timestamp:
Jul 31, 2019, 3:26:06 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
61cfae2
Parents:
c60a664 (diff), 40287c8 (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
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/prelude-gen.cc

    rc60a664 r99cadc60  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // prelude-gen.cc -- 
    8 // 
     6//
     7// prelude-gen.cc --
     8//
    99// Author           : Rob Schluntz and Thierry Delisle
    1010// Created On       : Sat Feb 16 08:44:58 2019
     
    1212// Last Modified On : Tue Apr  2 17:18:24 2019
    1313// Update Count     : 37
    14 // 
     14//
    1515
    1616#include <algorithm>
     
    264264                for (auto cvq : qualifiersPair) {
    265265                        for (auto is_vol : { "        ", "volatile" }) {
    266                                 cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
     266                                cout << "forall(dtype DT) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
    267267                        }
    268268                }
    269                 for (auto cvq : qualifiersSingle) {
    270                         for (auto is_vol : { "        ", "volatile" }) {
    271                                 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
    272                         }
    273                         for (auto is_vol : { "        ", "volatile" }) {
    274                                 cout << "forall(dtype DT) void ^?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
    275                         }
     269        }
     270        for (auto cvq : qualifiersSingle) {
     271                for (auto is_vol : { "        ", "volatile" }) {
     272                        cout << "void  ?{}(" << cvq << "void" << " * " << is_vol << " &);" << endl;
     273                }
     274                for (auto is_vol : { "        ", "volatile" }) {
     275                        cout << "void ^?{}(" << cvq << "void" << " * " << is_vol << " &);" << endl;
     276                }
     277        }
     278
     279        for (auto cvq : qualifiersSingle) {
     280                for (auto is_vol : { "        ", "volatile" }) {
     281                        cout << "forall(dtype DT) void  ?{}(" << cvq << "  DT" << " * " << is_vol << " &);" << endl;
     282                }
     283                for (auto is_vol : { "        ", "volatile" }) {
     284                        cout << "forall(dtype DT) void ^?{}(" << cvq << "  DT" << " * " << is_vol << " &);" << endl;
    276285                }
    277286        }
     
    288297        cout << endl;
    289298
    290         cout << "forall(ftype FT) void  ?{}( FT *          &, zero_t ); " << endl;
     299        cout << "forall(ftype FT) void  ?{}( FT *          &, zero_t );" << endl;
    291300        cout << "forall(ftype FT) FT *                  ?=?( FT *          &, zero_t );" << endl;
    292301        cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, zero_t );" << endl;
  • libcfa/src/heap.cfa

    rc60a664 r99cadc60  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 19 16:07:46 2019
    13 // Update Count     : 548
     12// Last Modified On : Wed Jul 24 13:12:45 2019
     13// Update Count     : 550
    1414//
    1515
     
    248248
    249249#ifdef FASTLOOKUP
    250 static_assert( 16 == sizeof(HeapManager.Storage), "size of HeapManager Storage wrong" ); // FIX ME
    251 enum { LookupSizes = 65_536 + 16 };                                             // number of fast lookup sizes
     250enum { LookupSizes = 65_536 + sizeof(HeapManager.Storage) }; // number of fast lookup sizes
    252251static unsigned char lookup[LookupSizes];                               // O(1) lookup for small sizes
    253252#endif // FASTLOOKUP
     
    869868                void * area;
    870869                if ( unlikely( alignment != 0 ) ) {                             // previous request memalign?
    871                         area = memalign( alignment, size );                     // create new area
     870                        area = memalign( alignment, size );                     // create new aligned area
    872871                } else {
    873872                        area = mallocNoStats( size );                           // create new area
  • libcfa/src/stdlib.hfa

    rc60a664 r99cadc60  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Apr 24 17:35:43 2019
    13 // Update Count     : 352
     12// Last Modified On : Tue Jul 23 14:14:59 2019
     13// Update Count     : 373
    1414//
    1515
     
    1717
    1818#include "bits/defs.hfa"
     19#include "bits/align.hfa"
    1920
    2021#include <stdlib.h>                                                                             // *alloc, strto*, ato*
     22
    2123extern "C" {
    2224        void * memalign( size_t align, size_t size );           // malloc.h
     
    3941
    4042        T * malloc( void ) {
    41                 return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
     43                if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
     44                else return (T *)memalign( _Alignof(T), sizeof(T) );
    4245        } // malloc
    4346
    4447        T * calloc( size_t dim ) {
    45                 return (T *)(void *)calloc( dim, sizeof(T) );   // C calloc
     48                if ( _Alignof(T) <= libAlign() )return (T *)(void *)calloc( dim, sizeof(T) ); // C calloc
     49                else return (T *)cmemalign( _Alignof(T), dim, sizeof(T) );
    4650        } // calloc
    4751
    4852        T * realloc( T * ptr, size_t size ) {
     53                if ( unlikely( ptr == 0 ) ) return malloc();
    4954                return (T *)(void *)realloc( (void *)ptr, size );
    5055        } // realloc
     
    6671
    6772        T * alloc( void ) {
    68                 return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
     73                return malloc();
    6974        } // alloc
    7075
    7176        T * alloc( char fill ) {
    72                 T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) );     // C malloc
     77                T * ptr;
     78                if ( _Alignof(T) <= libAlign() ) ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
     79                else ptr = (T *)memalign( _Alignof(T), sizeof(T) );
    7380                return (T *)memset( ptr, (int)fill, sizeof(T) ); // initialize with fill value
    7481        } // alloc
    7582
    7683        T * alloc( size_t dim ) {
    77                 return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc
     84                if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc
     85                else return (T *)memalign( _Alignof(T), dim * sizeof(T) );
    7886        } // alloc
    7987
    8088        T * alloc( size_t dim, char fill ) {
    81                 T * ptr = (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C calloc
    82                 return (T *)memset( ptr, (int)fill, dim * sizeof(T) ); // initialize with fill value
     89                return (T *)memset( (T *)alloc( dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value
    8390        } // alloc
    8491
    8592        T * alloc( T ptr[], size_t dim ) {
    86                 return (T *)(void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc
    87         } // alloc
    88 } // distribution
    89 
    90 
    91 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill );
     93                return realloc( ptr, dim * sizeof(T) );
     94        } // alloc
     95} // distribution
    9296
    9397
     
    107111
    108112        T * align_alloc( size_t align, size_t dim, char fill ) {
    109                 T * ptr;
    110113                if ( fill == '\0' ) {
    111                         ptr = (T *)cmemalign( align, dim, sizeof(T) );
     114                        return (T *)cmemalign( align, dim, sizeof(T) );
    112115                } else {
    113                         ptr = (T *)memalign( align, dim * sizeof(T) );
    114                         return (T *)memset( ptr, (int)fill, dim * sizeof(T) );
     116                        return (T *)memset( (T *)memalign( align, dim * sizeof(T) ), (int)fill, dim * sizeof(T) );
    115117                } // if
    116                 return ptr;
    117         } // align_alloc
    118 } // distribution
     118        } // align_alloc
     119} // distribution
     120
     121forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill );
    119122
    120123
Note: See TracChangeset for help on using the changeset viewer.