mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 14:41:42 +03:00
Restore tail call optimization subversion.
Restore the essence of 898960247a, which
sabotages tail call optimization. This is necessary even when the
mutually recursive functions are in separate compilation units.
This commit is contained in:
parent
940fdfd5ee
commit
b037a55f36
1 changed files with 13 additions and 7 deletions
|
|
@ -14,16 +14,22 @@ alloc_n_proto(1)
|
|||
void * \
|
||||
alloc_##n(unsigned bits) \
|
||||
{ \
|
||||
void *p; \
|
||||
\
|
||||
if (bits == 0) { \
|
||||
void *p = mallocx(1, 0); \
|
||||
assert_ptr_not_null(p, "Unexpected mallocx() failure"); \
|
||||
return (p); \
|
||||
} else { \
|
||||
if (bits == 0) \
|
||||
p = mallocx(1, 0); \
|
||||
else { \
|
||||
switch (bits & 0x1U) { \
|
||||
case 0: return (alloc_0(bits >> 1)); \
|
||||
case 1: return (alloc_1(bits >> 1)); \
|
||||
case 0: \
|
||||
p = (alloc_0(bits >> 1)); \
|
||||
break; \
|
||||
case 1: \
|
||||
p = (alloc_1(bits >> 1)); \
|
||||
break; \
|
||||
default: not_reached(); \
|
||||
} \
|
||||
} \
|
||||
/* Intentionally sabotage tail call optimization. */ \
|
||||
assert_ptr_not_null(p, "Unexpected mallocx() failure"); \
|
||||
return (p); \
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue