#include <mono/metadata/object.h>
#include <mono/metadata/threads.h>
+#include <mono/metadata/monitor.h>
#include <mono/metadata/reflection.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/tabledefs.h>
#include <mono/metadata/string-icalls.h>
#include <mono/metadata/debug-mono-symfile.h>
#include <mono/metadata/process.h>
+#include <mono/metadata/environment.h>
#include <mono/io-layer/io-layer.h>
#include <mono/utils/strtod.h>
#endif
#include "decimal.h"
+static MonoReflectionAssembly* ves_icall_System_Reflection_Assembly_GetCallingAssembly (void);
+
+
static MonoString *
mono_double_ToStringImpl (double value)
{
static double
mono_double_ParseImpl (char *ptr)
{
+ gchar *endptr = NULL;
+ gdouble result;
+
MONO_ARCH_SAVE_REGS;
- return bsd_strtod (ptr, NULL);
+ if (*ptr)
+ result = bsd_strtod (ptr, &endptr);
+
+ if (!*ptr || (endptr && *endptr))
+ mono_raise_exception (mono_exception_from_name (mono_defaults.corlib,
+ "System",
+ "FormatException"));
+
+ return result;
}
static MonoString *
MONO_CHECK_ARG (handle, klass);
/* This will call the type constructor */
- mono_class_vtable (mono_domain_get (), klass);
+ if (! (klass->flags & TYPE_ATTRIBUTE_INTERFACE))
+ mono_class_vtable (mono_domain_get (), klass);
}
static MonoObject *
return count;
}
-typedef struct getTypeInfo GetTypeInfo;
-struct getTypeInfo {
- MonoType *type;
- MonoTypeNameParse *info;
- MonoBoolean ignoreCase;
-};
-
static void
-try_get_type (gpointer key, gpointer value, gpointer user_data)
+ves_icall_AssemblyBuilder_build_metadata (MonoReflectionAssemblyBuilder *assb)
{
- GetTypeInfo *gt_info = user_data;
- MonoAssembly *assembly;
-
- if (gt_info->type != NULL)
- return;
+ MONO_ARCH_SAVE_REGS;
- assembly = value;
- /* Weird, but the domain is locked and the assembly will not be freed */
- memcpy (>_info->info->assembly, &assembly->aname, sizeof (MonoAssemblyName));
- gt_info->type = mono_reflection_get_type (assembly->image,
- gt_info->info,
- gt_info->ignoreCase);
+ mono_image_build_metadata (assb);
}
static MonoReflectionType*
MonoBoolean ignoreCase)
{
gchar *str;
- MonoType *type;
- MonoAssembly *assembly = NULL;
+ MonoType *type = NULL;
+ MonoAssembly *assembly;
MonoTypeNameParse info;
MONO_ARCH_SAVE_REGS;
if (info.assembly.name) {
assembly = mono_assembly_load (&info.assembly, NULL, NULL);
+ } else {
+ MonoReflectionAssembly *refass;
- if (!assembly) {
- g_free (str);
- g_list_free (info.modifiers);
- g_list_free (info.nested);
- if (throwOnError)
- mono_raise_exception (mono_get_exception_type_load ());
-
- return NULL;
- }
+ refass = ves_icall_System_Reflection_Assembly_GetCallingAssembly ();
+ assembly = refass->assembly;
}
-
- if (assembly) {
+
+ if (assembly)
type = mono_reflection_get_type (assembly->image, &info, ignoreCase);
- } else {
- MonoDomain *domain = mono_domain_get ();
- GetTypeInfo gt_info;
-
- gt_info.type = NULL;
- gt_info.info = &info;
- gt_info.ignoreCase = ignoreCase;
-
- mono_domain_lock (domain);
- g_hash_table_foreach (domain->assemblies, try_get_type, >_info);
- mono_domain_unlock (domain);
- type = gt_info.type;
- }
+
+ if (!info.assembly.name && !type) /* try mscorlib */
+ type = mono_reflection_get_type (NULL, &info, ignoreCase);
g_free (str);
g_list_free (info.modifiers);
} else
*((gpointer *)this + k->fields [i].offset) = val;
- g_assert (result);
+ out_args = mono_array_new (domain, mono_defaults.object_class, 0);
+ *outArgs = out_args;
+
g_free (str);
return NULL;
}
static MonoClass *System_Reflection_AssemblyName;
MonoArray *result;
MonoAssembly **ptr;
+ MonoDomain *domain = mono_object_domain (assembly);
int i, count = 0;
MONO_ARCH_SAVE_REGS;
for (i = 0; i < count; i++) {
MonoAssembly *assem = assembly->assembly->image->references [i];
MonoReflectionAssemblyName *aname;
+ char *codebase;
aname = (MonoReflectionAssemblyName *) mono_object_new (
- mono_object_domain (assembly), System_Reflection_AssemblyName);
+ domain, System_Reflection_AssemblyName);
if (strcmp (assem->aname.name, "corlib") == 0)
- aname->name = mono_string_new (mono_object_domain (assembly), "mscorlib");
+ aname->name = mono_string_new (domain, "mscorlib");
else
- aname->name = mono_string_new (mono_object_domain (assembly), assem->aname.name);
+ aname->name = mono_string_new (domain, assem->aname.name);
aname->major = assem->aname.major;
+ codebase = g_strconcat ("file://", assembly->assembly->image->references [i]->image->name, NULL);
+ aname->codebase = mono_string_new (domain, codebase);
+ g_free (codebase);
mono_array_set (result, gpointer, i, aname);
}
return result;
ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name)
{
MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
- MonoArray *result;
+ MonoArray *result = NULL;
int i;
const char *val;
char *n;
MONO_ARCH_SAVE_REGS;
- g_assert (domain->entry_assembly);
+ if (!domain->entry_assembly)
+ domain = mono_root_domain;
+
return mono_assembly_get_object (domain, domain->entry_assembly);
}
long int gmtoff;
int is_daylight = 0, day;
+ char tzone[10];
MONO_ARCH_SAVE_REGS;
+ if ((year < 1900) || (year > 2100))
+ mono_raise_exception (mono_get_exception_not_implemented ());
+
memset (&start, 0, sizeof (start));
start.tm_mday = 1;
#endif
gmtoff = gmt_offset (start);
-
+
MONO_CHECK_ARG_NULL (data);
MONO_CHECK_ARG_NULL (names);
/* Daylight saving starts or ends here. */
if (gmt_offset (tt) != gmtoff) {
- char tzone[10];
struct tm tt1;
time_t t1;
gmtoff = gmt_offset (tt);
}
+
+ if (!is_daylight) {
+ strftime (tzone, 10, "%Z", &tt);
+ mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
+ mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
+ mono_array_set ((*data), gint64, 0, 0);
+ mono_array_set ((*data), gint64, 1, 0);
+ mono_array_set ((*data), gint64, 2, (gint64) gmtoff * 10000000L);
+ mono_array_set ((*data), gint64, 3, 0);
+ }
+
return 1;
#else
MonoDomain *domain = mono_domain_get ();
return 0;
}
+static void
+ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (MonoReflectionType *type, MonoBoolean enable)
+{
+ MonoClass *klass;
+ MonoVTable* vtable;
+
+ MONO_ARCH_SAVE_REGS;
+
+ klass = mono_class_from_mono_type (type->type);
+ vtable = mono_class_vtable (mono_domain_get (), klass);
+
+ if (enable) vtable->remote = 1;
+ else vtable->remote = 0;
+}
+
+static MonoObject *
+ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance (MonoReflectionType *type)
+{
+ MonoClass *klass;
+ MonoDomain *domain;
+
+ MONO_ARCH_SAVE_REGS;
+
+ domain = mono_object_domain (type);
+ klass = mono_class_from_mono_type (type->type);
+
+ // Bypass remoting object creation check
+ return mono_object_new_alloc_specific (mono_class_vtable (domain, klass));
+}
+
static MonoObject *
ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal (MonoReflectionType *type)
{
return mono_compile_method (method);
}
-char * mono_cfg_dir = "";
+char const * mono_cfg_dir = "";
void
-mono_install_get_config_dir()
-{
+mono_install_get_config_dir (void)
+{
+#ifdef PLATFORM_WIN32
+ int i;
+#endif
+
mono_cfg_dir = getenv ("MONO_CFG_DIR");
- if (!mono_cfg_dir)
- mono_cfg_dir = MONO_CFG_DIR;
+ if (!mono_cfg_dir) {
+#ifndef PLATFORM_WIN32
+ mono_cfg_dir = MONO_CFG_DIR;
+#else
+ mono_cfg_dir = g_strdup (MONO_CFG_DIR);
+ for (i = strlen (mono_cfg_dir) - 1; i >= 0; i--) {
+ if (mono_cfg_dir [i] == '/')
+ mono_cfg_dir [i] = '\\';
+ }
+#endif
+ }
}
return mono_object_new (domain, klass);
}
+static MonoReflectionMethod *
+ves_icall_MonoMethod_get_base_definition (MonoReflectionMethod *m)
+{
+ MonoClass *klass;
+ MonoMethod *method = m->method;
+ MonoMethod *result = NULL;
+
+ MONO_ARCH_SAVE_REGS;
+
+ if (!(method->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
+ method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ||
+ method->flags & METHOD_ATTRIBUTE_NEW_SLOT)
+ return m;
+
+ if (method->klass == NULL || (klass = method->klass->parent) == NULL)
+ return m;
+
+ if (klass->vtable_size > method->slot)
+ result = klass->vtable [method->slot];
+
+ if (result == NULL)
+ return m;
+
+ return mono_method_get_object (mono_domain_get (), result, NULL);
+}
+
/* icall map */
static gconstpointer icall_map [] = {
"System.String::InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN,
"System.String::InternalIntern", ves_icall_System_String_InternalIntern,
"System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
- "System.String::InternalCompare(string,int,string,int,int,bool)", ves_icall_System_String_InternalCompareStr_N,
+ "System.String::InternalCompare(string,int,string,int,int,int)", ves_icall_System_String_InternalCompareStr_N,
"System.String::GetHashCode", ves_icall_System_String_GetHashCode,
"System.String::get_Chars", ves_icall_System_String_get_Chars,
"System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
"System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
"System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
- "System.AppDomain::Unload", ves_icall_System_AppDomain_Unload,
+ "System.AppDomain::InternalUnload", ves_icall_System_AppDomain_InternalUnload,
"System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
+ "System.AppDomain::InternalSetDomain", ves_icall_System_AppDomain_InternalSetDomain,
+ "System.AppDomain::InternalSetDomainByID", ves_icall_System_AppDomain_InternalSetDomainByID,
+ "System.AppDomain::InternalSetContext", ves_icall_System_AppDomain_InternalSetContext,
+ "System.AppDomain::InternalGetContext", ves_icall_System_AppDomain_InternalGetContext,
+ "System.AppDomain::InternalGetDefaultContext", ves_icall_System_AppDomain_InternalGetDefaultContext,
/*
* System.AppDomainSetup
* ModuleBuilder
*/
"System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
+ "System.Reflection.Emit.ModuleBuilder::basic_init", mono_image_module_basic_init,
/*
* AssemblyBuilder
"System.Reflection.Emit.AssemblyBuilder::getUSIndex", mono_image_insert_string,
"System.Reflection.Emit.AssemblyBuilder::getToken", ves_icall_AssemblyBuilder_getToken,
"System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
+ "System.Reflection.Emit.AssemblyBuilder::build_metadata", ves_icall_AssemblyBuilder_build_metadata,
/*
* Reflection stuff.
"System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
"System.RuntimeMethodHandle::GetFunctionPointer", ves_icall_RuntimeMethod_GetFunctionPointer,
+ "System.Reflection.MonoMethod::get_base_definition", ves_icall_MonoMethod_get_base_definition,
/* System.Enum */
* System.Security.Cryptography calls
*/
- "System.Security.Cryptography.RNGCryptoServiceProvider::GetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes,
- "System.Security.Cryptography.RNGCryptoServiceProvider::GetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes,
+ "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetBytes,
+ "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetNonZeroBytes,
/*
* System.Buffer
/*
* System.Math
*/
+ "System.Math::Floor", ves_icall_System_Math_Floor,
+ "System.Math::Round", ves_icall_System_Math_Round,
+ "System.Math::Round2", ves_icall_System_Math_Round2,
"System.Math::Sin", ves_icall_System_Math_Sin,
- "System.Math::Cos", ves_icall_System_Math_Cos,
- "System.Math::Tan", ves_icall_System_Math_Tan,
- "System.Math::Sinh", ves_icall_System_Math_Sinh,
- "System.Math::Cosh", ves_icall_System_Math_Cosh,
- "System.Math::Tanh", ves_icall_System_Math_Tanh,
- "System.Math::Acos", ves_icall_System_Math_Acos,
- "System.Math::Asin", ves_icall_System_Math_Asin,
- "System.Math::Atan", ves_icall_System_Math_Atan,
- "System.Math::Atan2", ves_icall_System_Math_Atan2,
- "System.Math::Exp", ves_icall_System_Math_Exp,
- "System.Math::Log", ves_icall_System_Math_Log,
- "System.Math::Log10", ves_icall_System_Math_Log10,
- "System.Math::PowImpl", ves_icall_System_Math_Pow,
- "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
+ "System.Math::Cos", ves_icall_System_Math_Cos,
+ "System.Math::Tan", ves_icall_System_Math_Tan,
+ "System.Math::Sinh", ves_icall_System_Math_Sinh,
+ "System.Math::Cosh", ves_icall_System_Math_Cosh,
+ "System.Math::Tanh", ves_icall_System_Math_Tanh,
+ "System.Math::Acos", ves_icall_System_Math_Acos,
+ "System.Math::Asin", ves_icall_System_Math_Asin,
+ "System.Math::Atan", ves_icall_System_Math_Atan,
+ "System.Math::Atan2", ves_icall_System_Math_Atan2,
+ "System.Math::Exp", ves_icall_System_Math_Exp,
+ "System.Math::Log", ves_icall_System_Math_Log,
+ "System.Math::Log10", ves_icall_System_Math_Log10,
+ "System.Math::Pow", ves_icall_System_Math_Pow,
+ "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
/*
* System.Environment
"System.Environment::get_TickCount", ves_icall_System_Environment_get_TickCount,
"System.Environment::Exit", ves_icall_System_Environment_Exit,
"System.Environment::get_Platform", ves_icall_System_Environment_get_Platform,
+ "System.Environment::get_ExitCode", mono_environment_exitcode_get,
+ "System.Environment::set_ExitCode", mono_environment_exitcode_set,
/*
* System.Runtime.Remoting
"System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
ves_icall_IsTransparentProxy,
+ /*
+ * System.Runtime.Remoting.Activation
+ */
+ "System.Runtime.Remoting.Activation.ActivationServices::AllocateUninitializedClassInstance",
+ ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance,
+ "System.Runtime.Remoting.Activation.ActivationServices::EnableProxyActivation",
+ ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation,
+
/*
* System.Runtime.Remoting.Messaging
*/
/*
* System.Runtime.Remoting.Proxies
*/
- "System.Runtime.Remoting.Proxies.RealProxy::GetTransparentProxy",
+ "System.Runtime.Remoting.Proxies.RealProxy::InternalGetTransparentProxy",
ves_icall_Remoting_RealProxy_GetTransparentProxy,
/*
"System.Reflection.Assembly::MonoDebugger_GetMethod",
ves_icall_MonoDebugger_GetMethod,
+ "System.Reflection.Assembly::MonoDebugger_GetMethodToken",
+ ves_icall_MonoDebugger_GetMethodToken,
+
"System.Reflection.Assembly::MonoDebugger_GetLocalTypeFromSignature",
ves_icall_MonoDebugger_GetLocalTypeFromSignature,