Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/mimalloc/src/prim/prim.c
6178 views
1
/* ----------------------------------------------------------------------------
2
Copyright (c) 2018-2023, Microsoft Research, Daan Leijen
3
This is free software; you can redistribute it and/or modify it under the
4
terms of the MIT license. A copy of the license can be found in the file
5
"LICENSE" at the root of this distribution.
6
-----------------------------------------------------------------------------*/
7
8
// Select the implementation of the primitives
9
// depending on the OS.
10
11
#if defined(_WIN32)
12
#include "windows/prim.c" // VirtualAlloc (Windows)
13
14
#elif defined(__APPLE__)
15
#include "osx/prim.c" // macOSX (actually defers to mmap in unix/prim.c)
16
17
#elif defined(__wasi__)
18
#define MI_USE_SBRK
19
#include "wasi/prim.c" // memory-grow or sbrk (Wasm)
20
21
#elif defined(__EMSCRIPTEN__)
22
#include "emscripten/prim.c" // emmalloc_*, + pthread support
23
24
#else
25
#include "unix/prim.c" // mmap() (Linux, macOSX, BSD, Illumnos, Haiku, DragonFly, etc.)
26
27
#endif
28
29