mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
GDScript: Perform validated calls with static methods
When the types are validated at compile time, this type of call runs faster. It is already used for instance methods, this adds this optimization to native static methods as well.
This commit is contained in:
parent
11d3768132
commit
7ca038effa
9 changed files with 330 additions and 165 deletions
|
|
@ -678,6 +678,50 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
incr += 4 + argc;
|
||||
} break;
|
||||
|
||||
case OPCODE_CALL_NATIVE_STATIC_VALIDATED_RETURN: {
|
||||
int instr_var_args = _code_ptr[++ip];
|
||||
text += "call native static method validated (return) ";
|
||||
MethodBind *method = _methods_ptr[_code_ptr[ip + 2 + instr_var_args]];
|
||||
int argc = _code_ptr[ip + 1 + instr_var_args];
|
||||
text += DADDR(1 + argc) + " = ";
|
||||
text += method->get_instance_class();
|
||||
text += ".";
|
||||
text += method->get_name();
|
||||
text += "(";
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
text += ", ";
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
incr = 4 + argc;
|
||||
} break;
|
||||
|
||||
case OPCODE_CALL_NATIVE_STATIC_VALIDATED_NO_RETURN: {
|
||||
int instr_var_args = _code_ptr[++ip];
|
||||
|
||||
text += "call native static method validated (no return) ";
|
||||
|
||||
MethodBind *method = _methods_ptr[_code_ptr[ip + 2 + instr_var_args]];
|
||||
|
||||
int argc = _code_ptr[ip + 1 + instr_var_args];
|
||||
|
||||
text += method->get_instance_class();
|
||||
text += ".";
|
||||
text += method->get_name();
|
||||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
||||
incr = 4 + argc;
|
||||
} break;
|
||||
|
||||
case OPCODE_CALL_METHOD_BIND_VALIDATED_RETURN: {
|
||||
int instr_var_args = _code_ptr[++ip];
|
||||
text += "call method-bind validated (return) ";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue