Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce MockVM #1049

Merged
merged 15 commits into from
Dec 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove examples and dummyvm. Minor fixes
  • Loading branch information
qinsoon committed Dec 14, 2023

Verified

This commit was signed with the committer’s verified signature.
brrttwrks Eric Barrett
commit 988548d0bebed454c51474390e9bad859f0e905d
1 change: 0 additions & 1 deletion .github/scripts/ci-style.sh
Original file line number Diff line number Diff line change
@@ -37,4 +37,3 @@ style_check_auxiliary_crate() {
}

style_check_auxiliary_crate macros
style_check_auxiliary_crate vmbindings/dummyvm
46 changes: 8 additions & 38 deletions .github/scripts/ci-test.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,18 @@
. $(dirname "$0")/ci-common.sh

# export RUST_BACKTRACE=1
# # Run all tests with 1G heap
# export MMTK_GC_TRIGGER=FixedHeapSize:1000000000
export RUST_BACKTRACE=1
# Run all tests with 1G heap
export MMTK_GC_TRIGGER=FixedHeapSize:1000000000

# for_all_features "cargo test"
for_all_features "cargo test"

# # target-specific features
# if [[ $arch == "x86_64" && $os == "linux" ]]; then
# cargo test --features perf_counter
# fi

# ./examples/build.py
# target-specific features
if [[ $arch == "x86_64" && $os == "linux" ]]; then
cargo test --features perf_counter
fi

ALL_PLANS=$(sed -n '/enum PlanSelector/,/}/p' src/util/options.rs | sed -e 's;//.*;;g' -e '/^$/d' -e 's/,//g' | xargs | grep -o '{.*}' | grep -o '\w\+')

# Test with DummyVM (each test in a separate run)
# cd vmbindings/dummyvm
# for fn in $(ls src/tests/*.rs); do
# t=$(basename -s .rs $fn)

# if [[ $t == "mod" ]]; then
# continue
# fi

# # Get the required plans.
# # Some tests need to be run with multiple plans because
# # some bugs can only be reproduced in some plans but not others.
# PLANS=$(sed -n 's/^\/\/ *GITHUB-CI: *MMTK_PLAN=//p' $fn)
# if [[ $PLANS == 'all' ]]; then
# PLANS=$ALL_PLANS
# elif [[ -z $PLANS ]]; then
# PLANS=NoGC
# fi

# # Some tests need some features enabled.
# FEATURES=$(sed -n 's/^\/\/ *GITHUB-CI: *FEATURES=//p' $fn)

# # Run the test with each plan it needs.
# for MMTK_PLAN in $PLANS; do
# env MMTK_PLAN=$MMTK_PLAN cargo test --features "$FEATURES" -- $t;
# done
# done

# Test with mock VM:
# - Find all the files that start with mock_test_
# - Run each file separately with cargo test, with the feature 'mock_test'
7 changes: 4 additions & 3 deletions benches/alloc.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
use criterion::Criterion;
use criterion::criterion_group;
qinsoon marked this conversation as resolved.
Show resolved Hide resolved
use criterion::Criterion;

use mmtk::memory_manager;
use mmtk::util::test_util::fixtures::*;
use mmtk::AllocationSemantics;
use mmtk::memory_manager;

pub fn bench(c: &mut Criterion) {
// Disable GC so we won't trigger GC
let mut fixture = MutatorFixture::create_with_heapsize(1 << 30);
memory_manager::disable_collection(&mut fixture.mmtk());
c.bench_function("alloc", |b| {
b.iter(|| {
let _addr = memory_manager::alloc(&mut fixture.mutator, 8, 8, 0, AllocationSemantics::Default);
let _addr =
memory_manager::alloc(&mut fixture.mutator, 8, 8, 0, AllocationSemantics::Default);
})
});
}
14 changes: 6 additions & 8 deletions benches/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use criterion::criterion_main;
use criterion::criterion_group;
use criterion::criterion_main;
use criterion::Criterion;

// As we can only initialize one MMTk instance, we have to run each benchmark in a separate process.
@@ -20,16 +20,14 @@ mod sft;

fn bench_main(c: &mut Criterion) {
match std::env::var("MMTK_BENCH") {
Ok(bench) => {
match bench.as_str() {
"alloc" => alloc::bench(c),
"sft" => sft::bench(c),
_ => panic!("Unknown benchmark {:?}", bench)
}
Ok(bench) => match bench.as_str() {
"alloc" => alloc::bench(c),
"sft" => sft::bench(c),
_ => panic!("Unknown benchmark {:?}", bench),
},
Err(_) => panic!("Need to name a benchmark by the env var MMTK_BENCH"),
}
}

criterion_group!(benches, bench_main);
criterion_main!(benches);
criterion_main!(benches);
8 changes: 4 additions & 4 deletions benches/sft.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use criterion::Criterion;
use criterion::black_box;
use criterion::criterion_group;
qinsoon marked this conversation as resolved.
Show resolved Hide resolved
use criterion::Criterion;

use mmtk::memory_manager;
use mmtk::util::test_util::fixtures::*;
use mmtk::util::test_util::mock_vm::*;
use mmtk::AllocationSemantics;
use mmtk::vm::VMBinding;
use mmtk::vm::ObjectModel;
use mmtk::memory_manager;
use mmtk::vm::VMBinding;
use mmtk::AllocationSemantics;

pub fn bench(c: &mut Criterion) {
let mut fixture = MutatorFixture::create();
17 changes: 0 additions & 17 deletions examples/allocation_benchmark.c

This file was deleted.

23 changes: 0 additions & 23 deletions examples/bench.sh

This file was deleted.

102 changes: 0 additions & 102 deletions examples/build.py

This file was deleted.

27 changes: 0 additions & 27 deletions examples/main.c

This file was deleted.

70 changes: 0 additions & 70 deletions examples/reference_bump_allocator.c

This file was deleted.

8 changes: 7 additions & 1 deletion src/tests/mock_test_allocate_align_offset.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,13 @@ pub fn allocate_alignment() {
let mut align = min;
while align <= max {
info!("Test allocation with alignment {}", align);
let addr = memory_manager::alloc(&mut fixture.mutator, 8, align, 0, AllocationSemantics::Default);
let addr = memory_manager::alloc(
&mut fixture.mutator,
8,
align,
0,
AllocationSemantics::Default,
);
assert!(
addr.is_aligned_to(align),
"Expected allocation alignment {}, returned address is {:?}",
Loading