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

[mono][interp] Throw invalid program if stack state is invalid #73215

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Aug 2, 2022

Rather than printing warning and then overflowing the stack info buffer. Store error in TransformData to reduce code size.

Fixes #54395

@ghost
Copy link

ghost commented Aug 2, 2022

Tagging subscribers to this area: @BrzVlad
See info in area-owners.md if you want to be subscribed.

Issue Details

Rather than printing warning and then overflowing the stack info buffer. Store error in TransformData to reduce code size.

Fixes #54395

Author: BrzVlad
Assignees: -
Labels:

area-Codegen-Interpreter-mono

Milestone: -

@lewing
Copy link
Member

lewing commented Aug 5, 2022

I think the failure here is that there is an UnmanagedCallersOnly attribute on a function that isn't binding correctly but will never be called (if is guarded by a platform check).

@lewing
Copy link
Member

lewing commented Aug 5, 2022

@maraf

System.PlatformNotSupportedException : No native to managed transition for method 'int System.Tests.TimeZoneInfoTests/WindowsUILanguageHelper:EnumUiLanguagesCallback (char*,intptr)', missing [UnmanagedCallersOnly] attribute. the attribute is there but can you check that the managed and unmanaged name mangling produce the same thing result in this case?

@maraf
Copy link
Member

maraf commented Aug 9, 2022

System.PlatformNotSupportedException : No native to managed transition for method 'int System.Tests.TimeZoneInfoTests/WindowsUILanguageHelper:EnumUiLanguagesCallback (char*,intptr)', missing [UnmanagedCallersOnly] attribute. the attribute is there but can you check that the managed and unmanaged name mangling produce the same thing result in this case?

Bin log says

Could not get pinvoke, or callbacks for method EnumUILanguages: System.NotSupportedException: Parsing function pointer types in signatures is not supported.
   at System.Reflection.TypeLoading.Ecma.EcmaModule.GetFunctionPointerType(MethodSignature`1 signature)
   at System.Reflection.Metadata.Ecma335.SignatureDecoder`2.DecodeType(BlobReader& blobReader, Boolean allowTypeSpecifications, Int32 typeCode)
   at System.Reflection.Metadata.Ecma335.SignatureDecoder`2.DecodeMethodSignature(BlobReader& blobReader)
   at System.Reflection.TypeLoading.Ecma.EcmaMethodDecoder.SpecializeMethodSig(IRoMethodBase roMethodBase)
   at System.Reflection.TypeLoading.RoDefinitionMethod`1.ComputeMethodSig()
   at System.Reflection.TypeLoading.RoMethod.get_ReturnType()
   at SignatureMapper.MethodToSignature(MethodInfo method) in C:\Development\dotnet\runtime\src\tasks\WasmAppBuilder\SignatureMapper.cs:line 54
   at PInvokeTableGenerator.<CollectPInvokes>g__CollectPInvokesForMethod|7_0(MethodInfo method, <>c__DisplayClass7_0&) in C:\Development\dotnet\runtime\src\tasks\WasmAppBuilder\PInvokeTableGenerator.cs:line 88
   at PInvokeTableGenerator.CollectPInvokes(List`1 pinvokes, List`1 callbacks, List`1 signatures, Type type) in C:\Development\dotnet\runtime\src\tasks\WasmAppBuilder\PInvokeTableGenerator.cs:line 70

It's the one that the System.Reflection.MetadataLoadContext doesn't support function pointer types. So we don't have a trampoline.

Anyway I don't understand why it's triggered on this PR. The WindowsUILanguageHelper.EnumUiLanguagesCallback is guarded by OperatingSystem.IsWindows() and should never get called on wasm.

Rather than printing warning and then overflowing the stack info buffer. Store error in TransformData to reduce code size.
@BrzVlad BrzVlad merged commit b5da2c6 into dotnet:main Dec 12, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants