Skip to content

Commit

Permalink
Add support for stack walks on wasm for the reflection methods which …
Browse files Browse the repository at this point in the history
…need them. (#45076)

Fixes #44269.
  • Loading branch information
vargaz authored Nov 23, 2020
1 parent 65d42f0 commit e274015
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/mono/mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit e274015

Please sign in to comment.