Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/perry-codegen/src/codegen/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ pub(crate) fn inline_hot_small_max_call_sites() -> u32 {
/// (every function stays on native statepoints, the pre-#8583 behavior).
const DEFAULT_ROOT_SPILL_RELOCATIONS: usize = 32_000_000;

fn root_spill_relocation_threshold() -> usize {
pub(crate) fn root_spill_relocation_threshold() -> usize {
std::env::var("PERRY_ROOT_SPILL_RELOCATIONS")
.ok()
.and_then(|v| v.trim().parse::<usize>().ok())
Expand Down
12 changes: 12 additions & 0 deletions crates/perry-codegen/src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,18 @@ pub fn short_spread_method_capabilities(hir: &HirModule) -> Vec<ShortSpreadMetho
out
}

/// Return the exact LLVM symbol used for a top-level HIR function.
///
/// The module prefix and function component deliberately use different
/// manglers: module names keep the stable public ABI, while function names
/// use the injective member mangler so `$a` and `_a` cannot collide. Compile
/// orchestration that prepares cross-module metadata must call this helper
/// instead of reconstructing the symbol with the module-name sanitizer.
pub fn user_function_symbol(module_name: &str, function_name: &str) -> String {
let module_prefix = sanitize(module_name);
helpers::scoped_fn_name(&module_prefix, function_name)
}

/// Compile a Perry HIR module to an object file via LLVM IR.
///
/// CRITICAL (#686): `hir` MUST be `&HirModule` (shared reference), never
Expand Down
9 changes: 8 additions & 1 deletion crates/perry-codegen/src/expr/dyn_extern_i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,15 @@ pub(crate) fn lower(ctx: &mut FnCtx<'_>, expr: &Expr) -> Result<String> {
is_eval: _,
} => {
let _ = lower_expr(ctx, filename)?;
if ctx.block().is_terminated() {
return Ok(double_literal(f64::from_bits(crate::nanbox::TAG_UNDEFINED)));
}
let options_val = if let Some(options) = options {
lower_expr(ctx, options)?
let value = lower_expr(ctx, options)?;
if ctx.block().is_terminated() {
return Ok(double_literal(f64::from_bits(crate::nanbox::TAG_UNDEFINED)));
}
value
} else {
double_literal(f64::from_bits(crate::nanbox::TAG_UNDEFINED))
};
Expand Down
Loading
Loading