core: Add compile-time feature to disable escape analysis
This commit is contained in:
parent
6d6f8be07f
commit
6c1d8ac001
|
@ -24,3 +24,4 @@ features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-l
|
|||
|
||||
[features]
|
||||
init-llvm-profile = []
|
||||
no-escape-analysis = ["nac3core/no-escape-analysis"]
|
||||
|
|
|
@ -4,6 +4,9 @@ version = "0.1.0"
|
|||
authors = ["M-Labs"]
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
no-escape-analysis = []
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.13"
|
||||
crossbeam = "0.8"
|
||||
|
|
|
@ -207,6 +207,9 @@ impl<'a> Inferencer<'a> {
|
|||
/// This is a workaround preventing the caller from using a variable `alloca`-ed in the body, which
|
||||
/// is freed when the function returns.
|
||||
fn check_return_value_ty(&mut self, ret_ty: Type) -> bool {
|
||||
if cfg!(feature = "no-escape-analysis") {
|
||||
true
|
||||
} else {
|
||||
match &*self.unifier.get_ty_immutable(ret_ty) {
|
||||
TypeEnum::TObj { .. } => [
|
||||
self.primitives.int32,
|
||||
|
@ -222,6 +225,7 @@ impl<'a> Inferencer<'a> {
|
|||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check statements for proper identifier def-use and return on all paths
|
||||
fn check_stmt(
|
||||
|
|
|
@ -4,6 +4,9 @@ version = "0.1.0"
|
|||
authors = ["M-Labs"]
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
no-escape-analysis = ["nac3core/no-escape-analysis"]
|
||||
|
||||
[dependencies]
|
||||
parking_lot = "0.12"
|
||||
nac3parser = { path = "../nac3parser" }
|
||||
|
|
Loading…
Reference in New Issue