From fefb17524c60770f6d48688d43adaf33e64ce159 Mon Sep 17 00:00:00 2001 From: arookas Date: Fri, 5 Feb 2016 01:55:48 -0500 Subject: [PATCH] Only write MKFR if there are actually locals Saves a single instruction, but only sometimes. Woo! --- ssc/symbol.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ssc/symbol.cs b/ssc/symbol.cs index f4aa53c..655dcce 100644 --- a/ssc/symbol.cs +++ b/ssc/symbol.cs @@ -207,7 +207,10 @@ namespace arookas { compiler.Context.Scopes.DeclareVariable(parameter); // since there is no AST node for these, they won't affect MaxLocalCount } compiler.Binary.WriteMKDS(1); - compiler.Binary.WriteMKFR(mBody.LocalCount); + var locals = mBody.LocalCount; + if (locals > 0) { + compiler.Binary.WriteMKFR(locals); + } mBody.Compile(compiler); compiler.Binary.WriteRET0(); compiler.Context.Scopes.Pop(compiler);