Ignore:
Timestamp:
Mar 9, 2020, 11:09:41 AM (20 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
5b544a6
Parents:
331eacb (diff), 3d3cbd0 (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.hfa

    r331eacb r87f572e  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  4 08:27:01 2020
    13 // Update Count     : 401
     12// Last Modified On : Thu Mar  5 11:29:06 2020
     13// Update Count     : 407
    1414//
    1515
     
    2121#include <stdlib.h>                                                                             // *alloc, strto*, ato*
    2222
     23// Reduce includes by explicitly defining these routines.
    2324extern "C" {
    2425        void * memalign( size_t align, size_t size );           // malloc.h
     26    void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA heap
    2527        void * memset( void * dest, int fill, size_t size ); // string.h
    2628        void * memcpy( void * dest, const void * src, size_t size ); // string.h
    27     void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA heap
    2829} // extern "C"
    2930
     
    4041
    4142static inline forall( dtype T | sized(T) ) {
    42         // C dynamic allocation
     43        // Cforall safe equivalents, i.e., implicit size specification
    4344
    4445        T * malloc( void ) {
     
    7273        } // posix_memalign
    7374
    74         // Cforall dynamic allocation
     75        // Cforall safe general allocation, fill, resize, array
    7576
    7677        T * alloc( void ) {
     
    159160
    160161static inline forall( dtype T | sized(T) ) {
    161         // data, non-array types
     162        // Cforall safe initialization/copy, i.e., implicit size specification, non-array types
    162163        T * memset( T * dest, char fill ) {
    163164                return (T *)memset( dest, fill, sizeof(T) );
     
    170171
    171172static inline forall( dtype T | sized(T) ) {
    172         // data, array types
     173        // Cforall safe initialization/copy, i.e., implicit size specification, array types
    173174        T * amemset( T dest[], char fill, size_t dim ) {
    174175                return (T *)(void *)memset( dest, fill, dim * sizeof(T) ); // C memset
     
    180181} // distribution
    181182
    182 // allocation/deallocation and constructor/destructor, non-array types
     183// Cforall allocation/deallocation and constructor/destructor, non-array types
    183184forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * new( Params p );
    184185forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void delete( T * ptr );
    185186forall( dtype T, ttype Params | sized(T) | { void ^?{}( T & ); void delete( Params ); } ) void delete( T * ptr, Params rest );
    186187
    187 // allocation/deallocation and constructor/destructor, array types
     188// Cforall allocation/deallocation and constructor/destructor, array types
    188189forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * anew( size_t dim, Params p );
    189190forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void adelete( size_t dim, T arr[] );
Note: See TracChangeset for help on using the changeset viewer.