Less aggressive inlining in debug builds

Being too aggressive about inlining in debug builds can result in huge
stack frames building up when inlined functions are contained in
non-tail-recursive, non-inlined function calls. This easily hits stack
overflows, so avoid it.
This commit is contained in:
Ayaz Hafiz 2022-10-26 14:20:40 -05:00
parent 91dd47c5e4
commit aa8a7b1ebc
No known key found for this signature in database
GPG Key ID: 0E2A37416A25EF58

View File

@ -224,7 +224,7 @@ pub fn num_literal(
constraints.exists([num_var], and_constraint)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn builtin_type(symbol: Symbol, args: Vec<Type>) -> Type {
Type::Apply(
symbol,
@ -233,23 +233,23 @@ pub fn builtin_type(symbol: Symbol, args: Vec<Type>) -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn empty_list_type(var: Variable) -> Type {
list_type(Type::Variable(var))
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn list_type(typ: Type) -> Type {
builtin_type(Symbol::LIST_LIST, vec![typ])
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn str_type() -> Type {
builtin_type(Symbol::STR_STR, Vec::new())
}
#[inline(always)]
fn builtin_alias(
#[cfg_attr(not(debug_assertions), inline(always))]
fn builtin_num_alias(
symbol: Symbol,
type_arguments: Vec<OptAbleType>,
actual: Box<Type>,
@ -264,9 +264,9 @@ fn builtin_alias(
}
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn num_float(range: Type) -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_FRAC,
vec![OptAbleType::unbound(range.clone())],
Box::new(num_num(num_floatingpoint(range))),
@ -274,9 +274,9 @@ pub fn num_float(range: Type) -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn num_floatingpoint(range: Type) -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_FLOATINGPOINT,
vec![OptAbleType::unbound(range.clone())],
Box::new(range),
@ -284,9 +284,9 @@ pub fn num_floatingpoint(range: Type) -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn num_u32() -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_U32,
vec![],
Box::new(num_int(num_unsigned32())),
@ -294,9 +294,9 @@ pub fn num_u32() -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
fn num_unsigned32() -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_UNSIGNED32,
vec![],
Box::new(Type::EmptyTagUnion),
@ -304,9 +304,9 @@ fn num_unsigned32() -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn num_binary64() -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_BINARY64,
vec![],
Box::new(Type::EmptyTagUnion),
@ -314,9 +314,9 @@ pub fn num_binary64() -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn num_int(range: Type) -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_INT,
vec![OptAbleType::unbound(range.clone())],
Box::new(num_num(num_integer(range))),
@ -324,9 +324,9 @@ pub fn num_int(range: Type) -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn num_signed64() -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_SIGNED64,
vec![],
Box::new(Type::EmptyTagUnion),
@ -334,9 +334,9 @@ pub fn num_signed64() -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn num_integer(range: Type) -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_INTEGER,
vec![OptAbleType::unbound(range.clone())],
Box::new(range),
@ -344,9 +344,9 @@ pub fn num_integer(range: Type) -> Type {
)
}
#[inline(always)]
#[cfg_attr(not(debug_assertions), inline(always))]
pub fn num_num(typ: Type) -> Type {
builtin_alias(
builtin_num_alias(
Symbol::NUM_NUM,
vec![OptAbleType::unbound(typ.clone())],
Box::new(typ),