GDScript: Add faster call instructions for builtin methods

Methods from builtin types can be called by using the function pointer
when the argument and base types are known at compile time.
This commit is contained in:
George Marques 2020-11-18 10:32:28 -03:00
parent d8b22097f2
commit 52ab64db69
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
7 changed files with 125 additions and 0 deletions

View file

@ -572,6 +572,27 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
DISASSEMBLE_PTRCALL(PACKED_VECTOR3_ARRAY);
DISASSEMBLE_PTRCALL(PACKED_COLOR_ARRAY);
case OPCODE_CALL_BUILTIN_TYPE_VALIDATED: {
int argc = _code_ptr[ip + 1 + instr_var_args];
text += "call-builtin-method validated ";
text += DADDR(2 + argc) + " = ";
text += DADDR(1) + ".";
text += "<unknown method>";
text += "(";
for (int i = 0; i < argc; i++) {
if (i > 0)
text += ", ";
text += DADDR(1 + i);
}
text += ")";
incr = 5 + argc;
} break;
case OPCODE_CALL_BUILT_IN: {
text += "call-built-in ";