From 6d5c179eac1b82cefda03e576a974068367a5f77 Mon Sep 17 00:00:00 2001 From: Devin Bidwell Date: Sun, 14 Dec 2025 03:16:58 -0700 Subject: [PATCH] Fixed stack overflow due to improper handling of leaf functions --- Changelog.md | 4 ++++ ModData/About/About.xml | 2 +- csharp_mod/Plugin.cs | 2 +- csharp_mod/stationeersSlang.csproj | 2 +- rust_compiler/Cargo.lock | 2 +- rust_compiler/Cargo.toml | 2 +- rust_compiler/libs/optimizer/src/lib.rs | 4 +++- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Changelog.md b/Changelog.md index d2179ce..46dc71e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Changelog +[0.3.2] + +- Fixed stack overflow due to incorrect optimization of 'leaf' functions + [0.3.1] - Fixed possible `KeyNotFoundException` in C# code due to invalid diff --git a/ModData/About/About.xml b/ModData/About/About.xml index d3a0e4f..23fe752 100644 --- a/ModData/About/About.xml +++ b/ModData/About/About.xml @@ -2,7 +2,7 @@ Slang JoeDiertay - 0.3.1 + 0.3.2 [h1]Slang: High-Level Programming for Stationeers[/h1] diff --git a/csharp_mod/Plugin.cs b/csharp_mod/Plugin.cs index 36123c5..339cf1b 100644 --- a/csharp_mod/Plugin.cs +++ b/csharp_mod/Plugin.cs @@ -41,7 +41,7 @@ namespace Slang { public const string PluginGuid = "com.biddydev.slang"; public const string PluginName = "Slang"; - public const string PluginVersion = "0.3.1"; + public const string PluginVersion = "0.3.2"; public static Mod MOD = new Mod(PluginName, PluginVersion); diff --git a/csharp_mod/stationeersSlang.csproj b/csharp_mod/stationeersSlang.csproj index 57a61e0..3e4c048 100644 --- a/csharp_mod/stationeersSlang.csproj +++ b/csharp_mod/stationeersSlang.csproj @@ -5,7 +5,7 @@ enable StationeersSlang Slang Compiler Bridge - 0.3.1 + 0.3.2 true latest diff --git a/rust_compiler/Cargo.lock b/rust_compiler/Cargo.lock index 17bf0df..511d7ef 100644 --- a/rust_compiler/Cargo.lock +++ b/rust_compiler/Cargo.lock @@ -930,7 +930,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "slang" -version = "0.3.1" +version = "0.3.2" dependencies = [ "anyhow", "clap", diff --git a/rust_compiler/Cargo.toml b/rust_compiler/Cargo.toml index 5b2305a..260e0c0 100644 --- a/rust_compiler/Cargo.toml +++ b/rust_compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "slang" -version = "0.3.1" +version = "0.3.2" edition = "2021" [workspace] diff --git a/rust_compiler/libs/optimizer/src/lib.rs b/rust_compiler/libs/optimizer/src/lib.rs index ffd97e1..ea75c06 100644 --- a/rust_compiler/libs/optimizer/src/lib.rs +++ b/rust_compiler/libs/optimizer/src/lib.rs @@ -174,7 +174,9 @@ fn optimize_leaf_functions<'a>( continue; // SKIP (Remove) } - if let Instruction::LabelDef(l) = &node.instruction { + if let Instruction::LabelDef(l) = &node.instruction + && !l.starts_with("__internal_L") + { processing_function = Some(l.to_string()); }