1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-30 18:30:54 +00:00

Merge pull request #113632 from Ivorforce/tracy-profile-opcodes

Add support for profiling system calls from GDScript with the tracy integration.
This commit is contained in:
Rémi Verschelde
2025-12-09 20:21:37 +01:00
3 changed files with 66 additions and 46 deletions

View File

@@ -496,7 +496,7 @@ void (*type_init_function_table[])(Variant *) = {
#define METHOD_CALL_ON_FREED_INSTANCE_ERROR(method_pointer) "Cannot call method '" + (method_pointer)->get_name() + "' on a previously freed instance."
Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Callable::CallError &r_err, CallState *p_state) {
GodotProfileZoneGroupedFirstScript(zone, this, source, name, _initial_line);
GodotProfileZoneScript(this, source, name, name, _initial_line);
OPCODES_TABLE;
@@ -1907,6 +1907,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(methodname_idx < 0 || methodname_idx >= _global_names_count);
const StringName *methodname = &_global_names_ptr[methodname_idx];
GodotProfileZoneScriptSystemCall(methodname, source, name, *methodname, line);
GET_INSTRUCTION_ARG(base, argc);
Variant **argptrs = instruction_args;
@@ -2027,6 +2029,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(_code_ptr[ip + 2] < 0 || _code_ptr[ip + 2] >= _methods_count);
MethodBind *method = _methods_ptr[_code_ptr[ip + 2]];
GodotProfileZoneScriptSystemCall(method, source, name, method->get_name(), line);
GET_INSTRUCTION_ARG(base, argc);
#ifdef DEBUG_ENABLED
@@ -2112,6 +2116,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(methodname_idx < 0 || methodname_idx >= _global_names_count);
const StringName *methodname = &_global_names_ptr[methodname_idx];
GodotProfileZoneScriptSystemCall(methodname, source, name, *methodname, line);
int argc = _code_ptr[ip + 3];
GD_ERR_BREAK(argc < 0);
@@ -2142,6 +2148,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(_code_ptr[ip + 1] < 0 || _code_ptr[ip + 1] >= _methods_count);
MethodBind *method = _methods_ptr[_code_ptr[ip + 1]];
GodotProfileZoneScriptSystemCall(method, source, name, method->get_name(), line);
int argc = _code_ptr[ip + 2];
GD_ERR_BREAK(argc < 0);
@@ -2188,6 +2196,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(_code_ptr[ip + 2] < 0 || _code_ptr[ip + 2] >= _methods_count);
MethodBind *method = _methods_ptr[_code_ptr[ip + 2]];
GodotProfileZoneScriptSystemCall(method, source, name, method->get_name(), line);
Variant **argptrs = instruction_args;
#ifdef DEBUG_ENABLED
@@ -2224,6 +2234,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(_code_ptr[ip + 2] < 0 || _code_ptr[ip + 2] >= _methods_count);
MethodBind *method = _methods_ptr[_code_ptr[ip + 2]];
GodotProfileZoneScriptSystemCall(method, source, name, method->get_name(), line);
Variant **argptrs = instruction_args;
#ifdef DEBUG_ENABLED
uint64_t call_time = 0;
@@ -2260,6 +2272,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(_code_ptr[ip + 2] < 0 || _code_ptr[ip + 2] >= _methods_count);
MethodBind *method = _methods_ptr[_code_ptr[ip + 2]];
GodotProfileZoneScriptSystemCall(method, source, name, method->get_name(), line);
GET_INSTRUCTION_ARG(base, argc);
#ifdef DEBUG_ENABLED
@@ -2312,6 +2326,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(_code_ptr[ip + 2] < 0 || _code_ptr[ip + 2] >= _methods_count);
MethodBind *method = _methods_ptr[_code_ptr[ip + 2]];
GodotProfileZoneScriptSystemCall(method, source, name, method->get_name(), line);
GET_INSTRUCTION_ARG(base, argc);
#ifdef DEBUG_ENABLED
bool freed = false;
@@ -2483,6 +2499,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#endif
const StringName *methodname = &_global_names_ptr[self_fun];
GodotProfileZoneScriptSystemCall(methodname, source, name, *methodname, line);
Variant **argptrs = instruction_args;
GET_INSTRUCTION_ARG(dst, argc);