Skip to content

Commit

Permalink
1.0.9b
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueAmulet committed Sep 15, 2024
1 parent 0920563 commit 688aed9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
8 changes: 5 additions & 3 deletions Packages/blueamulet.udonsharpoptimizer/Editor/Optimizer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Unofficial UdonSharp Optimizer
* The Optimizer.
* Version 1.0.9
* Version 1.0.9b
* Written by BlueAmulet
*/

Expand Down Expand Up @@ -458,7 +458,8 @@ internal static void OptimizeProgram(EmitContext moduleEmitContext)
// Observe what block variables are in for later
if (settings.EnableBlockReduction)
{
if (hasJump.Contains(instrs[i]))
// If previous instruction is a jump but the next isn't in hasJump, it was a call to another udon function
if (hasJump.Contains(instrs[i]) || (i > 0 && instrs[i - 1] is JumpInstruction))
{
currentBlock++;
}
Expand Down Expand Up @@ -519,7 +520,8 @@ internal static void OptimizeProgram(EmitContext moduleEmitContext)
{
AssemblyInstruction instr = instrs[i];
int skip = 0;
if (hasJump.Contains(instr))
// If previous instruction is a jump but the next isn't in hasJump, it was a call to another udon function
if (hasJump.Contains(instr) || (i > 0 && instrs[i - 1] is JumpInstruction))
{
blockCounters.Clear();
}
Expand Down
21 changes: 11 additions & 10 deletions Packages/blueamulet.udonsharpoptimizer/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ No permanent changes are made to the VRCSDK, all changes are made in memory and
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

Changelog:
1.0.0 - Initial 2022 version
1.0.1 - 2024 Update
1.0.2 - Fixed switch statements
1.0.3 - Reduced number of variables
1.0.4 - __this_ fix for even less variables
1.0.5 - Added ExternWrite+Copy check for variables, added missing jump checks
1.0.6 - Added tail call optimization
1.0.7 - Single .unitypackage installation
1.0.8 - Added basic Settings panel
1.0.9 - Moved TCO into first pass, added block based variable reduction
1.0.0 - Initial 2022 version
1.0.1 - 2024 Update
1.0.2 - Fixed switch statements
1.0.3 - Reduced number of variables
1.0.4 - __this_ fix for even less variables
1.0.5 - Added ExternWrite+Copy check for variables, added missing jump checks
1.0.6 - Added tail call optimization
1.0.7 - Single .unitypackage installation
1.0.8 - Added basic Settings panel
1.0.9 - Moved TCO into first pass, added block based variable reduction
1.0.9b - Fixed udon functions destroying variables in other functions
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ Any call to another Udon function followed by a return, can have its setup and t
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.

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

0 comments on commit 688aed9

Please sign in to comment.