aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/feature_flags.zig2
-rw-r--r--src/memory_allocator.zig4
-rw-r--r--src/mimalloc_arena.zig4
3 files changed, 10 insertions, 0 deletions
diff --git a/src/feature_flags.zig b/src/feature_flags.zig
index c7a2f4819..dbc7914ea 100644
--- a/src/feature_flags.zig
+++ b/src/feature_flags.zig
@@ -166,3 +166,5 @@ pub const boundary_based_chunking = true;
/// https://github.com/mitsuhiko/source-map-rfc/blob/proposals/debug-id/proposals/debug-id.md
/// https://github.com/source-map/source-map-rfc/pull/20
pub const source_map_debug_id = true;
+
+pub const alignment_tweak = true;
diff --git a/src/memory_allocator.zig b/src/memory_allocator.zig
index 0362f39c0..391446f5e 100644
--- a/src/memory_allocator.zig
+++ b/src/memory_allocator.zig
@@ -79,6 +79,10 @@ const CAllocator = struct {
}
fn alloc(_: *anyopaque, len: usize, log2_align: u8, _: usize) ?[*]u8 {
+ if (comptime FeatureFlags.alignment_tweak) {
+ return alignedAlloc(len, log2_align);
+ }
+
const alignment = @as(usize, 1) << @intCast(Allocator.Log2Align, log2_align);
return alignedAlloc(len, alignment);
}
diff --git a/src/mimalloc_arena.zig b/src/mimalloc_arena.zig
index 23a9f4762..d0d0bbeab 100644
--- a/src/mimalloc_arena.zig
+++ b/src/mimalloc_arena.zig
@@ -230,6 +230,10 @@ pub const Arena = struct {
var this = bun.cast(*mimalloc.Heap, arena);
// if (comptime Environment.allow_assert)
// ArenaRegistry.assert(.{ .heap = this });
+ if (comptime FeatureFlags.alignment_tweak) {
+ return alignedAlloc(this, len, log2_align);
+ }
+
const alignment = @as(usize, 1) << @intCast(Allocator.Log2Align, log2_align);
return alignedAlloc(