#include "metadata/sgen-gc.h"
#include "metadata/sgen-protocol.h"
#include "metadata/sgen-memory-governor.h"
+#include "metadata/sgen-thread-pool.h"
#include "metadata/profiler-private.h"
#include "utils/mono-time.h"
-#include "utils/dtrace.h"
#include "utils/mono-counters.h"
#include "utils/mono-threads.h"
+static gboolean world_is_stopped = FALSE;
+
#define TV_DECLARE SGEN_TV_DECLARE
#define TV_GETTIME SGEN_TV_GETTIME
#define TV_ELAPSED SGEN_TV_ELAPSED
* missing methods (#13951). To work around this, we disable the AOT fallback. For this to work, the JIT needs
* to register the jit info for all GC critical methods after they are JITted/loaded.
*/
- ji = mono_jit_info_table_find_internal (domain, ip, FALSE);
+ ji = mono_jit_info_table_find_internal (domain, ip, FALSE, FALSE);
if (!ji)
return FALSE;
{
TV_DECLARE (end_handshake);
int count, dead;
+ long long major_total = -1, major_marked = -1, los_total = -1, los_marked = -1;
+
+ SGEN_ASSERT (0, !world_is_stopped, "Why are we stopping a stopped world?");
mono_profiler_gc_event (MONO_GC_EVENT_PRE_STOP_WORLD, generation);
- MONO_GC_WORLD_STOP_BEGIN ();
binary_protocol_world_stopping (sgen_timestamp ());
acquire_gc_locks ();
count -= dead;
}
+ world_is_stopped = TRUE;
+
SGEN_LOG (3, "world stopped %d thread(s)", count);
mono_profiler_gc_event (MONO_GC_EVENT_POST_STOP_WORLD, generation);
- MONO_GC_WORLD_STOP_END ();
- if (binary_protocol_is_enabled ()) {
- long long major_total = -1, major_marked = -1, los_total = -1, los_marked = -1;
- if (binary_protocol_is_heavy_enabled ())
- count_cards (&major_total, &major_marked, &los_total, &los_marked);
- binary_protocol_world_stopped (sgen_timestamp (), major_total, major_marked, los_total, los_marked);
- }
+ if (binary_protocol_is_heavy_enabled ())
+ count_cards (&major_total, &major_marked, &los_total, &los_marked);
+ binary_protocol_world_stopped (sgen_timestamp (), major_total, major_marked, los_total, los_marked);
TV_GETTIME (end_handshake);
time_stop_world += TV_ELAPSED (stop_world_time, end_handshake);
TV_DECLARE (end_bridge);
unsigned long usec, bridge_usec;
+ SGEN_ASSERT (0, world_is_stopped, "Why are we restarting a running world?");
+
if (binary_protocol_is_enabled ()) {
long long major_total = -1, major_marked = -1, los_total = -1, los_marked = -1;
if (binary_protocol_is_heavy_enabled ())
if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_GC_MOVES))
sgen_gc_event_moves ();
mono_profiler_gc_event (MONO_GC_EVENT_PRE_START_WORLD, generation);
- MONO_GC_WORLD_RESTART_BEGIN (generation);
+
FOREACH_THREAD (info) {
info->stack_start = NULL;
#ifdef USE_MONO_CTX
time_restart_world += TV_ELAPSED (start_handshake, end_sw);
usec = TV_ELAPSED (stop_world_time, end_sw);
max_pause_usec = MAX (usec, max_pause_usec);
+
+ world_is_stopped = FALSE;
+
SGEN_LOG (2, "restarted %d thread(s) (pause time: %d usec, max: %d)", count, (int)usec, (int)max_pause_usec);
mono_profiler_gc_event (MONO_GC_EVENT_POST_START_WORLD, generation);
- MONO_GC_WORLD_RESTART_END (generation);
binary_protocol_world_restarted (generation, sgen_timestamp ());
/*
return count;
}
+gboolean
+sgen_is_world_stopped (void)
+{
+ return world_is_stopped;
+}
+
void
sgen_init_stw (void)
{
We can't suspend the workers that will do all the heavy lifting.
FIXME Use some state bit in SgenThreadInfo for this.
*/
- if (sgen_is_worker_thread (mono_thread_info_get_tid (info))) {
+ if (sgen_thread_pool_is_thread_pool_thread (mono_thread_info_get_tid (info))) {
return FALSE;
}