codegen: add a 'size' argument to ALU_WRITES_FLAGS
[ajla.git] / amalloc.h
blobdf633cedd468355c17dce3ba0e51bbd46d92e427
1 /*
2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
9 * version.
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
19 #ifndef AJLA_AMALLOC_H
20 #define AJLA_AMALLOC_H
22 #ifdef USE_AMALLOC
24 void * attr_fastcall amalloc(size_t size);
25 void * attr_fastcall acalloc(size_t size);
26 void * attr_fastcall amemalign(size_t al, size_t size);
27 void * attr_fastcall acmemalign(size_t al, size_t size);
28 void attr_fastcall afree(void *ptr);
29 void * attr_fastcall arealloc(void *ptr, size_t size);
30 bool attr_fastcall aptr_is_huge(void *ptr);
32 #ifdef POINTER_COMPRESSION_POSSIBLE
33 bool amalloc_ptrcomp_try_reserve_range(void *ptr, size_t length);
34 #endif
35 void *amalloc_run_alloc(size_t al, size_t length, bool clr, bool saved);
36 void amalloc_run_free(void *ptr, size_t length);
38 void amalloc_init(void);
39 void amalloc_init_multithreaded(void);
40 void amalloc_done_multithreaded(void);
41 void amalloc_done(void);
43 #else
45 static inline void * attr_fastcall amalloc(size_t attr_unused size) { return NULL; }
46 static inline void * attr_fastcall acalloc(size_t attr_unused size) { return NULL; }
47 static inline void * attr_fastcall amemalign(size_t attr_unused al, size_t attr_unused size) { return NULL; }
48 static inline void * attr_fastcall acmemalign(size_t attr_unused al, size_t attr_unused size) { return NULL; }
49 static inline void attr_fastcall afree(void attr_unused *ptr) { }
50 static inline void * attr_fastcall arealloc(void attr_unused *ptr, size_t attr_unused size) { return NULL; }
51 static inline bool attr_fastcall aptr_is_huge(void attr_unused *ptr) { return false; }
53 #define amalloc_init() do { } while(0)
54 #define amalloc_init_multithreaded() do { } while(0)
55 #define amalloc_done_multithreaded() do { } while(0)
56 #define amalloc_done() do { } while(0)
58 #endif
60 #endif