summaryrefslogtreecommitdiff
path: root/modules/mono/editor
diff options
context:
space:
mode:
authorRaul Santos <raulsntos@gmail.com>2022-11-25 20:27:36 +0100
committerRaul Santos <raulsntos@gmail.com>2022-11-27 03:04:34 +0100
commit3ff181096ac247c1613b1a535726949af3b01b46 (patch)
treebb3cd623a0602a61bf1cfcb6da48e58540770ac1 /modules/mono/editor
parentc7ceb94e372216b1b033d7c2ac26d5b7545c4dac (diff)
C#: Remove VariantSpanDisposer and use constants in stackalloc
- Remove `VariantSpanDisposer`, no need to dispose of the Variant Spans since we are now borrowing the Variants instead of copying them. - Remove `VariantSpanExtensions.Cleared` that was only used so the Span was initialized for `VariantSpanDisposer` to know what to dispose. - Fix stackalloc Spans to use constant VarArgsSpanThreshold and avoid bound checks.
Diffstat (limited to 'modules/mono/editor')
-rw-r--r--modules/mono/editor/bindings_generator.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 82b5f478e1..9185506776 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -2542,15 +2542,13 @@ Error BindingsGenerator::_generate_cs_native_calls(const InternalCall &p_icall,
<< INDENT2 "int total_length = " << real_argc_str << " + vararg_length;\n";
r_output << INDENT2 "Span<godot_variant.movable> varargs_span = vararg_length <= VarArgsSpanThreshold ?\n"
- << INDENT3 "stackalloc godot_variant.movable[VarArgsSpanThreshold].Cleared() :\n"
+ << INDENT3 "stackalloc godot_variant.movable[VarArgsSpanThreshold] :\n"
<< INDENT3 "new godot_variant.movable[vararg_length];\n";
r_output << INDENT2 "Span<IntPtr> " C_LOCAL_PTRCALL_ARGS "_span = total_length <= VarArgsSpanThreshold ?\n"
<< INDENT3 "stackalloc IntPtr[VarArgsSpanThreshold] :\n"
<< INDENT3 "new IntPtr[total_length];\n";
- r_output << INDENT2 "using var variantSpanDisposer = new VariantSpanDisposer(varargs_span);\n";
-
r_output << INDENT2 "fixed (godot_variant.movable* varargs = &MemoryMarshal.GetReference(varargs_span))\n"
<< INDENT2 "fixed (IntPtr* " C_LOCAL_PTRCALL_ARGS " = "
"&MemoryMarshal.GetReference(" C_LOCAL_PTRCALL_ARGS "_span))\n"