to force all of your Mono processes to use LLVM or SGEN without having
to modify any launch scripts.
.TP
-\fBMONO_ENV_OPTIONS\fR
+\fBMONO_SDB_ENV_OPTIONS\fR
Used to pass extra options to the debugger agent in the runtime, as they were passed
using --debugger-agent=.
.TP
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System System.Data System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System.Runtime.Serialization
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_MCS_FLAGS += /d:NO_CODEDOM
endif
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS) -unsafe
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
LIB_REFS = System System.Xml System.Xml.Linq
LIB_MCS_FLAGS = $(SIGN_FLAGS)
-PLATFORM_DEBUG_FLAGS =
-
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
--- /dev/null
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Mono {
+ internal static class RuntimeMarshal {
+ internal static string PtrToUtf8String (IntPtr ptr)
+ {
+ unsafe {
+ return new String ((sbyte*)ptr);
+ }
+ }
+
+ internal static SafeStringMarshal MarshalString (string str)
+ {
+ return new SafeStringMarshal (str);
+ }
+
+ static int DecodeBlobSize (IntPtr in_ptr, out IntPtr out_ptr)
+ {
+ uint size;
+ unsafe {
+ byte *ptr = (byte*)in_ptr;
+
+ if ((*ptr & 0x80) == 0) {
+ size = (uint)(ptr [0] & 0x7f);
+ ptr++;
+ } else if ((*ptr & 0x40) == 0){
+ size = (uint)(((ptr [0] & 0x3f) << 8) + ptr [1]);
+ ptr += 2;
+ } else {
+ size = (uint)(((ptr [0] & 0x1f) << 24) +
+ (ptr [1] << 16) +
+ (ptr [2] << 8) +
+ ptr [3]);
+ ptr += 4;
+ }
+ out_ptr = (IntPtr)ptr;
+ }
+
+ return (int)size;
+ }
+
+ internal static byte[] DecodeBlobArray (IntPtr ptr)
+ {
+ IntPtr out_ptr;
+ int size = DecodeBlobSize (ptr, out out_ptr);
+ byte[] res = new byte [size];
+ Marshal.Copy (out_ptr, res, 0, size);
+ return res;
+ }
+
+ internal static int AsciHexDigitValue (int c)
+ {
+ if (c >= '0' && c <= '9')
+ return c - '0';
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+ return c - 'A' + 10;
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ internal static extern void FreeAssemblyName (ref MonoAssemblyName name);
+ }
+}
}
}
+ //Maps to metadata-internals.h:: MonoAssemblyName
+ internal unsafe struct MonoAssemblyName
+ {
+ const int MONO_PUBLIC_KEY_TOKEN_LENGTH = 17;
+
+ internal IntPtr name;
+ internal IntPtr culture;
+ internal IntPtr hash_value;
+ internal IntPtr public_key;
+ internal fixed byte public_key_token [MONO_PUBLIC_KEY_TOKEN_LENGTH];
+ internal uint hash_alg;
+ internal uint hash_len;
+ internal uint flags;
+ internal ushort major, minor, build, revision;
+ internal ushort arch;
+ }
}
-
--- /dev/null
+//
+// Safe wrapper for a string and its UTF8 encoding
+//
+// Authors:
+// Aleksey Kliger <aleksey@xamarin.com>
+// Rodrigo Kumpera <kumpera@xamarin.com>
+//
+// Copyright 2016 Dot net foundation.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Mono {
+ internal struct SafeStringMarshal : IDisposable {
+ readonly string str;
+ IntPtr marshaled_string;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr StringToUtf8 (string str);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void GFree (IntPtr ptr);
+
+ public SafeStringMarshal (string str) {
+ this.str = str;
+ this.marshaled_string = IntPtr.Zero;
+ }
+
+ public IntPtr Value {
+ get {
+ if (marshaled_string == IntPtr.Zero && str != null)
+ marshaled_string = StringToUtf8 (str);
+ return marshaled_string;
+ }
+ }
+
+ public void Dispose () {
+ if (marshaled_string != IntPtr.Zero) {
+ GFree (marshaled_string);
+ marshaled_string = IntPtr.Zero;
+ }
+ }
+ }
+}
static extern Type MakeGenericType (Type gt, Type [] types);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern IntPtr GetMethodsByName_native (string name, BindingFlags bindingAttr, bool ignoreCase);
+ internal extern IntPtr GetMethodsByName_native (IntPtr namePtr, BindingFlags bindingAttr, bool ignoreCase);
internal RuntimeMethodInfo[] GetMethodsByName (string name, BindingFlags bindingAttr, bool ignoreCase, RuntimeType reflectedType)
{
var refh = new RuntimeTypeHandle (reflectedType);
- using (var h = new Mono.SafeGPtrArrayHandle (GetMethodsByName_native (name, bindingAttr, ignoreCase))) {
+ using (var namePtr = new Mono.SafeStringMarshal (name))
+ using (var h = new Mono.SafeGPtrArrayHandle (GetMethodsByName_native (namePtr.Value, bindingAttr, ignoreCase))) {
var n = h.Length;
var a = new RuntimeMethodInfo [n];
for (int i = 0; i < n; i++) {
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern IntPtr GetPropertiesByName_native (string name, BindingFlags bindingAttr, bool icase);
+ extern IntPtr GetPropertiesByName_native (IntPtr name, BindingFlags bindingAttr, bool icase);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern IntPtr GetConstructors_native (BindingFlags bindingAttr);
RuntimePropertyInfo[] GetPropertiesByName (string name, BindingFlags bindingAttr, bool icase, RuntimeType reflectedType)
{
var refh = new RuntimeTypeHandle (reflectedType);
- using (var h = new Mono.SafeGPtrArrayHandle (GetPropertiesByName_native (name, bindingAttr, icase))) {
+ using (var namePtr = new Mono.SafeStringMarshal (name))
+ using (var h = new Mono.SafeGPtrArrayHandle (GetPropertiesByName_native (namePtr.Value, bindingAttr, icase))) {
var n = h.Length;
var a = new RuntimePropertyInfo [n];
for (int i = 0; i < n; i++) {
extern int GetGenericParameterPosition ();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern IntPtr GetEvents_native (string name, BindingFlags bindingAttr);
+ extern IntPtr GetEvents_native (IntPtr name, BindingFlags bindingAttr);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern IntPtr GetFields_native (string name, BindingFlags bindingAttr);
+ extern IntPtr GetFields_native (IntPtr name, BindingFlags bindingAttr);
RuntimeFieldInfo[] GetFields_internal (string name, BindingFlags bindingAttr, RuntimeType reflectedType)
{
var refh = new RuntimeTypeHandle (reflectedType);
- using (var h = new Mono.SafeGPtrArrayHandle (GetFields_native (name, bindingAttr))) {
+ using (var namePtr = new Mono.SafeStringMarshal (name))
+ using (var h = new Mono.SafeGPtrArrayHandle (GetFields_native (namePtr.Value, bindingAttr))) {
int n = h.Length;
var a = new RuntimeFieldInfo[n];
for (int i = 0; i < n; i++) {
RuntimeEventInfo[] GetEvents_internal (string name, BindingFlags bindingAttr, RuntimeType reflectedType)
{
var refh = new RuntimeTypeHandle (reflectedType);
- using (var h = new Mono.SafeGPtrArrayHandle (GetEvents_native (name, bindingAttr))) {
+ using (var namePtr = new Mono.SafeStringMarshal (name))
+ using (var h = new Mono.SafeGPtrArrayHandle (GetEvents_native (namePtr.Value, bindingAttr))) {
int n = h.Length;
var a = new RuntimeEventInfo[n];
for (int i = 0; i < n; i++) {
public extern override Type[] GetInterfaces();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern RuntimeType[] GetNestedTypes_internal (string name, BindingFlags bindingAttr);
+ extern IntPtr GetNestedTypes_native (IntPtr name, BindingFlags bindingAttr);
+
+ RuntimeType[] GetNestedTypes_internal (string displayName, BindingFlags bindingAttr)
+ {
+ string internalName = null;
+ if (displayName != null)
+ internalName = TypeIdentifiers.FromDisplay (displayName).InternalName;
+ using (var namePtr = new Mono.SafeStringMarshal (internalName))
+ using (var h = new Mono.SafeGPtrArrayHandle (GetNestedTypes_native (namePtr.Value, bindingAttr))) {
+ int n = h.Length;
+ var a = new RuntimeType [n];
+ for (int i = 0; i < n; i++) {
+ var th = new RuntimeTypeHandle (h[i]);
+ a[i] = (RuntimeType) Type.GetTypeFromHandle (th);
+ }
+ return a;
+ }
+ }
public override string AssemblyQualifiedName {
get {
public override AssemblyName GetName (bool copiedName)
{
- AssemblyName aname = new AssemblyName ();
- FillName (this, aname);
+ var aname = AssemblyName.Create (this, false);
if (sn != null) {
aname.SetPublicKey (sn.PublicKey);
// Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
#pragma warning disable 649
- private IntPtr _mono_assembly;
+ internal IntPtr _mono_assembly;
#pragma warning restore 649
private ResolveEventHolder resolve_event_holder;
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal extern static void InternalGetAssemblyName (string assemblyFile, AssemblyName aname);
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- static extern internal void FillName (Assembly ass, AssemblyName aname);
-
public virtual AssemblyName GetName (Boolean copiedName)
{
throw new NotImplementedException ();
using System.Runtime.CompilerServices;
using System.IO;
+using Mono;
using Mono.Security;
using Mono.Security.Cryptography;
}
[MethodImpl (MethodImplOptions.InternalCall)]
- static extern bool ParseName (AssemblyName aname, string assemblyName);
-
+ static extern bool ParseAssemblyName (IntPtr name, out MonoAssemblyName aname, out bool is_version_definited, out bool is_token_defined);
+
public AssemblyName (string assemblyName)
{
if (assemblyName == null)
throw new ArgumentNullException ("assemblyName");
if (assemblyName.Length < 1)
throw new ArgumentException ("assemblyName cannot have zero length.");
-
- if (!ParseName (this, assemblyName))
- throw new FileLoadException ("The assembly name is invalid.");
+
+ using (var name = RuntimeMarshal.MarshalString (assemblyName)) {
+ MonoAssemblyName nativeName;
+ bool isVersionDefined, isTokenDefined;
+ //ParseName free the name if it fails.
+ if (!ParseAssemblyName (name.Value, out nativeName, out isVersionDefined, out isTokenDefined))
+ throw new FileLoadException ("The assembly name is invalid.");
+ try {
+ unsafe {
+ this.FillName (&nativeName, null, isVersionDefined, false, isTokenDefined);
+ }
+ } finally {
+ RuntimeMarshal.FreeAssemblyName (ref nativeName);
+ }
+ }
}
[MonoLimitation ("Not used, as the values are too limited; Mono supports more")]
contentType = value;
}
}
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ static extern unsafe MonoAssemblyName* GetNativeName (IntPtr assembly_ptr);
+
+ internal unsafe void FillName (MonoAssemblyName *native, string codeBase, bool addVersion, bool addPublickey, bool defaultToken)
+ {
+ this.name = RuntimeMarshal.PtrToUtf8String (native->name);
+
+ this.major = native->major;
+ this.minor = native->minor;
+ this.build = native->build;
+ this.revision = native->revision;
+
+ this.flags = (AssemblyNameFlags)native->flags;
+
+ this.hashalg = (AssemblyHashAlgorithm)native->hash_alg;
+
+ this.versioncompat = AssemblyVersionCompatibility.SameMachine;
+ this.processor_architecture = (ProcessorArchitecture)native->arch;
+
+ if (addVersion)
+ this.version = new Version (this.major, this.minor, this.build, this.revision);
+
+ this.codebase = codeBase;
+
+ if (native->culture != IntPtr.Zero)
+ this.cultureinfo = CultureInfo.CreateCulture ( RuntimeMarshal.PtrToUtf8String (native->culture), false);
+
+ if (native->public_key != IntPtr.Zero) {
+ this.publicKey = RuntimeMarshal.DecodeBlobArray (native->public_key);
+ this.flags |= AssemblyNameFlags.PublicKey;
+ } else if (addPublickey) {
+ this.publicKey = EmptyArray<byte>.Value;
+ this.flags |= AssemblyNameFlags.PublicKey;
+ }
+
+ // MonoAssemblyName keeps the public key token as an hexadecimal string
+ if (native->public_key_token [0] != 0) {
+ byte[] keyToken = new byte [8];
+ for (int i = 0, j = 0; i < 8; ++i) {
+ keyToken [i] = (byte)(RuntimeMarshal.AsciHexDigitValue (native->public_key_token [j++]) << 4);
+ keyToken [i] |= (byte)RuntimeMarshal.AsciHexDigitValue (native->public_key_token [j++]);
+ }
+ this.keyToken = keyToken;
+ } else if (defaultToken) {
+ this.keyToken = EmptyArray<byte>.Value;
+ }
+ }
+
+ internal static AssemblyName Create (Assembly assembly, bool fillCodebase)
+ {
+ AssemblyName aname = new AssemblyName ();
+ unsafe {
+ MonoAssemblyName *native = GetNativeName (assembly._mono_assembly);
+ aname.FillName (native, fillCodebase ? assembly.CodeBase : null, true, true, true);
+ }
+ return aname;
+ }
}
}
using System.Security.Policy;
using System.Security.Permissions;
+using Mono;
+
namespace System.Reflection {
abstract class RuntimeAssembly : Assembly
var _ = CodeBase; // this will ensure the Demand is made
}
#endif
-
- AssemblyName aname = new AssemblyName ();
- FillName (this, aname);
- return aname;
+ return AssemblyName.Create (this, true);
}
-
}
[ComVisible (true)]
Mono.Globalization.Unicode/Normalization.cs
Mono.Globalization.Unicode/NormalizationTableUtil.cs
Mono/Runtime.cs
-Mono/RuntimeStructs.cs
Mono/RuntimeHandles.cs
+Mono/RuntimeMarshal.cs
+Mono/RuntimeStructs.cs
Mono/SafeGPtrArrayHandle.cs
+Mono/SafeStringMarshal.cs
Mono/DataConverter.cs
Mono.Interop/ComInteropProxy.cs
Mono.Interop/IDispatch.cs
return base_type;
}
- if (iface_exprs != null) {
+ if (iface_exprs != null && this is Interface) {
foreach (var iface in iface_exprs) {
// the interface might not have been resolved, prevents a crash, see #442144
if (iface == null)
{
TypeSpec argument_type = a.Type;
+ //
+ // Exactly matching Expression phase
+ //
+
//
// If argument is an anonymous function
//
if (q != p) {
//
- // An inferred return type X exists for E in the context of that parameter list, and
- // the conversion from X to Y1 is better than the conversion from X to Y2
+ // An inferred return type X exists for E in the context of the parameter list, and
+ // an identity conversion exists from X to the return type of D
//
- argument_type = am.InferReturnType (ec, null, orig_q);
- if (argument_type == null) {
- // TODO: Can this be hit?
- return 1;
- }
+ var inferred_type = am.InferReturnType (ec, null, orig_q);
+ if (inferred_type != null) {
+ if (inferred_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic)
+ inferred_type = ec.BuiltinTypes.Object;
+
+ if (inferred_type == p)
+ return 1;
- if (argument_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic)
- argument_type = ec.BuiltinTypes.Object;
+ if (inferred_type == q)
+ return 2;
+ }
}
}
--- /dev/null
+using System;
+
+public class MainClass
+{
+ static long? X<T> (T a1, Func<T, T?> a2) where T : struct
+ {
+ return 0;
+ }
+
+ static int? X<T> (T a1, Func<T, int?> a2)
+ {
+ return 0;
+ }
+
+ static double? X<T> (T a1, Func<T, double?> a2)
+ {
+ return null;
+ }
+
+ public static void Main ()
+ {
+ int? sum = X<int> (1, i => {
+ if (i > 0)
+ return i;
+
+ return null;
+ });
+
+
+ int? sum2 = X (1, i => {
+ if (i > 0)
+ return i;
+
+ return null;
+ });
+
+ }
+}
--- /dev/null
+namespace Example
+{
+ public class A : A.InnerInterface
+ {
+ public interface InnerInterface
+ {
+ }
+
+ public static void Main ()
+ {
+ }
+ }
+}
\ No newline at end of file
</method>
</type>
</test>
+ <test name="gtest-lambda-37.cs">
+ <type name="MainClass">
+ <method name="System.Nullable`1[System.Int64] X[T](T, System.Func`2[T,System.Nullable`1[T]])" attrs="145">
+ <size>16</size>
+ </method>
+ <method name="System.Nullable`1[System.Int32] X[T](T, System.Func`2[T,System.Nullable`1[System.Int32]])" attrs="145">
+ <size>15</size>
+ </method>
+ <method name="System.Nullable`1[System.Double] X[T](T, System.Func`2[T,System.Nullable`1[System.Double]])" attrs="145">
+ <size>18</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>74</size>
+ </method>
+ <method name="System.Nullable`1[System.Int32] <Main>m__0(Int32)" attrs="145">
+ <size>37</size>
+ </method>
+ <method name="System.Nullable`1[System.Int32] <Main>m__1(Int32)" attrs="145">
+ <size>37</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-linq-01.cs">
<type name="from.C">
<method name="Void Main()" attrs="150">
</method>
</type>
</test>
+ <test name="test-938.cs">
+ <type name="Example.A">
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-94.cs">
<type name="Base">
<method name="Int32 IVehicle.Start()" attrs="481">
g_free ((void *) aname->name);
g_free ((void *) aname->culture);
g_free ((void *) aname->hash_value);
+ g_free ((guint8*) aname->public_key);
}
static gboolean
ICALL_TYPE(RTPTRARRAY, "Mono.RuntimeGPtrArrayHandle", RTPTRARRAY_1)
ICALL(RTPTRARRAY_1, "GPtrArrayFree", ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree)
+ICALL_TYPE(RTMARSHAL, "Mono.RuntimeMarshal", RTMARSHAL_1)
+ICALL(RTMARSHAL_1, "FreeAssemblyName", ves_icall_Mono_RuntimeMarshal_FreeAssemblyName)
+
+ICALL_TYPE(SAFESTRMARSHAL, "Mono.SafeStringMarshal", SAFESTRMARSHAL_1)
+ICALL(SAFESTRMARSHAL_1, "GFree", ves_icall_Mono_SafeStringMarshal_GFree)
+ICALL(SAFESTRMARSHAL_2, "StringToUtf8", ves_icall_Mono_SafeStringMarshal_StringToUtf8)
+
#ifndef PLATFORM_RO_FS
ICALL_TYPE(KPAIR, "Mono.Security.Cryptography.KeyPairPersistence", KPAIR_1)
ICALL(KPAIR_1, "_CanSecure", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure)
ICALL(OBJ_2, "InternalGetHashCode", mono_object_hash)
ICALL(OBJ_3, "MemberwiseClone", ves_icall_System_Object_MemberwiseClone)
-ICALL_TYPE(ASSEM, "System.Reflection.Assembly", ASSEM_1)
-ICALL(ASSEM_1, "FillName", ves_icall_System_Reflection_Assembly_FillName)
+ICALL_TYPE(ASSEM, "System.Reflection.Assembly", ASSEM_1a)
ICALL(ASSEM_1a, "GetAotId", ves_icall_System_Reflection_Assembly_GetAotId)
ICALL(ASSEM_2, "GetCallingAssembly", ves_icall_System_Reflection_Assembly_GetCallingAssembly)
ICALL(ASSEM_3, "GetEntryAssembly", ves_icall_System_Reflection_Assembly_GetEntryAssembly)
ICALL(ASSEM_25, "get_location", ves_icall_System_Reflection_Assembly_get_location)
ICALL(ASSEM_26, "load_with_partial_name", ves_icall_System_Reflection_Assembly_load_with_partial_name)
-ICALL_TYPE(ASSEMN, "System.Reflection.AssemblyName", ASSEMN_1)
-ICALL(ASSEMN_1, "ParseName", ves_icall_System_Reflection_AssemblyName_ParseName)
+ICALL_TYPE(ASSEMN, "System.Reflection.AssemblyName", ASSEMN_0)
+ICALL(ASSEMN_0, "GetNativeName", ves_icall_System_Reflection_AssemblyName_GetNativeName)
+ICALL(ASSEMN_3, "ParseAssemblyName", ves_icall_System_Reflection_AssemblyName_ParseAssemblyName)
ICALL(ASSEMN_2, "get_public_token", mono_digest_get_public_token)
ICALL_TYPE(CATTR_DATA, "System.Reflection.CustomAttributeData", CATTR_DATA_1)
ICALL(RT_10, "GetInterfaceMapData", ves_icall_RuntimeType_GetInterfaceMapData)
ICALL(RT_11, "GetInterfaces", ves_icall_RuntimeType_GetInterfaces)
ICALL(RT_12, "GetMethodsByName_native", ves_icall_RuntimeType_GetMethodsByName_native)
-ICALL(RT_13, "GetNestedTypes_internal", ves_icall_RuntimeType_GetNestedTypes)
+ICALL(RT_13, "GetNestedTypes_native", ves_icall_RuntimeType_GetNestedTypes_native)
ICALL(RT_14, "GetPacking", ves_icall_RuntimeType_GetPacking)
ICALL(RT_15, "GetPropertiesByName_native", ves_icall_RuntimeType_GetPropertiesByName_native)
ICALL(RT_16, "GetTypeCodeImplInternal", ves_icall_type_GetTypeCodeInternal)
g_ptr_array_free (ptr_array, TRUE);
}
+ICALL_EXPORT void
+ves_icall_Mono_SafeStringMarshal_GFree (void *c_str)
+{
+ g_free (c_str);
+}
+
+ICALL_EXPORT char*
+ves_icall_Mono_SafeStringMarshal_StringToUtf8 (MonoString *s)
+{
+ MonoError error;
+ char *res = mono_string_to_utf8_checked (s, &error);
+ mono_error_set_pending_exception (&error);
+ return res;
+}
+
/* System.TypeCode */
typedef enum {
TYPECODE_EMPTY,
};
ICALL_EXPORT GPtrArray*
-ves_icall_RuntimeType_GetFields_native (MonoReflectionType *type, MonoString *name, guint32 bflags)
+ves_icall_RuntimeType_GetFields_native (MonoReflectionType *type, char *utf8_name, guint32 bflags)
{
MonoError error;
- MonoDomain *domain;
MonoClass *startklass, *klass;
int match;
gpointer iter;
- char *utf8_name = NULL;
int (*compare_func) (const char *s1, const char *s2) = NULL;
MonoClassField *field;
- domain = ((MonoObject *)type)->vtable->domain;
if (type->type->byref) {
return g_ptr_array_new ();
}
+ mono_error_init (&error);
+
+ compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
+
klass = startklass = mono_class_from_mono_type (type->type);
GPtrArray *ptr_array = g_ptr_array_sized_new (16);
handle_parent:
if (mono_class_has_failure (klass)) {
- mono_error_init (&error);
mono_error_set_for_class_failure (&error, klass);
goto fail;
}
if (!match)
continue;
- if (name != NULL) {
- if (utf8_name == NULL) {
- utf8_name = mono_string_to_utf8_checked (name, &error);
- if (!is_ok (&error))
- goto fail;
- compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
- }
-
- if (compare_func (mono_field_get_name (field), utf8_name))
+ if (utf8_name != NULL && compare_func (mono_field_get_name (field), utf8_name))
continue;
- }
g_ptr_array_add (ptr_array, field);
}
if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
goto handle_parent;
- if (utf8_name != NULL)
- g_free (utf8_name);
return ptr_array;
fail:
}
ICALL_EXPORT GPtrArray*
-ves_icall_RuntimeType_GetMethodsByName_native (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case)
+ves_icall_RuntimeType_GetMethodsByName_native (MonoReflectionType *type, const char *mname, guint32 bflags, MonoBoolean ignore_case)
{
MonoError error;
- MonoDomain *domain;
- const char *mname = NULL;
GPtrArray *method_array;
MonoClass *klass;
klass = mono_class_from_mono_type (type->type);
- domain = ((MonoObject *)type)->vtable->domain;
if (type->type->byref) {
return g_ptr_array_new ();
}
- if (name) {
- mname = mono_string_to_utf8_checked (name, &error);
- if (mono_error_set_pending_exception (&error))
- return NULL;
- }
-
method_array = mono_class_get_methods_by_name (klass, mname, bflags, ignore_case, FALSE, &error);
- g_free ((char*)mname);
mono_error_set_pending_exception (&error);
return method_array;
}
}
ICALL_EXPORT GPtrArray*
-ves_icall_RuntimeType_GetPropertiesByName_native (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case)
+ves_icall_RuntimeType_GetPropertiesByName_native (MonoReflectionType *type, gchar *propname, guint32 bflags, MonoBoolean ignore_case)
{
MonoError error;
MonoClass *startklass, *klass;
MonoProperty *prop;
int match;
guint32 flags;
- gchar *propname = NULL;
int (*compare_func) (const char *s1, const char *s2) = NULL;
gpointer iter;
GHashTable *properties = NULL;
klass = startklass = mono_class_from_mono_type (type->type);
- if (name != NULL) {
- propname = mono_string_to_utf8_checked (name, &error);
- if (mono_error_set_pending_exception (&error))
- return NULL;
- compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
- }
+ compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
res_array = g_ptr_array_sized_new (8); /*This the average for ASP.NET types*/
handle_parent:
mono_class_setup_methods (klass);
mono_class_setup_vtable (klass);
- if (mono_class_has_failure (klass))
+ if (mono_class_has_failure (klass)) {
+ mono_error_set_for_class_failure (&error, klass);
goto loader_error;
+ }
iter = NULL;
while ((prop = mono_class_get_properties (klass, &iter))) {
continue;
match = 0;
- if (name != NULL) {
- if (compare_func (propname, prop->name))
- continue;
- }
+ if (propname != NULL && compare_func (propname, prop->name))
+ continue;
if (g_hash_table_lookup (properties, prop))
continue;
goto handle_parent;
g_hash_table_destroy (properties);
- g_free (propname);
return res_array;
loader_error:
- if (mono_class_has_failure (klass))
- mono_error_set_for_class_failure (&error, klass);
-
if (properties)
g_hash_table_destroy (properties);
- if (name)
- g_free (propname);
g_ptr_array_free (res_array, TRUE);
mono_error_set_pending_exception (&error);
}
ICALL_EXPORT GPtrArray*
-ves_icall_RuntimeType_GetEvents_native (MonoReflectionType *type, MonoString *name, guint32 bflags)
+ves_icall_RuntimeType_GetEvents_native (MonoReflectionType *type, char *utf8_name, guint32 bflags)
{
MonoError error;
MonoClass *startklass, *klass;
MonoEvent *event;
int match;
gpointer iter;
- char *utf8_name = NULL;
int (*compare_func) (const char *s1, const char *s2) = NULL;
GHashTable *events = NULL;
GPtrArray *res_array;
mono_error_init (&error);
+ compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
+
res_array = g_ptr_array_sized_new (4);
klass = startklass = mono_class_from_mono_type (type->type);
handle_parent:
mono_class_setup_methods (klass);
mono_class_setup_vtable (klass);
- if (mono_class_has_failure (klass))
- goto loader_error;
+ if (mono_class_has_failure (klass)) {
+ mono_error_set_for_class_failure (&error, klass);
+ goto failure;
+ }
iter = NULL;
while ((event = mono_class_get_events (klass, &iter))) {
if (!match)
continue;
- if (name != NULL) {
- if (utf8_name == NULL) {
- utf8_name = mono_string_to_utf8_checked (name, &error);
- if (!is_ok (&error))
- goto failure;
- compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
- }
-
- if (compare_func (event->name, utf8_name))
- continue;
- }
+ if (utf8_name != NULL && compare_func (event->name, utf8_name))
+ continue;
if (g_hash_table_lookup (events, event))
continue;
g_hash_table_destroy (events);
- if (utf8_name != NULL)
- g_free (utf8_name);
-
return res_array;
-loader_error:
- if (mono_class_has_failure (klass))
- mono_error_set_for_class_failure (&error, klass);
-
failure:
-
if (events != NULL)
g_hash_table_destroy (events);
- if (utf8_name != NULL)
- g_free (utf8_name);
g_ptr_array_free (res_array, TRUE);
return NULL;
}
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetNestedTypes (MonoReflectionType *type, MonoString *name, guint32 bflags)
+ICALL_EXPORT GPtrArray *
+ves_icall_RuntimeType_GetNestedTypes_native (MonoReflectionType *type, char *str, guint32 bflags)
{
- MonoError error;
- MonoReflectionType *rt;
- MonoDomain *domain;
MonoClass *klass;
- MonoArray *res = NULL;
- int i, match;
+ int match;
MonoClass *nested;
gpointer iter;
- char *str = NULL;
- MonoPtrArray tmp_array;
-
- mono_error_init (&error);
+ GPtrArray *res_array;
- domain = ((MonoObject *)type)->vtable->domain;
if (type->type->byref) {
- MonoArray *result = mono_array_new_cached (domain, mono_defaults.runtimetype_class, 0, &error);
- mono_error_set_pending_exception (&error);
- return result;
+ return g_ptr_array_new ();
}
+
klass = mono_class_from_mono_type (type->type);
/*
if (klass->generic_class)
klass = klass->generic_class->container_class;
- mono_ptr_array_init (tmp_array, 1, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection nested types list");
+ res_array = g_ptr_array_new ();
+
iter = NULL;
while ((nested = mono_class_get_nested_types (klass, &iter))) {
match = 0;
if (!match)
continue;
- if (name != NULL) {
- if (str == NULL) {
- str = mono_string_to_utf8_checked (name, &error);
- if (!is_ok (&error))
- goto leave;
- mono_identifier_unescape_type_name_chars (str);
- }
-
- if (strcmp (nested->name, str))
+ if (str != NULL && strcmp (nested->name, str))
continue;
- }
-
- rt = mono_type_get_object_checked (domain, &nested->byval_arg, &error);
- if (!is_ok (&error))
- goto leave;
- mono_ptr_array_append (tmp_array, (MonoObject*) rt);
+ g_ptr_array_add (res_array, &nested->byval_arg);
}
- res = mono_array_new_cached (domain, mono_defaults.runtimetype_class, mono_ptr_array_size (tmp_array), &error);
- if (!is_ok (&error))
- goto leave;
-
- for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
- mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-leave:
- mono_ptr_array_destroy (tmp_array);
-
- g_free (str);
-
- mono_error_set_pending_exception (&error);
- return res;
+ return res_array;
}
ICALL_EXPORT MonoReflectionType*
return res;
}
-ICALL_EXPORT void
-ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
+ICALL_EXPORT MonoAssemblyName *
+ves_icall_System_Reflection_AssemblyName_GetNativeName (MonoAssembly *mass)
{
- MonoError error;
- gchar *absolute, *dirname;
- MonoAssembly *mass = assembly->assembly;
-
- /* XXX this is duplicated code to compute the codebase URI, unify it */
- if (g_path_is_absolute (mass->image->name)) {
- absolute = g_strdup (mass->image->name);
- dirname = g_path_get_dirname (absolute);
- } else {
- absolute = g_build_filename (mass->basedir, mass->image->name, NULL);
- dirname = g_strdup (mass->basedir);
- }
-
- replace_shadow_path (mono_object_domain (assembly), dirname, &absolute);
- g_free (dirname);
-
- fill_reflection_assembly_name (mono_object_domain (assembly), aname, &mass->aname, absolute, TRUE, TRUE, TRUE, &error);
- mono_error_set_pending_exception (&error);
-
- g_free (absolute);
+ return &mass->aname;
}
ICALL_EXPORT void
return res;
}
-ICALL_EXPORT gboolean
-ves_icall_System_Reflection_AssemblyName_ParseName (MonoReflectionAssemblyName *name, MonoString *assname)
+ICALL_EXPORT void
+ves_icall_Mono_RuntimeMarshal_FreeAssemblyName (MonoAssemblyName *aname)
{
- MonoError error;
- MonoAssemblyName aname;
- MonoDomain *domain = mono_object_domain (name);
- char *val;
- gboolean is_version_defined;
- gboolean is_token_defined;
-
- aname.public_key = NULL;
- val = mono_string_to_utf8_checked (assname, &error);
- if (mono_error_set_pending_exception (&error))
- return FALSE;
-
- if (!mono_assembly_name_parse_full (val, &aname, TRUE, &is_version_defined, &is_token_defined)) {
- g_free ((guint8*) aname.public_key);
- g_free (val);
- return FALSE;
- }
-
- fill_reflection_assembly_name (domain, name, &aname, "", is_version_defined, FALSE, is_token_defined, &error);
- mono_error_set_pending_exception (&error);
+ mono_assembly_name_free (aname);
+}
- mono_assembly_name_free (&aname);
- g_free ((guint8*) aname.public_key);
- g_free (val);
+ICALL_EXPORT gboolean
+ves_icall_System_Reflection_AssemblyName_ParseAssemblyName (const char *name, MonoAssemblyName *aname, gboolean *is_version_definited, gboolean *is_token_defined)
+{
+ *is_version_definited = *is_token_defined = FALSE;
- return TRUE;
+ return mono_assembly_name_parse_full (name, aname, TRUE, is_version_definited, is_token_defined);
}
ICALL_EXPORT MonoReflectionType*
MonoError oerror;
/* Might be AOTed code */
+ mono_class_init (method->klass);
code = mono_aot_get_method_checked (domain, method, &oerror);
g_assert (code);
mono_error_assert_ok (&oerror);
ins->inst_basereg = cfg->frame_reg;
ins->inst_offset = offset;
offset += size;
+ }
+ if (cfg->arch.ss_trigger_page_var) {
+ MonoInst *ins;
ins = cfg->arch.ss_trigger_page_var;
size = 4;
ins->inst_basereg = cfg->frame_reg;
ins->inst_offset = offset;
offset += size;
+ }
+ if (cfg->arch.seq_point_bp_method_var) {
+ MonoInst *ins;
ins = cfg->arch.seq_point_bp_method_var;
size = 4;
}
if (cfg->gen_sdb_seq_points) {
+ if (cfg->compile_aot) {
+ MonoInst *ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
+ ins->flags |= MONO_INST_VOLATILE;
+ cfg->arch.seq_point_info_var = ins;
+
+ if (!cfg->soft_breakpoints) {
+ /* Allocate a separate variable for this to save 1 load per seq point */
+ ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
+ ins->flags |= MONO_INST_VOLATILE;
+ cfg->arch.ss_trigger_page_var = ins;
+ }
+ }
if (cfg->soft_breakpoints) {
MonoInst *ins;
ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
ins->flags |= MONO_INST_VOLATILE;
cfg->arch.seq_point_bp_method_var = ins;
-
- g_assert (!cfg->compile_aot);
- } else if (cfg->compile_aot) {
- MonoInst *ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
- ins->flags |= MONO_INST_VOLATILE;
- cfg->arch.seq_point_info_var = ins;
-
- /* Allocate a separate variable for this to save 1 load per seq point */
- ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
- ins->flags |= MONO_INST_VOLATILE;
- cfg->arch.ss_trigger_page_var = ins;
}
}
}
MonoInst *var;
int dreg = ARMREG_LR;
+#if 0
if (cfg->soft_breakpoints) {
g_assert (!cfg->compile_aot);
}
+#endif
/*
* For AOT, we use one got slot per method, which will point to a
mono_add_seq_point (cfg, bb, ins, code - cfg->native_code);
- if (cfg->soft_breakpoints) {
- /* Load the address of the breakpoint method into ip. */
- var = bp_method_var;
- g_assert (var);
- g_assert (var->opcode == OP_REGOFFSET);
- g_assert (arm_is_imm12 (var->inst_offset));
- ARM_LDR_IMM (code, dreg, var->inst_basereg, var->inst_offset);
-
- /*
- * A placeholder for a possible breakpoint inserted by
- * mono_arch_set_breakpoint ().
- */
- ARM_NOP (code);
- } else if (cfg->compile_aot) {
+ if (cfg->compile_aot) {
guint32 offset = code - cfg->native_code;
guint32 val;
/* What is faster, a branch or a load ? */
ARM_CMP_REG_IMM (code, dreg, 0, 0);
/* The breakpoint instruction */
- ARM_LDR_IMM_COND (code, dreg, dreg, 0, ARMCOND_NE);
+ if (cfg->soft_breakpoints)
+ ARM_BLX_REG_COND (code, ARMCOND_NE, dreg);
+ else
+ ARM_LDR_IMM_COND (code, dreg, dreg, 0, ARMCOND_NE);
+ } else if (cfg->soft_breakpoints) {
+ /* Load the address of the breakpoint method into ip. */
+ var = bp_method_var;
+ g_assert (var);
+ g_assert (var->opcode == OP_REGOFFSET);
+ g_assert (arm_is_imm12 (var->inst_offset));
+ ARM_LDR_IMM (code, dreg, var->inst_basereg, var->inst_offset);
+
+ /*
+ * A placeholder for a possible breakpoint inserted by
+ * mono_arch_set_breakpoint ().
+ */
+ ARM_NOP (code);
} else {
/*
* A placeholder for a possible breakpoint inserted by
guint32 native_offset = ip - (guint8*)ji->code_start;
MonoDebugOptions *opt = mini_get_debug_options ();
- if (opt->soft_breakpoints) {
- g_assert (!ji->from_aot);
- code += 4;
- ARM_BLX_REG (code, ARMREG_LR);
- mono_arch_flush_icache (code - 4, 4);
- } else if (ji->from_aot) {
+ if (ji->from_aot) {
SeqPointInfo *info = mono_arch_get_seq_point_info (mono_domain_get (), ji->code_start);
g_assert (native_offset % 4 == 0);
g_assert (info->bp_addrs [native_offset / 4] == 0);
- info->bp_addrs [native_offset / 4] = bp_trigger_page;
+ info->bp_addrs [native_offset / 4] = opt->soft_breakpoints ? breakpoint_tramp : bp_trigger_page;
+ } else if (opt->soft_breakpoints) {
+ code += 4;
+ ARM_BLX_REG (code, ARMREG_LR);
+ mono_arch_flush_icache (code - 4, 4);
} else {
int dreg = ARMREG_LR;
guint8 *code = ip;
int i;
- if (opt->soft_breakpoints) {
- g_assert (!ji->from_aot);
- code += 4;
- ARM_NOP (code);
- mono_arch_flush_icache (code - 4, 4);
- } else if (ji->from_aot) {
+ if (ji->from_aot) {
guint32 native_offset = ip - (guint8*)ji->code_start;
SeqPointInfo *info = mono_arch_get_seq_point_info (mono_domain_get (), ji->code_start);
g_assert (native_offset % 4 == 0);
- g_assert (info->bp_addrs [native_offset / 4] == bp_trigger_page);
+ g_assert (info->bp_addrs [native_offset / 4] == (opt->soft_breakpoints ? breakpoint_tramp : bp_trigger_page));
info->bp_addrs [native_offset / 4] = 0;
+ } else if (opt->soft_breakpoints) {
+ code += 4;
+ ARM_NOP (code);
+ mono_arch_flush_icache (code - 4, 4);
} else {
for (i = 0; i < 4; ++i)
ARM_NOP (code);