Skip to content

Commit bde2637

Browse files
committed
build: switch to released gcmodule fork
Signed-off-by: Yaroslav Bolyukin <[email protected]>
1 parent d76beb2 commit bde2637

File tree

38 files changed

+179
-206
lines changed

38 files changed

+179
-206
lines changed

Cargo.lock

Lines changed: 82 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/jsonnet/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ publish = false
1010
[dependencies]
1111
jrsonnet-evaluator = { path = "../../crates/jrsonnet-evaluator", version = "0.4.2" }
1212
jrsonnet-parser = { path = "../../crates/jrsonnet-parser", version = "0.4.2" }
13-
gcmodule = { git = "https://github.com/CertainLach/gcmodule", branch = "jrsonnet" }
13+
jrsonnet-gcmodule = { version = "0.3.4" }
1414

1515
[lib]
1616
crate-type = ["cdylib"]

bindings/jsonnet/src/native.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ use std::{
33
os::raw::{c_char, c_int},
44
};
55

6-
use gcmodule::Cc;
76
use jrsonnet_evaluator::{
87
error::{Error, LocError},
98
function::builtin::{BuiltinParam, NativeCallback, NativeCallbackHandler},
109
tb,
1110
typed::Typed,
1211
IStr, State, Val,
1312
};
13+
use jrsonnet_gcmodule::Cc;
1414

1515
type JsonnetNativeCallback = unsafe extern "C" fn(
1616
ctx: *const c_void,
1717
argv: *const *const Val,
1818
success: *mut c_int,
1919
) -> *mut Val;
2020

21-
#[derive(gcmodule::Trace)]
21+
#[derive(jrsonnet_gcmodule::Trace)]
2222
struct JsonnetNativeCallbackHandler {
23-
#[skip_trace]
23+
#[trace(skip)]
2424
ctx: *const c_void,
25-
#[skip_trace]
25+
#[trace(skip)]
2626
cb: JsonnetNativeCallback,
2727
}
2828
impl NativeCallbackHandler for JsonnetNativeCallbackHandler {

bindings/jsonnet/src/val_make.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::{
55
os::raw::{c_char, c_double, c_int},
66
};
77

8-
use gcmodule::Cc;
98
use jrsonnet_evaluator::{val::ArrValue, ObjValue, State, Val};
9+
use jrsonnet_gcmodule::Cc;
1010

1111
/// # Safety
1212
///

bindings/jsonnet/src/val_modify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
55
use std::{ffi::CStr, os::raw::c_char};
66

7-
use gcmodule::Cc;
87
use jrsonnet_evaluator::{val::ArrValue, State, Thunk, Val};
8+
use jrsonnet_gcmodule::Cc;
99

1010
/// # Safety
1111
///

cmds/jrsonnet/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ exp-destruct = ["jrsonnet-evaluator/exp-destruct"]
2323
jrsonnet-evaluator = { path = "../../crates/jrsonnet-evaluator", version = "0.4.2" }
2424
jrsonnet-parser = { path = "../../crates/jrsonnet-parser", version = "0.4.2" }
2525
jrsonnet-cli = { path = "../../crates/jrsonnet-cli", version = "0.4.2" }
26+
jrsonnet-gcmodule = { version = "0.3.4" }
27+
2628
mimallocator = { version = "0.1.3", optional = true }
2729
thiserror = "1.0"
28-
gcmodule = { git = "https://github.com/CertainLach/gcmodule", branch = "jrsonnet" }
2930
clap = { version = "3.1", features = ["derive"] }
3031
clap_complete = { version = "3.1" }

cmds/jrsonnet/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ fn main_catch(opts: Opts) -> bool {
115115
}
116116

117117
fn main_real(s: &State, opts: Opts) -> Result<(), Error> {
118-
opts.gc.configure_global();
119118
opts.general.configure(s)?;
120119
opts.manifest.configure(s)?;
121120

crates/jrsonnet-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jrsonnet-evaluator = { path = "../../crates/jrsonnet-evaluator", version = "0.4.
1414
"explaining-traces",
1515
] }
1616
jrsonnet-parser = { path = "../../crates/jrsonnet-parser", version = "0.4.2" }
17-
gcmodule = { git = "https://github.com/CertainLach/gcmodule", branch = "jrsonnet" }
17+
jrsonnet-gcmodule = { version = "0.3.4" }
1818

1919
clap = { version = "3.1", features = ["derive"] }

crates/jrsonnet-cli/src/lib.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::{env, path::PathBuf};
88
use clap::Parser;
99
pub use ext::*;
1010
use jrsonnet_evaluator::{error::Result, FileImportResolver, State};
11+
use jrsonnet_gcmodule::with_thread_object_space;
1112
pub use manifest::*;
1213
pub use tla::*;
1314
pub use trace::*;
@@ -111,15 +112,21 @@ pub struct GcOpts {
111112
gc_collect_before_printing_stats: bool,
112113
}
113114
impl GcOpts {
114-
pub fn configure_global(&self) {
115-
if !self.gc_collect_on_exit {
116-
gcmodule::set_thread_collect_on_drop(false)
117-
}
115+
pub fn stats_printer(&self) -> (Option<GcStatsPrinter>, Option<LeakSpace>) {
116+
(
117+
self.gc_print_stats.then(|| GcStatsPrinter {
118+
collect_before_printing_stats: self.gc_collect_before_printing_stats,
119+
}),
120+
(!self.gc_collect_on_exit).then(|| LeakSpace {}),
121+
)
118122
}
119-
pub fn stats_printer(&self) -> Option<GcStatsPrinter> {
120-
self.gc_print_stats.then(|| GcStatsPrinter {
121-
collect_before_printing_stats: self.gc_collect_before_printing_stats,
122-
})
123+
}
124+
125+
pub struct LeakSpace {}
126+
127+
impl Drop for LeakSpace {
128+
fn drop(&mut self) {
129+
with_thread_object_space(|s| s.leak())
123130
}
124131
}
125132

@@ -130,9 +137,9 @@ impl Drop for GcStatsPrinter {
130137
fn drop(&mut self) {
131138
eprintln!("=== GC STATS ===");
132139
if self.collect_before_printing_stats {
133-
let collected = gcmodule::collect_thread_cycles();
140+
let collected = jrsonnet_gcmodule::collect_thread_cycles();
134141
eprintln!("Collected: {}", collected);
135142
}
136-
eprintln!("Tracked: {}", gcmodule::count_thread_tracked())
143+
eprintln!("Tracked: {}", jrsonnet_gcmodule::count_thread_tracked())
137144
}
138145
}

crates/jrsonnet-evaluator/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jrsonnet-parser = { path = "../jrsonnet-parser", version = "0.4.2" }
3030
jrsonnet-stdlib = { path = "../jrsonnet-stdlib", version = "0.4.2" }
3131
jrsonnet-types = { path = "../jrsonnet-types", version = "0.4.2" }
3232
jrsonnet-macros = { path = "../jrsonnet-macros", version = "0.4.2" }
33+
jrsonnet-gcmodule = { version = "0.3.4" }
34+
3335
pathdiff = "0.2.1"
3436
hashbrown = "0.12.1"
3537
static_assertions = "1.1.0"
@@ -39,7 +41,6 @@ base64 = "0.13.0"
3941
rustc-hash = "1.1"
4042

4143
thiserror = "1.0"
42-
gcmodule = { git = "https://github.com/CertainLach/gcmodule", branch = "jrsonnet" }
4344

4445
serde = "1.0"
4546
serde_json = "1.0"

0 commit comments

Comments
 (0)