Beispiel #1
0
/* LOCKING: tasklets_mutex is assumed to e taken */
static void
internal_init (void)
{
	if (keepalive_stacks)
		return;
	MONO_GC_REGISTER_ROOT_PINNING (keepalive_stacks);
	keepalive_stacks = mono_g_hash_table_new (NULL, NULL);
}
Beispiel #2
0
MonoGHashTable *
mono_g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
			    GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
{
	MonoGHashTable *hash = mono_g_hash_table_new (hash_func, key_equal_func);
	if (hash == NULL)
		return NULL;
	
	hash->key_destroy_func = key_destroy_func;
	hash->value_destroy_func = value_destroy_func;
	
	return hash;
}
Beispiel #3
0
MonoGHashTable *
mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type)
{
	MonoGHashTable *hash = mono_g_hash_table_new (hash_func, key_equal_func);

	hash->gc_type = type;

#ifdef HAVE_SGEN_GC
	if (type < 0 || type > MONO_HASH_KEY_VALUE_GC)
		g_error ("wrong type for gc hashtable");
	/*
	 * We use a user defined marking function to avoid having to register a GC root for
	 * each hash node.
	 */
	if (!table_hash_descr)
		table_hash_descr = mono_gc_make_root_descr_user (mono_g_hash_mark);
	if (type != MONO_HASH_CONSERVATIVE_GC)
		mono_gc_register_root_wbarrier ((char*)hash, sizeof (MonoGHashTable), table_hash_descr);
#endif

	return hash;
}
Beispiel #4
0
MonoGHashTable *
mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, const char *msg)
{
	MonoGHashTable *hash = mono_g_hash_table_new (hash_func, key_equal_func);

	hash->gc_type = type;
	hash->source = source;
	hash->msg = msg;

	if (type > MONO_HASH_KEY_VALUE_GC)
		g_error ("wrong type for gc hashtable");

#ifdef HAVE_SGEN_GC
	/*
	 * We use a user defined marking function to avoid having to register a GC root for
	 * each hash node.
	 */
	if (!table_hash_descr)
		table_hash_descr = mono_gc_make_root_descr_user (mono_g_hash_mark);
	mono_gc_register_root_wbarrier ((char*)hash, sizeof (MonoGHashTable), table_hash_descr, source, msg);
#endif

	return hash;
}