From 19a6d789a11cec1205cd52d3c89ad3a12a3ae52f Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Tue, 17 Dec 2024 15:45:03 -0800 Subject: [PATCH] nuke allocator --- rewriter/Cargo.lock | 67 ++++++++++++++++++++++++++++++++++------ rewriter/wasm/Cargo.toml | 1 + rewriter/wasm/src/lib.rs | 3 ++ 3 files changed, 61 insertions(+), 10 deletions(-) diff --git a/rewriter/Cargo.lock b/rewriter/Cargo.lock index 7cea5d3..c61bad4 100644 --- a/rewriter/Cargo.lock +++ b/rewriter/Cargo.lock @@ -8,7 +8,7 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "once_cell", "version_check", "zerocopy", @@ -102,7 +102,7 @@ dependencies = [ "boa_profiler", "boa_string", "bytemuck", - "cfg-if", + "cfg-if 1.0.0", "dashmap", "fast-float2", "hashbrown 0.15.2", @@ -260,6 +260,12 @@ dependencies = [ "rustversion", ] +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.0" @@ -325,7 +331,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" dependencies = [ "castaway", - "cfg-if", + "cfg-if 1.0.0", "itoa", "rustversion", "ryu", @@ -411,7 +417,7 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crossbeam-utils", "hashbrown 0.14.5", "lock_api", @@ -478,7 +484,7 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "wasi", ] @@ -489,7 +495,7 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crunchy", ] @@ -675,7 +681,7 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -778,6 +784,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + [[package]] name = "native" version = "0.1.0" @@ -901,7 +913,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e03e63fd113c068b82d07c9c614b0b146c08a3ac0a4dface3ea1d1a9d14d549e" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "owo-colors", "oxc-miette-derive", "textwrap", @@ -1072,7 +1084,7 @@ version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "redox_syscall", "smallvec", @@ -1683,6 +1695,7 @@ dependencies = [ "thiserror 2.0.7", "wasm-bindgen", "web-sys", + "wee_alloc", ] [[package]] @@ -1691,7 +1704,7 @@ version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "once_cell", "wasm-bindgen-macro", ] @@ -1749,6 +1762,34 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "wee_alloc" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "memory_units", + "winapi", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.9" @@ -1758,6 +1799,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-sys" version = "0.52.0" diff --git a/rewriter/wasm/Cargo.toml b/rewriter/wasm/Cargo.toml index 548ef54..2aa3630 100644 --- a/rewriter/wasm/Cargo.toml +++ b/rewriter/wasm/Cargo.toml @@ -14,6 +14,7 @@ rewriter = { version = "0.1.0", path = "../rewriter", default-features = false } thiserror = "2.0.6" wasm-bindgen = "0.2.99" web-sys = { version = "0.3.76", features = ["Url"] } +wee_alloc = "0.4.5" [features] default = ["debug"] diff --git a/rewriter/wasm/src/lib.rs b/rewriter/wasm/src/lib.rs index 3a92a2e..e2b8b13 100644 --- a/rewriter/wasm/src/lib.rs +++ b/rewriter/wasm/src/lib.rs @@ -1,5 +1,8 @@ pub mod error; +#[global_allocator] +static ALLOCATOR: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; + use std::{sync::Arc, time::Duration}; use error::{Result, RewriterError};