From 632f9cb404097a05604e1e84c1c46b5a4e23f9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Inf=C3=BChr?= Date: Sun, 20 Oct 2024 14:06:18 +0200 Subject: [PATCH] Only include boots with --boots --- dora-frontend/src/program_parser.rs | 2 +- dora-frontend/src/sema.rs | 4 ++-- dora-language-server/src/main.rs | 2 +- dora-runtime/src/compiler/aot.rs | 6 +++++- dora-runtime/src/vm/flags.rs | 1 + dora-runtime/src/vm/stdlib_lookup.rs | 4 ++-- dora-sema-fuzzer/src/main.rs | 2 +- dora/src/driver/cmd.rs | 11 +++++------ dora/src/driver/start.rs | 10 ++++++++-- tools/test | 4 ++-- tools/test-3stage-bootstrap | 2 +- tools/test-3stage-bootstrap-mac-x64 | 2 +- tools/test-boots | 4 ++-- tools/test-boots-mac-x64 | 4 ++-- tools/test-mac-x64 | 2 +- tools/test-release | 4 ++-- tools/test-release.bat | 2 +- tools/test.bat | 2 +- tools/tester.rb | 2 +- 19 files changed, 40 insertions(+), 30 deletions(-) diff --git a/dora-frontend/src/program_parser.rs b/dora-frontend/src/program_parser.rs index 5bd1d3f30..be0140e7d 100644 --- a/dora-frontend/src/program_parser.rs +++ b/dora-frontend/src/program_parser.rs @@ -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; } diff --git a/dora-frontend/src/sema.rs b/dora-frontend/src/sema.rs index ae7a6f261..ac22d73f9 100644 --- a/dora-frontend/src/sema.rs +++ b/dora-frontend/src/sema.rs @@ -73,7 +73,7 @@ pub struct SemaArgs { pub packages: Vec<(String, PathBuf)>, pub arg_file: Option, pub test_file_as_string: Option, - pub include_boots: bool, + pub boots: bool, } impl SemaArgs { @@ -82,7 +82,7 @@ impl SemaArgs { packages: Vec::new(), arg_file: None, test_file_as_string: Some(input.into()), - include_boots: false, + boots: false, } } } diff --git a/dora-language-server/src/main.rs b/dora-language-server/src/main.rs index 3ca6f912a..7378c7ecd 100644 --- a/dora-language-server/src/main.rs +++ b/dora-language-server/src/main.rs @@ -317,7 +317,7 @@ fn compile_project(project: ProjectConfig, sender: Sender) { 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); diff --git a/dora-runtime/src/compiler/aot.rs b/dora-runtime/src/compiler/aot.rs index 373279019..08c9c24f8 100644 --- a/dora-runtime/src/compiler/aot.rs +++ b/dora-runtime/src/compiler/aot.rs @@ -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); diff --git a/dora-runtime/src/vm/flags.rs b/dora-runtime/src/vm/flags.rs index 312f9e423..dc0959012 100644 --- a/dora-runtime/src/vm/flags.rs +++ b/dora-runtime/src/vm/flags.rs @@ -16,6 +16,7 @@ pub struct Flags { pub emit_graph: Option, pub emit_stubs: bool, pub enable_perf: bool, + pub boots: bool, pub always_boots: bool, pub use_boots: Option, pub omit_bounds_check: bool, diff --git a/dora-runtime/src/vm/stdlib_lookup.rs b/dora-runtime/src/vm/stdlib_lookup.rs index aad29e1fd..b7d250a46 100644 --- a/dora-runtime/src/vm/stdlib_lookup.rs +++ b/dora-runtime/src/vm/stdlib_lookup.rs @@ -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()); } @@ -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() diff --git a/dora-sema-fuzzer/src/main.rs b/dora-sema-fuzzer/src/main.rs index 202ef58fd..4d8fefb2c 100644 --- a/dora-sema-fuzzer/src/main.rs +++ b/dora-sema-fuzzer/src/main.rs @@ -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); diff --git a/dora/src/driver/cmd.rs b/dora/src/driver/cmd.rs index 58b15b526..23106a5eb 100644 --- a/dora/src/driver/cmd.rs +++ b/dora/src/driver/cmd.rs @@ -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, @@ -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, @@ -321,10 +321,8 @@ pub fn parse_arguments() -> Result { 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()); @@ -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, diff --git a/dora/src/driver/start.rs b/dora/src/driver/start.rs index 7ad3349b8..836fb953b 100644 --- a/dora/src/driver/start.rs +++ b/dora/src/driver/start.rs @@ -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) } @@ -111,7 +117,7 @@ fn compile_into_program(args: &Args, file: String) -> Result { 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); diff --git a/tools/test b/tools/test index 6abdb9769..ed8c4969b 100755 --- a/tools/test +++ b/tools/test @@ -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 diff --git a/tools/test-3stage-bootstrap b/tools/test-3stage-bootstrap index 802b6470c..ade7610d0 100755 --- a/tools/test-3stage-bootstrap +++ b/tools/test-3stage-bootstrap @@ -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 diff --git a/tools/test-3stage-bootstrap-mac-x64 b/tools/test-3stage-bootstrap-mac-x64 index ca2009584..0864aeb1e 100755 --- a/tools/test-3stage-bootstrap-mac-x64 +++ b/tools/test-3stage-bootstrap-mac-x64 @@ -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 diff --git a/tools/test-boots b/tools/test-boots index fceff0293..22a0ed9b6 100755 --- a/tools/test-boots +++ b/tools/test-boots @@ -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 diff --git a/tools/test-boots-mac-x64 b/tools/test-boots-mac-x64 index 6b8df151c..50b3a0c71 100755 --- a/tools/test-boots-mac-x64 +++ b/tools/test-boots-mac-x64 @@ -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 diff --git a/tools/test-mac-x64 b/tools/test-mac-x64 index a8d1ac615..40ae5176e 100755 --- a/tools/test-mac-x64 +++ b/tools/test-mac-x64 @@ -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 diff --git a/tools/test-release b/tools/test-release index d7f65d108..3fe24145e 100755 --- a/tools/test-release +++ b/tools/test-release @@ -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 diff --git a/tools/test-release.bat b/tools/test-release.bat index 8f2ebf762..cc1e67ec6 100644 --- a/tools/test-release.bat +++ b/tools/test-release.bat @@ -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 diff --git a/tools/test.bat b/tools/test.bat index 79232c42e..2398af6b7 100644 --- a/tools/test.bat +++ b/tools/test.bat @@ -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 diff --git a/tools/tester.rb b/tools/tester.rb index 6ab452f27..7110bb1c3 100755 --- a/tools/tester.rb +++ b/tools/tester.rb @@ -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