Skip to content

Commit

Permalink
Only include boots with --boots
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Oct 20, 2024
1 parent 096c290 commit 632f9cb
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 30 deletions.
2 changes: 1 addition & 1 deletion dora-frontend/src/program_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<'a> ProgramParser<'a> {
}

fn add_boots_package(&mut self) {
if !self.sa.args.include_boots {
if !self.sa.args.boots {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions dora-frontend/src/sema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub struct SemaArgs {
pub packages: Vec<(String, PathBuf)>,
pub arg_file: Option<String>,
pub test_file_as_string: Option<String>,
pub include_boots: bool,
pub boots: bool,
}

impl SemaArgs {
Expand All @@ -82,7 +82,7 @@ impl SemaArgs {
packages: Vec::new(),
arg_file: None,
test_file_as_string: Some(input.into()),
include_boots: false,
boots: false,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dora-language-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ fn compile_project(project: ProjectConfig, sender: Sender<MainLoopTask>) {
arg_file: Some(project.main.to_string_lossy().into_owned()),
packages: Vec::new(),
test_file_as_string: None,
include_boots: false,
boots: false,
};

let mut sa = Sema::new(sem_args);
Expand Down
6 changes: 5 additions & 1 deletion dora-runtime/src/compiler/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ use crate::vm::{
};

pub fn compile_boots_aot(vm: &VM) {
if let Some(package_id) = vm.program.boots_package_id {
if vm.flags.boots {
let package_id = vm
.program
.boots_package_id
.expect("boots package is missing");
let entry_id = vm.known.boots_compile_fct_id();
let tests = compute_tests(vm, package_id);
let tc = compute_transitive_closure(vm, package_id, entry_id, &tests);
Expand Down
1 change: 1 addition & 0 deletions dora-runtime/src/vm/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct Flags {
pub emit_graph: Option<String>,
pub emit_stubs: bool,
pub enable_perf: bool,
pub boots: bool,
pub always_boots: bool,
pub use_boots: Option<String>,
pub omit_bounds_check: bool,
Expand Down
4 changes: 2 additions & 2 deletions dora-runtime/src/vm/stdlib_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn lookup(vm: &mut VM) {
apply_fct(vm, &module_items, path, implementation.clone());
}

if vm.program.boots_package_id.is_some() {
if vm.flags.boots {
for (path, implementation) in BOOTS_FUNCTIONS {
apply_fct(vm, &module_items, path, implementation.clone());
}
Expand Down Expand Up @@ -279,7 +279,7 @@ fn lookup_known_classes(vm: &mut VM, module_items: &ModuleItemMap) {
}

fn lookup_known_functions(vm: &mut VM, module_items: &ModuleItemMap) {
if vm.program.boots_package_id.is_some() {
if vm.flags.boots {
vm.known.boots_compile_fct_id = Some(
resolve_path(vm, module_items, "boots::interface::compile")
.function_id()
Expand Down
2 changes: 1 addition & 1 deletion dora-sema-fuzzer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn check_program(program: String) {
arg_file: None,
packages: Vec::new(),
test_file_as_string: Some(program),
include_boots: false,
boots: false,
};

let mut sa = Sema::new(sem_args);
Expand Down
11 changes: 5 additions & 6 deletions dora/src/driver/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub struct Args {
pub emit_compiler: bool,
pub emit_stubs: bool,
pub enable_perf: bool,
pub include_boots: bool,
pub boots: bool,
pub omit_bounds_check: bool,
pub always_boots: bool,
pub use_boots: Option<String>,
Expand Down Expand Up @@ -135,7 +135,7 @@ impl Default for Args {
emit_debug_boots: false,
emit_debug_entry: false,
enable_perf: false,
include_boots: true,
boots: false,
omit_bounds_check: false,
always_boots: false,
use_boots: None,
Expand Down Expand Up @@ -321,10 +321,8 @@ pub fn parse_arguments() -> Result<Args, String> {
args.code_size = Some(argument_mem_size(arg)?);
} else if arg.starts_with("--readonly-size=") {
args.readonly_size = Some(argument_mem_size(arg)?);
} else if arg == "--include-boots" {
args.include_boots = true;
} else if arg == "--no-include-boots" {
args.include_boots = false;
} else if arg == "--boots" {
args.boots = true;
} else if arg == "--package" {
if idx + 2 >= cli_arguments.len() {
return Err("--package needs two arguments".into());
Expand Down Expand Up @@ -428,6 +426,7 @@ pub fn create_vm_args(args: &Args) -> VmArgs {
emit_graph: args.emit_graph.clone(),
emit_stubs: args.emit_stubs,
always_boots: args.always_boots,
boots: args.boots,
use_boots: args.use_boots.clone(),
enable_perf: args.enable_perf,
omit_bounds_check: args.omit_bounds_check,
Expand Down
10 changes: 8 additions & 2 deletions dora/src/driver/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ pub fn start() -> i32 {

let exit_code = if command.is_test() {
if args.test_boots {
run_tests(&vm, &args, vm.program.boots_package_id.expect("no boots"))
run_tests(
&vm,
&args,
vm.program
.boots_package_id
.expect("boots package is missing"),
)
} else {
run_tests(&vm, &args, vm.program.program_package_id)
}
Expand Down Expand Up @@ -111,7 +117,7 @@ fn compile_into_program(args: &Args, file: String) -> Result<Program, ()> {
arg_file: Some(file),
packages: args.packages.clone(),
test_file_as_string: None,
include_boots: args.include_boots,
boots: args.boots,
};

let mut sa = Sema::new(sem_args);
Expand Down
4 changes: 2 additions & 2 deletions tools/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set -e

cargo build
cargo test
cargo run -p dora -- --include-boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
cargo run -p dora -- --boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
ruby tools/tester.rb $@
cargo run -p dora -- test --include-boots --test-boots --gc-verify tests/hello-world.dora
cargo run -p dora -- test --boots --test-boots --gc-verify tests/hello-world.dora
2 changes: 1 addition & 1 deletion tools/test-3stage-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

cargo run -p dora -- --include-boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
cargo run -p dora -- --boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
2 changes: 1 addition & 1 deletion tools/test-3stage-bootstrap-mac-x64
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e

TARGET=x86_64-apple-darwin
cargo run -p dora --target $TARGET -- --include-boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
cargo run -p dora --target $TARGET -- --boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
4 changes: 2 additions & 2 deletions tools/test-boots
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -e

cargo run -p dora -- test --include-boots --test-boots --gc-verify tests/hello-world.dora
cargo run -p dora -- --include-boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
cargo run -p dora -- test --boots --test-boots --gc-verify tests/hello-world.dora
cargo run -p dora -- --boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
ruby tools/tester.rb tests/boots
4 changes: 2 additions & 2 deletions tools/test-boots-mac-x64
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
set -e

TARGET=x86_64-apple-darwin
cargo run -p dora --target $TARGET -- test --include-boots --test-boots --gc-verify tests/hello-world.dora
cargo run -p dora --target $TARGET -- --include-boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
cargo run -p dora --target $TARGET -- test --boots --test-boots --gc-verify tests/hello-world.dora
cargo run -p dora --target $TARGET -- --boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
ruby tools/tester.rb --target $TARGET tests/boots
2 changes: 1 addition & 1 deletion tools/test-mac-x64
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ TARGET=x86_64-apple-darwin
cargo build --target $TARGET
cargo test --target $TARGET
ruby tools/tester.rb --target $TARGET $@
cargo run -p dora --target $TARGET -- test --include-boots --test-boots --gc-verify tests/hello-world.dora
cargo run -p dora --target $TARGET -- test --boots --test-boots --gc-verify tests/hello-world.dora
4 changes: 2 additions & 2 deletions tools/test-release
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set -e

cargo build --release
cargo test --release
cargo run -p dora --release -- --include-boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
cargo run -p dora --release -- --boots --gc-verbose --emit-compiler --bootstrap-compiler tests/boots/hello.dora
ruby tools/tester.rb --release $@
cargo run --release -p dora -- test --include-boots --test-boots tests/hello-world.dora
cargo run --release -p dora -- test --boots --test-boots tests/hello-world.dora
2 changes: 1 addition & 1 deletion tools/test-release.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cargo build --release && cargo test --release && ruby tools\tester.rb --release %* && cargo run -p dora --release -- test --include-boots --test-boots tests/hello-world.dora
cargo build --release && cargo test --release && ruby tools\tester.rb --release %* && cargo run -p dora --release -- test --boots --test-boots tests/hello-world.dora
2 changes: 1 addition & 1 deletion tools/test.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cargo build && cargo test && ruby tools\tester.rb %* && cargo run -p dora -- test --include-boots --test-boots tests/hello-world.dora --gc-verify
cargo build && cargo test && ruby tools\tester.rb %* && cargo run -p dora -- test --boots --test-boots tests/hello-world.dora --gc-verify
2 changes: 1 addition & 1 deletion tools/tester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def run_test(test_case, config, mutex)

args = ""
args << " #{config.flags}" unless config.flags.empty?
args << " --include-boots" if test_case.enable_boots || config.enable_boots
args << " --boots" if test_case.enable_boots || config.enable_boots
args << " --check" if $check_only
args << " #{test_case.vm_args}" unless test_case.vm_args.empty?
args << " #{$extra_args}" if $extra_args
Expand Down

0 comments on commit 632f9cb

Please sign in to comment.