Compare commits

...

16 Commits

Author SHA1 Message Date
Jarred Sumner
c9f48f08e0 Update BuildMimalloc.cmake 2025-08-07 15:20:52 -07:00
Jarred Sumner
6d37d4a430 Update BuildMimalloc.cmake 2025-08-07 15:20:43 -07:00
Jarred Sumner
92cb47539a Merge branch 'jarred/reduce-stack' into claude/reduce-stack-size 2025-08-07 15:14:46 -07:00
Jarred Sumner
f8dab03037 Merge branch 'main' into claude/reduce-stack-size 2025-08-07 15:14:38 -07:00
Jarred Sumner
05ef68f0f1 embiggen 2025-08-07 03:26:59 -07:00
Jarred Sumner
80ee48346e Redcue parseProperty stack utilization 2025-08-07 03:18:04 -07:00
Jarred Sumner
031a9ed9cb oopsies 2025-08-07 02:34:23 -07:00
autofix-ci[bot]
d9b874a1ba [autofix.ci] apply automated fixes 2025-08-07 08:52:19 +00:00
Jarred Sumner
28623dd2f7 Split up parseprefix 2025-08-07 01:49:58 -07:00
Jarred Sumner
a4afe3c878 Update parse.zig 2025-08-07 00:46:26 -07:00
Jarred Sumner
c6a5eabd6a Update parseSuffix.zig 2025-08-07 00:02:58 -07:00
Jarred Sumner
378fea9524 Split up parseStmt and don't inline parseExprCommon 2025-08-06 23:58:07 -07:00
Jarred Sumner
dec6b23879 Update visitExpr.zig 2025-08-06 22:43:57 -07:00
autofix-ci[bot]
cacf66dd32 [autofix.ci] apply automated fixes 2025-08-07 05:41:20 +00:00
Jarred Sumner
f9d3ed55f4 try 2025-08-06 22:24:19 -07:00
Claude Bot
d9a6d5006a Reduce stack size from 18MB to 8MB on Windows and macOS
Changed stack size from 0x1200000 (18MB) to 0x800000 (8MB) for both Windows (/STACK) and macOS (-Wl,-stack_size) linker options to reduce memory usage per thread.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-05 21:40:46 +00:00
12 changed files with 6474 additions and 3124 deletions

View File

@@ -950,7 +950,7 @@ endif()
if(WIN32)
target_link_options(${bun} PUBLIC
/STACK:0x1200000,0x200000
/STACK:0x800000,0x200000
/errorlimit:0
)
if(RELEASE)
@@ -976,7 +976,7 @@ if(APPLE)
target_link_options(${bun} PUBLIC
-Wl,-ld_new
-Wl,-no_compact_unwind
-Wl,-stack_size,0x1200000
-Wl,-stack_size,0x800000
-fno-keep-static-consts
-Wl,-map,${bun}.linker-map
)

View File

