From e23fc6d88cc26a234ef2795d0bea1fd2f7fb8bfa Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Tue, 13 Feb 2024 19:44:37 -0700 Subject: [PATCH] chore: deno_core bump (#22407) - Adding `None` flag for warmup script. - Modify opcall trace interface to match new Rust implementation --- Cargo.lock | 12 ++-- Cargo.toml | 2 +- cli/build.rs | 55 ++++++++++--------- cli/js/40_test.js | 11 ++-- cli/tools/test/fmt.rs | 2 +- runtime/snapshot.rs | 31 ++++++----- .../ops_sanitizer_multiple_timeout_tests.out | 8 +-- 7 files changed, 64 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 89af50a8a4..4e66ba3b89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1226,9 +1226,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.261.0" +version = "0.262.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743b191a1004e4989caf50c4ace8e3208732456118e79d433e2aff246772066" +checksum = "bb0c12fbe4f2c497ff53de92dd698a27d93f8e9c2519ea5684f608cb9f4ef44b" dependencies = [ "anyhow", "bit-set", @@ -1676,9 +1676,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee5973f100f3ff9dea83a5b6261276d233c51ebc7f4c4fcdebd4c0d476b4fe5" +checksum = "04698b09128a026abe3d8a82fdb231baf1a35f07443844728fe1441b2c2340f1" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -5450,9 +5450,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.170.0" +version = "0.171.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43cce12a1cbf76530919847280a975a7831dab85a73d513161a5e6153a8e75d6" +checksum = "88a2746b1f9e4015ee5f325bb87ab0f1891b76c38dfb1675bc83857eaf6451d0" dependencies = [ "bytes", "derive_more", diff --git a/Cargo.toml b/Cargo.toml index d069d1652a..becd0692ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "0.33.2", features = ["transpiling"] } -deno_core = { version = "0.261.0" } +deno_core = { version = "0.262.0" } deno_bench_util = { version = "0.131.0", path = "./bench_util" } deno_lockfile = "0.18.2" diff --git a/cli/build.rs b/cli/build.rs index 5fd6ca4d50..71751fb009 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -266,33 +266,36 @@ mod ts { ) .unwrap(); - let output = create_snapshot(CreateSnapshotOptions { - cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), - snapshot_path, - startup_snapshot: None, - extensions: vec![deno_tsc::init_ops_and_esm( - op_crate_libs, - build_libs, - path_dts, - )], - // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took - // ~45s on M1 MacBook Pro; without compression it took ~1s. - // Thus we're not not using compressed snapshot, trading off - // a lot of build time for some startup time in debug build. - #[cfg(debug_assertions)] - compression_cb: None, + let output = create_snapshot( + CreateSnapshotOptions { + cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), + snapshot_path, + startup_snapshot: None, + extensions: vec![deno_tsc::init_ops_and_esm( + op_crate_libs, + build_libs, + path_dts, + )], + // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took + // ~45s on M1 MacBook Pro; without compression it took ~1s. + // Thus we're not not using compressed snapshot, trading off + // a lot of build time for some startup time in debug build. + #[cfg(debug_assertions)] + compression_cb: None, - #[cfg(not(debug_assertions))] - compression_cb: Some(Box::new(|vec, snapshot_slice| { - eprintln!("Compressing TSC snapshot..."); - vec.extend_from_slice( - &zstd::bulk::compress(snapshot_slice, 22) - .expect("snapshot compression failed"), - ); - })), - with_runtime_cb: None, - skip_op_registration: false, - }); + #[cfg(not(debug_assertions))] + compression_cb: Some(Box::new(|vec, snapshot_slice| { + eprintln!("Compressing TSC snapshot..."); + vec.extend_from_slice( + &zstd::bulk::compress(snapshot_slice, 22) + .expect("snapshot compression failed"), + ); + })), + with_runtime_cb: None, + skip_op_registration: false, + }, + None, + ); for path in output.files_loaded_during_snapshot { println!("cargo:rerun-if-changed={}", path.display()); } diff --git a/cli/js/40_test.js b/cli/js/40_test.js index b9735fc01b..14adb5216a 100644 --- a/cli/js/40_test.js +++ b/cli/js/40_test.js @@ -156,6 +156,7 @@ function populateOpNames() { function assertOps(fn) { /** @param desc {TestDescription | TestStepDescription} */ return async function asyncOpSanitizer(desc) { + let hasTraces = false; if (opNames === null) populateOpNames(); const res = op_test_op_sanitizer_collect( desc.id, @@ -220,8 +221,7 @@ function assertOps(fn) { message += ` This is often caused by not ${hint}.`; } const traces = []; - for (const [id, { opName: traceOpName, stack }] of postTraces) { - if (traceOpName !== opName) continue; + for (const [id, stack] of postTraces) { if (MapPrototypeHas(preTraces, id)) continue; ArrayPrototypePush(traces, stack); } @@ -232,6 +232,7 @@ function assertOps(fn) { message += " The operations were started here:\n"; message += ArrayPrototypeJoin(traces, "\n\n"); } + hasTraces |= traces.length > 0; ArrayPrototypePush(details, message); } else if (diff < 0) { const [name, hint] = op_test_op_sanitizer_get_async_message(opName); @@ -247,8 +248,7 @@ function assertOps(fn) { message += ` This is often caused by not ${hint}.`; } const traces = []; - for (const [id, { opName: traceOpName, stack }] of preTraces) { - if (opName !== traceOpName) continue; + for (const [id, stack] of preTraces) { if (MapPrototypeHas(postTraces, id)) continue; ArrayPrototypePush(traces, stack); } @@ -259,6 +259,7 @@ function assertOps(fn) { message += " The operations were started here:\n"; message += ArrayPrototypeJoin(traces, "\n\n"); } + hasTraces |= traces.length > 0; ArrayPrototypePush(details, message); } else { throw new Error("unreachable"); @@ -266,7 +267,7 @@ function assertOps(fn) { } return { - failed: { leakedOps: [details, core.isOpCallTracingEnabled()] }, + failed: { leakedOps: [details, hasTraces] }, }; }; } diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs index 468b9d8f09..b0b37b5c4f 100644 --- a/cli/tools/test/fmt.rs +++ b/cli/tools/test/fmt.rs @@ -133,7 +133,7 @@ fn format_sanitizer_accum_item( ) -> (RuntimeActivityType, Cow<'static, str>) { let activity_type = activity.activity(); match activity { - RuntimeActivity::AsyncOp(_, name) => (activity_type, name.into()), + RuntimeActivity::AsyncOp(_, name, _) => (activity_type, name.into()), RuntimeActivity::Interval(_) => (activity_type, "".into()), RuntimeActivity::Resource(_, name) => (activity_type, name.into()), RuntimeActivity::Timer(_) => (activity_type, "".into()), diff --git a/runtime/snapshot.rs b/runtime/snapshot.rs index b23b024ee1..f7342ce14f 100644 --- a/runtime/snapshot.rs +++ b/runtime/snapshot.rs @@ -265,21 +265,24 @@ pub fn create_runtime_snapshot( } } - let output = create_snapshot(CreateSnapshotOptions { - cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), - snapshot_path, - startup_snapshot: None, - extensions, - compression_cb: None, - with_runtime_cb: Some(Box::new(|rt| { - let isolate = rt.v8_isolate(); - let scope = &mut v8::HandleScope::new(isolate); + let output = create_snapshot( + CreateSnapshotOptions { + cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), + snapshot_path, + startup_snapshot: None, + extensions, + compression_cb: None, + with_runtime_cb: Some(Box::new(|rt| { + let isolate = rt.v8_isolate(); + let scope = &mut v8::HandleScope::new(isolate); - let ctx = v8::Context::new(scope); - assert_eq!(scope.add_context(ctx), deno_node::VM_CONTEXT_INDEX); - })), - skip_op_registration: false, - }); + let ctx = v8::Context::new(scope); + assert_eq!(scope.add_context(ctx), deno_node::VM_CONTEXT_INDEX); + })), + skip_op_registration: false, + }, + None, + ); for path in output.files_loaded_during_snapshot { println!("cargo:rerun-if-changed={}", path.display()); } diff --git a/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out b/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out index d7ccc6a00e..6ebd28c51e 100644 --- a/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out +++ b/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out @@ -10,13 +10,13 @@ error: Leaking async ops: - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here: at [WILDCARD] at setTimeout ([WILDCARD]) - at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:4:3) + at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]) at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:8:27 at [WILDCARD] at [WILDCARD] at setTimeout ([WILDCARD]) - at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:5:3) + at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]) at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:8:27 at [WILDCARD] @@ -25,13 +25,13 @@ error: Leaking async ops: - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here: at [WILDCARD] at setTimeout ([WILDCARD]) - at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:4:3) + at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]) at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:10:27 at [WILDCARD] at [WILDCARD] at setTimeout ([WILDCARD]) - at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:5:3) + at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]) at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:10:27 at [WILDCARD]