diff options
author | George Marques <george@gmarqu.es> | 2021-04-14 14:35:51 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2021-04-14 14:35:51 -0300 |
commit | 40502a1689007f3a5995b39b30fa8987463767a4 (patch) | |
tree | a35a9178eeaf80094aeba217f56644e6ccfd9f78 /modules/gdscript/gdscript_compiler.cpp | |
parent | b4b7c97d3839170180e4f3f7c2bd3179b374057a (diff) | |
download | redot-engine-40502a1689007f3a5995b39b30fa8987463767a4.tar.gz |
GDScript: Pool temporary values by type on the stack
So the stack slots perform less type changes, which is useful for
future optimizations.
Diffstat (limited to 'modules/gdscript/gdscript_compiler.cpp')
-rw-r--r-- | modules/gdscript/gdscript_compiler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index abbca899bd..7429e3cc0b 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -711,7 +711,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code case GDScriptParser::Node::UNARY_OPERATOR: { const GDScriptParser::UnaryOpNode *unary = static_cast<const GDScriptParser::UnaryOpNode *>(p_expression); - GDScriptCodeGenerator::Address result = codegen.add_temporary(); + GDScriptCodeGenerator::Address result = codegen.add_temporary(_gdtype_from_datatype(unary->get_datatype())); GDScriptCodeGenerator::Address operand = _parse_expression(codegen, r_error, unary->operand); if (r_error) { @@ -729,7 +729,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code case GDScriptParser::Node::BINARY_OPERATOR: { const GDScriptParser::BinaryOpNode *binary = static_cast<const GDScriptParser::BinaryOpNode *>(p_expression); - GDScriptCodeGenerator::Address result = codegen.add_temporary(); + GDScriptCodeGenerator::Address result = codegen.add_temporary(_gdtype_from_datatype(binary->get_datatype())); switch (binary->operation) { case GDScriptParser::BinaryOpNode::OP_LOGIC_AND: { |