Chaos mode MVP: Skip branch optimization in MachBuffer (#6039)

* fuzz: Add chaos mode control plane

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* fuzz: Skip branch optimization with chaos mode

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* fuzz: Rename chaos engine -> control plane

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* chaos mode: refactoring ControlPlane to be passed through the call stack by reference

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Remo Senekowitsch <contact@remsle.dev>

* fuzz: annotate chaos todos

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* fuzz: cleanup control plane

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* fuzz: remove control plane from compiler context

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* fuzz: move control plane into emit state

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* fuzz: fix remaining compiler errors

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* fix tests

* refactor emission state ctrl plane accessors

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* centralize conditional compilation of chaos mode

Also cleanup a few straggling dependencies on cranelift-control
that aren't needed anymore.

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* add cranelift-control to published crates

prtest:full

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

* add cranelift-control to public crates

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>

---------

Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com>
Co-authored-by: Moritz Waser <mzrw.dev@pm.me>
Co-authored-by: Remo Senekowitsch <contact@remsle.dev>
This commit is contained in:
Remo Senekowitsch
2023-04-05 21:28:46 +02:00
committed by GitHub
parent 064968b01d
commit 7eb8914090
61 changed files with 815 additions and 245 deletions

View File

@@ -1041,9 +1041,11 @@ impl<'a> CrashCheckContext<'a> {
std::panic::set_hook(Box::new(|_| {})); // silence panics
let res = match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
let _ = self
.context
.compile_and_emit(self.isa, &mut self.code_memory);
let _ = self.context.compile_and_emit(
self.isa,
&mut self.code_memory,
&mut Default::default(),
);
})) {
Ok(()) => CheckResult::Succeed,
Err(err) => CheckResult::Crash(get_panic_string(err)),

View File

@@ -102,7 +102,7 @@ fn handle_module(
// Compile and encode the result to machine code.
let compiled_code = context
.compile_and_emit(isa, &mut mem)
.compile_and_emit(isa, &mut mem, &mut Default::default())
.map_err(|err| anyhow::anyhow!("{}", pretty_error(&err.func, err.inner)))?;
let code_info = compiled_code.code_info();
@@ -113,7 +113,7 @@ fn handle_module(
cranelift_module::Linkage::Export,
&context.func.signature,
)?;
module.define_function(fid, &mut context)?;
module.define_function(fid, &mut context, &mut Default::default())?;
}
if options.print {

View File

@@ -257,7 +257,7 @@ fn handle_module(options: &Options, path: &Path, name: &str, fisa: FlagsOrIsa) -
(vec![], vec![], vec![])
} else {
let compiled_code = context
.compile_and_emit(isa, &mut mem)
.compile_and_emit(isa, &mut mem, &mut Default::default())
.map_err(|err| anyhow::anyhow!("{}", pretty_error(&err.func, err.inner)))?;
let code_info = compiled_code.code_info();