* @klass. The method will typically have an thread-local inline allocation sequence.
* The signature of the called method is:
* object allocate (MonoVTable *vtable)
- * Some of the logic here is similar to mono_class_get_allocation_ftn () i object.c,
- * keep in sync.
* The thread local alloc logic is taken from libgc/pthread_support.c.
*/
-
MonoMethod*
mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box, gboolean known_instance_size)
{
monolist_item_vtable = mono_class_vtable (mono_get_root_domain (), klass);
g_assert (monolist_item_vtable);
}
- res = (MonoMList*)mono_object_new_fast_checked (monolist_item_vtable, error);
+ res = (MonoMList*)mono_object_new_specific_checked (monolist_item_vtable, error);
return_val_if_nok (error, NULL);
MONO_OBJECT_SETREF (res, data, data);
return res;
gboolean
mono_delegate_ctor (MonoObjectHandle this_obj, MonoObjectHandle target, gpointer addr, MonoError *error);
-void*
-mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *pass_size_in_words);
-
void
mono_runtime_free_method (MonoDomain *domain, MonoMethod *method);
MonoObject*
mono_object_new_fast_checked (MonoVTable *vtable, MonoError *error);
-MonoObject *
-ves_icall_object_new_fast (MonoVTable *vtable);
-
MonoObject *
mono_object_clone_checked (MonoObject *obj, MonoError *error);
type_initialization_hash = g_hash_table_new (NULL, NULL);
blocked_thread_hash = g_hash_table_new (NULL, NULL);
mono_os_mutex_init_recursive (&ldstr_section);
+ mono_register_jit_icall (ves_icall_string_alloc, "ves_icall_string_alloc", mono_create_icall_signature ("object int"), FALSE);
}
void
int max_set = 0;
gsize *bitmap;
gsize default_bitmap [4] = {0};
- static gboolean gcj_inited = FALSE;
MonoGCDescriptor gc_descr;
- if (!gcj_inited) {
- mono_loader_lock ();
-
- mono_register_jit_icall (ves_icall_object_new_fast, "ves_icall_object_new_fast", mono_create_icall_signature ("object ptr"), FALSE);
- mono_register_jit_icall (ves_icall_string_alloc, "ves_icall_string_alloc", mono_create_icall_signature ("object int"), FALSE);
-
- gcj_inited = TRUE;
- mono_loader_unlock ();
- }
-
if (!klass->inited)
mono_class_init (klass);
return o;
}
-MonoObject *
-ves_icall_object_new_fast (MonoVTable *vtable)
-{
- MonoError error;
- MonoObject *o = mono_object_new_fast_checked (vtable, &error);
- mono_error_set_pending_exception (&error);
-
- return o;
-}
-
MonoObject*
mono_object_new_mature (MonoVTable *vtable, MonoError *error)
{
return o;
}
-/**
- * mono_class_get_allocation_ftn:
- * \param vtable vtable
- * \param for_box the object will be used for boxing
- * \param pass_size_in_words Unused
- * \returns the allocation function appropriate for the given class.
- */
-void*
-mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *pass_size_in_words)
-{
- MONO_REQ_GC_NEUTRAL_MODE;
-
- *pass_size_in_words = FALSE;
-
- if (mono_class_has_finalizer (vtable->klass) || mono_class_is_marshalbyref (vtable->klass))
- return ves_icall_object_new_specific;
-
- if (vtable->gc_descr != MONO_GC_DESCRIPTOR_NULL) {
-
- return ves_icall_object_new_fast;
-
- /*
- * FIXME: This is actually slower than ves_icall_object_new_fast, because
- * of the overhead of parameter passing.
- */
- /*
- *pass_size_in_words = TRUE;
-#ifdef GC_REDIRECT_TO_LOCAL
- return GC_local_gcj_fast_malloc;
-#else
- return GC_gcj_fast_malloc;
-#endif
- */
- }
-
- return ves_icall_object_new_specific;
-}
-
/**
* mono_object_new_from_token:
* \param image Context where the type_token is hosted
/* This happens often in argument checking code, eg. throw new FooException... */
/* Avoid relocations and save some space by calling a helper function specialized to mscorlib */
EMIT_NEW_ICONST (cfg, iargs [0], mono_metadata_token_index (klass->type_token));
- return mono_emit_jit_icall (cfg, mono_helper_newobj_mscorlib, iargs);
+ alloc_ftn = mono_helper_newobj_mscorlib;
} else {
MonoVTable *vtable = mono_class_vtable (cfg->domain, klass);
MonoMethod *managed_alloc = NULL;
- gboolean pass_lw;
if (!vtable) {
mono_cfg_set_exception (cfg, MONO_EXCEPTION_TYPE_LOAD);
EMIT_NEW_ICONST (cfg, iargs [1], size);
return mono_emit_method_call (cfg, managed_alloc, iargs, NULL);
}
- alloc_ftn = mono_class_get_allocation_ftn (vtable, for_box, &pass_lw);
- if (pass_lw) {
- guint32 lw = vtable->klass->instance_size;
- lw = ((lw + (sizeof (gpointer) - 1)) & ~(sizeof (gpointer) - 1)) / sizeof (gpointer);
- EMIT_NEW_ICONST (cfg, iargs [0], lw);
- EMIT_NEW_VTABLECONST (cfg, iargs [1], vtable);
- }
- else {
- EMIT_NEW_VTABLECONST (cfg, iargs [0], vtable);
- }
+ alloc_ftn = ves_icall_object_new_specific;
+ EMIT_NEW_VTABLECONST (cfg, iargs [0], vtable);
}
return mono_emit_jit_icall (cfg, alloc_ftn, iargs);
#endif
/* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 140
+#define MONO_AOT_FILE_VERSION 141
//TODO: This is x86/amd64 specific.
#define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))