File tree Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ add_custom_target(generated ALL
180180add_library (redirect_small STATIC src/redirect/redirect.cc)
181181target_link_libraries (redirect_small snmalloc_lib)
182182target_include_directories (redirect_small PRIVATE ${CMAKE_CURRENT_BINARY_DIR} )
183-
183+ add_dependencies (redirect_small generated )
184184
185185# To build with just the header library target define SNMALLOC_ONLY_HEADER_LIBRARY
186186# in containing Cmake file.
Original file line number Diff line number Diff line change @@ -15,19 +15,23 @@ int main(int argc, char* argv[])
1515 ofstream outfile;
1616 outfile.open (argv[1 ]);
1717
18- for (size_t size = 1024 ; size > 0 ; size -= 16 )
18+ for (size_t align = 0 ; align < 10 ; align++ )
1919 {
20- auto sizeclass = snmalloc::size_to_sizeclass (size);
21- auto rsize = snmalloc::sizeclass_to_size (sizeclass);
22- if (rsize == size)
20+ for (size_t size = 1024 ; size > 0 ; size -= 16 )
2321 {
24- outfile << " DEFINE_MALLOC_SIZE(malloc_size_" << size << " , " << size
25- << " );" << std::endl;
26- }
27- else
28- {
29- outfile << " REDIRECT_MALLOC_SIZE(malloc_size_" << size << " , malloc_size_"
30- << rsize << " );" << std::endl;
22+ auto asize = snmalloc::aligned_size (1ULL << align, size);
23+ auto sizeclass = snmalloc::size_to_sizeclass (asize);
24+ auto rsize = snmalloc::sizeclass_to_size (sizeclass);
25+ if (rsize == size && align == 0 )
26+ {
27+ outfile << " DEFINE_MALLOC_SIZE(malloc_size_" << size << " _" << align << " , " << size
28+ << " );" << std::endl;
29+ }
30+ else
31+ {
32+ outfile << " REDIRECT_MALLOC_SIZE(malloc_size_" << size << " _" << align << " , malloc_size_"
33+ << rsize << " _" << 0 << " );" << std::endl;
34+ }
3135 }
3236 }
3337
Original file line number Diff line number Diff line change 1414 __attribute__ ((alias(#b))) extern "C" void* a()
1515#endif
1616
17- #define DEFINE_MALLOC_SIZE (a , s ) \
18- extern " C" void * a () \
17+ #define DEFINE_MALLOC_SIZE (name , s ) \
18+ extern " C" void * name () \
1919 { \
2020 return snmalloc::ThreadAlloc::get_noncachable ()->template alloc <s>(); \
2121 }
You can’t perform that action at this time.
0 commit comments