X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fsgen%2Fsgen-memory-governor.c;h=12c775a2384a1c106251a5ab5e5c2e1830bf81ce;hb=098e88f3a87205d92516a1fe912b6f84164d0a59;hp=d6c7f130f3cae7571d5524cd7cdf67c65119ce28;hpb=0b65fb9d99f02f2a330b20eafcfe57fec34c0465;p=mono.git diff --git a/mono/sgen/sgen-memory-governor.c b/mono/sgen/sgen-memory-governor.c index d6c7f130f3c..12c775a2384 100644 --- a/mono/sgen/sgen-memory-governor.c +++ b/mono/sgen/sgen-memory-governor.c @@ -1,6 +1,6 @@ -/* - * sgen-memory-governor.c: When to schedule collections based on - * memory usage. +/** + * \file + * When to schedule collections based on memory usage. * * Author: * Rodrigo Kumpera (rkumpera@novell.com) @@ -20,13 +20,13 @@ #include "mono/sgen/sgen-gc.h" #include "mono/sgen/sgen-memory-governor.h" -#include "mono/sgen/sgen-thread-pool.h" +#include "mono/sgen/sgen-workers.h" #include "mono/sgen/sgen-client.h" -#define MIN_MINOR_COLLECTION_ALLOWANCE ((mword)(DEFAULT_NURSERY_SIZE * default_allowance_nursery_size_ratio)) +#define MIN_MINOR_COLLECTION_ALLOWANCE ((mword)(SGEN_DEFAULT_NURSERY_SIZE * default_allowance_nursery_size_ratio)) static SgenPointerQueue log_entries = SGEN_POINTER_QUEUE_INIT (INTERNAL_MEM_TEMPORARY); -static MonoCoopMutex log_entries_mutex; +static mono_mutex_t log_entries_mutex; mword total_promoted_size = 0; mword total_allocated_major = 0; @@ -176,9 +176,9 @@ sgen_memgov_minor_collection_start (void) static void sgen_add_log_entry (SgenLogEntry *log_entry) { - mono_coop_mutex_lock (&log_entries_mutex); + mono_os_mutex_lock (&log_entries_mutex); sgen_pointer_queue_add (&log_entries, log_entry); - mono_coop_mutex_unlock (&log_entries_mutex); + mono_os_mutex_unlock (&log_entries_mutex); } void @@ -347,13 +347,13 @@ sgen_memgov_collection_end (int generation, gint64 stw_time) if (mono_trace_is_traced (G_LOG_LEVEL_INFO, MONO_TRACE_GC)) { size_t i; SGEN_ASSERT (0, !sgen_is_world_stopped (), "We can't log if the world is stopped"); - mono_coop_mutex_lock (&log_entries_mutex); + mono_os_mutex_lock (&log_entries_mutex); for (i = 0; i < log_entries.next_slot; i++) { sgen_output_log_entry (log_entries.data [i], stw_time, generation); sgen_free_internal (log_entries.data [i], INTERNAL_MEM_LOG_ENTRY); } sgen_pointer_queue_clear (&log_entries); - mono_coop_mutex_unlock (&log_entries_mutex); + mono_os_mutex_unlock (&log_entries_mutex); } } @@ -459,7 +459,7 @@ gboolean sgen_memgov_try_alloc_space (mword size, int space) { if (sgen_memgov_available_free_space () < size) { - SGEN_ASSERT (4, !sgen_thread_pool_is_thread_pool_thread (mono_native_thread_id_get ()), "Memory shouldn't run out in worker thread"); + SGEN_ASSERT (4, !sgen_workers_is_worker_thread (mono_native_thread_id_get ()), "Memory shouldn't run out in worker thread"); return FALSE; } @@ -480,7 +480,7 @@ sgen_memgov_init (size_t max_heap, size_t soft_limit, gboolean debug_allowance, mono_counters_register ("Memgov alloc", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES | MONO_COUNTER_VARIABLE, (void*)&total_alloc); mono_counters_register ("Memgov max alloc", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES | MONO_COUNTER_MONOTONIC, (void*)&total_alloc_max); - mono_coop_mutex_init (&log_entries_mutex); + mono_os_mutex_init (&log_entries_mutex); sgen_register_fixed_internal_mem_type (INTERNAL_MEM_LOG_ENTRY, sizeof (SgenLogEntry)); @@ -492,11 +492,11 @@ sgen_memgov_init (size_t max_heap, size_t soft_limit, gboolean debug_allowance, max_heap = soft_limit; } - if (max_heap < sgen_nursery_size * 4) { + if (max_heap < SGEN_DEFAULT_NURSERY_SIZE * 4) { sgen_env_var_error (MONO_GC_PARAMS_NAME, "Setting to minimum.", "`max-heap-size` must be at least 4 times as large as `nursery size`."); - max_heap = sgen_nursery_size * 4; + max_heap = SGEN_DEFAULT_NURSERY_SIZE * 4; } - max_heap_size = max_heap - sgen_nursery_size; + max_heap_size = max_heap - SGEN_DEFAULT_NURSERY_SIZE; if (allowance_ratio) default_allowance_nursery_size_ratio = allowance_ratio;