#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
#include <stdlib.h>
#endif
#include <mono/utils/monobitset.h>
#include <mono/utils/mono-time.h>
#include <mono/utils/mono-proclib.h>
+#include <mono/utils/mono-string.h>
+#include <mono/utils/mono-error-internals.h>
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
#include <windows.h>
#include <shlobj.h>
#endif
if (source->bounds || dest->bounds)
return FALSE;
+ /* there's no integer overflow since mono_array_length returns an unsigned integer */
if ((dest_idx + length > mono_array_length (dest)) ||
(source_idx + length > mono_array_length (source)))
return FALSE;
mono_gc_wbarrier_generic_store (ea, *(gpointer*)value);
} else {
g_assert (ec->inited);
+ g_assert (esize == mono_class_value_size (ec, NULL));
if (ec->has_references)
mono_gc_wbarrier_value_copy (ea, value, 1, ec);
- memcpy (ea, value, esize);
+ else
+ memcpy (ea, value, esize);
}
}
ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (MonoType *handle)
{
MonoClass *klass;
-
- MONO_ARCH_SAVE_REGS;
+ MonoVTable *vtable;
MONO_CHECK_ARG_NULL (handle);
klass = mono_class_from_mono_type (handle);
MONO_CHECK_ARG (handle, klass);
+ vtable = mono_class_vtable_full (mono_domain_get (), klass, TRUE);
+
/* This will call the type constructor */
- mono_runtime_class_init (mono_class_vtable (mono_domain_get (), klass));
+ mono_runtime_class_init (vtable);
}
static void
mono_image_check_for_module_cctor (image);
if (image->has_module_cctor) {
MonoClass *module_klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | 1);
- mono_runtime_class_init (mono_class_vtable (mono_domain_get (), module_klass));
+ /*It's fine to raise the exception here*/
+ mono_runtime_class_init (mono_class_vtable_full (mono_domain_get (), module_klass, TRUE));
}
}
return mono_field_get_object (mono_domain_get (), klass, handle);
}
-static MonoReflectionField*
-ves_icall_System_Reflection_FieldInfo_internal_from_handle (MonoClassField *handle)
-{
- MONO_ARCH_SAVE_REGS;
-
- g_assert (handle);
-
- return mono_field_get_object (mono_domain_get (), handle->parent, handle);
-}
-
static MonoArray*
ves_icall_System_Reflection_FieldInfo_GetTypeModifiers (MonoReflectionField *field, MonoBoolean optional)
{
vtable = NULL;
if (is_static) {
- vtable = mono_class_vtable (domain, cf->parent);
+ vtable = mono_class_vtable_full (domain, cf->parent, TRUE);
if (!vtable->initialized && !(cf->type->attrs & FIELD_ATTRIBUTE_LITERAL))
mono_runtime_class_init (vtable);
}
}
if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
- MonoVTable *vtable = mono_class_vtable (mono_object_domain (field), cf->parent);
+ MonoVTable *vtable = mono_class_vtable_full (mono_object_domain (field), cf->parent, TRUE);
if (!vtable->initialized)
mono_runtime_class_init (vtable);
mono_field_static_set_value (vtable, cf, v);
mono_gc_wbarrier_generic_store (targets, (MonoObject*) mono_array_new (domain, mono_defaults.method_info_class, len));
mono_gc_wbarrier_generic_store (methods, (MonoObject*) mono_array_new (domain, mono_defaults.method_info_class, len));
iter = NULL;
- iter = NULL;
while ((method = mono_class_get_methods (iclass, &iter))) {
member = mono_method_get_object (domain, method, iclass);
mono_array_setref (*methods, i, member);
MonoArray *res;
MonoClass *klass, *pklass;
MonoDomain *domain = mono_object_domain (type);
- MonoVTable *array_vtable = mono_class_vtable (domain, mono_array_class_get_cached (mono_defaults.systemtype_class, 1));
+ MonoVTable *array_vtable = mono_class_vtable_full (domain, mono_array_class_get_cached (mono_defaults.systemtype_class, 1), TRUE);
int i;
MONO_ARCH_SAVE_REGS;
enumtype->type = t->type;
}
-static MonoReflectionType*
-ves_icall_MonoGenericClass_GetParentType (MonoReflectionGenericClass *type)
-{
- MonoDynamicGenericClass *gclass;
- MonoReflectionType *parent = NULL, *res;
- MonoDomain *domain;
- MonoType *inflated;
- MonoClass *klass;
-
-
- MONO_ARCH_SAVE_REGS;
-
- g_assert (type->type.type->data.generic_class->is_dynamic);
- gclass = (MonoDynamicGenericClass *) type->type.type->data.generic_class;
-
- domain = mono_object_domain (type);
- klass = mono_class_from_mono_type (type->generic_type->type.type);
-
- if (!klass->generic_class && !klass->generic_container)
- return NULL;
-
- parent = monotype_cast (type->generic_type->parent);
-
- if (!parent || (parent->type->type != MONO_TYPE_GENERICINST))
- return NULL;
-
- inflated = mono_class_inflate_generic_type (
- parent->type, mono_generic_class_get_context ((MonoGenericClass *) gclass));
-
- res = mono_type_get_object (domain, inflated);
- mono_metadata_free_type (inflated);
- return res;
-}
-
-static MonoArray*
-ves_icall_MonoGenericClass_GetInterfaces (MonoReflectionGenericClass *type)
-{
- static MonoClass *System_Reflection_MonoGenericClass;
- MonoGenericClass *gclass;
- MonoReflectionTypeBuilder *tb = NULL;
- MonoClass *klass = NULL;
- MonoDomain *domain;
- MonoArray *res;
- int icount, i;
-
- MONO_ARCH_SAVE_REGS;
-
- if (!System_Reflection_MonoGenericClass) {
- System_Reflection_MonoGenericClass = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection", "MonoGenericClass");
- g_assert (System_Reflection_MonoGenericClass);
- }
-
- domain = mono_object_domain (type);
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
-
- tb = type->generic_type;
- icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
-
- res = mono_array_new (domain, System_Reflection_MonoGenericClass, icount);
-
- for (i = 0; i < icount; i++) {
- MonoReflectionType *iface;
- MonoType *it;
-
- if (tb) {
- iface = mono_array_get (tb->interfaces, MonoReflectionType *, i);
- it = iface->type;
- } else
- it = &klass->interfaces [i]->byval_arg;
-
- it = mono_class_inflate_generic_type (it, mono_generic_class_get_context (gclass));
-
- iface = mono_type_get_object (domain, it);
- mono_array_setref (res, i, iface);
- mono_metadata_free_type (it);
- }
-
- return res;
-}
-
-static MonoReflectionMethod*
-ves_icall_MonoGenericClass_GetCorrespondingInflatedMethod (MonoReflectionGenericClass *type,
- MonoReflectionMethod* generic)
-{
- MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
- MonoDomain *domain;
- int i;
-
- MONO_ARCH_SAVE_REGS;
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
-
- dgclass = (MonoDynamicGenericClass *) gclass;
-
- domain = mono_object_domain (type);
-
- for (i = 0; i < dgclass->count_methods; i++)
- if (generic->method->token == dgclass->methods [i]->token)
- return mono_method_get_object (domain, dgclass->methods [i], NULL);
-
- return NULL;
-}
-
-static MonoReflectionMethod*
-ves_icall_MonoGenericClass_GetCorrespondingInflatedConstructor (MonoReflectionGenericClass *type,
- MonoReflectionMethod* generic)
-{
- MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
- MonoDomain *domain;
- int i;
-
- MONO_ARCH_SAVE_REGS;
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
-
- dgclass = (MonoDynamicGenericClass *) gclass;
-
- domain = mono_object_domain (type);
-
- for (i = 0; i < dgclass->count_ctors; i++)
- if (generic->method->token == dgclass->ctors [i]->token)
- return mono_method_get_object (domain, dgclass->ctors [i], NULL);
-
- return NULL;
-}
-
-
-static MonoReflectionField*
-ves_icall_MonoGenericClass_GetCorrespondingInflatedField (MonoReflectionGenericClass *type,
- MonoString* generic_name)
-{
- MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
- MonoDomain *domain;
- MonoClass *refclass;
- char *utf8_name = mono_string_to_utf8 (generic_name);
- int i;
-
- MONO_ARCH_SAVE_REGS;
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
-
- dgclass = (MonoDynamicGenericClass *) gclass;
-
- refclass = mono_class_from_mono_type (type->type.type);
-
- domain = mono_object_domain (type);
-
- for (i = 0; i < dgclass->count_fields; i++)
- if (strcmp (utf8_name, mono_field_get_name (&dgclass->fields [i])) == 0) {
- g_free (utf8_name);
- return mono_field_get_object (domain, refclass, &dgclass->fields [i]);
- }
-
- g_free (utf8_name);
-
- return NULL;
-}
-
-
static MonoReflectionMethod*
ves_icall_MonoType_GetCorrespondingInflatedMethod (MonoReflectionType *type,
MonoReflectionMethod* generic)
return NULL;
}
-static MonoArray*
-ves_icall_MonoGenericClass_GetMethods (MonoReflectionGenericClass *type,
- MonoReflectionType *reflected_type)
-{
- MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
- MonoDomain *domain;
- MonoClass *refclass;
- MonoArray *res;
- int i;
-
- MONO_ARCH_SAVE_REGS;
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
- dgclass = (MonoDynamicGenericClass *) gclass;
-
- refclass = mono_class_from_mono_type (reflected_type->type);
-
- domain = mono_object_domain (type);
- res = mono_array_new (domain, mono_defaults.method_info_class, dgclass->count_methods);
-
- for (i = 0; i < dgclass->count_methods; i++)
- mono_array_setref (res, i, mono_method_get_object (domain, dgclass->methods [i], refclass));
-
- return res;
-}
-
-static MonoArray*
-ves_icall_MonoGenericClass_GetConstructors (MonoReflectionGenericClass *type,
- MonoReflectionType *reflected_type)
-{
- static MonoClass *System_Reflection_ConstructorInfo;
- MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
- MonoDomain *domain;
- MonoClass *refclass;
- MonoArray *res;
- int i;
-
- MONO_ARCH_SAVE_REGS;
-
- if (!System_Reflection_ConstructorInfo)
- System_Reflection_ConstructorInfo = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
- dgclass = (MonoDynamicGenericClass *) gclass;
-
- refclass = mono_class_from_mono_type (reflected_type->type);
-
- domain = mono_object_domain (type);
- res = mono_array_new_cached (domain, System_Reflection_ConstructorInfo, dgclass->count_ctors);
-
- for (i = 0; i < dgclass->count_ctors; i++)
- mono_array_setref (res, i, mono_method_get_object (domain, dgclass->ctors [i], refclass));
-
- return res;
-}
-
-static MonoArray*
-ves_icall_MonoGenericClass_GetFields (MonoReflectionGenericClass *type,
- MonoReflectionType *reflected_type)
-{
- MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
- MonoDomain *domain;
- MonoClass *refclass;
- MonoArray *res;
- int i;
-
- MONO_ARCH_SAVE_REGS;
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
- dgclass = (MonoDynamicGenericClass *) gclass;
- refclass = mono_class_from_mono_type (reflected_type->type);
-
- domain = mono_object_domain (type);
- res = mono_array_new (domain, mono_defaults.field_info_class, dgclass->count_fields);
-
- for (i = 0; i < dgclass->count_fields; i++)
- mono_array_setref (res, i, mono_field_get_object (domain, refclass, &dgclass->fields [i]));
-
- return res;
-}
-
-static MonoArray*
-ves_icall_MonoGenericClass_GetProperties (MonoReflectionGenericClass *type,
- MonoReflectionType *reflected_type)
-{
- static MonoClass *System_Reflection_PropertyInfo;
- MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
- MonoDomain *domain;
- MonoClass *refclass;
- MonoArray *res;
- int i;
-
- MONO_ARCH_SAVE_REGS;
-
- if (!System_Reflection_PropertyInfo)
- System_Reflection_PropertyInfo = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection", "PropertyInfo");
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
- dgclass = (MonoDynamicGenericClass *) gclass;
-
- refclass = mono_class_from_mono_type (reflected_type->type);
-
- domain = mono_object_domain (type);
- res = mono_array_new (domain, System_Reflection_PropertyInfo, dgclass->count_properties);
-
- for (i = 0; i < dgclass->count_properties; i++)
- mono_array_setref (res, i, mono_property_get_object (domain, refclass, &dgclass->properties [i]));
-
- return res;
-}
-
-static MonoArray*
-ves_icall_MonoGenericClass_GetEvents (MonoReflectionGenericClass *type,
- MonoReflectionType *reflected_type)
-{
- static MonoClass *System_Reflection_EventInfo;
- MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
- MonoDomain *domain;
- MonoClass *refclass;
- MonoArray *res;
- int i;
-
- MONO_ARCH_SAVE_REGS;
-
- if (!System_Reflection_EventInfo)
- System_Reflection_EventInfo = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection", "EventInfo");
-
- gclass = type->type.type->data.generic_class;
- g_assert (gclass->is_dynamic);
- dgclass = (MonoDynamicGenericClass *) gclass;
-
- refclass = mono_class_from_mono_type (reflected_type->type);
-
- domain = mono_object_domain (type);
- res = mono_array_new (domain, System_Reflection_EventInfo, dgclass->count_events);
-
- for (i = 0; i < dgclass->count_events; i++)
- mono_array_setref (res, i, mono_event_get_object (domain, refclass, &dgclass->events [i]));
-
- return res;
-}
-
-static MonoReflectionType*
-ves_icall_MonoGenericClass_InflateType (MonoReflectionGenericClass *type,
- MonoReflectionType *target)
-{
- MonoType *res_type;
- MonoClass *gklass;
- MonoReflectionType *res;
-
- MONO_ARCH_SAVE_REGS;
-
- gklass = mono_class_from_mono_type (type->type.type);
- res_type = mono_class_inflate_generic_type (mono_reflection_type_get_handle (target), mono_class_get_context (gklass));
- res = mono_type_get_object (mono_object_domain (type), res_type);
- mono_metadata_free_type (res_type);
- return res;
-}
static MonoReflectionMethod *
ves_icall_MonoType_get_DeclaringMethod (MonoReflectionType *ref_type)
const char *scope = NULL;
guint32 flags;
- if (!method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
+ if (!(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
return NULL;
if (!DllImportAttributeClass) {
import = method_aux->dllentry;
scope = method_aux->dll;
}
+
+ if (!import || !scope) {
+ mono_raise_exception (mono_get_exception_argument ("method", "System.Reflection.Emit method with invalid pinvoke information"));
+ return NULL;
+ }
}
else {
if (piinfo->implmap_idx) {
if (field_klass->valuetype) {
size = mono_type_size (field->type, &align);
-#ifdef HAVE_SGEN_GC
+ g_assert (size == mono_class_value_size (field_klass, NULL));
mono_gc_wbarrier_value_copy ((char *)this + field->offset, (char*)val + sizeof (MonoObject), 1, field_klass);
-#endif
- memcpy ((char *)this + field->offset,
- ((char *)val) + sizeof (MonoObject), size);
} else {
mono_gc_wbarrier_set_field (this, (char*)this + field->offset, val);
}
if (type->type->byref)
return NULL;
- compare_func = (bflags & BFLAGS_IgnoreCase) ? g_strcasecmp : strcmp;
+ compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
handle_parent:
if (klass->exception_type != MONO_EXCEPTION_NONE)
int i, len, match, nslots;
/*FIXME, use MonoBitSet*/
guint32 method_slots_default [8];
- guint32 *method_slots;
+ guint32 *method_slots = NULL;
gchar *mname = NULL;
int (*compare_func) (const char *s1, const char *s2) = NULL;
MonoVTable *array_vtable;
+ MonoException *ex;
MonoPtrArray tmp_array;
-
+
MONO_ARCH_SAVE_REGS;
mono_ptr_array_init (tmp_array, 4);
}
domain = ((MonoObject *)type)->vtable->domain;
- array_vtable = mono_class_vtable (domain, MethodInfo_array);
+ array_vtable = mono_class_vtable_full (domain, MethodInfo_array, TRUE);
if (type->type->byref)
return mono_array_new_specific (array_vtable, 0);
klass = startklass = mono_class_from_mono_type (type->type);
len = 0;
if (name != NULL) {
mname = mono_string_to_utf8 (name);
- compare_func = (ignore_case) ? g_strcasecmp : strcmp;
+ compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
}
/* An optimization for calls made from Delegate:CreateDelegate () */
if (klass->delegate && mname && !strcmp (mname, "Invoke") && (bflags == (BFLAGS_Public | BFLAGS_Static | BFLAGS_Instance))) {
method = mono_get_delegate_invoke (klass);
+ if (mono_loader_get_last_error ())
+ goto loader_error;
member = (MonoObject*)mono_method_get_object (domain, method, refklass);
-
+
res = mono_array_new_specific (array_vtable, 1);
mono_array_setref (res, 0, member);
g_free (mname);
}
mono_class_setup_vtable (klass);
+ if (klass->exception_type != MONO_EXCEPTION_NONE || mono_loader_get_last_error ())
+ goto loader_error;
if (is_generic_parameter (type->type))
nslots = mono_class_get_vtable_size (klass->parent);
}
handle_parent:
mono_class_setup_vtable (klass);
- if (klass->exception_type != MONO_EXCEPTION_NONE)
- mono_raise_exception (mono_class_get_exception_for_failure (klass));
+ if (klass->exception_type != MONO_EXCEPTION_NONE || mono_loader_get_last_error ())
+ goto loader_error;
iter = NULL;
while ((method = mono_class_get_methods (klass, &iter))) {
mono_ptr_array_destroy (tmp_array);
return res;
+
+loader_error:
+ g_free (mname);
+ if (method_slots != method_slots_default)
+ g_free (method_slots);
+ mono_ptr_array_destroy (tmp_array);
+ if (klass->exception_type != MONO_EXCEPTION_NONE) {
+ ex = mono_class_get_exception_for_failure (klass);
+ } else {
+ ex = mono_loader_error_prepare_exception (mono_loader_get_last_error ());
+ mono_loader_clear_error ();
+ }
+ mono_raise_exception (ex);
+ return NULL;
}
static MonoArray*
klass = startklass = mono_class_from_mono_type (type->type);
if (name != NULL) {
propname = mono_string_to_utf8 (name);
- compare_func = (ignore_case) ? g_strcasecmp : strcmp;
+ compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
}
mono_class_setup_vtable (klass);
replace_shadow_path (domain, dirname, &absolute);
g_free (dirname);
-#if PLATFORM_WIN32
+#if HOST_WIN32
{
gint i;
for (i = strlen (absolute) - 1; i >= 0; i--)
uri = g_filename_to_uri (absolute, NULL, NULL);
} else {
const char *prepend = "file://";
-#if PLATFORM_WIN32
+#if HOST_WIN32
if (*absolute == '/' && *(absolute + 1) == '/') {
prepend = "file:";
} else {
{
MonoMethod *m = mono_method_get_last_managed ();
- MONO_ARCH_SAVE_REGS;
+ while (m->is_inflated)
+ m = ((MonoMethodInflated*)m)->declaring;
return mono_method_get_object (mono_domain_get (), m, NULL);
}
codebase = g_strdup (absolute);
-#if PLATFORM_WIN32
+#if HOST_WIN32
{
gint i;
for (i = strlen (codebase) - 1; i >= 0; i--)
static gpointer
ves_icall_System_Reflection_Module_GetHINSTANCE (MonoReflectionModule *module)
{
-#ifdef PLATFORM_WIN32
+#ifdef HOST_WIN32
if (module->image && module->image->is_module_handle)
return module->image->raw_data;
#endif
*/
#define FILETIME_ADJUST ((guint64)504911232000000000LL)
-#ifdef PLATFORM_WIN32
+#ifdef HOST_WIN32
/* convert a SYSTEMTIME which is of the form "last thursday in october" to a real date */
static void
convert_to_absolute_date(SYSTEMTIME *date)
}
#endif
-#ifndef PLATFORM_WIN32
+#ifndef HOST_WIN32
/*
* Return's the offset from GMT of a local time.
*
static guint32
ves_icall_System_CurrentSystemTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
{
-#ifndef PLATFORM_WIN32
+#ifndef HOST_WIN32
MonoDomain *domain = mono_domain_get ();
struct tm start, tt;
time_t t;
static MonoString *
ves_icall_System_Environment_get_MachineName (void)
{
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
gunichar2 *buf;
guint32 len;
MonoString *result;
static int
ves_icall_System_Environment_get_Platform (void)
{
-#if defined (PLATFORM_WIN32)
+#if defined (TARGET_WIN32)
/* Win32NT */
return 2;
#elif defined(__MACH__)
{
MONO_ARCH_SAVE_REGS;
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
return mono_string_new (mono_domain_get (), "\r\n");
#else
return mono_string_new (mono_domain_get (), "\n");
* arm-apple-darwin9. We'll manually define the symbol on Apple as it does
* in fact exist on all implementations (so far)
*/
-gchar ***_NSGetEnviron();
+gchar ***_NSGetEnviron(void);
#define environ (*_NSGetEnviron())
#else
extern
static MonoArray *
ves_icall_System_Environment_GetEnvironmentVariableNames (void)
{
-#ifdef PLATFORM_WIN32
+#ifdef HOST_WIN32
MonoArray *names;
MonoDomain *domain;
MonoString *str;
static void
ves_icall_System_Environment_InternalSetEnvironmentVariable (MonoString *name, MonoString *value)
{
-#ifdef PLATFORM_WIN32
+ MonoError error;
+#ifdef HOST_WIN32
+
gunichar2 *utf16_name, *utf16_value;
#else
gchar *utf8_name, *utf8_value;
MONO_ARCH_SAVE_REGS;
-#ifdef PLATFORM_WIN32
+#ifdef HOST_WIN32
utf16_name = mono_string_to_utf16 (name);
if ((value == NULL) || (mono_string_length (value) == 0) || (mono_string_chars (value)[0] == 0)) {
SetEnvironmentVariable (utf16_name, NULL);
return;
}
- utf8_value = mono_string_to_utf8 (value);
+ utf8_value = mono_string_to_utf8_checked (value, &error);
+ if (!mono_error_ok (&error)) {
+ g_free (utf8_name);
+ mono_error_raise_exception (&error);
+ }
g_setenv (utf8_name, utf8_value, TRUE);
g_free (utf8_name);
static MonoString*
ves_icall_System_Environment_GetWindowsFolderPath (int folder)
{
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
#ifndef CSIDL_FLAG_CREATE
#define CSIDL_FLAG_CREATE 0x8000
#endif
static void
ves_icall_System_Environment_BroadcastSettingChange (void)
{
-#ifdef PLATFORM_WIN32
+#ifdef HOST_WIN32
SendMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, NULL, L"Environment", SMTO_ABORTIFHUNG, 2000, 0);
#endif
}
MONO_ARCH_SAVE_REGS;
klass = mono_class_from_mono_type (type->type);
- vtable = mono_class_vtable (mono_domain_get (), klass);
+ vtable = mono_class_vtable_full (mono_domain_get (), klass, TRUE);
if (enable) vtable->remote = 1;
else vtable->remote = 0;
return (MonoObject *) mono_array_new (domain, klass->element_class, 0);
} else {
/* Bypass remoting object creation check */
- return mono_object_new_alloc_specific (mono_class_vtable (domain, klass));
+ return mono_object_new_alloc_specific (mono_class_vtable_full (domain, klass, TRUE));
}
}
path = g_build_path (G_DIR_SEPARATOR_S, mono_get_config_dir (), "mono", mono_get_runtime_info ()->framework_version, "machine.config", NULL);
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
/* Avoid mixing '/' and '\\' */
{
gint i;
path = g_path_get_dirname (mono_get_config_dir ());
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
/* Avoid mixing '/' and '\\' */
{
gint i;
static MonoBoolean
ves_icall_System_Diagnostics_Debugger_IsAttached_internal (void)
{
- return mono_debug_using_mono_debugger ();
+ return mono_debug_using_mono_debugger () || mono_is_debugger_attached ();
}
static void
ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (MonoString *message)
{
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
OutputDebugString (mono_string_chars (message));
#else
- g_warning ("WriteWindowsDebugString called and PLATFORM_WIN32 not defined!\n");
+ g_warning ("WriteWindowsDebugString called and HOST_WIN32 not defined!\n");
#endif
}
}
static MonoReflectionMethod *
-ves_icall_MonoMethod_get_base_definition (MonoReflectionMethod *m)
+ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, gboolean definition)
{
MonoClass *klass, *parent;
MonoMethod *method = m->method;
if (klass->generic_class)
klass = klass->generic_class->container_class;
- /* At the end of the loop, klass points to the eldest class that has this virtual function slot. */
- for (parent = klass->parent; parent != NULL; parent = parent->parent) {
- mono_class_setup_vtable (parent);
- if (parent->vtable_size <= method->slot)
- break;
- klass = parent;
- }
+ if (definition) {
+ /* At the end of the loop, klass points to the eldest class that has this virtual function slot. */
+ for (parent = klass->parent; parent != NULL; parent = parent->parent) {
+ mono_class_setup_vtable (parent);
+ if (parent->vtable_size <= method->slot)
+ break;
+ klass = parent;
+ }
+ } else {
+ klass = klass->parent;
+ if (!klass)
+ return m;
+ }
if (klass == method->klass)
return m;
iter->args = start;
} else {
iter->args = argsp + sizeof (gpointer);
-#ifndef MONO_ARCH_REGPARMS
- {
- guint32 i, arg_size;
- gint32 align;
- for (i = 0; i < iter->sig->sentinelpos; ++i) {
- arg_size = mono_type_stack_size (iter->sig->params [i], &align);
- iter->args = (char*)iter->args + arg_size;
- }
- }
-#endif
}
iter->num_args = iter->sig->param_count - iter->sig->sentinelpos;
}
}
-static MonoBoolean
-GCHandle_CheckCurrentDomain (guint32 gchandle)
-{
- return mono_gchandle_is_in_domain (gchandle, mono_domain_get ());
-}
-
static MonoString*
ves_icall_Mono_Runtime_GetDisplayName (void)
{
- static const char display_name_str [] = "Mono " VERSION;
- MonoString *display_name = mono_string_new (mono_domain_get (), display_name_str);
+ char *info;
+ MonoString *display_name;
+
+ info = mono_get_runtime_callbacks ()->get_runtime_build_info ();
+ display_name = mono_string_new (mono_domain_get (), info);
+ g_free (info);
return display_name;
}
res = mono_metadata_signature_alloc (mono_defaults.corlib, len - 1);
res->pinvoke = 1;
-#ifdef PLATFORM_WIN32
+#ifdef HOST_WIN32
/*
* Under windows, the default pinvoke calling convention is STDCALL but
* we need CDECL.