WIP fix stack overflow

This commit is contained in:
2025-12-14 02:54:56 -07:00
parent 30b564a153
commit b7fbc499b6
5 changed files with 15 additions and 4 deletions

View File

@@ -14,6 +14,10 @@ pub fn find_leaf_functions(instructions: &[InstructionNode]) -> HashSet<String>
for node in instructions {
match &node.instruction {
Instruction::LabelDef(label) => {
if label.starts_with("__internal_L") {
continue;
}
// If we were tracking a function, and it remained a leaf until now, save it.
if let Some(name) = current_label.take()
&& is_current_leaf

View File

@@ -99,7 +99,7 @@ fn optimize_leaf_functions<'a>(
// First scan: Identify instructions to remove and capture RA offsets
for (i, node) in input.iter().enumerate() {
match &node.instruction {
Instruction::LabelDef(label) => {
Instruction::LabelDef(label) if !label.starts_with("__internal_L") => {
current_function = Some(label.to_string());
function_start_indices.insert(label.to_string(), i);
}