Skip to content

Commit 688aed9

Browse files
committed
1.0.9b
1 parent 0920563 commit 688aed9

3 files changed

Lines changed: 27 additions & 23 deletions

File tree

Packages/blueamulet.udonsharpoptimizer/Editor/Optimizer.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Unofficial UdonSharp Optimizer
33
* The Optimizer.
4-
* Version 1.0.9
4+
* Version 1.0.9b
55
* Written by BlueAmulet
66
*/
77

@@ -458,7 +458,8 @@ internal static void OptimizeProgram(EmitContext moduleEmitContext)
458458
// Observe what block variables are in for later
459459
if (settings.EnableBlockReduction)
460460
{
461-
if (hasJump.Contains(instrs[i]))
461+
// If previous instruction is a jump but the next isn't in hasJump, it was a call to another udon function
462+
if (hasJump.Contains(instrs[i]) || (i > 0 && instrs[i - 1] is JumpInstruction))
462463
{
463464
currentBlock++;
464465
}
@@ -519,7 +520,8 @@ internal static void OptimizeProgram(EmitContext moduleEmitContext)
519520
{
520521
AssemblyInstruction instr = instrs[i];
521522
int skip = 0;
522-
if (hasJump.Contains(instr))
523+
// If previous instruction is a jump but the next isn't in hasJump, it was a call to another udon function
524+
if (hasJump.Contains(instr) || (i > 0 && instrs[i - 1] is JumpInstruction))
523525
{
524526
blockCounters.Clear();
525527
}

Packages/blueamulet.udonsharpoptimizer/README.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ No permanent changes are made to the VRCSDK, all changes are made in memory and
88
The USOPatch.dll included is part of the non permanent change system, allowing the optimizer access to UdonSharp's internals. The source code for this dll is included in the USOPatch folder
99

1010
Changelog:
11-
1.0.0 - Initial 2022 version
12-
1.0.1 - 2024 Update
13-
1.0.2 - Fixed switch statements
14-
1.0.3 - Reduced number of variables
15-
1.0.4 - __this_ fix for even less variables
16-
1.0.5 - Added ExternWrite+Copy check for variables, added missing jump checks
17-
1.0.6 - Added tail call optimization
18-
1.0.7 - Single .unitypackage installation
19-
1.0.8 - Added basic Settings panel
20-
1.0.9 - Moved TCO into first pass, added block based variable reduction
11+
1.0.0 - Initial 2022 version
12+
1.0.1 - 2024 Update
13+
1.0.2 - Fixed switch statements
14+
1.0.3 - Reduced number of variables
15+
1.0.4 - __this_ fix for even less variables
16+
1.0.5 - Added ExternWrite+Copy check for variables, added missing jump checks
17+
1.0.6 - Added tail call optimization
18+
1.0.7 - Single .unitypackage installation
19+
1.0.8 - Added basic Settings panel
20+
1.0.9 - Moved TCO into first pass, added block based variable reduction
21+
1.0.9b - Fixed udon functions destroying variables in other functions

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ Any call to another Udon function followed by a return, can have its setup and t
1717
UdonSharp makes a *LOT* of temporary variables. We detect places where we can reuse existing temporary variables instead of creating new ones. This does not make the program faster but does make the program smaller.
1818

1919
## Changelog
20-
1.0.0 - Initial 2022 version
21-
1.0.1 - 2024 Update
22-
1.0.2 - Fixed switch statements
23-
1.0.3 - Reduced number of variables
24-
1.0.4 - __this_ fix for even less variables
25-
1.0.5 - Added ExternWrite+Copy check for variables, added missing jump checks
26-
1.0.6 - Added tail call optimization
27-
1.0.7 - Single .unitypackage installation
28-
1.0.8 - Added basic Settings panel
29-
1.0.9 - Moved TCO into first pass, added block based variable reduction
20+
1.0.0 - Initial 2022 version
21+
1.0.1 - 2024 Update
22+
1.0.2 - Fixed switch statements
23+
1.0.3 - Reduced number of variables
24+
1.0.4 - __this_ fix for even less variables
25+
1.0.5 - Added ExternWrite+Copy check for variables, added missing jump checks
26+
1.0.6 - Added tail call optimization
27+
1.0.7 - Single .unitypackage installation
28+
1.0.8 - Added basic Settings panel
29+
1.0.9 - Moved TCO into first pass, added block based variable reduction
30+
1.0.9b - Fixed udon functions destroying variables in other functions

0 commit comments

Comments
 (0)