Skip to content

Commit 465ff74

Browse files
committed
jitlayers: reduce excess alignment of #52182 (#52210)
(cherry picked from commit 72cd63c)
1 parent 332d9f3 commit 465ff74

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/jitlayers.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,9 @@ class MaxAlignedAllocImpl
312312
// the returned pointer, this is >= alignof(std::max_align_t), which is too
313313
// small often to actually use.
314314
const size_t MaxAlignment = JL_CACHE_BYTE_ALIGNMENT;
315-
return Align(std::min((size_t)llvm::PowerOf2Ceil(Size), MaxAlignment));
315+
if (Size <= offset)
316+
return Align(1);
317+
return Align(std::min((size_t)llvm::PowerOf2Ceil(Size - offset), MaxAlignment));
316318
}
317319

318320
LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size, Align Alignment) {

0 commit comments

Comments
 (0)