Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Don't box params on Native->C# calls with Variant params #53942

Merged
merged 2 commits into from
Nov 8, 2021

Conversation

raulsntos
Copy link
Member

@raulsntos raulsntos commented Oct 18, 2021

Backport of #44106 and #53975 to 3.x.
Also includes some changes from #37050 since they were intertwined.

bool attrs_fetched;
MonoCustomAttrInfo *attributes;
bool attrs_fetched = false;
MonoCustomAttrInfo *attributes = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What C++ version are we using in 3.x? Is this allowed?

Copy link
Member Author

@raulsntos raulsntos Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right, this C++ feature is not used in 3.x so I undid these changes.

modules/mono/mono_gd/gd_mono_property.cpp Outdated Show resolved Hide resolved
@neikeq
Copy link
Contributor

neikeq commented Oct 18, 2021

Since 3.4 is late in beta, I'll let @akien-mga decide whether he prefers to leave this for 3.4.1/3.5. It's not a breaking change but it risks introducing bugs.

@akien-mga akien-mga added this to the 3.5 milestone Oct 18, 2021
@akien-mga
Copy link
Member

Let's play it safe and wait for 3.5 then.

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.
@akien-mga akien-mga merged commit d0b1e3d into godotengine:3.x Nov 8, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants