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

[wasm] test case for broken .locals init #71387

Closed
wants to merge 2 commits into from

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Jun 28, 2022

See #71425

@ghost
Copy link

ghost commented Jun 28, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

New unit test System.Runtime.InteropServices.JavaScript.Tests.JavaScriptTests
showing that it takes 1000 calls to JS to expose un-initialised out int something argument on icall.
Only when in Release and with [MethodImpl(MethodImplOptions.AggressiveInlining)]

Author: pavelsavara
Assignees: pavelsavara
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript

Milestone: -

@pavelsavara
Copy link
Member Author

cc @vargaz

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vargaz
Copy link
Contributor

vargaz commented Jun 29, 2022

Seems to be caused by the tiering code.
@BrzVlad

@BrzVlad
Copy link
Member

BrzVlad commented Jun 29, 2022

This just looks like #37955. Is this showing somewhere relevant ?

@vargaz
Copy link
Contributor

vargaz commented Jun 29, 2022

The failure seems to happen when tiering up.

@BrzVlad
Copy link
Member

BrzVlad commented Jun 29, 2022

The failure seems to happen when tiering up.

Because this issue was always present with optimized code (with inlining). It's not related to tiering.

@pavelsavara
Copy link
Member Author

This just looks like #37955. Is this showing somewhere relevant ?

I can avoid it in the interop code which lead me to discovery of this.
But BCL full AggressiveInlining, that would break there too, right ?

@BrzVlad
Copy link
Member

BrzVlad commented Jun 30, 2022

@pavelsavara This issue doesn't happen normally because C# requires you to initialize all vars explicitly.

@pavelsavara
Copy link
Member Author

But BCL is also full of PInvoke. Are there reasons why this is not worth fixing ?

@BrzVlad
Copy link
Member

BrzVlad commented Jun 30, 2022

I'm not sure I understand why this is a problem. The pinvoke signature has the argument defined as out. So this logically means that this argument passes no value and the native code is responsible to initialize it to whatever the result of the pinvoke is. Why would the native code rely on this variable to be already initialized to 0, given that it has to write the result to it ? If the pinvoke does expect a certain value, then you should pass ref and C# would force you to initialize the variable.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 30, 2022
@pavelsavara pavelsavara deleted the locals_init_repro branch November 29, 2022 16:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants