Skip to content

Commit

Permalink
[mono][jit] Fix clearing of LastError (#57127)
Browse files Browse the repository at this point in the history
* [mono][jit] Fix clearing of LastError

The clearing was added as part of CEE_CALL and CEE_CALLVIRT opcodes instead of CEE_CALLI which is actually used for pinvoke calls.

* Disable test

We can't enable this test on wasm due to dynamic library lookup limitation

On android we seem to have some sort of issue with the runtime tests causing the pinvokes failing to be resolved
  • Loading branch information
BrzVlad authored Aug 12, 2021
1 parent c8dc49e commit 60f1105
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/mono/mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -7088,6 +7088,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
inst_tailcall && is_supported_tailcall (cfg, ip, method, NULL, fsig,
FALSE/*virtual irrelevant*/, addr != NULL, &tailcall);

if (save_last_error)
mono_emit_jit_icall (cfg, mono_marshal_clear_last_error, NULL);

if (callee) {
if (method->wrapper_type != MONO_WRAPPER_DELEGATE_INVOKE)
/* Not tested */
Expand Down Expand Up @@ -7589,10 +7592,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}
}

if (save_last_error) {
mono_emit_jit_icall (cfg, mono_marshal_clear_last_error, NULL);
}

/* Tail prefix / tailcall optimization */

/* FIXME: Enabling TAILC breaks some inlining/stack trace/etc tests.
Expand Down
9 changes: 6 additions & 3 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1236,9 +1236,6 @@
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/SafeHandles/**">
<Issue>https://github.com/dotnet/runtime/issues/48084</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/SetLastError/**">
<Issue>https://github.com/dotnet/runtime/issues/51600</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/SizeParamIndex/PInvoke/Invalid/InvalidParamIndex/**">
<Issue>needs triage</Issue>
</ExcludeList>
Expand Down Expand Up @@ -2426,6 +2423,9 @@
<ExcludeList Include = "$(XunitTestBinBase)/Interop/PInvoke/Primitives/Int/PInvokeIntTest/**">
<Issue>https://github.com/dotnet/runtime/issues/41519</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/SetLastError/**">
<Issue>https://github.com/dotnet/runtime/issues/41519</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/Interop/SuppressGCTransition/SuppressGCTransitionTest/**">
<Issue>https://github.com/dotnet/runtime/issues/41519</Issue>
</ExcludeList>
Expand Down Expand Up @@ -2735,6 +2735,9 @@
<ExcludeList Include = "$(XunitTestBinBase)/Interop/PInvoke/Primitives/Pointer/NonBlittablePointer/**">
<Issue>needs triage</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/Interop/PInvoke/SetLastError/**">
<Issue>needs triage</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/Interop/SuppressGCTransition/SuppressGCTransitionTest/**">
<Issue>needs triage</Issue>
</ExcludeList>
Expand Down

0 comments on commit 60f1105

Please sign in to comment.