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.
This commit is contained in:
Ignacio Etcheverry 2020-12-05 00:19:15 +01:00 committed by Raul Santos
parent a05aefb74b
commit b775573a21
12 changed files with 712 additions and 649 deletions

View file

@ -2479,7 +2479,7 @@ bool CSharpScript::_get_signal(GDMonoClass *p_class, GDMonoClass *p_delegate, Ve
if (mono_type_get_type(raw_type) == MONO_TYPE_CLASS) {
// Arguments are accessibles as arguments of .Invoke method
GDMonoMethod *invoke = p_delegate->get_method("Invoke", -1);
GDMonoMethod *invoke = p_delegate->get_method(mono_get_delegate_invoke(p_delegate->get_mono_ptr()));
Vector<StringName> names;
Vector<ManagedType> types;