@@ -4,7 +4,7 @@ register_repository(
REPOSITORY
oven-sh/mimalloc
COMMIT
1cef3e8f4167733818f1883b2f3a9dd4754224cf
f89e039be029cf9733b2d2162916f93b8b9f89c6
)
set(MIMALLOC_CMAKE_ARGS
@@ -48,7 +48,7 @@ elseif(APPLE OR LINUX)
# Enable static override when ASAN is not enabled
list(APPEND MIMALLOC_CMAKE_ARGS -DMI_OVERRIDE=ON)
if(APPLE)
list(APPEND MIMALLOC_CMAKE_ARGS -DMI_OSX_ZONE=ON)
list(APPEND MIMALLOC_CMAKE_ARGS -DMI_OSX_ZONE=OFF)
list(APPEND MIMALLOC_CMAKE_ARGS -DMI_OSX_INTERPOSE=ON)
else()
list(APPEND MIMALLOC_CMAKE_ARGS -DMI_OSX_ZONE=OFF)

View File

@@ -1070,7 +1070,7 @@ pub fn NewParser_(
}
}
pub fn keyNameForError(noalias p: *P, key: js_ast.Expr) string {
pub fn keyNameForError(noalias p: *P, key: *const js_ast.Expr) string {
switch (key.data) {
.e_string => {
return key.data.e_string.string(p.allocator) catch unreachable;

View File

@@ -26,25 +26,27 @@ pub fn Parse(
pub const parseTypeScriptImportEqualsStmt = @import("./parseTypescript.zig").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypeScriptImportEqualsStmt;
pub const parseTypescriptEnumStmt = @import("./parseTypescript.zig").ParseTypescript(parser_feature__typescript, parser_feature__jsx, parser_feature__scan_only).parseTypescriptEnumStmt;
pub inline fn parseExprOrBindings(p: *P, level: Level, errors: ?*DeferredErrors) anyerror!Expr {
return try p.parseExprCommon(level, errors, Expr.EFlags.none);
pub inline fn parseExprOrBindings(p: *P, level: Level, errors: ?*DeferredErrors, expr: *Expr) anyerror!void {
return p.parseExprCommon(level, errors, Expr.EFlags.none, expr);
}
pub inline fn parseExpr(p: *P, level: Level) anyerror!Expr {
return try p.parseExprCommon(level, null, Expr.EFlags.none);
var expr: Expr = undefined;
try p.parseExprCommon(level, null, Expr.EFlags.none, &expr);
return expr;
}
pub inline fn parseExprWithFlags(p: *P, level: Level, flags: Expr.EFlags) anyerror!Expr {
return try p.parseExprCommon(level, null, flags);
pub inline fn parseExprWithFlags(p: *P, level: Level, flags: Expr.EFlags, expr: *Expr) anyerror!void {
return p.parseExprCommon(level, null, flags, expr);
}
pub fn parseExprCommon(p: *P, level: Level, errors: ?*DeferredErrors, flags: Expr.EFlags) anyerror!Expr {
pub fn parseExprCommon(p: *P, level: Level, errors: ?*DeferredErrors, flags: Expr.EFlags, expr: *Expr) anyerror!void {
if (!p.stack_check.isSafeToRecurse()) {
try bun.throwStackOverflow();
}
const had_pure_comment_before = p.lexer.has_pure_comment_before and !p.options.ignore_dce_annotations;
var expr = try p.parsePrefix(level, errors, flags);
expr.* = try p.parsePrefix(level, errors, flags);
// There is no formal spec for "__PURE__" comments but from reverse-
// engineering, it looks like they apply to the next CallExpression or
@@ -52,7 +54,7 @@ pub fn Parse(
// to the expression "a().b()".
if (had_pure_comment_before and level.lt(.call)) {
expr = try p.parseSuffix(expr, @as(Level, @enumFromInt(@intFromEnum(Level.call) - 1)), errors, flags);
try p.parseSuffix(expr, @as(Level, @enumFromInt(@intFromEnum(Level.call) - 1)), errors, flags);
switch (expr.data) {
.e_call => |ex| {
ex.can_be_unwrapped_if_unused = .if_unused;
@@ -64,7 +66,7 @@ pub fn Parse(
}
}
return try p.parseSuffix(expr, level, errors, flags);
try p.parseSuffix(expr, level, errors, flags);
}
pub fn parseYieldExpr(p: *P, loc: logger.Loc) !ExprNodeIndex {
@@ -343,10 +345,13 @@ pub fn Parse(
// We don't know yet whether these are arguments or expressions, so parse
p.latest_arrow_arg_loc = p.lexer.loc();
var item = try p.parseExprOrBindings(.comma, &errors);
try items_list.ensureUnusedCapacity(1);
const item: *Expr = &items_list.unusedCapacitySlice()[0];
try p.parseExprOrBindings(.comma, &errors, item);
items_list.items.len += 1;
if (is_spread) {
item = p.newExpr(E.Spread{ .value = item }, loc);
item.* = p.newExpr(E.Spread{ .value = item.* }, loc);
}
// Skip over types
@@ -359,11 +364,9 @@ pub fn Parse(
// There may be a "=" after the type (but not after an "as" cast)
if (is_typescript_enabled and p.lexer.token == .t_equals and !p.forbid_suffix_after_as_loc.eql(p.lexer.loc())) {
try p.lexer.next();
item = Expr.assign(item, try p.parseExpr(.comma));
item.* = Expr.assign(item.*, try p.parseExpr(.comma));
}
items_list.append(item) catch unreachable;
if (p.lexer.token != .t_comma) {
break;
}
@@ -675,7 +678,7 @@ pub fn Parse(
try p.lexer.next();
const raw2 = p.lexer.raw();
const value = if (p.lexer.token == .t_identifier and strings.eqlComptime(raw2, "using")) value: {
var value = if (p.lexer.token == .t_identifier and strings.eqlComptime(raw2, "using")) value: {
// const using_loc = p.saveExprCommentsHere();
const using_range = p.lexer.range();
try p.lexer.next();
@@ -711,13 +714,15 @@ pub fn Parse(
if (p.lexer.token == .t_asterisk_asterisk) {
try p.lexer.unexpected();
}
const expr = p.newExpr(
E.Await{ .value = try p.parseSuffix(value, .prefix, null, .none) },
try p.parseSuffix(&value, .prefix, null, .none);
var expr = p.newExpr(
E.Await{ .value = value },
token_range.loc,
);
try p.parseSuffix(&expr, .lowest, null, .none);
return ExprOrLetStmt{
.stmt_or_expr = js_ast.StmtOrExpr{
.expr = try p.parseSuffix(expr, .lowest, null, .none),
.expr = expr,
},
};
} else {
@@ -730,12 +735,13 @@ pub fn Parse(
// Parse the remainder of this expression that starts with an identifier
const ref = try p.storeNameInRef(raw);
const expr = p.newExpr(E.Identifier{ .ref = ref }, token_range.loc);
return ExprOrLetStmt{
var result = ExprOrLetStmt{
.stmt_or_expr = js_ast.StmtOrExpr{
.expr = try p.parseSuffix(expr, .lowest, null, .none),
.expr = p.newExpr(E.Identifier{ .ref = ref }, token_range.loc),
},
};
try p.parseSuffix(&result.stmt_or_expr.expr, .lowest, null, .none);
return result;
}
pub fn parseBinding(p: *P, comptime opts: ParseBindingOptions) anyerror!Binding {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,9 @@ pub fn ParseTypescript(
// }
//
// This matches the behavior of the TypeScript compiler.
try decorators.append(try p.parseExprWithFlags(.new, Expr.EFlags.ts_decorator));
try decorators.ensureUnusedCapacity(1);
try p.parseExprWithFlags(.new, Expr.EFlags.ts_decorator, &decorators.unusedCapacitySlice()[0]);
decorators.items.len += 1;
}
return decorators.items;

View File

@@ -25,15 +25,12 @@ pub fn VisitExpr(
p.log.addError(p.source, expr.loc, "Invalid assignment target") catch unreachable;
}
// Output.print("\nVisit: {s} - {d}\n", .{ @tagName(expr.data), expr.loc.start });
switch (@as(Expr.Tag, expr.data)) {
inline else => |tag| {
if (@hasDecl(visitors, @tagName(tag))) {
return @field(visitors, @tagName(tag))(p, expr, in);
}
return expr;
},
}
return switch (@as(Expr.Tag, expr.data)) {
inline else => |tag| if (comptime @hasDecl(visitors, @tagName(tag)))
@field(visitors, @tagName(tag))(p, expr, in)
else
expr,
};
}
const visitors = struct {

View File

@@ -1034,7 +1034,7 @@ pub const FetchTasklet = struct {
pub fn get(
allocator: std.mem.Allocator,
globalThis: *jsc.JSGlobalObject,
fetch_options: FetchOptions,
fetch_options: *const FetchOptions,
promise: jsc.JSPromise.Strong,
) !*FetchTasklet {
var jsc_vm = globalThis.bunVM();
@@ -1270,7 +1270,7 @@ pub const FetchTasklet = struct {
pub fn queue(
allocator: std.mem.Allocator,
global: *JSGlobalObject,
fetch_options: FetchOptions,
fetch_options: *const FetchOptions,
promise: jsc.JSPromise.Strong,
) !*FetchTasklet {
http.HTTPThread.init(&.{});
@@ -2625,7 +2625,7 @@ pub fn Bun__fetch_(
_ = FetchTasklet.queue(
allocator,
globalThis,
.{
&.{
.method = method,
.url = url,
.headers = headers orelse Headers{

File diff suppressed because it is too large Load Diff