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:
committed by
GitHub
parent
064968b01d
commit
7eb8914090
@@ -14,6 +14,7 @@ cranelift-module = { workspace = true }
|
||||
cranelift-native = { workspace = true }
|
||||
cranelift-codegen = { workspace = true, features = ["std"] }
|
||||
cranelift-entity = { workspace = true }
|
||||
cranelift-control = { workspace = true }
|
||||
anyhow = { workspace = true }
|
||||
region = "2.2.0"
|
||||
libc = { version = "0.2.42" }
|
||||
|
||||
@@ -51,7 +51,10 @@ fn main() {
|
||||
bcx.seal_all_blocks();
|
||||
bcx.finalize();
|
||||
}
|
||||
module.define_function(func_a, &mut ctx).unwrap();
|
||||
let ctrl_plane = &mut Default::default();
|
||||
module
|
||||
.define_function(func_a, &mut ctx, ctrl_plane)
|
||||
.unwrap();
|
||||
module.clear_context(&mut ctx);
|
||||
|
||||
ctx.func.signature = sig_b;
|
||||
@@ -74,7 +77,9 @@ fn main() {
|
||||
bcx.seal_all_blocks();
|
||||
bcx.finalize();
|
||||
}
|
||||
module.define_function(func_b, &mut ctx).unwrap();
|
||||
module
|
||||
.define_function(func_b, &mut ctx, ctrl_plane)
|
||||
.unwrap();
|
||||
module.clear_context(&mut ctx);
|
||||
|
||||
// Perform linking.
|
||||
|
||||
@@ -5,6 +5,7 @@ use cranelift_codegen::isa::{OwnedTargetIsa, TargetIsa};
|
||||
use cranelift_codegen::settings::Configurable;
|
||||
use cranelift_codegen::{self, ir, settings, MachReloc};
|
||||
use cranelift_codegen::{binemit::Reloc, CodegenError};
|
||||
use cranelift_control::ControlPlane;
|
||||
use cranelift_entity::SecondaryMap;
|
||||
use cranelift_module::{
|
||||
DataContext, DataDescription, DataId, FuncId, Init, Linkage, Module, ModuleCompiledFunction,
|
||||
@@ -682,6 +683,7 @@ impl Module for JITModule {
|
||||
&mut self,
|
||||
id: FuncId,
|
||||
ctx: &mut cranelift_codegen::Context,
|
||||
ctrl_plane: &mut ControlPlane,
|
||||
) -> ModuleResult<ModuleCompiledFunction> {
|
||||
info!("defining function {}: {}", id, ctx.func.display());
|
||||
let decl = self.declarations.get_function_decl(id);
|
||||
@@ -694,7 +696,7 @@ impl Module for JITModule {
|
||||
}
|
||||
|
||||
// work around borrow-checker to allow reuse of ctx below
|
||||
let res = ctx.compile(self.isa())?;
|
||||
let res = ctx.compile(self.isa(), ctrl_plane)?;
|
||||
let alignment = res.alignment as u64;
|
||||
let compiled_code = ctx.compiled_code().unwrap();
|
||||
|
||||
|
||||
@@ -57,7 +57,9 @@ fn define_simple_function(module: &mut JITModule) -> FuncId {
|
||||
bcx.ins().return_(&[]);
|
||||
}
|
||||
|
||||
module.define_function(func_id, &mut ctx).unwrap();
|
||||
module
|
||||
.define_function(func_id, &mut ctx, &mut Default::default())
|
||||
.unwrap();
|
||||
|
||||
func_id
|
||||
}
|
||||
@@ -207,7 +209,9 @@ fn libcall_function() {
|
||||
bcx.ins().return_(&[]);
|
||||
}
|
||||
|
||||
module.define_function(func_id, &mut ctx).unwrap();
|
||||
module
|
||||
.define_function(func_id, &mut ctx, &mut Default::default())
|
||||
.unwrap();
|
||||
|
||||
module.finalize_definitions().unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user