Skip to content

Commit d48fd1e

Browse files
committed
Change API
1 parent 28c9d09 commit d48fd1e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/redirect/generate.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ int main(int argc, char* argv[])
2424
auto rsize = snmalloc::sizeclass_to_size(sizeclass);
2525
if (rsize == size && align == 0)
2626
{
27-
outfile << "DEFINE_MALLOC_SIZE(malloc_size_" << size << "_" << align << ", " << size
27+
outfile << "DEFINE_MALLOC_SIZE(__stack_alloc_small_" << size << "_" << align << ", " << size
2828
<< ");" << std::endl;
2929
}
3030
else
3131
{
32-
outfile << "REDIRECT_MALLOC_SIZE(malloc_size_" << size << "_" << align << ", malloc_size_"
32+
outfile << "REDIRECT_MALLOC_SIZE(__stack_alloc_small_" << size << "_" << align << ", __stack_alloc_small_"
3333
<< rsize << "_" << 0 << ");" << std::endl;
3434
}
35+
outfile << "GENERATE_FREE_SIZE(__stack_free_small_" << size << "_" << align << ");" << std::endl;
36+
3537
}
3638
}
3739

src/redirect/redirect.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@
2020
return snmalloc::ThreadAlloc::get_noncachable()->template alloc<s>(); \
2121
}
2222

23+
extern "C" void free_local_small(void* ptr)
24+
{
25+
if (snmalloc::Alloc::small_local_dealloc(ptr))
26+
return;
27+
snmalloc::ThreadAlloc::get_noncachable()->small_local_dealloc_slow(ptr);
28+
}
29+
30+
# define GENERATE_FREE_SIZE(a) \
31+
__attribute__((alias("free_local_small"))) extern "C" void* a()
32+
2333
#include "generated.cc"

0 commit comments

Comments
 (0)