Only write MKFR if there are actually locals
Saves a single instruction, but only sometimes. Woo!
This commit is contained in:
parent
9749b81452
commit
fefb17524c
1 changed files with 4 additions and 1 deletions
|
@ -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.Context.Scopes.DeclareVariable(parameter); // since there is no AST node for these, they won't affect MaxLocalCount
|
||||||
}
|
}
|
||||||
compiler.Binary.WriteMKDS(1);
|
compiler.Binary.WriteMKDS(1);
|
||||||
compiler.Binary.WriteMKFR(mBody.LocalCount);
|
var locals = mBody.LocalCount;
|
||||||
|
if (locals > 0) {
|
||||||
|
compiler.Binary.WriteMKFR(locals);
|
||||||
|
}
|
||||||
mBody.Compile(compiler);
|
mBody.Compile(compiler);
|
||||||
compiler.Binary.WriteRET0();
|
compiler.Binary.WriteRET0();
|
||||||
compiler.Context.Scopes.Pop(compiler);
|
compiler.Context.Scopes.Pop(compiler);
|
||||||
|
|
Loading…
Reference in a new issue