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

@ -190,6 +190,7 @@ public:
OPCODE_CALL_RETURN,
OPCODE_CALL_ASYNC,
OPCODE_CALL_BUILT_IN,
OPCODE_CALL_BUILTIN_TYPE_VALIDATED,
OPCODE_CALL_SELF_BASE,
OPCODE_CALL_METHOD_BIND,
OPCODE_CALL_METHOD_BIND_RET,
@ -300,6 +301,8 @@ private:
const Variant::ValidatedIndexedSetter *_indexed_setters_ptr = nullptr;
int _indexed_getters_count = 0;
const Variant::ValidatedIndexedGetter *_indexed_getters_ptr = nullptr;
int _builtin_methods_count = 0;
const Variant::ValidatedBuiltInMethod *_builtin_methods_ptr = nullptr;
int _methods_count = 0;
MethodBind **_methods_ptr = nullptr;
const int *_code_ptr = nullptr;
@ -326,6 +329,7 @@ private:
Vector<Variant::ValidatedKeyedGetter> keyed_getters;
Vector<Variant::ValidatedIndexedSetter> indexed_setters;
Vector<Variant::ValidatedIndexedGetter> indexed_getters;
Vector<Variant::ValidatedBuiltInMethod> builtin_methods;
Vector<MethodBind *> methods;
Vector<int> code;
Vector<GDScriptDataType> argument_types;