diff options
author | Bernhard Urban-Forster <lewurm@gmail.com> | 2020-04-29 22:17:06 +0300 |
---|---|---|
committer | Bernhard Urban-Forster <lewurm@gmail.com> | 2020-04-29 22:17:06 +0300 |
commit | 1f0d847e1f5ae1a3e7b1f73399868c3432a25d0b (patch) | |
tree | 5253cd1cdf8bd0f252bf6b83614400779d3b5d2c | |
parent | fc40159320dc862e699256dec2bce5dbea04b165 (diff) |
[interp] extend imethod-copy to all threads
-rwxr-xr-x | mono/mini/Makefile.am.in | 1 | ||||
-rw-r--r-- | mono/mini/interp/interp.c | 42 | ||||
-rw-r--r-- | mono/mini/mini.h | 2 | ||||
-rw-r--r-- | mono/tests/enc/Makefile.am | 3 |
4 files changed, 32 insertions, 16 deletions
diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index c193c9c683b..16748f14a11 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -81,6 +81,7 @@ if !ENABLE_MSVC_ONLY AM_CFLAGS = \ -I$(top_srcdir) \ + -I$(top_srcdir)/mono \ $(GLIB_CFLAGS) \ $(LLVM_CFLAGS) \ $(JEMALLOC_CFLAGS) \ diff --git a/mono/mini/interp/interp.c b/mono/mini/interp/interp.c index 587f039918a..fba7d7667de 100644 --- a/mono/mini/interp/interp.c +++ b/mono/mini/interp/interp.c @@ -27,6 +27,10 @@ #include <mono/utils/mono-counters.h> #include <mono/utils/mono-logger-internals.h> #include <mono/utils/mono-tls-inline.h> +// hrm. +#define HAVE_SGEN_GC +#include <mono/sgen/sgen-gc.h> +#include <mono/utils/mono-threads.h> #include <mono/utils/mono-membar.h> #ifdef HAVE_ALLOCA_H @@ -7602,32 +7606,42 @@ copy_imethod_for_frame (MonoDomain *domain, InterpFrame *frame) static void interp_invalidate_transformed (MonoDomain *domain) { - /* TODO more locking */ + mono_gc_stop_world (); /* (1) make a copy of imethod for every interpframe that is on the stack, * so we do not invalidate currently running methods */ - /* TODO: make it for each thread */ - MonoLMF *lmf = mono_get_lmf (); - while (lmf) { - if (((gsize) lmf->previous_lmf) & 2) { - MonoLMFExt *ext = (MonoLMFExt *) lmf; - if (ext->kind == MONO_LMFEXT_INTERP_EXIT || ext->kind == MONO_LMFEXT_INTERP_EXIT_WITH_CTX) { - InterpFrame *frame = ext->interp_exit_data; - while (frame) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_METADATA_UPDATE, "copy imethod for method=%s\n", mono_method_full_name (frame->imethod->method, 1)); - copy_imethod_for_frame (domain, frame); - frame = frame->parent; + FOREACH_THREAD_EXCLUDE (info, MONO_THREAD_INFO_FLAGS_NO_GC) { + if (!info) + continue; + if (info->client_info.skip) + continue; + if (!info->client_info.info.jit_data) + continue; + + MonoLMF *lmf = info->client_info.info.jit_data->lmf; + while (lmf) { + if (((gsize) lmf->previous_lmf) & 2) { + MonoLMFExt *ext = (MonoLMFExt *) lmf; + if (ext->kind == MONO_LMFEXT_INTERP_EXIT || ext->kind == MONO_LMFEXT_INTERP_EXIT_WITH_CTX) { + InterpFrame *frame = ext->interp_exit_data; + while (frame) { + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_METADATA_UPDATE, "threadinfo=%p, copy imethod for method=%s", info, mono_method_full_name (frame->imethod->method, 1)); + copy_imethod_for_frame (domain, frame); + frame = frame->parent; + } } } + lmf = (MonoLMF *)(((gsize) lmf->previous_lmf) & ~3); } - lmf = (MonoLMF *)(((gsize) lmf->previous_lmf) & ~3); - } + } FOREACH_THREAD_END /* (2) invalidate all the registered imethods */ MonoJitDomainInfo *info = domain_jit_info (domain); mono_domain_jit_code_hash_lock (domain); mono_internal_hash_table_apply (&info->interp_code_hash, invalidate_transform); mono_domain_jit_code_hash_unlock (domain); + + mono_gc_restart_world (); } static void diff --git a/mono/mini/mini.h b/mono/mini/mini.h index d3d4fd3bd0d..0af277af0fd 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -65,11 +65,13 @@ typedef struct SeqPointInfo SeqPointInfo; * The mini code should not have any compile time dependencies on the GC being used, so the same object file from mini/ * can be linked into both mono and mono-sgen. */ +#if 0 #if !defined(MONO_DLL_EXPORT) || !defined(_MSC_VER) #if defined(HAVE_BOEHM_GC) || defined(HAVE_SGEN_GC) #error "The code in mini/ should not depend on these defines." #endif #endif +#endif #ifndef __GNUC__ /*#define __alignof__(a) sizeof(a)*/ diff --git a/mono/tests/enc/Makefile.am b/mono/tests/enc/Makefile.am index e9c08100d6d..9f42ddc1db6 100644 --- a/mono/tests/enc/Makefile.am +++ b/mono/tests/enc/Makefile.am @@ -4,8 +4,7 @@ ROSLYNILDIFF ?=/Users/lewurm/work/roslynildiff/bin/Debug/roslynildiff.exe DISABLED_TESTS := \ AddClass.dll \ AddStaticField.dll \ - LambdaFunc.dll \ - OnStackMethodThreadThread.dll + LambdaFunc.dll TESTS_REGULAR := \ AddClass.dll \ |