/src/mozilla-central/memory/build/fallback.cpp
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "mozmemory.h" |
8 | | #include "mozjemalloc.h" |
9 | | #include <stdlib.h> |
10 | | |
11 | | #ifndef HAVE_MEMALIGN |
12 | | MOZ_MEMORY_API void* |
13 | | memalign(size_t aAlignment, size_t aSize) |
14 | | { |
15 | | #ifdef XP_WIN |
16 | | return _aligned_malloc(aSize, aAlignment); |
17 | | #else |
18 | | void* ret; |
19 | | if (posix_memalign(&ret, aAlignment, aSize) != 0) { |
20 | | return nullptr; |
21 | | } |
22 | | return ret; |
23 | | #endif |
24 | | } |
25 | | #endif |
26 | | |
27 | | struct SystemMalloc |
28 | | { |
29 | | #define MALLOC_DECL(name, return_type, ...) \ |
30 | | static inline return_type name(ARGS_HELPER(TYPED_ARGS, ##__VA_ARGS__)) \ |
31 | 4.88M | { \ |
32 | 4.88M | return ::name(ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ |
33 | 4.88M | } SystemMalloc::malloc(unsigned long) Line | Count | Source | 31 | 4.88M | { \ | 32 | 4.88M | return ::name(ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ | 33 | 4.88M | } |
SystemMalloc::calloc(unsigned long, unsigned long) Line | Count | Source | 31 | 1.55k | { \ | 32 | 1.55k | return ::name(ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ | 33 | 1.55k | } |
SystemMalloc::realloc(void*, unsigned long) Line | Count | Source | 31 | 2.78k | { \ | 32 | 2.78k | return ::name(ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ | 33 | 2.78k | } |
Unexecuted instantiation: SystemMalloc::free(void*) Unexecuted instantiation: SystemMalloc::memalign(unsigned long, unsigned long) |
34 | | #define MALLOC_FUNCS MALLOC_FUNCS_MALLOC_BASE |
35 | | #include "malloc_decls.h" |
36 | | }; |
37 | | |
38 | | #define MALLOC_DECL(name, return_type, ...) \ |
39 | | MOZ_JEMALLOC_API return_type name(ARGS_HELPER(TYPED_ARGS, ##__VA_ARGS__)) \ |
40 | 4.88M | { \ |
41 | 4.88M | return DummyArenaAllocator<SystemMalloc>::name( \ |
42 | 4.88M | ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ |
43 | 4.88M | } moz_create_arena_with_params Line | Count | Source | 40 | 6 | { \ | 41 | 6 | return DummyArenaAllocator<SystemMalloc>::name( \ | 42 | 6 | ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ | 43 | 6 | } |
Unexecuted instantiation: moz_dispose_arena Line | Count | Source | 40 | 4.88M | { \ | 41 | 4.88M | return DummyArenaAllocator<SystemMalloc>::name( \ | 42 | 4.88M | ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ | 43 | 4.88M | } |
Line | Count | Source | 40 | 1.55k | { \ | 41 | 1.55k | return DummyArenaAllocator<SystemMalloc>::name( \ | 42 | 1.55k | ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ | 43 | 1.55k | } |
Line | Count | Source | 40 | 2.78k | { \ | 41 | 2.78k | return DummyArenaAllocator<SystemMalloc>::name( \ | 42 | 2.78k | ARGS_HELPER(ARGS, ##__VA_ARGS__)); \ | 43 | 2.78k | } |
Unexecuted instantiation: moz_arena_free Unexecuted instantiation: moz_arena_memalign |
44 | | #define MALLOC_FUNCS MALLOC_FUNCS_ARENA |
45 | | #include "malloc_decls.h" |