GDScript: Add faster instruction for validated constructor

Only for built-in types.
This commit is contained in:
George Marques 2020-11-18 11:37:08 -03:00
parent e0dca3c6b6
commit 5518e2a68e
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
5 changed files with 112 additions and 3 deletions

View file

@ -384,7 +384,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
} break;
case OPCODE_CONSTRUCT: {
Variant::Type t = Variant::Type(_code_ptr[ip + 3 + instr_var_args]);
int argc = _code_ptr[ip + 2 + instr_var_args];
int argc = _code_ptr[ip + 1 + instr_var_args];
text += "construct ";
text += DADDR(1 + argc);
@ -400,6 +400,23 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr = 3 + instr_var_args;
} break;
case OPCODE_CONSTRUCT_VALIDATED: {
int argc = _code_ptr[ip + 1 + instr_var_args];
text += "construct validated ";
text += DADDR(1 + argc);
text += " = ";
text += "<unkown type>(";
for (int i = 0; i < argc; i++) {
if (i > 0)
text += ", ";
text += DADDR(i + 1);
}
text += ")";
incr = 3 + instr_var_args;
} break;
case OPCODE_CONSTRUCT_ARRAY: {
int argc = _code_ptr[ip + 1 + instr_var_args];
text += " make_array ";