Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonojenkins <jo.shields+jenkins@xamarin.com>2020-11-23 20:26:11 +0300
committerGitHub <noreply@github.com>2020-11-23 20:26:11 +0300
commit61b9845d4a8ff954af1ee6b864959464d0051f8a (patch)
tree4f11eb8936aac507504e87aa817e4a21f6020df4
parentf492232b9d9dc63941bc64a3d5be640980fbcfe2 (diff)
Add support for stack walks on wasm for the reflection methods which need them. (#20605)
Fixes https://github.com/dotnet/runtime/issues/44269. Co-authored-by: vargaz <vargaz@users.noreply.github.com>
-rw-r--r--mono/mini/method-to-ir.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c
index 1586923d803..d738e7d7466 100644
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -3489,6 +3489,22 @@ method_needs_stack_walk (MonoCompile *cfg, MonoMethod *cmethod)
if (!strcmp (cmethod->name, "GetType"))
return TRUE;
}
+
+#if defined(ENABLE_NETCORE)
+ /*
+ * In corelib code, methods which need to do a stack walk declare a StackCrawlMark local and pass it as an
+ * arguments until it reaches an icall. Its hard to detect which methods do that especially with
+ * StackCrawlMark.LookForMyCallersCaller, so for now, just hardcode the classes which contain the public
+ * methods whose caller is needed.
+ */
+ if (mono_is_corlib_image (m_class_get_image (cmethod->klass))) {
+ const char *cname = m_class_get_name (cmethod->klass);
+ if (!strcmp (cname, "Assembly") ||
+ !strcmp (cname, "AssemblyLoadContext") ||
+ (!strcmp (cname, "Activator")))
+ return TRUE;
+ }
+#endif
return FALSE;
}