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