Changeset ada0246d for libcfa


Ignore:
Timestamp:
May 27, 2020, 3:14:50 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
a491a3c
Parents:
c19bc90
Message:

create heap.hfa, use it in malloc.h, and cleanup includes with respect to extern "C"

Location:
libcfa/src
Files:
2 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    rc19bc90 rada0246d  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Sun May 17 21:10:26 2020
    14 ## Update Count     : 243
     13## Last Modified On : Tue May 26 14:03:18 2020
     14## Update Count     : 244
    1515###############################################################################
    1616
     
    4141headers_nosrc = bitmanip.hfa math.hfa gmp.hfa time_t.hfa clock.hfa \
    4242                bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa containers/list.hfa
    43 headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
     43headers = common.hfa fstream.hfa heap.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa \
    4444                containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/stackLockFree.hfa containers/vector.hfa
    4545
  • libcfa/src/concurrency/coroutine.cfa

    rc19bc90 rada0246d  
    1010// Created On       : Mon Nov 28 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  4 12:29:25 2020
    13 // Update Count     : 16
     12// Last Modified On : Tue May 26 22:06:09 2020
     13// Update Count     : 21
    1414//
    1515
     
    1818#include "coroutine.hfa"
    1919
    20 extern "C" {
    2120#include <stddef.h>
    2221#include <malloc.h>
     
    2423#include <string.h>
    2524#include <unistd.h>
    26 // use this define to make unwind.h play nice, definetely a hack
     25#include <sys/mman.h>                                                                   // mprotect
     26extern "C" {
     27// use this define to make unwind.h play nice, definitely a hack
    2728#define HIDE_EXPORTS
    2829#include <unwind.h>
    2930#undef HIDE_EXPORTS
    30 #include <sys/mman.h>
    3131}
    3232
  • libcfa/src/concurrency/kernel.cfa

    rc19bc90 rada0246d  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  4 13:03:15 2020
    13 // Update Count     : 58
     12// Last Modified On : Tue May 26 22:05:19 2020
     13// Update Count     : 59
    1414//
    1515
     
    2121#include <errno.h>
    2222#include <string.h>
    23 extern "C" {
    2423#include <stdio.h>
    2524#include <fenv.h>
    26 #include <sys/resource.h>
    2725#include <signal.h>
    2826#include <unistd.h>
    2927#include <limits.h>                                                                             // PTHREAD_STACK_MIN
    3028#include <sys/mman.h>                                                                   // mprotect
     29extern "C" {
     30#include <sys/resource.h>
    3131}
    3232
  • libcfa/src/heap.cfa

    rc19bc90 rada0246d  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 17 20:58:17 2020
    13 // Update Count     : 762
     12// Last Modified On : Wed May 27 15:08:49 2020
     13// Update Count     : 770
    1414//
    1515
     
    2020#include <string.h>                                                                             // memset, memcpy
    2121#include <limits.h>                                                                             // ULONG_MAX
    22 extern "C" {
     22#include <malloc.h>                                                                             // memalign, malloc_usable_size
    2323#include <sys/mman.h>                                                                   // mmap, munmap
    24 } // extern "C"
    2524
    2625#include "bits/align.hfa"                                                               // libPow2
     
    2928#include "startup.hfa"                                                                  // STARTUP_PRIORITY_MEMORY
    3029//#include "stdlib.hfa"                                                                 // bsearchl
    31 #include "malloc.h"
    3230#include "bitmanip.hfa"                                                                 // ceiling
    3331
  • libcfa/src/stdhdr/malloc.h

    rc19bc90 rada0246d  
    1010// Created On       : Thu Jul 20 15:58:16 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 16 22:44:06 2020
    13 // Update Count     : 13
     12// Last Modified On : Wed May 27 14:13:14 2020
     13// Update Count     : 18
    1414//
    15 
    16 
    17 size_t default_mmap_start();                                                    // CFA extras
    18 size_t default_heap_expansion();
    19 
    20 bool traceHeap();
    21 bool traceHeapOn();
    22 bool traceHeapOff();
    23 
    24 bool traceHeapTerm();
    25 bool traceHeapTermOn();
    26 bool traceHeapTermOff();
    27 
    28 bool checkFree();
    29 bool checkFreeOn();
    30 bool checkFreeOff();
    31 
    32 extern "C" {
    33 void * aalloc( size_t noOfElems, size_t elemSize );
    34 void * amemalign( size_t alignment, size_t noOfElems, size_t elemSize );
    35 void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize );
    36 size_t malloc_alignment( void * );
    37 bool malloc_zero_fill( void * );
    38 size_t malloc_size( void * );
    39 int malloc_stats_fd( int fd );
    40 } // extern "C"
    4115
    4216extern "C" {
    4317#include_next <malloc.h>                                                                // has internal check for multiple expansion
    4418} // extern "C"
     19
     20#include <heap.hfa>
    4521
    4622// Local Variables: //
  • libcfa/src/stdlib.hfa

    rc19bc90 rada0246d  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 13 17:23:51 2020
    13 // Update Count     : 435
     12// Last Modified On : Tue May 26 22:50:08 2020
     13// Update Count     : 439
    1414//
    1515
     
    1919#include "bits/align.hfa"
    2020
     21#include <malloc.h>
    2122#include <stdlib.h>                                                                             // *alloc, strto*, ato*
    2223
    2324// Reduce includes by explicitly defining these routines.
    2425extern "C" {
    25         void * aalloc( size_t dim, size_t elemSize );           // CFA heap
    26         void * resize( void * oaddr, size_t size );                     // CFA heap
    27         void * memalign( size_t align, size_t size );           // malloc.h
    28         void * amemalign( size_t align, size_t dim, size_t elemSize ); // CFA heap
    29         void * cmemalign( size_t align, size_t noOfElems, size_t elemSize ); // CFA heap
    30         size_t malloc_size( void * addr );                                      // CFA heap
    31         size_t malloc_usable_size( void * ptr );                        // malloc.h
    3226        void * memset( void * dest, int fill, size_t size ); // string.h
    3327        void * memcpy( void * dest, const void * src, size_t size ); // string.h
    3428} // extern "C"
    35 
    36 void * resize( void * oaddr, size_t nalign, size_t size ); // CFA heap
    37 void * realloc( void * oaddr, size_t nalign, size_t size ); // CFA heap
    3829
    3930//---------------------------------------
     
    9182                return posix_memalign( (void **)ptr, align, sizeof(T) ); // C posix_memalign
    9283        } // posix_memalign
     84
     85        T * valloc( void ) {
     86                return (T *)valloc( sizeof(T) );                                // C valloc
     87        } // valloc
     88
     89        T * pvalloc( void ) {
     90                return (T *)pvalloc( sizeof(T) );                               // C pvalloc
     91        } // pvalloc
    9392} // distribution
    9493
Note: See TracChangeset for help on using the changeset viewer.