From cfe3d04299be2436d515f9c448db3e461f40228a Mon Sep 17 00:00:00 2001 From: Daan Leijen Date: Wed, 15 Mar 2023 19:15:53 -0700 Subject: [PATCH] cleanup --- src/bitmap.h | 2 +- src/prim/prim.h | 14 +++++++------- src/static.c | 21 +++++++++++---------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/bitmap.h b/src/bitmap.h index 39ca55b2..435c5f0a 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- -Copyright (c) 2019-2020 Microsoft Research, Daan Leijen +Copyright (c) 2019-2023 Microsoft Research, Daan Leijen This is free software; you can redistribute it and/or modify it under the terms of the MIT license. A copy of the license can be found in the file "LICENSE" at the root of this distribution. diff --git a/src/prim/prim.h b/src/prim/prim.h index 5ed0f2e0..5a58a79f 100644 --- a/src/prim/prim.h +++ b/src/prim/prim.h @@ -22,10 +22,10 @@ typedef struct mi_os_mem_config_s { } mi_os_mem_config_t; // Initialize -void _mi_prim_mem_init( mi_os_mem_config_t* config ); +void _mi_prim_mem_init( mi_os_mem_config_t* config ); // Free OS memory -void _mi_prim_free(void* addr, size_t size ); +void _mi_prim_free(void* addr, size_t size ); // Allocate OS memory. Return NULL on error. // The `try_alignment` is just a hint and the returned pointer does not have to be aligned. @@ -34,14 +34,14 @@ void _mi_prim_free(void* addr, size_t size ); void* _mi_prim_alloc(size_t size, size_t try_alignment, bool commit, bool allow_large, bool* is_large); // Commit memory. Returns error code or 0 on success. -int _mi_prim_commit(void* addr, size_t size, bool commit); +int _mi_prim_commit(void* addr, size_t size, bool commit); // Reset memory. The range keeps being accessible but the content might be reset. // Returns error code or 0 on success. -int _mi_prim_reset(void* addr, size_t size); +int _mi_prim_reset(void* addr, size_t size); // Protect memory. Returns error code or 0 on success. -int _mi_prim_protect(void* addr, size_t size, bool protect); +int _mi_prim_protect(void* addr, size_t size, bool protect); // Allocate huge (1GiB) pages possibly associated with a NUMA node. // pre: size > 0 and a multiple of 1GiB. @@ -59,13 +59,13 @@ size_t _mi_prim_numa_node_count(void); mi_msecs_t _mi_prim_clock_now(void); // Return process information (only for statistics) -void _mi_prim_process_info(mi_msecs_t* utime, mi_msecs_t* stime, +void _mi_prim_process_info(mi_msecs_t* utime, mi_msecs_t* stime, size_t* current_rss, size_t* peak_rss, size_t* current_commit, size_t* peak_commit, size_t* page_faults); // Default stderr output. (only for warnings etc. with verbose enabled) // msg != NULL && _mi_strlen(msg) > 0 -void _mi_prim_out_stderr( const char* msg ); +void _mi_prim_out_stderr( const char* msg ); // Get an environment variable. (only for options) // name != NULL, result != NULL, result_size >= 64 diff --git a/src/static.c b/src/static.c index 4b3abc28..0de72fe3 100644 --- a/src/static.c +++ b/src/static.c @@ -20,20 +20,21 @@ terms of the MIT license. A copy of the license can be found in the file // containing the whole library. If it is linked first // it will override all the standard library allocation // functions (on Unix's). -#include "stats.c" -#include "random.c" -#include "os.c" -#include "bitmap.c" -#include "arena.c" -#include "region.c" -#include "segment.c" -#include "page.c" -#include "heap.c" #include "alloc.c" #include "alloc-aligned.c" -#include "alloc-posix.c" #if MI_OSX_ZONE #include "alloc-override-osx.c" #endif +#include "alloc-posix.c" +#include "arena.c" +#include "bitmap.c" +#include "heap.c" #include "init.c" #include "options.c" +#include "os.c" +#include "page.c" +#include "prim/prim.c" +#include "random.c" +#include "region.c" +#include "segment.c" +#include "stats.c"