Skip to content

Commit

Permalink
Merge pull request #102 from jacob-hughes/allow_debug_boehm
Browse files Browse the repository at this point in the history
Run Boehm assertions on CI
  • Loading branch information
ltratt authored Dec 5, 2023
2 parents 29c5c58 + 6a18017 commit 8853d4c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .buildbot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export RUSTUP_HOME="`pwd`/.rustup"
# Ensure the build fails if it uses excessive amounts of memory.
ulimit -d $((1024 * 1024 * 8)) # 8 GiB

/usr/bin/time -v python3 x.py test --stage 2 --config .buildbot.config.toml --exclude rustdoc-json --exclude debuginfo
ENABLE_GC_ASSERTIONS=true /usr/bin/time -v python3 x.py test --stage 2 --config .buildbot.config.toml --exclude rustdoc-json --exclude debuginfo

19 changes: 15 additions & 4 deletions library/boehm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,24 @@ fn main() {
run("git", |cmd| cmd.arg("clone").arg(BOEHM_ATOMICS_REPO).current_dir(&boehm_src));
}

cmake::Config::new(&boehm_src)
let mut build = cmake::Config::new(&boehm_src);
build
.pic(true)
.profile("Release")
.define("BUILD_SHARED_LIBS", "OFF")
.cflag("-DGC_ALWAYS_MULTITHREADED")
.cflag("-DGC_JAVA_FINALIZATION")
.build();
.cflag("-DGC_JAVA_FINALIZATION");

if env::var("ENABLE_GC_ASSERTIONS").map_or(false, |v| v == "true") {
build.define("enable_gc_assertions", "ON");
}

if env::var("ENABLE_GC_DEBUG").map_or(false, |v| v == "true") {
build.profile("Debug");
} else {
build.profile("Release");
}

build.build();

println!("cargo:rustc-link-search=native={}", &build_dir.display());
println!("cargo:rustc-link-lib=static=gc");
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl Builder {
///
/// let builder = thread::Builder::new()
/// .name("foo".into())
/// .stack_size(32 * 1024);
/// .stack_size(64 * 1024);
///
/// let handler = builder.spawn(|| {
/// // thread code
Expand Down
4 changes: 3 additions & 1 deletion tests/ui/codegen/issue-28950.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// FIXME(eddyb) Improve unoptimized codegen to avoid the temporary,
// and thus run successfully even when compiled at -C opt-level=0.

const LEN: usize = 1 << 15;
// For Alloy, this must be larger than 1 << 16 because very small threads fail when
// doing stack scanning work for GC.
const LEN: usize = 1 << 17;

use std::thread::Builder;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-2190-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::thread::Builder;
static generations: usize = 1024+256+128+49;

fn spawn(mut f: Box<dyn FnMut() + 'static + Send>) {
Builder::new().stack_size(32 * 1024).spawn(move|| f());
Builder::new().stack_size(64 * 1024).spawn(move|| f());
}

fn child_no(x: usize) -> Box<dyn FnMut() + 'static + Send> {
Expand Down
8 changes: 7 additions & 1 deletion tests/ui/runtime/gc/zero_vecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ fn test_pop(v: &mut Vec<Gc<Finalizable>, GcAllocator>) {
let mut _gc = Some(v.pop());
_gc = None;
}

// Sometimes the last reference to an object lingers in a register (usually
// in debug builds) which means the object is kept alive and not finalized.
// We get around this by reusing the register with a pointer to
// another, unrelated GC value.
let _gc = Gc::new(0xDEADBEEF as u32);
}

fn main() {
Expand All @@ -39,5 +45,5 @@ fn main() {

GcAllocator::force_gc();

assert_eq!(FINALIZER_COUNT.load(atomic::Ordering::Relaxed), 19);
assert_eq!(FINALIZER_COUNT.load(atomic::Ordering::Relaxed), 20);
}

0 comments on commit 8853d4c

Please sign in to comment.