Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion scripts/verify-baseline-static/allowlist-x64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,11 @@ jsimd_ycc_rgb_convert_avx2.return [AVX, AVX2]
# single-digit hit here is decode noise. Ceiling [AVX] so a multi-feature leak
# still fails. On ELF each opcode handler has its own symbol, so layout shifts
# can move the desync between llint_op_* siblings; add them here as they trip.
# (2 symbols)
# llint_op_jmp_wide32 decoded a stray RDPMC (0F 33) out of the same garbage.
# That is not a SIMD feature and the bytes move with layout, so it is a blanket
# pass; a real -march leak would show up in the other llint_op_* symbols.
# (3 symbols)
# ----------------------------------------------------------------------------
llint_op_enter_wide32 [AVX]
llint_op_wide16_wide16 [AVX]
llint_op_jmp_wide32
9 changes: 3 additions & 6 deletions src/js_parser_jsc/Macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ use bun_jsc::{
};
use bun_jsc::{BuildMessage, ResolveMessage};

bun_core::declare_scope!(macros, visible);
Comment thread
robobun marked this conversation as resolved.

const NAMESPACE_WITH_COLON: &[u8] = b"macro:";

fn is_macro_path(str: &[u8]) -> bool {
Expand Down Expand Up @@ -899,12 +901,7 @@ impl Runner {
id: i32,
javascript_object: JSValue,
) -> Result<Expr, MacroError> {
if bun_core::env::IS_DEBUG {
bun_core::prettyln!(
"<r><d>[macro]<r> call <d><b>{}<r>",
bstr::BStr::new(function_name)
);
}
bun_core::scoped_log!(macros, "call <b>{}<r>", bstr::BStr::new(function_name));

// The exception holder is never read in this body (legacy from an earlier
// exception-reporting path); a thread-local sentinel suffices.
Expand Down
16 changes: 6 additions & 10 deletions test/bundler/transpiler/macro-test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ test("object argument with a sparse numeric key", async () => {
});
const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
// One combined assertion so stderr (where JSC prints the exception check failure) shows up in
// the diff if the child aborts. Debug builds print "[macro] call take" to stdout before the
// script's own output, so only the tail of stdout is matched.
expect({ stdout, stderr, exitCode, signalCode: proc.signalCode }).toMatchObject({
stdout: expect.stringMatching(/200000\n$/),
// the diff if the child aborts.
expect({ stdout, stderr, exitCode, signalCode: proc.signalCode }).toEqual({
stdout: "200000\n",
stderr: "",
exitCode: 0,
signalCode: null,
});
Expand All @@ -178,7 +178,7 @@ test("object destructuring of a macro result keeps every bound property regardle
stderr: "pipe",
});
const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
expect({ lastLine: stdout.trim().split("\n").pop(), stderr }).toEqual({ lastLine: "[2,1,1,1,2]", stderr: "" });
expect({ stdout, stderr }).toEqual({ stdout: "[2,1,1,1,2]\n", stderr: "" });
expect(exitCode).toBe(0);
});

Expand All @@ -199,11 +199,7 @@ describe("event loop routing around macros", () => {
stderr: "pipe",
});
const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
// Debug builds also print "[macro] call <name>" to stdout.
const lines = stdout
.trim()
.split("\n")
.filter(line => !line.startsWith("[macro]"));
const lines = stdout.trim().split("\n");
return { lines, stderr, exitCode };
}

Expand Down
3 changes: 1 addition & 2 deletions test/regression/issue/39900.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test.concurrent("macro that awaits crypto.subtle.digest resolves under bun run",
});
const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
expect(stderr).toBe("");
// A debug build also logs "[macro] call sha" to stdout.
expect(stdout).toContain(`${expected}\n`);
expect(stdout).toBe(`${expected}\n`);
expect(exitCode).toBe(0);
});

Expand Down
Loading