forked from M-Labs/nac3
1
0
Fork 0

core: Add compile-time feature to disable escape analysis

This commit is contained in:
David Mak 2024-07-12 14:00:46 +08:00 committed by sb10q
parent 432c81a500
commit 9e0601837a
4 changed files with 24 additions and 13 deletions

View File

@ -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"]

View File

@ -4,6 +4,9 @@ version = "0.1.0"
authors = ["M-Labs"]
edition = "2021"
[features]
no-escape-analysis = []
[dependencies]
itertools = "0.13"
crossbeam = "0.8"

View File

@ -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
/// 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,
@ -227,6 +230,7 @@ impl<'a> Inferencer<'a> {
_ => false,
}
}
}
// check statements for proper identifier def-use and return on all paths
fn check_stmt(

View File

@ -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" }