From ba7c2f9a78fd2a3b7ec42c3873b044dd6e971092 Mon Sep 17 00:00:00 2001
From: y21 <30553356+y21@users.noreply.github.com>
Date: Tue, 29 Oct 2024 11:04:13 +0100
Subject: [PATCH] adjust GC threshold
---
cli/src/main.rs | 2 +-
crates/dash_rt/src/runtime.rs | 2 +-
crates/dash_vm/src/dispatch.rs | 6 ++---
crates/dash_vm/src/js_std/date.rs | 2 +-
crates/dash_vm/src/js_std/math.rs | 2 +-
crates/dash_vm/src/lib.rs | 29 ++++++++++----------
crates/dash_vm/src/params.rs | 45 +++++++------------------------
7 files changed, 32 insertions(+), 56 deletions(-)
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 80279ca6..998ed8c1 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -21,7 +21,7 @@ fn main() -> anyhow::Result<()> {
let nodejs = Arg::new("node").long("node").takes_value(false);
let initial_gc_threshold = Arg::new("initial-gc-threshold")
- .help("Sets the initial GC object threshold, i.e. the object count at which the first GC cycle triggers.")
+ .help("Sets the initial GC object threshold, i.e. the RSS at which the first GC cycle triggers.")
.long("initial-gc-threshold")
.takes_value(true)
.required(false);
diff --git a/crates/dash_rt/src/runtime.rs b/crates/dash_rt/src/runtime.rs
index a4e420f6..c0a2667f 100644
--- a/crates/dash_rt/src/runtime.rs
+++ b/crates/dash_rt/src/runtime.rs
@@ -41,7 +41,7 @@ impl Runtime {
.set_state(Box::new(state));
if let Some(threshold) = initial_gc_threshold {
- params = params.set_initial_gc_object_threshold(threshold);
+ params = params.set_initial_gc_rss_threshold(threshold);
}
let vm = Vm::new(params);
diff --git a/crates/dash_vm/src/dispatch.rs b/crates/dash_vm/src/dispatch.rs
index 0e348076..a058421d 100755
--- a/crates/dash_vm/src/dispatch.rs
+++ b/crates/dash_vm/src/dispatch.rs
@@ -1900,7 +1900,7 @@ mod handlers {
pub fn import_dyn(mut cx: DispatchContext<'_>) -> Result