#include <mono/metadata/tokentype.h>
#include <mono/metadata/loader.h>
#include <mono/metadata/object.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/domain-internals.h>
#include "mono/metadata/metadata-internals.h"
#include "mono/metadata/profiler-private.h"
#include "mono/metadata/security-manager.h"
#include "mono/metadata/mono-debug-debugger.h"
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
#include <mono/metadata/verify-internals.h>
#include <mono/utils/strenc.h>
#include <mono/utils/mono-counters.h>
mono_string_to_utf8_internal (MonoMemPool *mp, MonoImage *image, MonoString *s, gboolean ignore_error, MonoError *error);
-#define ldstr_lock() mono_mutex_lock (&ldstr_section)
-#define ldstr_unlock() mono_mutex_unlock (&ldstr_section)
+#define ldstr_lock() mono_os_mutex_lock (&ldstr_section)
+#define ldstr_unlock() mono_os_mutex_unlock (&ldstr_section)
static mono_mutex_t ldstr_section;
void
-mono_runtime_object_init (MonoObject *this)
+mono_runtime_object_init (MonoObject *this_obj)
{
MONO_REQ_GC_UNSAFE_MODE;
MonoMethod *method = NULL;
- MonoClass *klass = this->vtable->klass;
+ MonoClass *klass = this_obj->vtable->klass;
method = mono_class_get_method_from_name (klass, ".ctor", 0);
if (!method)
g_error ("Could not lookup zero argument constructor for class %s", mono_type_get_full_name (klass));
if (method->klass->valuetype)
- this = mono_object_unbox (this);
- mono_runtime_invoke (method, this, NULL, NULL);
+ this_obj = (MonoObject *)mono_object_unbox (this_obj);
+ mono_runtime_invoke (method, this_obj, NULL, NULL);
}
/* The pseudo algorithm for type initialization from the spec
MonoNativeThreadId initializing_tid;
guint32 waiting_count;
gboolean done;
- mono_mutex_t initialization_section;
+ MonoCoopMutex initialization_section;
} TypeInitializationLock;
/* for locking access to type_initialization_hash and blocked_thread_hash */
-static mono_mutex_t type_initialization_section;
+static MonoCoopMutex type_initialization_section;
static inline void
mono_type_initialization_lock (void)
{
/* The critical sections protected by this lock in mono_runtime_class_init_full () can block */
- MONO_PREPARE_BLOCKING;
- mono_mutex_lock (&type_initialization_section);
- MONO_FINISH_BLOCKING;
+ mono_coop_mutex_lock (&type_initialization_section);
}
static inline void
mono_type_initialization_unlock (void)
{
- mono_mutex_unlock (&type_initialization_section);
+ mono_coop_mutex_unlock (&type_initialization_section);
}
static void
{
MONO_REQ_GC_NEUTRAL_MODE;
- MONO_TRY_BLOCKING;
- mono_mutex_lock (&lock->initialization_section);
- MONO_FINISH_TRY_BLOCKING;
+ mono_coop_mutex_lock (&lock->initialization_section);
}
static void
mono_type_init_unlock (TypeInitializationLock *lock)
{
- mono_mutex_unlock (&lock->initialization_section);
+ mono_coop_mutex_unlock (&lock->initialization_section);
}
/* from vtable to lock */
void
mono_type_initialization_init (void)
{
- mono_mutex_init_recursive (&type_initialization_section);
+ mono_coop_mutex_init_recursive (&type_initialization_section);
type_initialization_hash = g_hash_table_new (NULL, NULL);
blocked_thread_hash = g_hash_table_new (NULL, NULL);
- mono_mutex_init_recursive (&ldstr_section);
+ mono_os_mutex_init_recursive (&ldstr_section);
}
void
/* This is causing race conditions with
* mono_release_type_locks
*/
- mono_mutex_destroy (&type_initialization_section);
+ mono_coop_mutex_destroy (&type_initialization_section);
g_hash_table_destroy (type_initialization_hash);
type_initialization_hash = NULL;
#endif
- mono_mutex_destroy (&ldstr_section);
+ mono_os_mutex_destroy (&ldstr_section);
g_hash_table_destroy (blocked_thread_hash);
blocked_thread_hash = NULL;
ex = NULL;
mono_domain_lock (domain);
if (domain->type_init_exception_hash)
- ex = mono_g_hash_table_lookup (domain->type_init_exception_hash, klass);
+ ex = (MonoException *)mono_g_hash_table_lookup (domain->type_init_exception_hash, klass);
mono_domain_unlock (domain);
if (!ex) {
mono_raise_exception (get_type_init_exception_for_vtable (vtable));
return get_type_init_exception_for_vtable (vtable);
}
- lock = g_hash_table_lookup (type_initialization_hash, vtable);
+ lock = (TypeInitializationLock *)g_hash_table_lookup (type_initialization_hash, vtable);
if (lock == NULL) {
/* This thread will get to do the initialization */
if (mono_domain_get () != domain) {
return mono_get_exception_appdomain_unloaded ();
}
}
- lock = g_malloc (sizeof(TypeInitializationLock));
- mono_mutex_init_recursive (&lock->initialization_section);
+ lock = (TypeInitializationLock *)g_malloc (sizeof (TypeInitializationLock));
+ mono_coop_mutex_init_recursive (&lock->initialization_section);
lock->initializing_tid = tid;
lock->waiting_count = 1;
lock->done = FALSE;
g_hash_table_remove (blocked_thread_hash, GUINT_TO_POINTER (tid));
--lock->waiting_count;
if (lock->waiting_count == 0) {
- mono_mutex_destroy (&lock->initialization_section);
+ mono_coop_mutex_destroy (&lock->initialization_section);
g_hash_table_remove (type_initialization_hash, vtable);
g_free (lock);
}
mono_type_init_unlock (lock);
--lock->waiting_count;
if (lock->waiting_count == 0) {
- mono_mutex_destroy (&lock->initialization_section);
+ mono_coop_mutex_destroy (&lock->initialization_section);
g_free (lock);
return TRUE;
}
max_size = klass->instance_size / sizeof (gpointer);
if (max_size > size) {
g_assert (offset <= 0);
- bitmap = g_malloc0 ((max_size + BITMAP_EL_SIZE - 1) / BITMAP_EL_SIZE * sizeof (gsize));
+ bitmap = (gsize *)g_malloc0 ((max_size + BITMAP_EL_SIZE - 1) / BITMAP_EL_SIZE * sizeof (gsize));
size = max_size;
}
sig = mono_method_signature (method);
hashes_count = sig->param_count + 4;
- hashes_start = malloc (hashes_count * sizeof (guint32));
+ hashes_start = (guint32 *)malloc (hashes_count * sizeof (guint32));
hashes = hashes_start;
if (! MONO_CLASS_IS_INTERFACE (method->klass)) {
return;
}
- entry = g_malloc0 (sizeof (MonoImtBuilderEntry));
+ entry = (MonoImtBuilderEntry *)g_malloc0 (sizeof (MonoImtBuilderEntry));
entry->key = method;
entry->value.vtable_slot = vtable_slot;
entry->next = imt_builder [imt_slot];
MONO_REQ_GC_NEUTRAL_MODE;
int number_of_entries = entries->children + 1;
- MonoImtBuilderEntry **sorted_array = malloc (sizeof (MonoImtBuilderEntry*) * number_of_entries);
+ MonoImtBuilderEntry **sorted_array = (MonoImtBuilderEntry **)malloc (sizeof (MonoImtBuilderEntry*) * number_of_entries);
GPtrArray *result = g_ptr_array_new ();
MonoImtBuilderEntry *current_entry;
int i;
int i;
GSList *list_item;
guint32 imt_collisions_bitmap = 0;
- MonoImtBuilderEntry **imt_builder = calloc (MONO_IMT_SIZE, sizeof (MonoImtBuilderEntry*));
+ MonoImtBuilderEntry **imt_builder = (MonoImtBuilderEntry **)calloc (MONO_IMT_SIZE, sizeof (MonoImtBuilderEntry*));
int method_count = 0;
gboolean record_method_count_for_max_collisions = FALSE;
gboolean has_generic_virtual = FALSE, has_variant_iface = FALSE;
int interface_offset = klass->vtable_size;
for (list_item = extra_interfaces; list_item != NULL; list_item=list_item->next) {
- MonoClass* iface = list_item->data;
+ MonoClass* iface = (MonoClass *)list_item->data;
int method_slot_in_interface;
for (method_slot_in_interface = 0; method_slot_in_interface < iface->method.count; method_slot_in_interface++) {
MonoMethod *method = mono_class_get_method_by_index (iface, method_slot_in_interface);
if (domain->thunk_free_lists)
return;
- domain->thunk_free_lists = mono_domain_alloc0 (domain, sizeof (gpointer) * NUM_FREE_LISTS);
+ domain->thunk_free_lists = (MonoThunkFreeList **)mono_domain_alloc0 (domain, sizeof (gpointer) * NUM_FREE_LISTS);
}
static int
}
generic_virtual_thunks_size += size;
- p = mono_domain_code_reserve (domain, size);
+ p = (guint32 *)mono_domain_code_reserve (domain, size);
*p = size;
mono_domain_lock (domain);
{
MONO_REQ_GC_NEUTRAL_MODE;
- guint32 *p = code;
+ guint32 *p = (guint32 *)code;
MonoThunkFreeList *l = (MonoThunkFreeList*)(p - 1);
gboolean found = FALSE;
if (!domain->generic_virtual_cases)
domain->generic_virtual_cases = g_hash_table_new (mono_aligned_addr_hash, NULL);
- list = g_hash_table_lookup (domain->generic_virtual_cases, vtable_slot);
+ list = (GenericVirtualCase *)g_hash_table_lookup (domain->generic_virtual_cases, vtable_slot);
entries = NULL;
for (; list; list = list->next) {
domain->generic_virtual_cases = g_hash_table_new (mono_aligned_addr_hash, NULL);
/* Check whether the case was already added */
- list = g_hash_table_lookup (domain->generic_virtual_cases, vtable_slot);
+ list = (GenericVirtualCase *)g_hash_table_lookup (domain->generic_virtual_cases, vtable_slot);
gvc = list;
while (gvc) {
if (gvc->method == method)
/* If not found, make a new one */
if (!gvc) {
- gvc = mono_domain_alloc (domain, sizeof (GenericVirtualCase));
+ gvc = (GenericVirtualCase *)mono_domain_alloc (domain, sizeof (GenericVirtualCase));
gvc->method = method;
gvc->code = code;
gvc->count = 0;
- gvc->next = g_hash_table_lookup (domain->generic_virtual_cases, vtable_slot);
+ gvc->next = (GenericVirtualCase *)g_hash_table_lookup (domain->generic_virtual_cases, vtable_slot);
g_hash_table_insert (domain->generic_virtual_cases, vtable_slot, gvc);
}
if (++gvc->count == THUNK_THRESHOLD) {
- gpointer *old_thunk = *vtable_slot;
+ gpointer *old_thunk = (void **)*vtable_slot;
gpointer vtable_trampoline = NULL;
gpointer imt_trampoline = NULL;
if (klass != mono_defaults.monotype_class) {
/*FIXME check for OOM*/
vt->type = mono_type_get_object (domain, &klass->byval_arg);
- if (mono_object_get_class (vt->type) != mono_defaults.monotype_class)
+ if (mono_object_get_class ((MonoObject *)vt->type) != mono_defaults.monotype_class)
/* This is unregistered in
unregister_vtable_reflection_type() in
domain.c. */
/* this is a bounded memory retention issue: may want to
* handle it differently when we'll have a rcu-like system.
*/
- runtime_info = mono_image_alloc0 (klass->image, MONO_SIZEOF_CLASS_RUNTIME_INFO + new_size * sizeof (gpointer));
+ runtime_info = (MonoClassRuntimeInfo *)mono_image_alloc0 (klass->image, MONO_SIZEOF_CLASS_RUNTIME_INFO + new_size * sizeof (gpointer));
runtime_info->max_domain = new_size - 1;
/* copy the stuff from the older info */
if (old_info) {
if (klass == mono_defaults.monotype_class) {
/*FIXME check for OOM*/
vt->type = mono_type_get_object (domain, &klass->byval_arg);
- if (mono_object_get_class (vt->type) != mono_defaults.monotype_class)
+ if (mono_object_get_class ((MonoObject *)vt->type) != mono_defaults.monotype_class)
/* This is unregistered in
unregister_vtable_reflection_type() in
domain.c. */
g_assert (mono_error_ok (&error)); /*FIXME do proper error handling*/
if (ifaces) {
for (i = 0; i < ifaces->len; ++i) {
- MonoClass *ic = g_ptr_array_index (ifaces, i);
+ MonoClass *ic = (MonoClass *)g_ptr_array_index (ifaces, i);
/*FIXME test for interfaces with variant generic arguments*/
if (MONO_CLASS_IMPLEMENTS_INTERFACE (klass, ic->interface_id))
continue; /* interface implemented by the class */
pvt->max_interface_id = max_interface_id;
bsize = sizeof (guint8) * (max_interface_id/8 + 1 );
#ifdef COMPRESSED_INTERFACE_BITMAP
- bitmap = g_malloc0 (bsize);
+ bitmap = (uint8_t *)g_malloc0 (bsize);
#else
- bitmap = mono_domain_alloc0 (domain, bsize);
+ bitmap = (uint8_t *)mono_domain_alloc0 (domain, bsize);
#endif
for (i = 0; i < klass->interface_offsets_count; ++i) {
/* Create trampolines for the methods of the interfaces */
for (list_item = extra_interfaces; list_item != NULL; list_item=list_item->next) {
- interf = list_item->data;
+ interf = (MonoClass *)list_item->data;
bitmap [interf->interface_id >> 3] |= (1 << (interf->interface_id & 7));
if (remote_class == NULL) {
if (extra_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
- key = g_malloc (sizeof(gpointer) * 3);
+ key = (void **)g_malloc (sizeof(gpointer) * 3);
key [0] = GINT_TO_POINTER (2);
key [1] = mono_defaults.marshalbyrefobject_class;
key [2] = extra_class;
} else {
- key = g_malloc (sizeof(gpointer) * 2);
+ key = (void **)g_malloc (sizeof(gpointer) * 2);
key [0] = GINT_TO_POINTER (1);
key [1] = extra_class;
}
} else {
if (extra_class != NULL && (extra_class->flags & TYPE_ATTRIBUTE_INTERFACE)) {
- key = g_malloc (sizeof(gpointer) * (remote_class->interface_count + 3));
+ key = (void **)g_malloc (sizeof(gpointer) * (remote_class->interface_count + 3));
key [0] = GINT_TO_POINTER (remote_class->interface_count + 2);
key [1] = remote_class->proxy_class;
key [j] = extra_class;
} else {
// Replace the old class. The interface list is the same
- key = g_malloc (sizeof(gpointer) * (remote_class->interface_count + 2));
+ key = (void **)g_malloc (sizeof(gpointer) * (remote_class->interface_count + 2));
key [0] = GINT_TO_POINTER (remote_class->interface_count + 1);
key [1] = extra_class != NULL ? extra_class : remote_class->proxy_class;
for (i = 0; i < remote_class->interface_count; i++)
MONO_REQ_GC_NEUTRAL_MODE
int key_size = (GPOINTER_TO_UINT (key [0]) + 1) * sizeof (gpointer);
- gpointer *mp_key = mono_domain_alloc (domain, key_size);
+ gpointer *mp_key = (gpointer *)mono_domain_alloc (domain, key_size);
memcpy (mp_key, key, key_size);
key = create_remote_class_key (NULL, proxy_class);
mono_domain_lock (domain);
- rc = g_hash_table_lookup (domain->proxy_vtable_hash, key);
+ rc = (MonoRemoteClass *)g_hash_table_lookup (domain->proxy_vtable_hash, key);
if (rc) {
g_free (key);
key = mp_key;
if (proxy_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
- rc = mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*));
+ rc = (MonoRemoteClass *)mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*));
rc->interface_count = 1;
rc->interfaces [0] = proxy_class;
rc->proxy_class = mono_defaults.marshalbyrefobject_class;
} else {
- rc = mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS);
+ rc = (MonoRemoteClass *)mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS);
rc->interface_count = 0;
rc->proxy_class = proxy_class;
}
gpointer* key, *mp_key;
key = create_remote_class_key (remote_class, extra_class);
- rc = g_hash_table_lookup (domain->proxy_vtable_hash, key);
+ rc = (MonoRemoteClass *)g_hash_table_lookup (domain->proxy_vtable_hash, key);
if (rc != NULL) {
g_free (key);
return rc;
if (extra_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
int i,j;
- rc = mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*) * (remote_class->interface_count + 1));
+ rc = (MonoRemoteClass *)mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*) * (remote_class->interface_count + 1));
rc->proxy_class = remote_class->proxy_class;
rc->interface_count = remote_class->interface_count + 1;
rc->interfaces [j] = extra_class;
} else {
// Replace the old class. The interface array is the same
- rc = mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*) * remote_class->interface_count);
+ rc = (MonoRemoteClass *)mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*) * remote_class->interface_count);
rc->proxy_class = extra_class;
rc->interface_count = remote_class->interface_count;
if (rc->interface_count > 0)
if (redo_vtable) {
tproxy->remote_class = clone_remote_class (domain, remote_class, klass);
- proxy_object->vtable = mono_remote_class_vtable (domain, tproxy->remote_class, tproxy->rp);
+ proxy_object->vtable = (MonoVTable *)mono_remote_class_vtable (domain, tproxy->remote_class, tproxy->rp);
}
mono_domain_unlock (domain);
gpointer res;
- MONO_PREPARE_RESET_BLOCKING
+ MONO_PREPARE_RESET_BLOCKING;
method = mono_marshal_get_thunk_invoke_wrapper (method);
res = mono_compile_method (method);
- MONO_FINISH_RESET_BLOCKING
+ MONO_FINISH_RESET_BLOCKING;
return res;
}
case MONO_TYPE_CLASS:
case MONO_TYPE_OBJECT:
case MONO_TYPE_ARRAY:
- mono_gc_wbarrier_generic_store (dest, deref_pointer? *(gpointer*)value: value);
+ mono_gc_wbarrier_generic_store (dest, deref_pointer ? *(MonoObject **)value : (MonoObject *)value);
return;
case MONO_TYPE_FNPTR:
case MONO_TYPE_PTR: {
mono_domain_lock (vt->domain);
addr = g_hash_table_lookup (vt->domain->special_static_fields, field);
mono_domain_unlock (vt->domain);
- src = mono_get_special_static_data (GPOINTER_TO_UINT (addr));
+ src = (guint8 *)mono_get_special_static_data (GPOINTER_TO_UINT (addr));
} else {
src = (guint8*)mono_vtable_get_static_field_data (vt) + field->offset;
}
gboolean has_byref_nullables = FALSE;
if (NULL != params) {
- pa = alloca (sizeof (gpointer) * mono_array_length (params));
+ pa = (void **)alloca (sizeof (gpointer) * mono_array_length (params));
for (i = 0; i < mono_array_length (params); i++) {
MonoType *t = sig->params [i];
}
#endif
if (method->klass->valuetype)
- o = mono_object_unbox (obj);
+ o = (MonoObject *)mono_object_unbox ((MonoObject *)obj);
else
o = obj;
} else if (method->klass->valuetype) {
}
mono_runtime_invoke (method, o, pa, exc);
- return obj;
+ return (MonoObject *)obj;
} else {
if (mono_class_is_nullable (method->klass)) {
MonoObject *nullable;
/* Convert the unboxed vtype into a Nullable structure */
nullable = mono_object_new (mono_domain_get (), method->klass);
- mono_nullable_init (mono_object_unbox (nullable), mono_value_box (mono_domain_get (), method->klass->cast_class, obj), method->klass);
+ mono_nullable_init ((guint8 *)mono_object_unbox (nullable), mono_value_box (mono_domain_get (), method->klass->cast_class, obj), method->klass);
obj = mono_object_unbox (nullable);
}
return NULL;
#ifdef HAVE_SGEN_GC
- return mono_gc_alloc_pinned_obj (vtable, mono_class_instance_size (klass));
+ return (MonoObject *)mono_gc_alloc_pinned_obj (vtable, mono_class_instance_size (klass));
#else
return mono_object_new_specific (vtable);
#endif
{
MONO_REQ_GC_UNSAFE_MODE;
- MonoObject *o = mono_gc_alloc_obj (vtable, vtable->klass->instance_size);
+ MonoObject *o = (MonoObject *)mono_gc_alloc_obj (vtable, vtable->klass->instance_size);
if (G_UNLIKELY (vtable->klass->has_finalize))
mono_object_register_finalizer (o);
{
MONO_REQ_GC_UNSAFE_MODE;
- return mono_gc_alloc_obj (vtable, vtable->klass->instance_size);
+ return (MonoObject *)mono_gc_alloc_obj (vtable, vtable->klass->instance_size);
}
/**
if (obj->vtable->klass->rank)
return (MonoObject*)mono_array_clone ((MonoArray*)obj);
- o = mono_gc_alloc_obj (obj->vtable, size);
+ o = (MonoObject *)mono_gc_alloc_obj (obj->vtable, size);
/* If the object doesn't contain references this will do a simple memmove. */
mono_gc_wbarrier_object_copy (o, obj);
return o;
}
- sizes = alloca (klass->rank * sizeof(intptr_t) * 2);
+ sizes = (uintptr_t *)alloca (klass->rank * sizeof(intptr_t) * 2);
size = mono_array_element_size (klass);
for (i = 0; i < klass->rank; ++i) {
sizes [i] = array->bounds [i].length;
if (CHECK_MUL_OVERFLOW_UN (byte_len, len))
return FALSE;
byte_len *= len;
- if (CHECK_ADD_OVERFLOW_UN (byte_len, sizeof (MonoArray)))
+ if (CHECK_ADD_OVERFLOW_UN (byte_len, MONO_SIZEOF_MONO_ARRAY))
return FALSE;
- byte_len += sizeof (MonoArray);
+ byte_len += MONO_SIZEOF_MONO_ARRAY;
*res = byte_len;
*/
vtable = mono_class_vtable_full (domain, array_class, TRUE);
if (bounds_size)
- o = mono_gc_alloc_array (vtable, byte_len, len, bounds_size);
+ o = (MonoObject *)mono_gc_alloc_array (vtable, byte_len, len, bounds_size);
else
- o = mono_gc_alloc_vector (vtable, byte_len, len);
+ o = (MonoObject *)mono_gc_alloc_vector (vtable, byte_len, len);
array = (MonoArray*)o;
bounds = array->bounds;
mono_gc_out_of_memory (MONO_ARRAY_MAX_SIZE);
return NULL;
}
- o = mono_gc_alloc_vector (vtable, byte_len, n);
+ o = (MonoObject *)mono_gc_alloc_vector (vtable, byte_len, n);
ao = (MonoArray*)o;
return ao;
vtable = mono_class_vtable (domain, mono_defaults.string_class);
g_assert (vtable);
- s = mono_gc_alloc_string (vtable, size, len);
+ s = (MonoString *)mono_gc_alloc_string (vtable, size, len);
return s;
}
g_assert (klass->valuetype);
if (mono_class_is_nullable (klass))
- return mono_nullable_box (value, klass);
+ return mono_nullable_box ((guint8 *)value, klass);
vtable = mono_class_vtable (domain, klass);
if (!vtable)
return sizeof (MonoString) + 2 * mono_string_length ((MonoString*) o) + 2;
} else if (o->vtable->rank) {
MonoArray *array = (MonoArray*)o;
- size_t size = sizeof (MonoArray) + mono_array_element_size (klass) * mono_array_length (array);
+ size_t size = MONO_SIZEOF_MONO_ARRAY + mono_array_element_size (klass) * mono_array_length (array);
if (array->bounds) {
size += 3;
size &= ~3;
{
MONO_REQ_GC_UNSAFE_MODE;
- LDStrInfo *info = user_data;
+ LDStrInfo *info = (LDStrInfo *)user_data;
if (info->res || domain == info->orig_domain)
return;
- info->res = mono_g_hash_table_lookup (domain->ldstr_table, info->ins);
+ info->res = (MonoString *)mono_g_hash_table_lookup (domain->ldstr_table, info->ins);
}
#ifdef HAVE_SGEN_GC
int size;
MonoString *news;
size = sizeof (MonoString) + 2 * (mono_string_length (str) + 1);
- news = mono_gc_alloc_pinned_obj (((MonoObject*)str)->vtable, size);
+ news = (MonoString *)mono_gc_alloc_pinned_obj (((MonoObject*)str)->vtable, size);
if (news) {
memcpy (mono_string_chars (news), mono_string_chars (str), mono_string_length (str) * 2);
news->length = mono_string_length (str);
domain = ((MonoObject *)str)->vtable->domain;
ldstr_table = domain->ldstr_table;
ldstr_lock ();
- res = mono_g_hash_table_lookup (ldstr_table, str);
+ res = (MonoString *)mono_g_hash_table_lookup (ldstr_table, str);
if (res) {
ldstr_unlock ();
return res;
s = mono_string_get_pinned (str);
if (s) {
ldstr_lock ();
- res = mono_g_hash_table_lookup (ldstr_table, str);
+ res = (MonoString *)mono_g_hash_table_lookup (ldstr_table, str);
if (res) {
ldstr_unlock ();
return res;
MONO_REQ_GC_UNSAFE_MODE;
if (image->dynamic) {
- MonoString *str = mono_lookup_dynamic_token (image, MONO_TOKEN_STRING | idx, NULL);
+ MonoString *str = (MonoString *)mono_lookup_dynamic_token (image, MONO_TOKEN_STRING | idx, NULL);
return str;
} else {
if (!mono_verifier_verify_string_signature (image, idx, NULL))
}
#endif
ldstr_lock ();
- interned = mono_g_hash_table_lookup (domain->ldstr_table, o);
+ interned = (MonoString *)mono_g_hash_table_lookup (domain->ldstr_table, o);
ldstr_unlock ();
if (interned)
return interned; /* o will get garbage collected */
o = mono_string_get_pinned (o);
if (o) {
ldstr_lock ();
- interned = mono_g_hash_table_lookup (domain->ldstr_table, o);
+ interned = (MonoString *)mono_g_hash_table_lookup (domain->ldstr_table, o);
if (!interned) {
mono_g_hash_table_insert (domain->ldstr_table, o, o);
interned = o;
/* g_utf16_to_utf8 may not be able to complete the convertion (e.g. NULL values were found, #335488) */
if (s->length > written) {
/* allocate the total length and copy the part of the string that has been converted */
- char *as2 = g_malloc0 (s->length);
+ char *as2 = (char *)g_malloc0 (s->length);
memcpy (as2, as, written);
g_free (as);
as = as2;
/* g_utf16_to_utf8 may not be able to complete the convertion (e.g. NULL values were found, #335488) */
if (s->length > written) {
/* allocate the total length and copy the part of the string that has been converted */
- char *as2 = g_malloc0 (s->length);
+ char *as2 = (char *)g_malloc0 (s->length);
memcpy (as2, as, written);
g_free (as);
as = as2;
if (s == NULL)
return NULL;
- as = g_malloc ((s->length * 2) + 2);
+ as = (char *)g_malloc ((s->length * 2) + 2);
as [(s->length * 2)] = '\0';
as [(s->length * 2) + 1] = '\0';
len = strlen (r) + 1;
if (mp)
- mp_s = mono_mempool_alloc (mp, len);
+ mp_s = (char *)mono_mempool_alloc (mp, len);
else
- mp_s = mono_image_alloc (image, len);
+ mp_s = (char *)mono_image_alloc (image, len);
memcpy (mp_s, r, len);
domain->capture_context_method = mono_compile_method (method);
}
- runtime_invoke = domain->capture_context_runtime_invoke;
+ runtime_invoke = (RuntimeInvokeFunction)domain->capture_context_runtime_invoke;
return runtime_invoke (NULL, NULL, NULL, domain->capture_context_method);
}
/* note: result may be null if the flow is suppressed */
}
- res->data = data;
+ res->data = (void **)data;
MONO_OBJECT_SETREF (res, object_data, object_data);
MONO_OBJECT_SETREF (res, async_state, state);
if (handle != NULL)
for (i = 0, j = 0; i < sig->param_count; i++) {
if (sig->params [i]->byref) {
if (out_args) {
- MonoObject* arg = mono_array_get (out_args, gpointer, j);
+ MonoObject* arg = (MonoObject *)mono_array_get (out_args, gpointer, j);
mono_array_setref (this_obj->args, i, arg);
j++;
}
for (i = 0, j = 0; i < sig->param_count; i++) {
if (sig->params [i]->byref) {
MonoObject* arg;
- arg = mono_array_get (msg->args, gpointer, i);
+ arg = (MonoObject *)mono_array_get (msg->args, gpointer, i);
mono_array_setref (*out_args, j, arg);
j++;
}
g_assert (addr);
- ji = mono_jit_info_table_find (domain, mono_get_addr_from_ftnptr (addr));
+ ji = mono_jit_info_table_find (domain, (char *)mono_get_addr_from_ftnptr (addr));
/* Shared code */
if (!ji && domain != mono_get_root_domain ())
- ji = mono_jit_info_table_find (mono_get_root_domain (), mono_get_addr_from_ftnptr (addr));
+ ji = mono_jit_info_table_find (mono_get_root_domain (), (char *)mono_get_addr_from_ftnptr (addr));
if (ji) {
method = mono_jit_info_get_method (ji);
g_assert (!method->klass->generic_container);
if (j >= out_len)
mono_raise_exception (mono_get_exception_execution_engine ("The proxy call returned an incorrect number of output arguments"));
- arg = mono_array_get (out_args, gpointer, j);
+ arg = (char *)mono_array_get (out_args, gpointer, j);
type = pt->type;
g_assert (type != MONO_TYPE_VOID);