diff options
| author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-12-05 00:19:15 +0100 |
|---|---|---|
| committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-12-06 01:36:20 +0100 |
| commit | a946f84e3d115ed313dbe511ba33390fc204fd11 (patch) | |
| tree | d54c84a63610ece78682af754a8677868cbd7ad2 /modules/mono/mono_gd/gd_mono_class.h | |
| parent | 04bef80b42408f45d7838f9ef29f0e0553957475 (diff) | |
| download | redot-engine-a946f84e3d115ed313dbe511ba33390fc204fd11.tar.gz | |
Don't box params on Native->C# calls with Variant params
Godot uses Variant parameters for calls to script methods.
Up until now we were boxing such parameters when marshalling
them for invokation, even if they were value types.
Now Godot allocates the marshalled parameters on the stack,
reducing the GC allocations resulted from boxing.
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_class.h')
| -rw-r--r-- | modules/mono/mono_gd/gd_mono_class.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/mono/mono_gd/gd_mono_class.h b/modules/mono/mono_gd/gd_mono_class.h index 87db2fa033..b93dfec30a 100644 --- a/modules/mono/mono_gd/gd_mono_class.h +++ b/modules/mono/mono_gd/gd_mono_class.h @@ -59,13 +59,12 @@ class GDMonoClass { MethodKey() {} - MethodKey(const StringName &p_name, int p_params_count) { - name = p_name; - params_count = p_params_count; + MethodKey(const StringName &p_name, uint16_t p_params_count) : + name(p_name), params_count(p_params_count) { } StringName name; - int params_count; + uint16_t params_count = 0; }; StringName namespace_name; @@ -139,10 +138,10 @@ public: bool implements_interface(GDMonoClass *p_interface); bool has_public_parameterless_ctor(); - GDMonoMethod *get_method(const StringName &p_name, int p_params_count = 0); + GDMonoMethod *get_method(const StringName &p_name, uint16_t p_params_count = 0); GDMonoMethod *get_method(MonoMethod *p_raw_method); GDMonoMethod *get_method(MonoMethod *p_raw_method, const StringName &p_name); - GDMonoMethod *get_method(MonoMethod *p_raw_method, const StringName &p_name, int p_params_count); + GDMonoMethod *get_method(MonoMethod *p_raw_method, const StringName &p_name, uint16_t p_params_count); GDMonoMethod *get_method_with_desc(const String &p_description, bool p_include_namespace); GDMonoField *get_field(const StringName &p_name); |
