summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd/gd_mono_property.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2020-12-05 00:19:15 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2020-12-06 01:36:20 +0100
commita946f84e3d115ed313dbe511ba33390fc204fd11 (patch)
treed54c84a63610ece78682af754a8677868cbd7ad2 /modules/mono/mono_gd/gd_mono_property.cpp
parent04bef80b42408f45d7838f9ef29f0e0553957475 (diff)
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_property.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono_property.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/mono/mono_gd/gd_mono_property.cpp b/modules/mono/mono_gd/gd_mono_property.cpp
index bc3be97102..1027c08a4a 100644
--- a/modules/mono/mono_gd/gd_mono_property.cpp
+++ b/modules/mono/mono_gd/gd_mono_property.cpp
@@ -149,10 +149,9 @@ bool GDMonoProperty::has_setter() {
void GDMonoProperty::set_value(MonoObject *p_object, MonoObject *p_value, MonoException **r_exc) {
MonoMethod *prop_method = mono_property_get_set_method(mono_property);
- MonoArray *params = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(MonoObject), 1);
- mono_array_setref(params, 0, p_value);
+ void *params[1] = { p_value };
MonoException *exc = nullptr;
- GDMonoUtils::runtime_invoke_array(prop_method, p_object, params, &exc);
+ GDMonoUtils::runtime_invoke(prop_method, p_object, params, &exc);
if (exc) {
if (r_exc) {
*r_exc = exc;