mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Add alignment feature flag
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user