Branch: refs/heads/master
Home:
https://github.com/mono/mono
Compare:
https://github.com/mono/mono/compare/2975c3c9b5f8...3b6058791c08
Commit: f19a364025edc23559597e24ea332890f3b1e0ff
Author: Neale <
ne...@sinenomine.net> (nealef)
Date: 2013-04-17 02:27:47 GMT
URL:
https://github.com/mono/mono/commit/f19a364025edc23559597e24ea332890f3b1e0ff
When .NET serializes it will use the TypeForwardedFrom information when
writing Assembly information but Mono does not. This means that
serialized objects created on one platform are not able to be
deserialized on the other, thus preventing interoperability between .NET
and mono applications. Fixes the ObservableCollection part of bugzilla
11294.
Changed paths:
M mcs/class/System/System.Collections.ObjectModel/ObservableCollection.cs
M mcs/class/WindowsBase/System.Collections.ObjectModel/ObservableCollection.cs
M mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
M mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
Modified: mcs/class/System/System.Collections.ObjectModel/ObservableCollection.cs
===================================================================
@@ -40,30 +40,33 @@ namespace System.Collections.ObjectModel
#endif
public class ObservableCollection<T> : Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged {
[Serializable]
- sealed class Reentrant : IDisposable {
- private int count = 0;
+#if !MOBILE
+ [TypeForwardedFrom (Consts.WindowsBase_3_0)]
+#endif
+ sealed class SimpleMonitor : IDisposable {
+ private int _busyCount = 0;
- public Reentrant()
+ public SimpleMonitor()
{
}
public void Enter()
{
- count++;
+ _busyCount++;
}
public void Dispose()
{
- count--;
+ _busyCount--;
}
public bool Busy
{
- get { return count > 0; }
+ get { return _busyCount > 0; }
}
}
- private Reentrant reentrant = new Reentrant ();
+ private SimpleMonitor _monitor = new SimpleMonitor ();
public ObservableCollection ()
{
@@ -83,7 +86,9 @@ public ObservableCollection (List<T> list)
{
}
+ [field:NonSerializedAttribute()]
public virtual event NotifyCollectionChangedEventHandler CollectionChanged;
+ [field:NonSerializedAttribute()]
protected virtual event PropertyChangedEventHandler PropertyChanged;
event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged {
@@ -93,8 +98,8 @@ public ObservableCollection (List<T> list)
protected IDisposable BlockReentrancy ()
{
- reentrant.Enter ();
- return reentrant;
+ _monitor.Enter ();
+ return _monitor;
}
protected void CheckReentrancy ()
@@ -102,7 +107,7 @@ protected void CheckReentrancy ()
NotifyCollectionChangedEventHandler eh = CollectionChanged;
// Only have a problem if we have more than one event listener.
- if (reentrant.Busy && eh != null && eh.GetInvocationList ().Length > 1)
+ if (_monitor.Busy && eh != null && eh.GetInvocationList ().Length > 1)
throw new InvalidOperationException ("Cannot modify the collection while reentrancy is blocked.");
}
Modified: mcs/class/WindowsBase/System.Collections.ObjectModel/ObservableCollection.cs
===================================================================
@@ -44,7 +44,7 @@ namespace System.Collections.ObjectModel
public class ObservableCollection<T> : Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged {
private class Reentrant : IDisposable {
- private int count = 0;
+ private int _busyCount = 0;
public Reentrant()
{
@@ -52,17 +52,17 @@ public Reentrant()
public void Enter()
{
- count++;
+ _busyCount++;
}
public void Dispose()
{
- count--;
+ _busyCount--;
}
public bool Busy
{
- get { return count > 0; }
+ get { return _busyCount > 0; }
}
}
Modified: mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
===================================================================
@@ -115,8 +115,13 @@ static public Type GenerateMetadataTypeInternal (Type type, StreamingContext con
// EMIT ow.WriteAssembly (writer, memberType.Assembly);
gen.Emit (OpCodes.Ldarg_1);
gen.Emit (OpCodes.Ldarg_2);
+#if NET_4_0
+ EmitLoadType (gen, memberType);
+ gen.EmitCall (OpCodes.Callvirt, typeof(ObjectWriter).GetMethod("WriteTypeAssembly"), null);
+#else
EmitLoadTypeAssembly (gen, memberType, field.Name);
gen.EmitCall (OpCodes.Callvirt, typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
+#endif
gen.Emit (OpCodes.Pop);
}
}
@@ -292,8 +297,14 @@ static void EmitWriteTypeSpec (ILGenerator gen, Type type, string member)
// EMIT writer.Write ((int)ow.GetAssemblyId (type.Assembly));
gen.Emit (OpCodes.Ldarg_2);
gen.Emit (OpCodes.Ldarg_1);
+#if NET_4_0
+ EmitLoadType (gen, type);
+ gen.EmitCall (OpCodes.Callvirt, typeof(GetForwardedAttribute).GetMethod("GetAssemblyName"), null);
+ gen.EmitCall (OpCodes.Callvirt, typeof(ObjectWriter).GetMethod("GetAssemblyNameId"), null);
+#else
EmitLoadTypeAssembly (gen, type, member);
gen.EmitCall (OpCodes.Callvirt, typeof(ObjectWriter).GetMethod("GetAssemblyId"), null);
+#endif
gen.Emit (OpCodes.Conv_I4);
EmitWrite (gen, typeof(int));
break;
@@ -318,6 +329,12 @@ static void EmitLoadTypeAssembly (ILGenerator gen, Type type, string member)
gen.EmitCall (OpCodes.Callvirt, typeof(Type).GetProperty("Assembly").GetGetMethod(), null);
}
+ static void EmitLoadType (ILGenerator gen, Type type)
+ {
+ gen.Emit (OpCodes.Ldtoken, type);
+ gen.EmitCall (OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle"), null);
+ }
+
static void EmitWrite (ILGenerator gen, Type type)
{
gen.EmitCall (OpCodes.Callvirt, typeof(BinaryWriter).GetMethod("Write", new Type[] { type }), null);
Modified: mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
===================================================================
@@ -35,9 +35,25 @@
using System.Runtime.Remoting.Messaging;
using System.Reflection;
using System.Globalization;
+using System.Runtime.CompilerServices;
namespace System.Runtime.Serialization.Formatters.Binary
{
+#if NET_4_0
+ public class GetForwardedAttribute
+ {
+ public static string GetAssemblyName (Type self)
+ {
+ var attrs = self.GetCustomAttributes(
+ typeof (TypeForwardedFromAttribute), false);
+ if (attrs.Length == 0)
+ return self.Assembly.FullName;
+ else
+ return ((TypeForwardedFromAttribute)attrs [0]).AssemblyFullName;
+ }
+ }
+#endif
+
abstract class TypeMetadata
{
public string TypeAssemblyName;
@@ -73,7 +89,11 @@ public ClrTypeMetadata (Type instanceType)
{
InstanceType = instanceType;
InstanceTypeName = instanceType.FullName;
+#if NET_4_0
+ TypeAssemblyName = GetForwardedAttribute.GetAssemblyName(instanceType);
+#else
TypeAssemblyName = instanceType.Assembly.FullName;
+#endif
}
public override bool RequiresTypes {
@@ -102,7 +122,11 @@ public SerializableTypeMetadata (Type itype, SerializationInfo info)
}
TypeAssemblyName = info.AssemblyName;
+#if NET_4_0
+ InstanceTypeName = GetForwardedAttribute.GetAssemblyName(itype);
+#else
InstanceTypeName = info.FullTypeName;
+#endif
}
public override bool IsCompatible (TypeMetadata other)
@@ -129,7 +153,7 @@ public override void WriteAssemblies (ObjectWriter ow, BinaryWriter writer)
while (type.IsArray)
type = type.GetElementType();
- ow.WriteAssembly (writer, type.Assembly);
+ ow.WriteTypeAssembly (writer, type);
}
}
@@ -142,7 +166,7 @@ public override void WriteTypeData (ObjectWriter ow, BinaryWriter writer, bool w
writer.Write (name);
// Types of fields
- foreach (Type type in types)
+ foreach (Type type in types)
ObjectWriter.WriteTypeCode (writer, type);
// Type specs of fields
@@ -181,7 +205,7 @@ public override void WriteAssemblies (ObjectWriter ow, BinaryWriter writer)
while (type.IsArray)
type = type.GetElementType();
- ow.WriteAssembly (writer, type.Assembly);
+ ow.WriteTypeAssembly (writer, type);
}
}
@@ -511,7 +535,7 @@ private void WriteGenericArray (BinaryWriter writer, long id, Array array)
var tag = GetTypeTag (elementType);
if ((tag != TypeTag.ArrayOfObject) && (tag != TypeTag.ArrayOfString) && (tag != TypeTag.ArrayOfPrimitiveType))
- WriteAssembly (writer, elementType.Assembly);
+ WriteTypeAssembly (writer, elementType);
// Writes the array
@@ -809,6 +833,15 @@ private void WriteString (BinaryWriter writer, long id, string str)
writer.Write (str);
}
+ public int WriteTypeAssembly (BinaryWriter writer, Type aType)
+ {
+#if NET_4_0
+ return WriteAssemblyName (writer, GetForwardedAttribute.GetAssemblyName(aType));
+#else
+ return WriteAssemblyName (writer, aType.Assembly.FullName);
+#endif
+ }
+
public int WriteAssembly (BinaryWriter writer, Assembly assembly)
{
return WriteAssemblyName (writer, assembly.FullName);
@@ -994,7 +1027,12 @@ public void WriteTypeSpec (BinaryWriter writer, Type type)
case TypeTag.GenericType:
writer.Write (type.FullName);
+#if NET_4_0
+ string asmName = GetForwardedAttribute.GetAssemblyName(type);
+ writer.Write ((int) GetAssemblyNameId (asmName));
+#else
writer.Write ((int)GetAssemblyId (type.Assembly));
+#endif
break;
case TypeTag.ArrayOfPrimitiveType:
Commit: 3b6058791c08d56a9c9d9b3cdb2af9c390ed555b
Author: Neale <
ne...@sinenomine.net> (nealef)
Date: 2013-04-17 02:32:39 GMT
URL:
https://github.com/mono/mono/commit/3b6058791c08d56a9c9d9b3cdb2af9c390ed555b
Merge branch 'master' of
https://github.com/mono/mono
Changed paths:
M
configure.in M eglib/src/
eglib-config.h.in M eglib/src/gfile-posix.c
M eglib/src/gmodule-unix.c
M eglib/src/goutput.c
M ikvm-native/os.c
M libgc/dyn_load.c
M libgc/include/private/gc_locks.h
M libgc/include/private/gcconfig.h
M libgc/misc.c
M libgc/pthread_stop_world.c
M libgc/pthread_support.c
M man/mono.1
M mcs/class/Makefile
M mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItem.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionParser.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TargetBatchingImpl.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskBatchingImpl.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildItemTest.cs
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ConsoleLoggerTest.cs
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/TargetTest.cs
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/UsingTaskTest.cs
M mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
M mcs/class/Microsoft.Build.Engine/Test/various/EvaluationOrder.cs
M mcs/class/Microsoft.Build.Engine/Test/various/Items.cs
M mcs/class/Microsoft.Build.Engine/Test/various/Properties.cs
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/CustomAttributeDataMirror.cs
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
M mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
M mcs/class/Mono.Debugger.Soft/Test/dtest.cs
M mcs/class/System.Data/System.Data/DataTableCollection.cs
M mcs/class/System.Data/Test/System.Data.Common/DbConnectionStringBuilderTest.cs
M mcs/class/System.Data/Test/System.Data/DataSetTest2.cs
M mcs/class/System.Reactive.Core/Makefile
M mcs/class/System.Reactive.Debugger/Makefile
M mcs/class/System.Reactive.Experimental/Makefile
M mcs/class/System.Reactive.Interfaces/Makefile
M mcs/class/System.Reactive.Linq/Makefile
M mcs/class/System.Reactive.PlatformServices/Makefile
M mcs/class/System.Reactive.Providers/Makefile
M mcs/class/System.Reactive.Runtime.Remoting/Makefile
M mcs/class/System.Reactive.Windows.Forms/Makefile
M mcs/class/System.Reactive.Windows.Threading/Makefile
M mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
M mcs/class/System/System.Net.Sockets/Socket.cs
M mcs/class/System/System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs
M mcs/class/System/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
M mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs
M mcs/class/System/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
M mcs/class/System/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
M mcs/class/System/System.Security.Cryptography.X509Certificates/X509Store.cs
M mcs/class/System/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
M mcs/class/System/System.Security.Cryptography/AsnEncodedData.cs
M mcs/class/System/Test/System.Collections.Concurrent/ConcurrentBagTests.cs
M mcs/class/System/Test/System.ComponentModel/ComponentConverterTests.cs
M mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
M mcs/class/System/Test/System.Threading/SemaphoreTest.cs
M mcs/class/corlib/System/Delegate.cs
M mcs/errors/cs0185.cs
M mcs/mcs/anonymous.cs
M mcs/mcs/argument.cs
M mcs/mcs/assembly.cs
M mcs/mcs/async.cs
M mcs/mcs/attribute.cs
M mcs/mcs/class.cs
M mcs/mcs/const.cs
M mcs/mcs/constant.cs
M mcs/mcs/cs-parser.jay
M mcs/mcs/decl.cs
M mcs/mcs/delegate.cs
M mcs/mcs/dynamic.cs
M mcs/mcs/ecore.cs
M mcs/mcs/enum.cs
M mcs/mcs/eval.cs
M mcs/mcs/expression.cs
M mcs/mcs/field.cs
M mcs/mcs/generic.cs
M mcs/mcs/import.cs
M mcs/mcs/iterators.cs
M mcs/mcs/linq.cs
M mcs/mcs/literal.cs
M mcs/mcs/membercache.cs
M mcs/mcs/method.cs
M mcs/mcs/nullable.cs
M mcs/mcs/parameter.cs
M mcs/mcs/pending.cs
M mcs/mcs/property.cs
M mcs/mcs/report.cs
M mcs/mcs/statement.cs
M mcs/mcs/typemanager.cs
M mcs/tests/test-debug-01-ref.xml
M mcs/tests/test-debug-02-ref.xml
M mcs/tests/test-debug-03-ref.xml
M mcs/tests/test-debug-04-ref.xml
M mcs/tests/test-debug-05-ref.xml
M mcs/tests/test-debug-06-ref.xml
M mcs/tests/test-debug-07-ref.xml
M mcs/tests/test-debug-08-ref.xml
M mcs/tests/test-debug-09-ref.xml
M mcs/tests/test-debug-10-ref.xml
M mcs/tests/test-debug-11-ref.xml
M mcs/tests/test-debug-12-ref.xml
M mcs/tests/test-debug-13-ref.xml
M mcs/tests/test-debug-14-ref.xml
M mcs/tests/test-debug-15-ref.xml
M mcs/tests/test-debug-16-ref.xml
M mcs/tests/test-debug-17-ref.xml
M mcs/tests/test-debug-18-ref.xml
M mcs/tests/test-debug-19-ref.xml
M mcs/tests/test-debug-20-ref.xml
M mcs/tests/test-debug-21-ref.xml
M mcs/tests/test-debug-22-ref.xml
M mcs/tests/test-debug-23-ref.xml
M mcs/tests/test-debug-24-ref.xml
M mcs/tests/test-debug-25-ref.xml
M mcs/tests/ver-il-net_4_5.xml
M mcs/tools/mkbundle/mkbundle.cs
M mono/dis/dump.c
M mono/io-layer/io.c
M mono/io-layer/processes.c
M mono/io-layer/shared.c
M mono/io-layer/sockets.c
M mono/metadata/appdomain.c
M mono/metadata/assembly.c
M mono/metadata/boehm-gc.c
M mono/metadata/class.c
M mono/metadata/decimal.c
M mono/metadata/gc.c
M mono/metadata/icall.c
M mono/metadata/marshal.c
M mono/metadata/metadata-verify.c
M mono/metadata/nacl-stub.c
M mono/metadata/null-gc.c
M mono/metadata/object.c
M mono/metadata/rand.c
M mono/metadata/reflection.c
M mono/metadata/security-core-clr.c
M mono/metadata/security-manager.c
M mono/metadata/security-manager.h
M mono/metadata/sgen-cardtable.c
M mono/metadata/sgen-cardtable.h
M mono/metadata/sgen-debug.c
M mono/metadata/sgen-fin-weak-hash.c
M mono/metadata/sgen-gc.c
M mono/metadata/sgen-gc.h
M mono/metadata/sgen-internal.c
M mono/metadata/sgen-los.c
M mono/metadata/sgen-marksweep.c
M mono/metadata/sgen-pinning.c
M mono/metadata/sgen-protocol.c
M mono/metadata/sgen-protocol.h
M mono/metadata/sgen-stw.c
M mono/metadata/socket-io.c
M mono/metadata/threads.c
M mono/metadata/verify.c
M mono/mini/
Makefile.am.in M mono/mini/aot-compiler.c
M mono/mini/aot-runtime.c
M mono/mini/arrays.cs
M mono/mini/basic-calls.cs
M mono/mini/basic-float.cs
M mono/mini/basic-long.cs
M mono/mini/basic-math.cs
M mono/mini/basic.cs
M mono/mini/debugger-agent.c
M mono/mini/declsec.c
M mono/mini/declsec.h
M mono/mini/driver.c
M mono/mini/exceptions-arm.c
M mono/mini/exceptions.cs
M mono/mini/genmdesc.c
M mono/mini/graph.c
M mono/mini/helpers.c
M mono/mini/ldscript
M mono/mini/method-to-ir.c
M mono/mini/mini-amd64.h
M mono/mini/mini-arm.c
M mono/mini/mini-arm.h
M mono/mini/mini-gc.c
M mono/mini/mini-generic-sharing.c
M mono/mini/mini-llvm.h
M mono/mini/mini-ops.h
M mono/mini/mini-posix.c
M mono/mini/mini-trampolines.c
M mono/mini/mini.c
M mono/mini/mini.h
M mono/mini/nacl.cs
M mono/mini/objects.cs
M mono/mini/regalloc.h
M mono/mini/wapihandles.c
M mono/monograph/monograph.c
M mono/profiler/Makefile.am
M mono/profiler/decode.c
M mono/tests/Makefile.am
M mono/utils/atomic.h
M mono/utils/mono-codeman.c
M mono/utils/mono-context.c
M mono/utils/mono-mmap.c
M mono/utils/mono-path.c
M mono/utils/mono-threads-mach.c
M mono/utils/mono-threads-posix.c
M mono/utils/monobitset.c
M msvc/libmonoruntime.vcxproj
M runtime/Makefile.am
M runtime/
mono-wrapper.in M tools/sgen/sgen-grep-binprot.c
Added paths:
A mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTaskItemGroup.cs
A mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTaskPropertyGroup.cs
A mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildTask.cs
A mcs/errors/cs0012-19.cs
A mcs/errors/cs0012-20.cs
A mcs/errors/cs0162-17.cs
A mcs/errors/cs0185-2.cs
A mcs/errors/cs0761-2.cs
A mcs/errors/cs0761.cs
A mcs/errors/cs1997-2.cs
A mcs/tests/gtest-partial-06.cs
A mcs/tests/test-867.cs
A mcs/tests/test-async-46.cs
A mcs/tests/test-debug-26-ref.xml
A mcs/tests/test-debug-26.cs
Removed paths:
D mono/mini/fsacheck.c
Modified:
configure.in
===================================================================
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
-AC_INIT(mono, [3.0.8],
+AC_INIT(mono, [3.0.10],
[
http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README])
@@ -743,7 +743,7 @@ DISABLED_FEATURES=none
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, appdomains, verifier,
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, perfcounters, normalization, assembly_remapping, shared_perfcounters, remoting,
- sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
+ security, sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
[
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
eval "mono_feature_disable_$feature='yes'"
@@ -887,6 +887,11 @@ if test "x$mono_feature_disable_remoting" = "xyes"; then
AC_MSG_NOTICE([Disabled remoting])
fi
+if test "x$mono_feature_disable_security" = "xyes"; then
+ AC_DEFINE(DISABLE_SECURITY, 1, [Disable CAS/CoreCLR security])
+ AC_MSG_NOTICE([Disabled CAS/CoreCLR security manager (used e.g. for Moonlight)])
+fi
+
if test "x$mono_feature_disable_sgen_remset" = "xyes"; then
AC_DEFINE(DISABLE_SGEN_REMSET, 1, [Disable wbarrier=remset support in SGEN.])
AC_MSG_NOTICE([Disabled wbarrier=remset support in SGEN.])
@@ -1074,6 +1079,8 @@ AC_TRY_COMPILE([
AC_DEFINE_UNQUOTED(MONO_ZERO_LEN_ARRAY, 1, [Length of zero length arrays])
])
+AC_CHECK_HEADERS(nacl/nacl_dyncode.h)
+
if test x$target_win32 = xno; then
dnl hires monotonic clock support
@@ -1784,11 +1791,13 @@ if test x$target_win32 = xno; then
dnl **********************************
dnl *** epoll ***
dnl **********************************
- AC_CHECK_HEADERS(sys/epoll.h)
- haveepoll=no
- AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
- if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes" ; then
- AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
+ if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xno"; then
+ AC_CHECK_HEADERS(sys/epoll.h)
+ haveepoll=no
+ AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
+ if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
+ AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
+ fi
fi
havekqueue=no
@@ -2304,6 +2313,16 @@ AC_ARG_ENABLE(nacl_codegen, [ --enable-nacl-codegen Enable Native Client c
AC_ARG_ENABLE(nacl_gc, [ --enable-nacl-gc Enable Native Client garbage collection], enable_nacl_gc=$enableval, enable_nacl_gc=no)
AM_CONDITIONAL(NACL_CODEGEN, test x$enable_nacl_codegen != xno)
+
+dnl
+dnl Hack to use system mono for operations in build/install not allowed in NaCl.
+dnl
+nacl_self_host=""
+if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xyes"; then
+ nacl_self_host="nacl_self_host"
+fi
+AC_SUBST(nacl_self_host)
+
if test "x$enable_nacl_codegen" = "xyes"; then
MONO_NACL_ALIGN_MASK_OFF=1
CPPFLAGS="$CPPFLAGS -D__native_client_codegen__"
@@ -2472,6 +2491,10 @@ case "$host" in
TARGET=AMD64;
arch_target=amd64;
JIT_SUPPORTED=yes
+ if test "x$ac_cv_sizeof_void_p" = "x4"; then
+ AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
+ sizeof_register=8
+ fi
case $host_os in
linux*)
sgen_supported=true
@@ -2568,6 +2591,15 @@ case "$host" in
NESTED_LIBGC_FLAGS="$NESTED_LIBGC_FLAGS -DHAVE_ARMV6"
fi
;;
+# TODO: make proper support for NaCl host.
+# arm*-*nacl)
+# TARGET=ARM;
+# arch_target=arm;
+# ACCESS_UNALIGNED="no"
+# JIT_SUPPORTED=yes
+# sgen_supported=true
+# AOT_SUPPORTED="no"
+# ;;
s390-*-linux*)
TARGET=S390;
arch_target=s390;
@@ -2632,7 +2664,29 @@ if test "x$host" != "x$target"; then
AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
sizeof_register=8
;;
- *-*-nacl)
+# TODO: make proper support for NaCl target.
+# arm*-*nacl)
+# TARGET=ARM
+# arch_target=arm
+# AC_DEFINE(TARGET_ARM, 1, [...])
+# ACCESS_UNALIGNED="no"
+# JIT_SUPPORTED=yes
+# sizeof_register=4
+# CPPFLAGS="$CPPFLAGS \
+# -DARM_FPU_VFP=1 -D__ARM_EABI__ \
+# -D__arm__ \
+# -D__portable_native_client__ \
+# -DARM_FPU_VFP=1 \
+# -Dtimezone=_timezone \
+# -DDISABLE_SOCKETS \
+# -DDISABLE_ATTACH \
+# -DUSE_NEWLIB"
+# jit_wanted=true
+ # Can't use tls, since it depends on the runtime detection of tls offsets
+ # in mono-compiler.h
+# with_tls=pthread
+# ;;
+ i686-*-nacl)
TARGET=X86
arch_target=x86
AC_DEFINE(TARGET_X86, 1, [...])
Modified: eglib/src/
eglib-config.h.in
===================================================================
@@ -37,9 +37,6 @@ typedef signed @GSIZE@ gssize;
#endif
#if defined (__native_client__)
-#define sem_trywait(x) sem_wait(x)
-#define sem_timedwait(x,y) sem_wait(x)
-#define getdtablesize() (32768)
#undef G_BREAKPOINT
#define G_BREAKPOINT()
#endif
Modified: eglib/src/gfile-posix.c
===================================================================
@@ -154,6 +154,15 @@
gchar *
g_get_current_dir (void)
{
+#ifdef __native_client__
+ char *buffer;
+ if ((buffer = getenv("NACL_PWD"))) {
+ buffer = g_strdup(buffer);
+ } else {
+ buffer = g_strdup(".");
+ }
+ return buffer;
+#else
int s = 32;
char *buffer = NULL, *r;
gboolean fail;
@@ -172,4 +181,5 @@
* so we return the buffer here since it has a pointer to the valid string
*/
return buffer;
+#endif
}
Modified: eglib/src/gmodule-unix.c
===================================================================
@@ -28,46 +28,12 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <config.h>
+
#include <glib.h>
#include <gmodule.h>
-#if defined(__native_client__)
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
-{
- printf("dlopen() not supported on Native Client.\n");
- return NULL;
-}
-
-
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
-{
- return FALSE;
-}
-
-
-const gchar*
-g_module_error(void)
-{
- return "dlopen not supported on Native Client.";
-}
-
-gboolean
-g_module_close (GModule *module)
-{
- return FALSE;
-}
-
-gchar*
-g_module_build_path (const gchar *directory, const gchar *module_name)
-{
- return NULL;
-}
-
-#else
-
-#ifdef G_OS_UNIX
+#if defined(G_OS_UNIX) && defined(HAVE_DLFCN_H)
#include <dlfcn.h>
/* For Linux and Solaris, need to add others as we port this */
@@ -322,5 +288,3 @@ struct _GModule {
return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
}
-#endif /* __native_client__ */
-
Modified: eglib/src/goutput.c
===================================================================
@@ -148,6 +148,12 @@
if (vasprintf (&msg, format, args) < 0)
return;
+#ifdef G_OS_WIN32
+ printf ("%s%s%s\n",
+ log_domain != NULL ? log_domain : "",
+ log_domain != NULL ? ": " : "",
+ msg);
+#else
#if MONOTOUCH
FILE *target = stderr;
#else
@@ -158,6 +164,7 @@
log_domain != NULL ? log_domain : "",
log_domain != NULL ? ": " : "",
msg);
+#endif
free (msg);
if (log_level & fatal){
fflush (stdout);
Modified: ikvm-native/os.c
===================================================================
@@ -95,6 +95,11 @@
JNIEXPORT int JNICALL ikvm_msync(void* address, jint size)
{
+#if defined(__native_client__) && defined(USE_NEWLIB)
+ g_assert_not_reached ();
+ return -1;
+#else
return msync(address, size, MS_SYNC);
+#endif
}
#endif
Modified: libgc/dyn_load.c
===================================================================
@@ -26,7 +26,7 @@
* None of this is safe with dlclose and incremental collection.
* But then not much of anything is safe in the presence of dlclose.
*/
-#if defined(__linux__) && !defined(_GNU_SOURCE)
+#if (defined(__linux__) || defined(__native_client__)) && !defined(_GNU_SOURCE)
/* Can't test LINUX, since this must be define before other includes */
# define _GNU_SOURCE
#endif
@@ -54,7 +54,7 @@
#if !defined(SUNOS4) && !defined(SUNOS5DL) && !defined(IRIX5) && \
!defined(MSWIN32) && !defined(MSWINCE) && \
!(defined(ALPHA) && defined(OSF1)) && \
- !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
+ !defined(HPUX) && !((defined(LINUX) || defined(NACL)) && defined(__ELF__)) && \
!defined(RS6000) && !defined(SCO_ELF) && !defined(DGUX) && \
!(defined(FREEBSD) && defined(__ELF__)) && \
!(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) && \
@@ -91,7 +91,7 @@
# define ELFSIZE ARCH_ELFSIZE
#endif
-#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+#if (defined(LINUX) || defined(NACL)) && defined(__ELF__) || defined(SCO_ELF) || \
(defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
(defined(OPENBSD) && defined(__ELF__)) || \
(defined(NETBSD) && defined(__ELF__)) || defined(HURD)
@@ -297,7 +297,7 @@ void GC_register_dynamic_libraries()
# endif /* !USE_PROC ... */
# endif /* SUNOS */
-#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+#if (defined(LINUX) || defined(NACL)) && defined(__ELF__) || defined(SCO_ELF) || \
(defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
(defined(OPENBSD) && defined(__ELF__)) || \
(defined(NETBSD) && defined(__ELF__)) || defined(HURD)
@@ -394,7 +394,7 @@ GC_bool GC_register_main_static_data()
/* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
/* versions. Thanks to Jakub Jelinek for most of the code. */
-# if defined(LINUX) /* Are others OK here, too? */ \
+# if (defined(LINUX) || defined(NACL)) /* Are others OK here, too? */ \
&& (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
Modified: libgc/include/private/gc_locks.h
===================================================================
@@ -223,12 +223,22 @@
# define GC_CLEAR_DEFINED
# endif /* ALPHA */
# ifdef ARM32
+#ifdef __native_client__
+#define NACL_ALIGN() ".align 4\n"
+#define MASK_REGISTER(reg) "bic " reg ", " reg ", #0xc0000000\n"
+#else
+#define NACL_ALIGN()
+#define MASK_REGISTER(reg)
+#endif
inline static int GC_test_and_set(volatile unsigned int *addr) {
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7__)
int ret, tmp;
__asm__ __volatile__ (
"1:\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%3")
"ldrex %0, [%3]\n"
+ MASK_REGISTER("%3")
"strex %1, %2, [%3]\n"
"teq %1, #0\n"
"bne 1b\n"
@@ -242,7 +252,8 @@
* bus because there are no SMP ARM machines. If/when there are,
* this code will likely need to be updated. */
/* See linuxthreads/sysdeps/arm/pt-machine.h in glibc-2.1 */
- __asm__ __volatile__("swp %0, %1, [%2]"
+ __asm__ __volatile__(MASK_REGISTER("%2")
+ "swp %0, %1, [%2]"
: "=&r"(oldval)
: "r"(1), "r"(addr)
: "memory");
Modified: libgc/include/private/gcconfig.h
===================================================================
@@ -67,12 +67,18 @@
/* Determine the machine type: */
# if defined(__native_client__)
# define NACL
-# define I386
-# define mach_type_known
+# if !defined(__portable_native_client__)
+# define I386
+# define mach_type_known
+# else
+ /* Here we will rely upon arch-specific defines. */
+# endif
# endif
# if defined(__arm__) || defined(__thumb__)
# define ARM32
-# if !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN)
+# if defined(NACL)
+# define mach_type_known
+# elif !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN)
# define NOSYS
# define mach_type_known
# endif
@@ -928,6 +934,30 @@
# endif
# endif
+
+# ifdef NACL
+# define OS_TYPE "NACL"
+# if defined(__GLIBC__)
+# define DYNAMIC_LOADING
+# endif
+# define DATASTART ((ptr_t)0x10020000)
+ extern int _end[];
+# define DATAEND (_end)
+# ifdef STACK_GRAN
+# undef STACK_GRAN
+# endif /* STACK_GRAN */
+# define STACK_GRAN 0x10000
+# define HEURISTIC1
+# define USE_MMAP
+# define USE_MUNMAP
+# define USE_MMAP_ANON
+# ifdef USE_MMAP_FIXED
+# undef USE_MMAP_FIXED
+# endif
+# define GETPAGESIZE() 65536
+# define MAX_NACL_GC_THREADS 1024
+# endif
+
# ifdef VAX
# define MACH_TYPE "VAX"
# define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
@@ -1204,33 +1234,6 @@
# define HEAP_START DATAEND
# endif /* USE_MMAP */
# endif /* DGUX */
-# ifdef NACL
-# define OS_TYPE "NACL"
- extern int etext[];
-//# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
-# define DATASTART ((ptr_t)0x10000000)
- extern int _end[];
-# define DATAEND (_end)
-# ifdef STACK_GRAN
-# undef STACK_GRAN
-# endif /* STACK_GRAN */
-# define STACK_GRAN 0x10000
-# define HEURISTIC1
-# ifdef USE_MMAP
-# undef USE_MMAP
-# endif
-# ifdef USE_MUNMAP
-# undef USE_MUNMAP
-# endif
-# ifdef USE_MMAP_ANON
-# undef USE_MMAP_ANON
-# endif
-# ifdef USE_MMAP_FIXED
-# undef USE_MMAP_FIXED
-# endif
-# define GETPAGESIZE() 65536
-# define MAX_NACL_GC_THREADS 1024
-# endif
# ifdef LINUX
# ifndef __GNUC__
/* The Intel compiler doesn't like inline assembly */
@@ -1925,8 +1928,12 @@
# endif
# ifdef ARM32
-# define CPP_WORDSZ 32
+# if defined( NACL )
+# define MACH_TYPE "NACL"
+# else
# define MACH_TYPE "ARM32"
+# endif
+# define CPP_WORDSZ 32
# define ALIGNMENT 4
# ifdef NETBSD
# define OS_TYPE "NETBSD"
Modified: libgc/misc.c
===================================================================
@@ -1003,7 +1003,11 @@ void GC_printf(format, a, b, c, d, e, f)
buf[1024] = 0x15;
(void) sprintf(buf, format, a, b, c, d, e, f);
if (buf[1024] != 0x15) ABORT("GC_printf clobbered stack");
+#ifdef NACL
+ WRITE(GC_stdout, buf, strlen(buf));
+#else
if (WRITE(GC_stdout, buf, strlen(buf)) < 0) ABORT("write to stdout failed");
+#endif
}
void GC_err_printf(format, a, b, c, d, e, f)
@@ -1015,13 +1019,21 @@ void GC_err_printf(format, a, b, c, d, e, f)
buf[1024] = 0x15;
(void) sprintf(buf, format, a, b, c, d, e, f);
if (buf[1024] != 0x15) ABORT("GC_err_printf clobbered stack");
+#ifdef NACL
+ WRITE(GC_stderr, buf, strlen(buf));
+#else
if (WRITE(GC_stderr, buf, strlen(buf)) < 0) ABORT("write to stderr failed");
+#endif
}
void GC_err_puts(s)
GC_CONST char *s;
{
+#ifdef NACL
+ WRITE(GC_stderr, s, strlen(s));
+#else
if (WRITE(GC_stderr, s, strlen(s)) < 0) ABORT("write to stderr failed");
+#endif
}
#if defined(LINUX) && !defined(SMALL_CONFIG)
Modified: libgc/pthread_stop_world.c
===================================================================
@@ -24,7 +24,7 @@
#endif
#ifdef NACL
-int nacl_park_threads_now = 0;
+volatile int __nacl_thread_suspension_needed = 0;
pthread_t nacl_thread_parker = -1;
volatile int nacl_thread_parked[MAX_NACL_GC_THREADS];
@@ -471,7 +471,7 @@ static void pthread_stop_world()
GC_printf1("pthread_stop_world: num_threads %d\n", nacl_num_gc_threads - 1);
#endif
nacl_thread_parker = pthread_self();
- nacl_park_threads_now = 1;
+ __nacl_thread_suspension_needed = 1;
while (1) {
#define NACL_PARK_WAIT_NANOSECONDS 100000
@@ -537,6 +537,22 @@ static void pthread_stop_world()
__asm__ __volatile__ ("add $16, %esp");\
} while (0)
+#elif __arm__
+
+#define NACL_STORE_REGS() \
+ do { \
+ __asm__ __volatile__ ("push {r4-r12,lr}");\
+ __asm__ __volatile__ ("mov r0, %0" : : "r" (&nacl_gc_thread_self->stop_info.stack_ptr)); \
+ __asm__ __volatile__ ("bic r0, r0, #0xc0000000");\
+ __asm__ __volatile__ ("str sp, [r0]");\
+ memcpy(nacl_gc_thread_self->stop_info.reg_storage, nacl_gc_thread_self->stop_info.stack_ptr, NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t));\
+ __asm__ __volatile__ ("add sp, sp, #40");\
+ __asm__ __volatile__ ("bic sp, sp, #0xc0000000");\
+ } while (0)
+#else
+
+#error "Please port NACL_STORE_REGS"
+
#endif
void nacl_pre_syscall_hook()
@@ -549,6 +565,8 @@ void nacl_pre_syscall_hook()
}
}
+void __nacl_suspend_thread_if_needed();
+
void nacl_post_syscall_hook()
{
/* Calling __nacl_suspend_thread_if_needed() right away should guarantee we don't mutate the GC set. */
@@ -559,7 +577,7 @@ void nacl_post_syscall_hook()
}
void __nacl_suspend_thread_if_needed() {
- if (nacl_park_threads_now) {
+ if (__nacl_thread_suspension_needed) {
pthread_t self = pthread_self();
int local_dummy = 0;
/* Don't try to park the thread parker. */
@@ -578,7 +596,7 @@ void __nacl_suspend_thread_if_needed() {
nacl_gc_thread_self->stop_info.stack_ptr = (ptr_t)(&local_dummy);
}
nacl_thread_parked[nacl_thread_idx] = 1;
- while (nacl_park_threads_now)
+ while (__nacl_thread_suspension_needed)
; /* spin */
nacl_thread_parked[nacl_thread_idx] = 0;
@@ -688,7 +706,7 @@ static void pthread_start_world()
# if DEBUG_THREADS
GC_printf0("World starting\n");
# endif
- nacl_park_threads_now = 0;
+ __nacl_thread_suspension_needed = 0;
if (GC_notify_event)
GC_notify_event (GC_EVENT_POST_START_WORLD);
#endif /* NACL */
Modified: libgc/pthread_support.c
===================================================================
@@ -699,10 +699,20 @@ void GC_mark_thread_local_free_lists(void)
extern void nacl_post_syscall_hook();
extern void nacl_register_gc_hooks(void (*pre)(), void (*post)());
+#include <stdio.h>
+
+struct nacl_irt_blockhook {
+ int (*register_block_hooks)(void (*pre)(void), void (*post)(void));
+};
+
+extern size_t nacl_interface_query(const char *interface_ident,
+ void *table, size_t tablesize);
+
void nacl_initialize_gc_thread()
{
int i;
- nacl_register_gc_hooks(nacl_pre_syscall_hook, nacl_post_syscall_hook);
+ static struct nacl_irt_blockhook gc_hook;
+
pthread_mutex_lock(&nacl_thread_alloc_lock);
if (!nacl_thread_parking_inited)
{
@@ -710,6 +720,10 @@ void nacl_initialize_gc_thread()
nacl_thread_used[i] = 0;
nacl_thread_parked[i] = 0;
}
+ // TODO: replace with public 'register hook' function when
+ // available from glibc
+ nacl_interface_query("nacl-irt-blockhook-0.1", &gc_hook, sizeof(gc_hook));
+ gc_hook.register_block_hooks(nacl_pre_syscall_hook, nacl_post_syscall_hook);
nacl_thread_parking_inited = 1;
}
GC_ASSERT(nacl_num_gc_threads <= MAX_NACL_GC_THREADS);
@@ -942,6 +956,7 @@ int GC_segment_is_thread_stack(ptr_t lo, ptr_t hi)
/* Return the number of processors, or i<= 0 if it can't be determined. */
int GC_get_nprocs()
{
+#ifndef NACL
/* Should be "return sysconf(_SC_NPROCESSORS_ONLN);" but that */
/* appears to be buggy in many cases. */
/* We look for lines "cpu<n>" in /proc/stat. */
@@ -971,6 +986,9 @@ int GC_get_nprocs()
}
close(f);
return result;
+#else /* NACL */
+ return sysconf(_SC_NPROCESSORS_ONLN);
+#endif
}
#endif /* GC_LINUX_THREADS */
@@ -1362,12 +1380,10 @@ int WRAP_FUNC(pthread_join)(pthread_t thread, void **retval)
}
#ifdef NACL
-/* Native Client doesn't support pthread cleanup functions, */
-/* so wrap pthread_exit and manually cleanup the thread. */
+/* TODO: remove, NaCl glibc now supports pthread cleanup functions. */
void
WRAP_FUNC(pthread_exit)(void *status)
{
- GC_thread_exit_proc(0);
REAL_FUNC(pthread_exit)(status);
}
#endif
Modified: man/mono.1
===================================================================
@@ -1176,6 +1176,11 @@ are allocated (clear-at-gc). The consistency check ensures that
there are no major to minor references that are not on the remembered
sets.
.TP
+\fBmod-union-consistency-check\fR
+Checks that the mod-union cardtable is consistent before each
+finishing major collection pause. This check is only applicable to
+concurrent major collectors.
+.TP
\fBcheck-mark-bits\fR
Checks that mark bits in the major heap are consistent at the end of
each major collection. Consistent mark bits mean that if an object is
Modified: mcs/class/Makefile
===================================================================
@@ -154,7 +154,6 @@ mobile_dirs := \
System.Reactive.PlatformServices \
System.Reactive.Experimental \
System.Reactive.Debugger \
- System.Net.Http \
System.IO.Compression \
System.IO.Compression.FileSystem \
System.ComponentModel.DataAnnotations \
@@ -164,6 +163,7 @@ monodroid_dirs := \
Mono.CompilerServices.SymbolWriter \
Mono.CSharp \
Microsoft.CSharp \
+ System.Net.Http \
System.Reactive.Providers
monotouch_runtime_dirs := \
@@ -193,8 +193,7 @@ monotouch_runtime_dirs := \
System.Web \
Mono.Web \
System.Web.Services \
- System.Web \
- System.Net.Http
+ System.Web
net_3_5_only_dirs := \
Microsoft.Build.Framework \
Modified: mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
===================================================================
@@ -369,8 +369,8 @@ public UpDownBase()
txtView.Dock = DockStyle.Fill;
SuspendLayout ();
- Controls.Add (txtView);
Controls.Add (spnSpinner);
+ Controls.Add (txtView);
ResumeLayout ();
Height = PreferredHeight;
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItem.cs
===================================================================
@@ -26,6 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
+using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
@@ -50,6 +51,9 @@ public class BuildItem {
//string recursiveDir;
IDictionary evaluatedMetadata;
IDictionary unevaluatedMetadata;
+ bool isDynamic;
+ bool keepDuplicates = true;
+ string removeMetadata, keepMetadata;
BuildItem ()
{
@@ -90,11 +94,49 @@ internal BuildItem (XmlElement itemElement, BuildItemGroup parentItemGroup)
this.parent_item_group = parentItemGroup;
this.itemElement = itemElement;
-
- if (Include == String.Empty)
- throw new InvalidProjectFileException (String.Format ("The required attribute \"Include\" is missing from element <{0}>.", Name));
+ isDynamic = parentItemGroup.IsDynamic;
+
+ if (IsDynamic) {
+ if (!string.IsNullOrEmpty (Remove)) {
+ if (!string.IsNullOrEmpty (Include) || !string.IsNullOrEmpty (Exclude))
+ throw new InvalidProjectFileException (string.Format ("The attribute \"Remove\" in element <{0}> is unrecognized.", Name));
+ if (itemElement.HasChildNodes)
+ throw new InvalidProjectFileException ("Children are not allowed below an item remove element.");
+ }
+ if (string.IsNullOrEmpty (Include) && !string.IsNullOrEmpty (Exclude))
+ throw new InvalidProjectFileException (string.Format ("The attribute \"Exclude\" in element <{0}> is unrecognized.", Name));
+ } else {
+ if (string.IsNullOrEmpty (Include))
+ throw new InvalidProjectFileException (string.Format ("The required attribute \"Include\" is missing from element <{0}>.", Name));
+ if (!string.IsNullOrEmpty (Remove))
+ throw new InvalidProjectFileException (string.Format ("The attribute \"Remove\" in element <{0}> is unrecognized.", Name));
+ }
+
+ foreach (XmlAttribute attr in itemElement.Attributes) {
+ if (attr.Name == "Include" || attr.Name == "Exclude" || attr.Name == "Condition")
+ continue;
+ if (!IsDynamic)
+ throw new InvalidProjectFileException (string.Format ("The attribute \"{0}\" in element <{1}> is unrecognized.", attr.Name, Name));
+
+ switch (attr.Name) {
+ case "Remove":
+ Remove = attr.Value;
+ break;
+ case "KeepDuplicates":
+ KeepDuplicates = bool.Parse (attr.Value);
+ break;
+ case "RemoveMetadata":
+ removeMetadata = attr.Value;
+ break;
+ case "KeepMetadata":
+ keepMetadata = attr.Value;
+ break;
+ default:
+ throw new InvalidProjectFileException (string.Format ("The attribute \"{0}\" in element <{1}> is unrecognized.", attr.Name, Name));
+ }
+ }
}
-
+
BuildItem (BuildItem parent)
{
isImported = parent.isImported;
@@ -254,21 +296,39 @@ internal void Evaluate (Project project, bool evaluatedTo)
this.finalItemSpec = MSBuildUtils.Unescape (Include);
return;
}
-
+
foreach (XmlNode xn in itemElement.ChildNodes) {
XmlElement xe = xn as XmlElement;
if (xe != null && ConditionParser.ParseAndEvaluate (xe.GetAttribute ("Condition"), project))
AddMetadata (xe.Name, xe.InnerText);
}
+ if (IsDynamic) {
+ if (!evaluatedTo)
+ return;
+
+ if (!string.IsNullOrEmpty (Remove)) {
+ RemoveItems (project);
+ return;
+ }
+
+ if (string.IsNullOrEmpty (Include)) {
+ UpdateMetadata (project);
+ return;
+ }
+ }
+
DirectoryScanner directoryScanner;
Expression includeExpr, excludeExpr;
ITaskItem[] includes, excludes;
+ var options = IsDynamic ?
+ ParseOptions.AllowItemsMetadataAndSplit : ParseOptions.AllowItemsNoMetadataAndSplit;
+
includeExpr = new Expression ();
- includeExpr.Parse (Include, ParseOptions.AllowItemsNoMetadataAndSplit);
+ includeExpr.Parse (Include, options);
excludeExpr = new Expression ();
- excludeExpr.Parse (Exclude, ParseOptions.AllowItemsNoMetadataAndSplit);
+ excludeExpr.Parse (Exclude, options);
includes = (ITaskItem[]) includeExpr.ConvertTo (project, typeof (ITaskItem[]),
ExpressionOptions.ExpandItemRefs);
@@ -293,9 +353,123 @@ internal void Evaluate (Project project, bool evaluatedTo)
foreach (ITaskItem matchedItem in directoryScanner.MatchedItems)
AddEvaluatedItem (project, evaluatedTo, matchedItem);
}
-
+
+ bool CheckCondition (Project project)
+ {
+ if (parent_item_group != null && !ConditionParser.ParseAndEvaluate (parent_item_group.Condition, project))
+ return false;
+ if (parent_item != null && !parent_item.CheckCondition (project))
+ return false;
+ return ConditionParser.ParseAndEvaluate (Condition, project);
+ }
+
+ void UpdateMetadata (Project project)
+ {
+ BuildItemGroup group;
+ if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
+ return;
+
+ foreach (BuildItem item in group) {
+ if (!item.CheckCondition (project))
+ continue;
+
+ foreach (string name in evaluatedMetadata.Keys) {
+ item.SetMetadata (name, (string)evaluatedMetadata [name]);
+ }
+
+ AddAndRemoveMetadata (project, item);
+ }
+ }
+
+ void AddAndRemoveMetadata (Project project, BuildItem item)
+ {
+ if (!string.IsNullOrEmpty (removeMetadata)) {
+ var removeExpr = new Expression ();
+ removeExpr.Parse (removeMetadata, ParseOptions.AllowItemsNoMetadataAndSplit);
+
+ var removeSpec = (string[]) removeExpr.ConvertTo (
+ project, typeof (string[]), ExpressionOptions.ExpandItemRefs);
+
+ foreach (var remove in removeSpec) {
+ item.DeleteMetadata (remove);
+ }
+ }
+
+ if (!string.IsNullOrEmpty (keepMetadata)) {
+ var keepExpr = new Expression ();
+ keepExpr.Parse (keepMetadata, ParseOptions.AllowItemsNoMetadataAndSplit);
+
+ var keepSpec = (string[]) keepExpr.ConvertTo (
+ project, typeof (string[]), ExpressionOptions.ExpandItemRefs);
+
+ var metadataNames = new string [item.evaluatedMetadata.Count];
+ item.evaluatedMetadata.Keys.CopyTo (metadataNames, 0);
+
+ foreach (string name in metadataNames) {
+ if (!keepSpec.Contains (name))
+ item.DeleteMetadata (name);
+ }
+ }
+ }
+
+ void RemoveItems (Project project)
+ {
+ BuildItemGroup group;
+ if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
+ return;
+
+ var removeExpr = new Expression ();
+ removeExpr.Parse (Remove, ParseOptions.AllowItemsNoMetadataAndSplit);
+
+ var removes = (ITaskItem[]) removeExpr.ConvertTo (
+ project, typeof (ITaskItem[]), ExpressionOptions.ExpandItemRefs);
+
+ var directoryScanner = new DirectoryScanner ();
+
+ directoryScanner.Includes = removes;
+
+ if (project.FullFileName != String.Empty)
+ directoryScanner.BaseDirectory = new DirectoryInfo (Path.GetDirectoryName (project.FullFileName));
+ else
+ directoryScanner.BaseDirectory = new DirectoryInfo (Directory.GetCurrentDirectory ());
+
+ directoryScanner.Scan ();
+
+ foreach (ITaskItem matchedItem in directoryScanner.MatchedItems) {
+ group.RemoveItem (matchedItem);
+ }
+ }
+
+ bool ContainsItem (Project project, ITaskItem taskItem)
+ {
+ BuildItemGroup group;
+ if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
+ return false;
+
+ var item = group.FindItem (taskItem);
+ if (item == null)
+ return false;
+
+ foreach (string metadataName in evaluatedMetadata.Keys) {
+ string metadataValue = (string)evaluatedMetadata [metadataName];
+ if (!metadataValue.Equals (item.evaluatedMetadata [metadataName]))
+ return false;
+ }
+
+ foreach (string metadataName in item.evaluatedMetadata.Keys) {
+ string metadataValue = (string)item.evaluatedMetadata [metadataName];
+ if (!metadataValue.Equals (evaluatedMetadata [metadataName]))
+ return false;
+ }
+
+ return true;
+ }
+
void AddEvaluatedItem (Project project, bool evaluatedTo, ITaskItem taskitem)
{
+ if (IsDynamic && evaluatedTo && !KeepDuplicates && ContainsItem (project, taskitem))
+ return;
+
BuildItemGroup big;
BuildItem bi = new BuildItem (this);
bi.finalItemSpec = taskitem.ItemSpec;
@@ -328,6 +502,9 @@ void AddEvaluatedItem (Project project, bool evaluatedTo, ITaskItem taskitem)
}
big.AddItem (bi);
+
+ if (IsDynamic)
+ AddAndRemoveMetadata (project, bi);
}
// during item's eval phase, any item refs in this item, have either
@@ -488,6 +665,20 @@ static BuildItem InsertElementAfter (BuildItem parent, BuildItem child, XmlEleme
}
}
+ internal bool IsDynamic {
+ get { return isDynamic; }
+ }
+
+ internal string Remove {
+ get;
+ private set;
+ }
+
+ internal bool KeepDuplicates {
+ get { return keepDuplicates; }
+ private set { keepDuplicates = value; }
+ }
+
public bool IsImported {
get { return isImported; }
}
@@ -522,6 +713,10 @@ static BuildItem InsertElementAfter (BuildItem parent, BuildItem child, XmlEleme
internal bool FromXml {
get { return itemElement != null; }
}
+
+ internal XmlElement XmlElement {
+ get { return itemElement; }
+ }
internal bool HasParentItem {
get { return parent_item != null; }
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs
===================================================================
@@ -26,6 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
+using System.Linq;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
@@ -42,7 +43,8 @@ public class BuildItemGroup : IEnumerable {
GroupingCollection parentCollection;
Project parentProject;
bool read_only;
- bool evaluated;
+ bool evaluated;
+ bool isDynamic;
public BuildItemGroup ()
: this (null, null, null, false)
@@ -55,12 +57,18 @@ internal BuildItemGroup (Project project)
}
internal BuildItemGroup (XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly)
+ : this (xmlElement, project, importedProject, readOnly, false)
+ {
+ }
+
+ internal BuildItemGroup (XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly, bool dynamic)
{
this.buildItems = new List <BuildItem> ();
this.importedProject = importedProject;
this.itemGroupElement = xmlElement;
this.parentProject = project;
this.read_only = readOnly;
+ this.isDynamic = dynamic;
if (!FromXml)
return;
@@ -169,6 +177,24 @@ public void RemoveItemAt (int index)
RemoveItem (item);
}
+ internal BuildItem FindItem (ITaskItem taskItem)
+ {
+ return buildItems.FirstOrDefault (i => i.FinalItemSpec == taskItem.ItemSpec);
+ }
+
+ internal void RemoveItem (ITaskItem itemToRemove)
+ {
+ if (itemToRemove == null)
+ return;
+
+ var item = FindItem (itemToRemove);
+ if (item == null)
+ return;
+
+ item.Detach ();
+ buildItems.Remove (item);
+ }
+
public BuildItem[] ToArray ()
{
return buildItems.ToArray ();
@@ -239,7 +265,7 @@ internal void Detach ()
internal void Evaluate ()
{
- if (evaluated)
+ if (!isDynamic && evaluated)
return;
foreach (BuildItem bi in buildItems) {
if (bi.Condition == String.Empty)
@@ -317,5 +343,11 @@ internal void ReplaceWith (BuildItem item, List <BuildItem> list)
return itemGroupElement;
}
}
+
+ internal bool IsDynamic {
+ get {
+ return isDynamic;
+ }
+ }
}
}
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs
===================================================================
@@ -35,7 +35,7 @@
using Microsoft.Build.Utilities;
namespace Microsoft.Build.BuildEngine {
- public class BuildTask {
+ public class BuildTask : IBuildTask {
ITaskHost hostObject;
Target parentTarget;
@@ -127,7 +127,7 @@ public string[] GetParameterNames ()
continue;
tempNames.Add (xmlAttribute.Name);
}
-
+
return tempNames.ToArray ();
}
@@ -156,7 +156,7 @@ public string GetParameterValue (string attributeName)
else
taskElement.SetAttribute (parameterName, parameterValue);
}
-
+
void LogTaskStarted ()
{
TaskStartedEventArgs tsea = new TaskStartedEventArgs ("Task started.", null,
@@ -266,11 +266,29 @@ ITask InitializeTask ()
get { return taskElement; }
set { taskElement = value; }
}
-
+
[MonoTODO]
public Type Type {
get { return parentTarget.Project.TaskDatabase.GetTypeFromClassName (Name); }
}
+
+ public IEnumerable<string> GetAttributes ()
+ {
+ foreach (XmlAttribute attrib in TaskElement.Attributes)
+ yield return attrib.Value;
+ foreach (XmlNode xn in TaskElement.ChildNodes) {
+ XmlElement xe = xn as XmlElement;
+ if (xe == null)
+ continue;
+
+ //FIXME: error on any other child
+ if (String.Compare (xe.LocalName, "Output", StringComparison.Ordinal) == 0) {
+ foreach (XmlAttribute attrib in xe.Attributes)
+ yield return attrib.Value;
+ }
+ }
+ }
+
}
}
Added: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTaskItemGroup.cs
===================================================================
@@ -0,0 +1,63 @@
+//
+// BuildTaskItemGroup.cs
+//
+// Author:
+// Martin Baulig <
martin...@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (
http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+
+ internal class BuildTaskItemGroup : BuildItemGroup, IBuildTask {
+
+ public bool ContinueOnError {
+ get; set;
+ }
+
+ internal BuildTaskItemGroup (XmlElement element, Target target)
+ : base (element, target.Project, null, false, true)
+ {
+ }
+
+ public bool Execute ()
+ {
+ Evaluate ();
+ return true;
+ }
+
+ public IEnumerable<string> GetAttributes ()
+ {
+ foreach (XmlAttribute attrib in XmlElement.Attributes)
+ yield return attrib.Value;
+
+ foreach (BuildItem item in this) {
+ foreach (XmlAttribute attrib in item.XmlElement.Attributes)
+ yield return attrib.Value;
+ }
+ }
+
+ }
+}
+
Added: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTaskPropertyGroup.cs
===================================================================
@@ -0,0 +1,59 @@
+//
+// BuildTaskPropertyGroup.cs
+//
+// Author:
+// Martin Baulig <
martin...@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (
http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine {
+
+ internal class BuildTaskPropertyGroup : BuildPropertyGroup, IBuildTask {
+
+ public bool ContinueOnError {
+ get; set;
+ }
+
+ internal BuildTaskPropertyGroup (XmlElement element, Target target)
+ : base (element, target.Project, null, false)
+ {
+ }
+
+ public bool Execute ()
+ {
+ Evaluate ();
+ return true;
+ }
+
+ public IEnumerable<string> GetAttributes ()
+ {
+ foreach (XmlAttribute attrib in XmlElement.Attributes)
+ yield return attrib.Value;
+ }
+
+ }
+}
+
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionParser.cs
===================================================================
@@ -89,6 +89,11 @@ ConditionExpression ParseBooleanExpression ()
{
return ParseBooleanAnd ();
}
+
+ public static string And (string a, string b)
+ {
+ return a + " and " + b;
+ }
ConditionExpression ParseBooleanAnd ()
{
Added: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/IBuildTask.cs
===================================================================
@@ -0,0 +1,44 @@
+//
+// IBuildTask.cs
+//
+// Author:
+// Martin Baulig <
martin...@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (
http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.Build.BuildEngine {
+ internal interface IBuildTask {
+ bool ContinueOnError {
+ get; set;
+ }
+
+ string Condition {
+ get; set;
+ }
+
+ bool Execute ();
+
+ IEnumerable<string> GetAttributes ();
+ }
+}
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
===================================================================
@@ -26,12 +26,14 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
+using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
+using Mono.XBuild.Utilities;
namespace Microsoft.Build.BuildEngine {
public class Target : IEnumerable {
@@ -44,7 +46,7 @@ public class Target : IEnumerable {
Project project;
XmlElement targetElement;
List <XmlElement> onErrorElements;
- List <BuildTask> buildTasks;
+ List <IBuildTask> buildTasks;
internal Target (XmlElement targetElement, Project project, ImportedProject importedProject)
{
@@ -62,7 +64,7 @@ internal Target (XmlElement targetElement, Project project, ImportedProject impo
this.onErrorElements = new List <XmlElement> ();
this.buildState = BuildState.NotStarted;
- this.buildTasks = new List <BuildTask> ();
+ this.buildTasks = new List <IBuildTask> ();
this.batchingImpl = new TargetBatchingImpl (project, this.targetElement);
bool onErrorFound = false;
@@ -77,8 +79,10 @@ internal Target (XmlElement targetElement, Project project, ImportedProject impo
"The element <OnError> must be last under element <Target>. Found element <Error> instead.");
#if NET_3_5
else if (xe.Name == "ItemGroup") {
- //don't blow up for ItemGroups inside Targets in >= 3.5
- // TODO: evaluate them (see
https://bugzilla.xamarin.com/show_bug.cgi?id=1862 and test in TargetTest.cs )
+ buildTasks.Add (new BuildTaskItemGroup (xe, this));
+ continue;
+ } else if (xe.Name == "PropertyGroup") {
+ buildTasks.Add (new BuildTaskPropertyGroup (xe, this));
continue;
}
#endif
@@ -379,7 +383,7 @@ void LogMessage (MessageImportance importance, string message, params object []
internal List<string> AfterThisTargets { get; set; }
#endif
- internal List<BuildTask> BuildTasks {
+ internal List<IBuildTask> BuildTasks {
get { return buildTasks; }
}
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TargetBatchingImpl.cs
===================================================================
@@ -118,7 +118,7 @@ bool RunTargetWithBucket (Dictionary<string, BuildItemGroup> bucket, Target targ
for (int i = 0; i < target.BuildTasks.Count; i ++) {
//FIXME: parsing attributes repeatedly
- BuildTask bt = target.BuildTasks [i];
+ IBuildTask bt = target.BuildTasks [i];
TaskBatchingImpl batchingImpl = new TaskBatchingImpl (project);
bool task_result = batchingImpl.Build (bt, out executeOnErrors);
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskBatchingImpl.cs
===================================================================
@@ -40,7 +40,7 @@ public TaskBatchingImpl (Project project)
{
}
- public bool Build (BuildTask buildTask, out bool executeOnErrors)
+ public bool Build (IBuildTask buildTask, out bool executeOnErrors)
{
executeOnErrors = false;
try {
@@ -68,7 +68,7 @@ public bool Build (BuildTask buildTask, out bool executeOnErrors)
}
}
- bool Run (BuildTask buildTask, out bool executeOnErrors)
+ bool Run (IBuildTask buildTask, out bool executeOnErrors)
{
executeOnErrors = false;
@@ -108,21 +108,10 @@ bool Run (BuildTask buildTask, out bool executeOnErrors)
// Parse task attributes to get list of referenced metadata and items
// to determine batching
//
- void ParseTaskAttributes (BuildTask buildTask)
+ void ParseTaskAttributes (IBuildTask buildTask)
{
- foreach (XmlAttribute attrib in buildTask.TaskElement.Attributes)
- ParseAttribute (attrib.Value);
-
- foreach (XmlNode xn in buildTask.TaskElement.ChildNodes) {
- XmlElement xe = xn as XmlElement;
- if (xe == null)
- continue;
-
- //FIXME: error on any other child
- if (String.Compare (xe.LocalName, "Output", StringComparison.Ordinal) == 0) {
- foreach (XmlAttribute attrib in xe.Attributes)
- ParseAttribute (attrib.Value);
- }
+ foreach (var attr in buildTask.GetAttributes ()) {
+ ParseAttribute (attr);
}
}
}
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
===================================================================
@@ -18,6 +18,8 @@ Microsoft.Build.BuildEngine/BuildPropertyGroupCollection.cs
Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
Microsoft.Build.BuildEngine/BuildSettings.cs
Microsoft.Build.BuildEngine/BuildTask.cs
+Microsoft.Build.BuildEngine/BuildTaskItemGroup.cs
+Microsoft.Build.BuildEngine/BuildTaskPropertyGroup.cs
Microsoft.Build.BuildEngine/BuildWhen.cs
Microsoft.Build.BuildEngine/ChangeType.cs
Microsoft.Build.BuildEngine/ColorResetter.cs
@@ -46,6 +48,7 @@ Microsoft.Build.BuildEngine/ImportCollection.cs
Microsoft.Build.BuildEngine/ImportedProject.cs
Microsoft.Build.BuildEngine/InternalLoggerException.cs
Microsoft.Build.BuildEngine/InvalidProjectFileException.cs
+Microsoft.Build.BuildEngine/IBuildTask.cs
Microsoft.Build.BuildEngine/IReference.cs
Microsoft.Build.BuildEngine/ItemReference.cs
Microsoft.Build.BuildEngine/LogExtensions.cs
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildItemTest.cs
===================================================================
@@ -95,6 +95,7 @@ public void TestCtor5 ()
// Parameter "itemInclude" cannot have zero length.
[Test]
+ [Category ("NotDotNet")]
[ExpectedException (typeof (ArgumentException))]
public void TestCtor6 ()
{
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
===================================================================
@@ -220,6 +220,7 @@ public void TestCondition3 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestGetEnumerator1 ()
{
BuildPropertyGroup bpg = new BuildPropertyGroup ();
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
===================================================================
@@ -349,6 +349,7 @@ public void TestValue2 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestValueXml ()
{
BuildPropertyGroup [] bpgs = new BuildPropertyGroup [1];
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ConsoleLoggerTest.cs
===================================================================
@@ -35,6 +35,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
[TestFixture]
public class ConsoleLoggerTest {
[Test]
+ [Category ("NotDotNet")]
public void TestAssignment ()
{
ConsoleLogger cl = new ConsoleLogger ();
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
===================================================================
@@ -275,6 +275,7 @@ public void TestBuildProjectFile1 ()
}
[Test]
+ [Category ("NotDotNet")]
[ExpectedException (typeof (ArgumentException))]
public void TestBuildProject1 ()
{
@@ -305,6 +306,7 @@ public void TestBuildProject2 ()
}
[Test]
+ [Category ("NotDotNet")]
[ExpectedException (typeof (ArgumentException))]
public void TestBuildProjectNull1 ()
{
@@ -313,6 +315,7 @@ public void TestBuildProjectNull1 ()
}
[Test]
+ [Category ("NotDotNet")]
[ExpectedException (typeof (ArgumentException))]
public void TestBuildProjectNull2 ()
{
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
===================================================================
@@ -1301,6 +1301,7 @@ public void TestBuildProjectFileXml8 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestBatchedMetadataRef1 ()
{
//test for multiple items with same metadata also
@@ -1341,6 +1342,7 @@ public void TestBatchedMetadataRef1 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestBatchedMetadataRef2 ()
{
string projectString = @"<Project xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
@@ -1394,6 +1396,7 @@ public void TestBatchedMetadataRef2 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestBatchedMetadataRef3 ()
{
string projectString = @"<Project xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
@@ -1429,6 +1432,7 @@ public void TestBatchedMetadataRef3 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestBatchedMetadataRef4 ()
{
string projectString = @"<Project xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
@@ -1457,6 +1461,7 @@ public void TestBatchedMetadataRef4 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestBatchedMetadataRef5 ()
{
string projectString = @"<Project xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
@@ -1492,6 +1497,7 @@ public void TestBatchedMetadataRef5 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestBatchedMetadataRefInOutput () {
string projectString = @"<Project xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
<UsingTask TaskName=""BatchingTestTask"" AssemblyFile=""Test/resources/TestTasks.dll"" />
@@ -1831,6 +1837,7 @@ public void TestPropertiesFromImportedProjects ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestMSBuildThisProperties ()
{
Engine engine = new Engine (Consts.BinPath);
@@ -2005,6 +2012,7 @@ public void TestRequiredTask_TaskItem2 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestRequiredTask_TaskItemArray1 ()
{
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItems", "@(NonExistant)",
@@ -2016,6 +2024,7 @@ public void TestRequiredTask_TaskItemArray1 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestRequiredTask_TaskItemArray2 ()
{
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItems", "$(NonExistant)",
@@ -2027,6 +2036,7 @@ public void TestRequiredTask_TaskItemArray2 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestRequiredTask_TaskItemArray3 ()
{
Project p = CheckProjectForRequiredTests ("RequiredTestTask_IntArray", "$(NonExistant)",
@@ -2038,6 +2048,7 @@ public void TestRequiredTask_TaskItemArray3 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestRequiredTask_TaskItemArray4 () {
Project p = CheckProjectForRequiredTests ("RequiredTestTask_IntArray", "%(NonExistant.Md)",
true, "Build failed", "count: 0");
@@ -2048,6 +2059,7 @@ public void TestRequiredTask_TaskItemArray3 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestRequiredTask_TaskItemArray5 () {
// with extra space in prop value
Project p = CheckProjectForRequiredTests ("RequiredTestTask_IntArray", " %(NonExistant.Md)",
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/TargetTest.cs
===================================================================
@@ -26,14 +26,15 @@
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
using System;
using System.Collections;
using Microsoft.Build.BuildEngine;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
+using MonoTests.Microsoft.Build.Tasks;
using NUnit.Framework;
using System.IO;
+using System.Xml;
namespace MonoTests.Microsoft.Build.BuildEngine {
[TestFixture]
@@ -349,38 +350,87 @@ public void TestTargetOutputs1 ()
}
#if NET_3_5
- [Test]
- public void BuildProjectWithItemGroupInsideTarget()
+ bool Build (string projectXml, ILogger logger)
{
- ItemGroupInsideATarget ();
+ if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
+ var reader = new StringReader (projectXml);
+ var xml = XmlReader.Create (reader);
+ return BuildOnWindows (xml, logger);
+ } else {
+ return BuildOnLinux (projectXml, logger);
+ }
}
- private MonoTests.Microsoft.Build.Tasks.TestMessageLogger ItemGroupInsideATarget() {
- var engine = new Engine(Consts.BinPath);
- var project = engine.CreateNewProject();
- var projectXml = GetProjectXmlWithItemGroupInsideATarget ();
- project.LoadXml(projectXml);
+ bool BuildOnWindows (XmlReader reader, ILogger logger)
+ {
+ var type = Type.GetType ("Microsoft.Build.Evaluation.ProjectCollection, Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
+
+ var prop = type.GetProperty ("GlobalProjectCollection");
+ var coll = prop.GetValue (null);
+
+ var loadProject = coll.GetType ().GetMethod (
+ "LoadProject", new Type[] { typeof (XmlReader), typeof (string) });
+ var proj = loadProject.Invoke (coll, new object[] { reader, "4.0" });
+
+ var build = proj.GetType ().GetMethod ("Build", new Type[] { typeof (string), typeof (ILogger[]) });
+ var ret = (bool)build.Invoke (proj, new object[] { "Main", new ILogger[] { logger }});
+ return ret;
+ }
- MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
- new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
+ bool BuildOnLinux (string projectXml, ILogger logger)
+ {
+ var engine = new Engine (Consts.BinPath);
+ var project = engine.CreateNewProject ();
+ project.LoadXml (projectXml);
+
engine.RegisterLogger (logger);
+
+ return project.Build ("Main");
+ }
- bool result = project.Build("Main");
- if (!result)
- {
+ TestMessageLogger CreateLogger (string projectXml)
+ {
+ var logger = new TestMessageLogger ();
+ var result = Build (projectXml, logger);
+
+ if (!result) {
logger.DumpMessages ();
- Assert.Fail("Build failed");
+ Assert.Fail ("Build failed");
}
return logger;
}
- private string GetProjectXmlWithItemGroupInsideATarget ()
+ void ItemGroupInsideTarget (string xml, params string[] messages)
+ {
+ var logger = CreateLogger (xml);
+
+ try
+ {
+ Assert.AreEqual(messages.Length, logger.NormalMessageCount, "Expected number of messages");
+ for (int i = 0; i < messages.Length; i++)
+ logger.CheckLoggedMessageHead (messages [i], i.ToString ());
+ Assert.AreEqual(0, logger.NormalMessageCount, "Extra messages found");
+
+ Assert.AreEqual(1, logger.TargetStarted, "TargetStarted count");
+ Assert.AreEqual(1, logger.TargetFinished, "TargetFinished count");
+ Assert.AreEqual(messages.Length, logger.TaskStarted, "TaskStarted count");
+ Assert.AreEqual(messages.Length, logger.TaskFinished, "TaskFinished count");
+ }
+ catch (AssertionException)
+ {
+ logger.DumpMessages();
+ throw;
+ }
+ }
+
+ [Test]
+ public void BuildProjectWithItemGroupInsideTarget ()
{
- return
+ ItemGroupInsideTarget (
@"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
- <fruit Include=""apple""/>
+ <fruit Include=""apple""/>
<fruit Include=""apricot""/>
</ItemGroup>
@@ -390,35 +440,258 @@ private string GetProjectXmlWithItemGroupInsideATarget ()
</ItemGroup>
<Message Text=""%(fruit.Identity)""/>
</Target>
- </Project>";
+ </Project>", "apple", "apricot", "raspberry");
}
+
+ [Test]
+ public void BuildProjectWithItemGroupInsideTarget2 ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""4.0"">
+ <ItemGroup>
+ <A Include='1'>
+ <Sub>Foo</Sub>
+ </A>
+ </ItemGroup>
+ <PropertyGroup>
+ <Foo>Bar</Foo>
+ </PropertyGroup>
+ <Target Name='Main'>
+ <ItemGroup>
+ <A Include='2'>
+ <Sub>$(Foo);Hello</Sub>
+ </A>
+ </ItemGroup>
+
+ <Message Text='@(A)' />
+ <Message Text='%(A.Sub)' />
+ </Target>
+ </Project>", "1;2", "Foo", "Bar;Hello");
+ }
+
[Test]
- [Category ("NotWorking")] //
https://bugzilla.xamarin.com/show_bug.cgi?id=1862- public void BuildProjectOutputWithItemGroupInsideTarget()
+ public void BuildProjectWithPropertyGroupInsideTarget ()
{
- var logger = ItemGroupInsideATarget ();
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A>Foo</A>
+ <B>Bar</B>
+ </PropertyGroup>
- try
- {
- Assert.AreEqual(3, logger.NormalMessageCount, "Expected number of messages");
- logger.CheckLoggedMessageHead("apple", "A1");
- logger.CheckLoggedMessageHead("apricot", "A2");
- logger.CheckLoggedMessageHead("raspberry", "A3");
- Assert.AreEqual(0, logger.NormalMessageCount, "Extra messages found");
+ <Target Name=""Main"">
+ <Message Text='$(A)' />
+ <PropertyGroup>
+ <A>$(B)</A>
+ </PropertyGroup>
+ <Message Text='$(A)' />
+ </Target>
+ </Project>", "Foo", "Bar");
+ }
- Assert.AreEqual(1, logger.TargetStarted, "TargetStarted count");
- Assert.AreEqual(1, logger.TargetFinished, "TargetFinished count");
- Assert.AreEqual(3, logger.TaskStarted, "TaskStarted count");
- Assert.AreEqual(3, logger.TaskFinished, "TaskFinished count");
+ [Test]
+ public void BuildProjectWithPropertyGroupInsideTarget2 ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A>Foo</A>
+ <B>Bar</B>
+ </PropertyGroup>
- }
- catch (AssertionException)
- {
- logger.DumpMessages();
- throw;
- }
+ <Target Name=""Main"">
+ <Message Text='$(A)' />
+ <PropertyGroup Condition='true'>
+ <B Condition='false'>False</B>
+ </PropertyGroup>
+ <PropertyGroup Condition='true'>
+ <A>$(B)</A>
+ </PropertyGroup>
+ <Message Text='$(A)' />
+ <Message Text='$(B)' />
+ <PropertyGroup>
+ <A Condition='$(A) == $(B)'>Equal</A>
+ </PropertyGroup>
+ <Message Text='$(A)' />
+ </Target>
+ </Project>", "Foo", "Bar", "Bar", "Equal");
}
+
+ [Test]
+ public void ItemGroupInsideTarget_ModifyMetadata ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Server Include='Server1'>
+ <AdminContact>Mono</AdminContact>
+ </Server>
+ <Server Include='Server2'>
+ <AdminContact>Mono</AdminContact>
+ </Server>
+ <Server Include='Server3'>
+ <AdminContact>Root</AdminContact>
+ </Server>
+ </ItemGroup>
+
+ <Target Name='Main'>
+ <ItemGroup>
+ <Server Condition=""'%(Server.AdminContact)' == 'Mono'"">
+ <AdminContact>Monkey</AdminContact>
+ </Server>
+ </ItemGroup>
+
+ <Message Text='%(Server.Identity) : %(Server.AdminContact)' />
+ </Target>
+ </Project>", "Server1 : Monkey", "Server2 : Monkey", "Server3 : Root");
+ }
+
+ [Test]
+ public void ItemGroupInsideTarget_RemoveItem ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Foo Include='A;B;C;D' />
+ </ItemGroup>
+
+ <Target Name='Main'>
+ <ItemGroup>
+ <Foo Remove='B' />
+ </ItemGroup>
+
+ <Message Text='@(Foo)' />
+ </Target>
+ </Project>", "A;C;D");
+ }
+
+ [Test]
+ public void ItemGroupInsideTarget_DontKeepDuplicates ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Foo Include='A;B' />
+ <Foo Include='C'>
+ <Hello>World</Hello>
+ </Foo>
+ <Foo Include='D'>
+ <Hello>Boston</Hello>
+ </Foo>
+ </ItemGroup>
+
+ <Target Name='Main'>
+ <ItemGroup>
+ <Foo Include='B;C;D' KeepDuplicates='false'>
+ <Hello>Boston</Hello>
+ </Foo>
+ </ItemGroup>
+
+ <Message Text='@(Foo)' />
+ </Target>
+ </Project>", "A;B;C;D;B;C");
+ }
+
+ [Test]
+ public void ItemGroupInsideTarget_RemoveMetadata ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Foo Include='A' />
+ <Foo Include='B'>
+ <Hello>World</Hello>
+ </Foo>
+ <Foo Include='C'>
+ <Hello>Boston</Hello>
+ </Foo>
+ <Foo Include='D'>
+ <Test>Monkey</Test>
+ </Foo>
+ </ItemGroup>
+ <PropertyGroup>
+ <Foo>Hello</Foo>
+ </PropertyGroup>
+
+ <Target Name='Main'>
+ <ItemGroup>
+ <Bar Include='@(Foo)' RemoveMetadata='$(Foo)' />
+ <Bar Include='E'>
+ <Hello>Monkey</Hello>
+ </Bar>
+ </ItemGroup>
+
+ <Message Text='%(Bar.Identity)' Condition=""'%(Bar.Hello)' != ''""/>
+ </Target>
+ </Project>", "E");
+ }
+
+ [Test]
+ public void ItemGroupInsideTarget_RemoveMetadata2 ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Foo Include='A' />
+ <Foo Include='B'>
+ <Hello>World</Hello>
+ </Foo>
+ <Foo Include='C'>
+ <Hello>Boston</Hello>
+ </Foo>
+ <Foo Include='D'>
+ <Test>Monkey</Test>
+ </Foo>
+ </ItemGroup>
+ <PropertyGroup>
+ <Foo>Hello</Foo>
+ </PropertyGroup>
+
+ <Target Name='Main'>
+ <ItemGroup>
+ <Foo RemoveMetadata='$(Foo)' />
+ <Foo Include='E'>
+ <Hello>Monkey</Hello>
+ </Foo>
+ </ItemGroup>
+
+ <Message Text='%(Foo.Identity)' Condition=""'%(Foo.Hello)' != ''""/>
+ </Target>
+ </Project>", "E");
+ }
+
+ [Test]
+ public void ItemGroupInsideTarget_KeepMetadata ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Foo Include='A' />
+ <Foo Include='B'>
+ <Hello>World</Hello>
+ </Foo>
+ <Foo Include='C'>
+ <Hello>Boston</Hello>
+ </Foo>
+ <Foo Include='D'>
+ <Test>Monkey</Test>
+ </Foo>
+ </ItemGroup>
+
+ <Target Name='Main'>
+ <ItemGroup>
+ <Foo KeepMetadata='Test' />
+ <Foo Include='E'>
+ <Hello>Monkey</Hello>
+ </Foo>
+ </ItemGroup>
+
+ <Message Text='%(Foo.Identity)' Condition=""'%(Foo.Test)' != ''""/>
+ </Target>
+ </Project>", "D");
+ }
+
#endif
[Test]
@@ -542,6 +815,7 @@ public void TestOverridingTargets ()
#if NET_4_0
[Test]
+ [Category ("NotDotNet")]
public void TestBeforeAndAfterTargets ()
{
Engine engine;
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/UsingTaskTest.cs
===================================================================
@@ -202,6 +202,7 @@ public void TestAssemblyNameOrAssemblyFile2 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestDuplicate1 ()
{
string documentString = @"
@@ -294,6 +295,7 @@ public void TestLazyLoad1 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestLazyLoad2 ()
{
string documentString = @"
Modified: mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
===================================================================
@@ -284,6 +284,7 @@ public void TestCondition9 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestCondition10 ()
{
Engine engine = new Engine (Consts.BinPath);
Modified: mcs/class/Microsoft.Build.Engine/Test/various/EvaluationOrder.cs
===================================================================
@@ -233,6 +233,7 @@ public void TestOrder6 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestImportOrder1 ()
{
Engine engine = new Engine (Consts.BinPath);
@@ -255,6 +256,7 @@ public void TestImportOrder1 ()
}
[Test]
+ [Category ("NotDotNet")]
[ExpectedException (typeof (InvalidProjectFileException))]
public void TestImportOrder2 ()
{
@@ -326,6 +328,7 @@ public void TestImportOrder4 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestImportOrder5 ()
{
Engine engine = new Engine (Consts.BinPath);
@@ -348,6 +351,7 @@ public void TestImportOrder5 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestImportOrder6 ()
{
Engine engine = new Engine (Consts.BinPath);
@@ -370,6 +374,7 @@ public void TestImportOrder6 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestImportOrder7 ()
{
Engine engine = new Engine (Consts.BinPath);
Modified: mcs/class/Microsoft.Build.Engine/Test/various/Items.cs
===================================================================
@@ -718,6 +718,7 @@ public void TestSelfRefrentialItems ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestEmptyItemsWithBatching ()
{
string project_xml = @"<Project xmlns=""
http://schemas.microsoft.com/developer/msbuild/2003"">
@@ -799,6 +800,7 @@ public void TestEmptyItemsWithBatching ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestItemsInTarget1 ()
{
Engine engine = new Engine (Consts.BinPath);
@@ -891,6 +893,7 @@ public void TestItemsInTarget2 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestItemsInTarget3 ()
{
Engine engine = new Engine (Consts.BinPath);
@@ -934,6 +937,7 @@ public void TestItemsInTarget3 ()
}
[Test]
+ [Category ("NotDotNet")]
//Test with ITaskItem[]
public void TestItemsInTarget3a ()
{
@@ -982,6 +986,7 @@ public void TestItemsInTarget3a ()
}
[Test]
+ [Category ("NotDotNet")]
//Test with string[]
public void TestItemsInTarget3b ()
{
@@ -1024,6 +1029,7 @@ public void TestItemsInTarget3b ()
}
[Test]
+ [Category ("NotDotNet")]
//Test with string
public void TestItemsInTarget3c ()
{
@@ -1131,6 +1137,7 @@ public void TestSingleTaskItemError8 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestSingleTaskItem1 ()
{
Project proj = BuildProjectForSingleTaskItem ("$(D)$(C)");
@@ -1138,6 +1145,7 @@ public void TestSingleTaskItem1 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestSingleTaskItem2 ()
{
Project proj = BuildProjectForSingleTaskItem ("@(Item1)");
@@ -1145,6 +1153,7 @@ public void TestSingleTaskItem2 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestSingleTaskItem3 ()
{
Project proj = BuildProjectForSingleTaskItem ("$(A).foo");
@@ -1152,6 +1161,7 @@ public void TestSingleTaskItem3 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestSingleTaskItem4 ()
{
Project proj = BuildProjectForSingleTaskItem ("$(C)");
Modified: mcs/class/Microsoft.Build.Engine/Test/various/Properties.cs
===================================================================
@@ -55,6 +55,7 @@ public void TestProperties1 ()
}
[Test]
+ [Category ("NotDotNet")]
public void TestProperties2 ()
{
Engine engine = new Engine (Consts.BinPath);
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/CustomAttributeDataMirror.cs
===================================================================
@@ -119,16 +119,20 @@ public override string ToString ()
val = CreateArg (vm, arg.value);
- if (arg.is_property) {
- foreach (var prop in ctor.DeclaringType.GetProperties ()) {
- if (prop.Id ==
arg.id)
- named_args [j] = new CustomAttributeNamedArgumentMirror (prop, null, val);
- }
- } else {
- foreach (var field in ctor.DeclaringType.GetFields ()) {
- if (field.Id ==
arg.id)
- named_args [j] = new CustomAttributeNamedArgumentMirror (null, field, val);
+ TypeMirror t = ctor.DeclaringType;
+ while (named_args [j] == null && t != null) {
+ if (arg.is_property) {
+ foreach (var prop in t.GetProperties ()) {
+ if (prop.Id ==
arg.id)
+ named_args [j] = new CustomAttributeNamedArgumentMirror (prop, null, val);
+ }
+ } else {
+ foreach (var field in t.GetFields ()) {
+ if (field.Id ==
arg.id)
+ named_args [j] = new CustomAttributeNamedArgumentMirror (null, field, val);
+ }
}
+ t = t.BaseType;
}
if (named_args [j] == null)
throw new NotImplementedException ();
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs
===================================================================
@@ -240,13 +240,13 @@ public class MethodMirror : Mirror
public LocalVariable[] GetLocals () {
if (locals == null) {
-
LocalsInfo li = new LocalsInfo ();
try {
li = vm.conn.Method_GetLocalsInfo (id);
} catch (CommandException) {
- throw new ArgumentException ("Method doesn't have a body.");
+ throw new AbsentInformationException ();
}
+
// Add the arguments as well
var pi = vm.conn.Method_GetParamInfo (id);
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
===================================================================
@@ -681,9 +681,9 @@ class EventHandler : MarshalByRefObject, IEventHandler
}
}
- internal class CommandException : Exception {
+ public class CommandException : Exception {
- public CommandException (ErrorCode error_code) : base ("Debuggee returned error code " + error_code + ".") {
+ internal CommandException (ErrorCode error_code) : base ("Debuggee returned error code " + error_code + ".") {
ErrorCode = error_code;
}
Modified: mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
===================================================================
@@ -49,8 +49,17 @@ public static class Tests4 {
}
}
+public class AAttribute : Attribute {
+ public int afield;
+}
+
+public class BAttribute : AAttribute {
+ public int bfield;
+}
+
[DebuggerDisplay ("Tests", Name="FOO", Target=typeof (int))]
[DebuggerTypeProxy (typeof (Tests))]
+[BAttribute (afield = 1, bfield = 2)]
public class Tests2 {
[DebuggerBrowsableAttribute (DebuggerBrowsableState.Collapsed)]
public int field_j;
Modified: mcs/class/Mono.Debugger.Soft/Test/dtest.cs
===================================================================
@@ -1091,7 +1091,7 @@ public class DebuggerTests
t = frame.Method.GetParameters ()[8].ParameterType;
Assert.AreEqual ("Tests2", t.Name);
var attrs = t.GetCustomAttributes (true);
- Assert.AreEqual (2, attrs.Length);
+ Assert.AreEqual (3, attrs.Length);
foreach (var attr in attrs) {
if (
attr.Constructor.DeclaringType.Name == "DebuggerDisplayAttribute") {
Assert.AreEqual (1, attr.ConstructorArguments.Count);
@@ -1106,6 +1106,10 @@ public class DebuggerTests
Assert.AreEqual (1, attr.ConstructorArguments.Count);
Assert.IsInstanceOfType (typeof (TypeMirror), attr.ConstructorArguments [0].Value);
Assert.AreEqual ("Tests", (attr.ConstructorArguments [0].Value as TypeMirror).Name);
+ } else if (
attr.Constructor.DeclaringType.Name == "BAttribute") {
+ Assert.AreEqual (2, attr.NamedArguments.Count);
+ Assert.AreEqual ("afield", attr.NamedArguments [0].Field.Name);
+ Assert.AreEqual ("bfield", attr.NamedArguments [1].Field.Name);
} else {
Assert.Fail (
attr.Constructor.DeclaringType.Name);
}
Modified: mcs/class/System.Data/System.Data/DataTableCollection.cs
===================================================================
@@ -274,9 +274,9 @@ private int IndexOf (string name, bool error, int start)
int count = 0, match = -1;
for (int i = start; i < List.Count; i++) {
String name2 = ((DataTable) List[i]).TableName;
- if (String.Compare (name, name2, false) == 0)
+ if (String.Compare (name, name2, false, dataSet.Locale) == 0)
return i;
- if (String.Compare (name, name2, true) == 0) {
+ if (String.Compare (name, name2, true, dataSet.Locale) == 0) {
match = i;
count++;
}
Modified: mcs/class/System.Data/Test/System.Data.Common/DbConnectionStringBuilderTest.cs
===================================================================
@@ -1791,6 +1791,7 @@ public void TryGetValue_Keyword_Null ()
}
[Test]
+ [NUnit.Framework.Category ("MobileNotWorking")] // DefaultMemberAttribute is removed by the tuner, causing #3 to fail
public void ICTD_GetClassNameTest ()
{
ICustomTypeDescriptor ictd = (ICustomTypeDescriptor) builder;
Modified: mcs/class/System.Data/Test/System.Data/DataSetTest2.cs
===================================================================
@@ -37,6 +37,7 @@
using System.Xml;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
+using System.Globalization;
namespace MonoTests_System.Data
{
@@ -985,6 +986,17 @@ public void InferXmlSchema_inferingTables5()
Assert.AreEqual(culInfo , ds.Locale , "DS157");
}
+ [Test]
+ [SetCulture ("cs-CZ")]
+ public void DataSetSpecificCulture ()
+ {
+ var ds = new DataSet() ;
+ ds.Locale = CultureInfo.GetCultureInfo (1033);
+ var dt = ds.Tables.Add ("machine");
+ dt.Locale = ds.Locale;
+ Assert.AreSame (dt, ds.Tables["MACHINE"]);
+ }
+
[Test] public void MergeFailed()
{
EventRaised = false;
Modified: mcs/class/System.Reactive.Core/Makefile
===================================================================
@@ -23,12 +23,12 @@ RESOURCES = $(RESX_RESOURCES)
PREBUILT = $(RESX_RESOURCES:=.prebuilt)
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Reactive.Debugger/Makefile
===================================================================
@@ -12,12 +12,12 @@ LIB_MCS_FLAGS = \
-r:System.Reactive.Linq.dll
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Reactive.Experimental/Makefile
===================================================================
@@ -12,12 +12,12 @@ LIB_MCS_FLAGS = \
-r:System.Reactive.Linq.dll
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Reactive.Interfaces/Makefile
===================================================================
@@ -9,12 +9,12 @@ LIB_MCS_FLAGS = \
-r:System.Core.dll
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Reactive.Linq/Makefile
===================================================================
@@ -24,12 +24,12 @@ RESOURCES = $(RESX_RESOURCES)
PREBUILT = $(RESX_RESOURCES:=.prebuilt)
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Reactive.PlatformServices/Makefile
===================================================================
@@ -25,12 +25,12 @@ RESOURCES = $(RESX_RESOURCES)
PREBUILT = $(RESX_RESOURCES:=.prebuilt)
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
NO_TASK_DELAY := $(filter 4.5 2.1, $(FRAMEWORK_VERSION))
Modified: mcs/class/System.Reactive.Providers/Makefile
===================================================================
@@ -25,12 +25,12 @@ RESOURCES = $(RESX_RESOURCES)
PREBUILT = $(RESX_RESOURCES:=.prebuilt)
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Reactive.Runtime.Remoting/Makefile
===================================================================
@@ -17,7 +17,7 @@ endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Reactive.Windows.Forms/Makefile
===================================================================
@@ -13,12 +13,12 @@ LIB_MCS_FLAGS = \
-r:System.Windows.Forms.dll
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Reactive.Windows.Threading/Makefile
===================================================================
@@ -26,12 +26,12 @@ RESOURCES = $(RESX_RESOURCES)
PREBUILT = $(RESX_RESOURCES:=.prebuilt)
ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
endif
NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
ifdef NET_4_5
-LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
Modified: mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
===================================================================
@@ -138,7 +138,8 @@ public void WriteObjectToStream ()
ser.WriteObject (sw, 1);
string expected = "<int xmlns=\"
http://schemas.microsoft.com/2003/10/Serialization/\">1</int>";
byte[] buf = sw.ToArray ();
- Assert.AreEqual (expected, Encoding.UTF8.GetString (buf, 0, buf.Length));
+ // Skip the utf8 bom
+ Assert.AreEqual (expected, Encoding.UTF8.GetString (buf, 3, buf.Length - 3));
}
[Test]
Modified: mcs/class/System/System.Net.Sockets/Socket.cs
===================================================================
@@ -11,7 +11,6 @@
//
http://www.myelin.co.nz // (c) 2004-2011 Novell, Inc. (
http://www.novell.com)
//
-
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -55,6 +54,8 @@ public partial class Socket : IDisposable
private bool useoverlappedIO;
private const int SOCKET_CLOSED = 10004;
+ private static readonly string timeout_exc_msg = "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond";
+
static void AddSockets (List<Socket> sockets, IList list, string name)
{
if (list != null) {
@@ -1494,20 +1495,7 @@ public bool Poll (int time_us, SelectMode mode)
public int Receive (byte [] buffer)
{
- if (disposed && closed)
- throw new ObjectDisposedException (GetType ().ToString ());
-
- if (buffer == null)
- throw new ArgumentNullException ("buffer");
-
- SocketError error;
-
- int ret = Receive_nochecks (buffer, 0, buffer.Length, SocketFlags.None, out error);
-
- if (error != SocketError.Success)
- throw new SocketException ((int) error);
-
- return ret;
+ return Receive (buffer, SocketFlags.None);
}
public int Receive (byte [] buffer, SocketFlags flags)
@@ -1524,7 +1512,7 @@ public int Receive (byte [] buffer, SocketFlags flags)
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && blocking) // This might happen when ReceiveTimeout is set
- throw new SocketException ((int) error, "Operation timed out.");
+ throw new SocketException ((int) error, timeout_exc_msg);
throw new SocketException ((int) error);
}
@@ -1547,7 +1535,7 @@ public int Receive (byte [] buffer, int size, SocketFlags flags)
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && blocking) // This might happen when ReceiveTimeout is set
- throw new SocketException ((int) error, "Operation timed out.");
+ throw new SocketException ((int) error, timeout_exc_msg);
throw new SocketException ((int) error);
}
@@ -1570,7 +1558,7 @@ public int Receive (byte [] buffer, int offset, int size, SocketFlags flags)
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && blocking) // This might happen when ReceiveTimeout is set
- throw new SocketException ((int) error, "Operation timed out.");
+ throw new SocketException ((int) error, timeout_exc_msg);
throw new SocketException ((int) error);
}
@@ -1709,7 +1697,7 @@ public int ReceiveFrom (byte [] buffer, SocketFlags flags, ref EndPoint remoteEP
connected = false;
else if (err == SocketError.WouldBlock && blocking) { // This might happen when ReceiveTimeout is set
if (throwOnError)
- throw new SocketException ((int) SocketError.TimedOut, "Operation timed out");
+ throw new SocketException ((int) SocketError.TimedOut, timeout_exc_msg);
error = (int) SocketError.TimedOut;
return 0;
}
Modified: mcs/class/System/System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs
===================================================================
@@ -28,11 +28,13 @@
#if SECURITY_DEP
+extern alias MonoSecurity;
+
using System.Collections;
using System.Text;
-using Mono.Security;
-using MX = Mono.Security.X509;
+using MonoSecurity::Mono.Security;
+using MX = MonoSecurity::Mono.Security.X509;
namespace System.Security.Cryptography.X509Certificates {
@@ -91,7 +93,7 @@ public X500DistinguishedName (string distinguishedName, X500DistinguishedNameFla
RawData = new byte [2] { 0x30, 0x00 };
DecodeRawData ();
} else {
- ASN1 dn = MX.X501.FromString (distinguishedName);
+ var dn = MX.X501.FromString (distinguishedName);
if ((flag & X500DistinguishedNameFlags.Reversed) != 0) {
ASN1 rdn = new ASN1 (0x30);
for (int i = dn.Count - 1; i >= 0; i--)
Modified: mcs/class/System/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
===================================================================
@@ -31,9 +31,11 @@
#if SECURITY_DEP
+extern alias MonoSecurity;
+
using System.Text;
-using Mono.Security;
+using MonoSecurity::Mono.Security;
namespace System.Security.Cryptography.X509Certificates {
Modified: mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs
===================================================================
@@ -893,7 +893,7 @@ private MX.X509Crl FindCrl (X509Certificate2 caCertificate)
string ski = GetSubjectKeyIdentifier (caCertificate);
// consider that the LocalMachine directories could not exists... and cannot be created by the user
- MX.X509Crl result = (LMCAStore.Store == null) ? null : CheckCrls (subject, ski, LMCAStore.Store.Crls);
+ var result = (LMCAStore.Store == null) ? null : CheckCrls (subject, ski, LMCAStore.Store.Crls);
if (result != null)
return result;
if (location == StoreLocation.CurrentUser) {
Modified: mcs/class/System/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
===================================================================
@@ -28,9 +28,11 @@
#if SECURITY_DEP
+extern alias MonoSecurity;
+
using System.Text;
-using Mono.Security;
+using MonoSecurity::Mono.Security;
namespace System.Security.Cryptography.X509Certificates {
Modified: mcs/class/System/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
===================================================================
@@ -30,9 +30,11 @@
#if SECURITY_DEP
+extern alias MonoSecurity;
+
using System.Text;
-using Mono.Security;
+using MonoSecurity::Mono.Security;
namespace System.Security.Cryptography.X509Certificates {
Modified: mcs/class/System/System.Security.Cryptography.X509Certificates/X509Store.cs
===================================================================
@@ -29,8 +29,10 @@
#if SECURITY_DEP
+extern alias MonoSecurity;
+
using System.Security.Permissions;
-using MX = Mono.Security.X509;
+using MX = MonoSecurity::Mono.Security.X509;
namespace System.Security.Cryptography.X509Certificates {
Modified: mcs/class/System/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
===================================================================
@@ -30,10 +30,12 @@
#if SECURITY_DEP
+extern alias MonoSecurity;
+
using System.Text;
-using Mono.Security;
-using Mono.Security.Cryptography;
+using MonoSecurity::Mono.Security;
+using MonoSecurity::Mono.Security.Cryptography;
namespace System.Security.Cryptography.X509Certificates {
Modified: mcs/class/System/System.Security.Cryptography/AsnEncodedData.cs
===================================================================
@@ -29,11 +29,13 @@
#if SECURITY_DEP
+extern alias MonoSecurity;
+
using System.Security.Cryptography.X509Certificates;
using System.Text;
-using Mono.Security;
-using Mono.Security.Cryptography;
+using MonoSecurity::Mono.Security;
+using MonoSecurity::Mono.Security.Cryptography;
namespace System.Security.Cryptography {
Modified: mcs/class/System/Test/System.Collections.Concurrent/ConcurrentBagTests.cs
===================================================================
@@ -97,7 +97,7 @@ public void AddFromMultipleThreadTakeFromOneThread ()
threads[i].Start ();
}
foreach (var t in threads)
- Assert.IsTrue (t.Join (200));
+ Assert.IsTrue (t.Join (2000));
Assert.IsFalse (bag.IsEmpty);
Assert.AreEqual (threads.Length, bag.Count);
Modified: mcs/class/System/Test/System.ComponentModel/ComponentConverterTests.cs
===================================================================
@@ -21,6 +21,7 @@ namespace MonoTests.System.ComponentModel
public class ComponentConverterTests
{
[Test]
+ [NUnit.Framework.Category ("MobileNotWorking")] // IComponent doesn't have the TypeConverter attribute
public void DataSetConversions ()
{
TypeConverter converter = TypeDescriptor.GetConverter (typeof (DataSet));
Modified: mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
===================================================================
@@ -728,6 +728,7 @@ void Read (IAsyncResult ar)
// Not technically a 2.0 only test, but I use lambdas, so I need gmcs
[Test]
+ [NUnit.Framework.Category ("MobileNotWorking")]
// This was for bug #459450
public void TestEventRaising ()
{
@@ -797,6 +798,7 @@ public void ProcessName_NotStarted ()
}
[Test]
+ [NUnit.Framework.Category ("MobileNotWorking")]
public void ProcessName_AfterExit ()
{
Process p = new Process ();
Modified: mcs/class/System/Test/System.Threading/SemaphoreTest.cs
===================================================================
@@ -182,6 +182,7 @@ public void Constructor_IntIntStringBoolSecurity_NullName ()
}
[Test]
+ [Category ("MobileNotWorking")]
public void Constructor_IntIntStringBoolSecurity ()
{
bool created = false;
@@ -191,6 +192,7 @@ public void Constructor_IntIntStringBoolSecurity ()
}
[Test]
+ [Category ("MobileNotWorking")]
[ExpectedException (typeof (ArgumentNullException))]
public void OpenExisting_NullName ()
{
@@ -198,6 +200,7 @@ public void OpenExisting_NullName ()
}
[Test]
+ [Category ("MobileNotWorking")]
[ExpectedException (typeof (ArgumentException))]
public void OpenExisting_EmptyName ()
{
@@ -205,6 +208,7 @@ public void OpenExisting_EmptyName ()
}
[Test]
+ [Category ("MobileNotWorking")]
[ExpectedException (typeof (ArgumentException))]
public void OpenExisting_TooLongName ()
{
@@ -212,6 +216,7 @@ public void OpenExisting_TooLongName ()
}
[Test]
+ [Category ("MobileNotWorking")]
[ExpectedException (typeof (WaitHandleCannotBeOpenedException))]
public void OpenExisting_Unexisting ()
{
Modified: mcs/class/corlib/System/Delegate.cs
===================================================================
@@ -565,7 +565,7 @@ public static Delegate RemoveAll (Delegate source, Delegate value)
internal bool IsTransparentProxy ()
{
-#if MONOTOUCH
+#if DISABLE_REMOTING
return false;
#else
return RemotingServices.IsTransparentProxy (m_target);
Added: mcs/errors/cs0012-19.cs
===================================================================
@@ -0,0 +1,13 @@
+// CS0012: The type `A1' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 10
+// Compiler options: -r:CS0012-lib.dll
+
+class Test
+{
+ public static void Main ()
+ {
+ var b = new B ();
+ b.Test ();
+ b.Test ();
+ }
+}
\ No newline at end of file
Added: mcs/errors/cs0012-20.cs
===================================================================
@@ -0,0 +1,19 @@
+// CS0012: The type `A1' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 13
+// Compiler options: -r:CS0012-lib.dll
+
+using System.Threading.Tasks;
+
+class Test
+{
+ public static void Main ()
+ {
+ var b = new B ();
+ var t = Task.Factory.StartNew (() => {
+ b.Test ();
+ b.Test ();
+ });
+
+ b.Test ();
+ }
+}
\ No newline at end of file
Added: mcs/errors/cs0162-17.cs
===================================================================
@@ -0,0 +1,12 @@
+// CS0162: Unreachable code detected
+// Line: 10
+// Compiler options: -warnaserror
+
+public class X
+{
+ public static void Main ()
+ {
+ return;
+ 1+1;
+ }
+}
\ No newline at end of file
Added: mcs/errors/cs0185-2.cs
===================================================================
@@ -0,0 +1,18 @@
+// CS0185: `method group' is not a reference type as required by the lock statement
+// Line: 15
+
+class MainClass
+{
+ public static void Main ()
+ {
+ lock (Bar.Buzz) {
+ }
+ }
+}
+
+class Bar
+{
+ internal void Buzz ()
+ {
+ }
+}
\ No newline at end of file
Modified: mcs/errors/cs0185.cs
===================================================================
@@ -1,5 +1,5 @@
// CS0185: `int' is not a reference type as required by the lock statement
-// Line:
+// Line: 7
class X {
static void Main ()
Added: mcs/errors/cs0761-2.cs
===================================================================
@@ -0,0 +1,11 @@
+// CS0761: Partial method declarations of `C.Foo<U>()' have inconsistent constraints for type parameter `U'
+// Line: 8
+
+partial class C
+{
+ partial void Foo<T> () where T : new ();
+
+ partial void Foo<U> ()
+ {
+ }
+}
Added: mcs/errors/cs0761.cs
===================================================================
@@ -0,0 +1,11 @@
+// CS0761: Partial method declarations of `C.Foo<T>()' have inconsistent constraints for type parameter `T'
+// Line: 8
+
+partial class C
+{
+ partial void Foo<U> ();
+
+ partial void Foo<T> () where T : class
+ {
+ }
+}
Added: mcs/errors/cs1997-2.cs
===================================================================
@@ -0,0 +1,17 @@
+// CS1997: `System.Func<System.Threading.Tasks.Task>': A return keyword must not be followed by an expression when async delegate returns `Task'. Consider using `Task<T>' return type
+// Line: 12
+
+using System;
+using System.Threading.Tasks;
+
+class Test
+{
+ public static void Main()
+ {
+ Func<Task> t = async delegate {
+ return null;
+ };
+
+ return;
+ }
+}
Modified: mcs/mcs/anonymous.cs
===================================================================
@@ -1001,12 +1001,12 @@ TypeSpec CompatibleChecks (ResolveContext ec, TypeSpec delegate_type)
return delegate_type;
ec.Report.Error (835, loc, "Cannot convert `{0}' to an expression tree of non-delegate type `{1}'",
- GetSignatureForError (), TypeManager.CSharpName (delegate_type));
+ GetSignatureForError (), delegate_type.GetSignatureForError ());
return null;
}
ec.Report.Error (1660, loc, "Cannot convert `{0}' to non-delegate type `{1}'",
- GetSignatureForError (), TypeManager.CSharpName (delegate_type));
+ GetSignatureForError (), delegate_type.GetSignatureForError ());
return null;
}
@@ -1018,7 +1018,7 @@ protected bool VerifyExplicitParameters (ResolveContext ec, TypeSpec delegate_ty
if (!ec.IsInProbingMode)
ec.Report.Error (1661, loc,
"Cannot convert `{0}' to delegate type `{1}' since there is a parameter mismatch",
- GetSignatureForError (), TypeManager.CSharpName (delegate_type));
+ GetSignatureForError (), delegate_type.GetSignatureForError ());
return false;
}
@@ -1030,7 +1030,7 @@ protected bool VerifyParameterCompatibility (ResolveContext ec, TypeSpec delegat
return false;
ec.Report.Error (1593, loc, "Delegate `{0}' does not take `{1}' arguments",
- TypeManager.CSharpName (delegate_type), Parameters.Count.ToString ());
+ delegate_type.GetSignatureForError (), Parameters.Count.ToString ());
return false;
}
@@ -1070,8 +1070,8 @@ protected bool VerifyParameterCompatibility (ResolveContext ec, TypeSpec delegat
ec.Report.Error (1678, loc, "Parameter `{0}' is declared as type `{1}' but should be `{2}'",
(i+1).ToString (),
- TypeManager.CSharpName (Parameters.Types [i]),
- TypeManager.CSharpName (invoke_pd.Types [i]));
+ Parameters.Types [i].GetSignatureForError (),
+ invoke_pd.Types [i].GetSignatureForError ());
error = true;
}
}
@@ -1375,7 +1375,7 @@ AnonymousMethodBody CompatibleMethodBody (ResolveContext ec, TypeInferenceContex
return null;
}
- b = b.ConvertToAsyncTask (ec, ec.CurrentMemberDefinition.Parent.PartialContainer, p, return_type, loc);
+ b = b.ConvertToAsyncTask (ec, ec.CurrentMemberDefinition.Parent.PartialContainer, p, return_type, delegate_type, loc);
}
return CompatibleMethodFactory (return_type ?? InternalType.ErrorType, delegate_type, p, b);
@@ -1738,6 +1738,7 @@ public override void Emit (EmitContext ec)
//
method = DoCreateMethodHost (ec);
method.Define ();
+ method.PrepareEmit ();
}
bool is_static = (method.ModFlags & Modifiers.STATIC) != 0;
@@ -1864,7 +1865,7 @@ AnonymousMethodStorey FindBestMethodStorey ()
public override string GetSignatureForError ()
{
- return TypeManager.CSharpName (type);
+ return type.GetSignatureForError ();
}
}
@@ -2086,6 +2087,7 @@ protected override bool DoDefineMembers ()
equals.Block = equals_block;
equals.Define ();
+ equals.PrepareEmit ();
Members.Add (equals);
//
@@ -2140,6 +2142,7 @@ protected override bool DoDefineMembers ()
hashcode_block.AddStatement (new Return (hash_variable, loc));
hashcode.Block = hashcode_top;
hashcode.Define ();
+ hashcode.PrepareEmit ();
Members.Add (hashcode);
//
@@ -2150,6 +2153,7 @@ protected override bool DoDefineMembers ()
tostring_block.AddStatement (new Return (string_concat, loc));
tostring.Block = tostring_block;
tostring.Define ();
+ tostring.PrepareEmit ();
Members.Add (tostring);
return true;
Modified: mcs/mcs/argument.cs
===================================================================
@@ -132,7 +132,7 @@ public string GetSignatureForError ()
if (Expr.eclass == ExprClass.MethodGroup)
return Expr.ExprClassName;
- return TypeManager.CSharpName (Expr.Type);
+ return Expr.Type.GetSignatureForError ();
}
public bool ResolveMethodGroup (ResolveContext ec)
@@ -347,7 +347,7 @@ public ArrayInitializer CreateDynamicBinderArguments (ResolveContext rc)
} else if (arg_type.Kind == MemberKind.Void || arg_type == InternalType.Arglist || arg_type.IsPointer) {
rc.Report.Error (1978, a.Expr.Location,
"An expression of type `{0}' cannot be used as an argument of dynamic operation",
- TypeManager.CSharpName (arg_type));
+ arg_type.GetSignatureForError ());
}
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
Modified: mcs/mcs/assembly.cs
===================================================================
@@ -288,7 +288,7 @@ public void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, P
} else if (emitted_forwarders.ContainsKey (t.MemberDefinition)) {
Report.SymbolRelatedToPreviousError (emitted_forwarders[t.MemberDefinition].Location, null);
Report.Error (739, a.Location, "A duplicate type forward of type `{0}'",
- TypeManager.CSharpName (t));
+ t.GetSignatureForError ());
return;
}
@@ -297,13 +297,13 @@ public void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, P
if (t.MemberDefinition.DeclaringAssembly == this) {
Report.SymbolRelatedToPreviousError (t);
Report.Error (729, a.Location, "Cannot forward type `{0}' because it is defined in this assembly",
- TypeManager.CSharpName (t));
+ t.GetSignatureForError ());
return;
}
if (t.IsNested) {
Report.Error (730, a.Location, "Cannot forward type `{0}' because it is a nested type",
- TypeManager.CSharpName (t));
+ t.GetSignatureForError ());
return;
}
Modified: mcs/mcs/async.cs
===================================================================
@@ -378,6 +378,10 @@ public AsyncInitializer (ParametersBlock block, TypeDefinition host, TypeSpec re
}
}
+ public TypeSpec DelegateType {
+ get; set;
+ }
+
public override bool IsIterator {
get {
return false;
Modified: mcs/mcs/attribute.cs
===================================================================
@@ -265,7 +265,7 @@ public void Error_MisusedDynamicAttribute ()
public void Error_AttributeEmitError (string inner)
{
Report.Error (647, Location, "Error during emitting `{0}' attribute. The reason is `{1}'",
- TypeManager.CSharpName (Type), inner);
+ Type.GetSignatureForError (), inner);
}
public void Error_InvalidSecurityParent ()
@@ -368,7 +368,7 @@ public TypeSpec ResolveTypeForComparison ()
public string GetSignatureForError ()
{
if (Type != null)
- return TypeManager.CSharpName (Type);
+ return Type.GetSignatureForError ();
return expression.GetSignatureForError ();
}
@@ -449,7 +449,7 @@ public MethodSpec Resolve ()
ObsoleteAttribute obsolete_attr = Type.GetAttributeObsolete ();
if (obsolete_attr != null) {
- AttributeTester.Report_ObsoleteMessage (obsolete_attr, TypeManager.CSharpName (Type), Location, Report);
+ AttributeTester.Report_ObsoleteMessage (obsolete_attr, Type.GetSignatureForError (), Location, Report);
}
ResolveContext rc = null;
Modified: mcs/mcs/class.cs
===================================================================
@@ -1259,8 +1259,10 @@ bool CreateTypeBuilder ()
all_tp_builders = TypeBuilder.DefineGenericParameters (tparam_names);
- if (CurrentTypeParameters != null)
- CurrentTypeParameters.Define (all_tp_builders, spec, CurrentTypeParametersStartIndex, this);
+ if (CurrentTypeParameters != null) {
+ CurrentTypeParameters.Create (spec, CurrentTypeParametersStartIndex, this);
+ CurrentTypeParameters.Define (all_tp_builders);
+ }
}
return true;
@@ -1421,6 +1423,7 @@ public MethodSpec CreateHoistedBaseCallProxy (ResolveContext rc, MethodSpec meth
members.Add (proxy_method);
proxy_method.Define ();
+ proxy_method.PrepareEmit ();
hoisted_base_call_proxies.Add (method, proxy_method);
}
@@ -1603,6 +1606,10 @@ public override void PrepareEmit ()
foreach (var member in members) {
var pm = member as IParametersMember;
if (pm != null) {
+ var mc = member as MethodOrOperator;
+ if (mc != null) {
+ mc.PrepareEmit ();
+ }
var p = pm.Parameters;
if (p.IsEmpty)
@@ -1674,19 +1681,6 @@ public void SetPredefinedSpec (BuiltinTypeSpec spec)
current_type = null;
}
- void UpdateTypeParameterConstraints (TypeDefinition part)
- {
- for (int i = 0; i < CurrentTypeParameters.Count; i++) {
- if (CurrentTypeParameters[i].AddPartialConstraints (part, part.MemberName.TypeParameters[i]))
- continue;
-
- Report.SymbolRelatedToPreviousError (Location, "");
- Report.Error (265, part.Location,
- "Partial declarations of `{0}' have inconsistent constraints for type parameter `{1}'",
- GetSignatureForError (), CurrentTypeParameters[i].GetSignatureForError ());
- }
- }
-
public override void RemoveContainer (TypeContainer cont)
{
base.RemoveContainer (cont);
@@ -1711,7 +1705,7 @@ protected virtual bool DoResolveTypeParameters ()
}
if (IsPartialPart) {
- PartialContainer.UpdateTypeParameterConstraints (this);
+ PartialContainer.CurrentTypeParameters.UpdateConstraints (this);
}
return true;
@@ -2272,7 +2266,7 @@ public bool VerifyImplements (InterfaceMemberBase mb)
Report.SymbolRelatedToPreviousError (mb.InterfaceType);
Report.Error (540, mb.Location, "`{0}': containing type does not implement interface `{1}'",
- mb.GetSignatureForError (), TypeManager.CSharpName (mb.InterfaceType));
+ mb.GetSignatureForError (), mb.InterfaceType.GetSignatureForError ());
return false;
}
@@ -3023,7 +3017,7 @@ protected override bool VerifyClsCompliance ()
Report.SymbolRelatedToPreviousError (iface);
Report.Warning (3027, 1, Location, "`{0}' is not CLS-compliant because base interface `{1}' is not CLS-compliant",
- GetSignatureForError (), TypeManager.CSharpName (iface));
+ GetSignatureForError (), iface.GetSignatureForError ());
}
}
@@ -3258,10 +3252,10 @@ protected virtual bool CheckOverrideAgainstBase (MemberSpec base_member)
Report.SymbolRelatedToPreviousError (base_member);
if (this is PropertyBasedMember) {
Report.Error (1715, Location, "`{0}': type must be `{1}' to match overridden member `{2}'",
- GetSignatureForError (), TypeManager.CSharpName (base_member_type), TypeManager.CSharpSignature (base_member));
+ GetSignatureForError (), base_member_type.GetSignatureForError (), base_member.GetSignatureForError ());
} else {
Report.Error (508, Location, "`{0}': return type must be `{1}' to match overridden member `{2}'",
- GetSignatureForError (), TypeManager.CSharpName (base_member_type), TypeManager.CSharpSignature (base_member));
+ GetSignatureForError (), base_member_type.GetSignatureForError (), base_member.GetSignatureForError ());
}
ok = false;
}
@@ -3335,7 +3329,7 @@ public override bool Define ()
if (!InterfaceType.IsInterface) {
Report.SymbolRelatedToPreviousError (InterfaceType);
Report.Error (538, Location, "The type `{0}' in explicit interface declaration is not an interface",
- TypeManager.CSharpName (InterfaceType));
+ InterfaceType.GetSignatureForError ());
} else {
Parent.PartialContainer.VerifyImplements (this);
}
@@ -3366,15 +3360,15 @@ protected bool DefineParameters (ParametersCompiled parameters)
if (this is Indexer)
Report.Error (55, Location,
"Inconsistent accessibility: parameter type `{0}' is less accessible than indexer `{1}'",
- TypeManager.CSharpName (t), GetSignatureForError ());
+ t.GetSignatureForError (), GetSignatureForError ());
else if (this is Operator)
Report.Error (57, Location,
"Inconsistent accessibility: parameter type `{0}' is less accessible than operator `{1}'",
- TypeManager.CSharpName (t), GetSignatureForError ());
+ t.GetSignatureForError (), GetSignatureForError ());
else
Report.Error (51, Location,
"Inconsistent accessibility: parameter type `{0}' is less accessible than method `{1}'",
- TypeManager.CSharpName (t), GetSignatureForError ());
+ t.GetSignatureForError (), GetSignatureForError ());
error = true;
}
return !error;
@@ -3483,7 +3477,7 @@ public string GetFullName (string name)
// replacing predefined names which saves some space and name
// is still unique
//
- return TypeManager.CSharpName (InterfaceType) + "." + name;
+ return InterfaceType.GetSignatureForError () + "." + name;
}
public override string GetSignatureForDocumentation ()
@@ -3583,28 +3577,28 @@ protected virtual void DoMemberTypeDependentChecks ()
if (this is Property)
Report.Error (53, Location,
"Inconsistent accessibility: property type `" +
- TypeManager.CSharpName (MemberType) + "' is less " +
+ MemberType.GetSignatureForError () + "' is less " +
"accessible than property `" + GetSignatureForError () + "'");
else if (this is Indexer)
Report.Error (54, Location,
"Inconsistent accessibility: indexer return type `" +
- TypeManager.CSharpName (MemberType) + "' is less " +
+ MemberType.GetSignatureForError () + "' is less " +
"accessible than indexer `" + GetSignatureForError () + "'");
else if (this is MethodCore) {
if (this is Operator)
Report.Error (56, Location,
"Inconsistent accessibility: return type `" +
- TypeManager.CSharpName (MemberType) + "' is less " +
+ MemberType.GetSignatureForError () + "' is less " +
"accessible than operator `" + GetSignatureForError () + "'");
else
Report.Error (50, Location,
"Inconsistent accessibility: return type `" +
- TypeManager.CSharpName (MemberType) + "' is less " +
+ MemberType.GetSignatureForError () + "' is less " +
"accessible than method `" + GetSignatureForError () + "'");
} else {
Report.Error (52, Location,
"Inconsistent accessibility: field type `" +
- TypeManager.CSharpName (MemberType) + "' is less " +
+ MemberType.GetSignatureForError () + "' is less " +
"accessible than field `" + GetSignatureForError () + "'");
}
}
Modified: mcs/mcs/const.cs
===================================================================
@@ -100,10 +100,10 @@ public static void Error_InvalidConstantType (TypeSpec t, Location loc, Report R
{
if (t.IsGenericParameter) {
Report.Error (1959, loc,
- "Type parameter `{0}' cannot be declared const", TypeManager.CSharpName (t));
+ "Type parameter `{0}' cannot be declared const", t.GetSignatureForError ());
} else {
Report.Error (283, loc,
- "The type `{0}' cannot be declared const", TypeManager.CSharpName (t));
+ "The type `{0}' cannot be declared const", t.GetSignatureForError ());
}
}
}
Modified: mcs/mcs/constant.cs
===================================================================
@@ -64,7 +64,7 @@ public override void Error_ValueCannotBeConverted (ResolveContext ec, TypeSpec t
BuiltinTypeSpec.IsPrimitiveTypeOrDecimal (target) &&
BuiltinTypeSpec.IsPrimitiveTypeOrDecimal (type)) {
ec.Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
- GetValueAsLiteral (), TypeManager.CSharpName (target));
+ GetValueAsLiteral (), target.GetSignatureForError ());
} else {
base.Error_ValueCannotBeConverted (ec, target, expl);
}
@@ -100,7 +100,7 @@ public virtual Constant ConvertImplicitly (TypeSpec type)
// reached, by calling Convert.ImplicitStandardConversionExists
//
throw new InternalErrorException ("Missing constant conversion between `{0}' and `{1}'",
- TypeManager.CSharpName (Type), TypeManager.CSharpName (type));
+ Type.GetSignatureForError (), type.GetSignatureForError ());
}
return CreateConstantFromValue (type, constant_value, loc);
@@ -396,7 +396,7 @@ public override void Error_ValueCannotBeConverted (ResolveContext ec, TypeSpec t
catch
{
ec.Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
- GetValue ().ToString (), TypeManager.CSharpName (target));
+ GetValue ().ToString (), target.GetSignatureForError ());
}
}
Modified: mcs/mcs/cs-parser.jay
===================================================================
@@ -866,7 +866,7 @@ named_attribute_argument
;
named_argument
- : identifier_inside_body COLON opt_named_modifier expression
+ : identifier_inside_body COLON opt_named_modifier expression_or_error
{
if (lang_version <= LanguageVersion.V_3)
FeatureIsNotAvailable (GetLocation ($1), "named argument");
@@ -1342,8 +1342,10 @@ method_header
current_type.AddMember (method);
- if ($11 != null)
- method.SetConstraints ((List<Constraints>) $11);
+ async_block = (method.ModFlags & Modifiers.ASYNC) != 0;
+
+ if ($12 != null)
+ method.SetConstraints ((List<Constraints>) $12);
if (doc_support)
method.DocComment = Lexer.consume_doc_comment ();
@@ -5364,7 +5366,6 @@ statement_expression
ExpressionStatement s = $1 as ExpressionStatement;
if (s == null) {
var expr = $1 as Expression;
- expr.Error_InvalidExpressionStatement (report);
$$ = new StatementErrorExpression (expr);
} else {
$$ = new StatementExpression (s);
Modified: mcs/mcs/decl.cs
===================================================================
@@ -1275,6 +1275,11 @@ public interface IMemberDefinition
void SetIsUsed ();
}
+ public interface IMethodDefinition : IMemberDefinition
+ {
+ MethodBase Metadata { get; }
+ }
+
public interface IParametersMember : IInterfaceMemberSpec
{
AParametersCollection Parameters { get; }
Modified: mcs/mcs/delegate.cs
===================================================================
@@ -153,7 +153,7 @@ protected override bool DoDefineMembers ()
Report.SymbolRelatedToPreviousError (partype);
Report.Error (59, Location,
"Inconsistent accessibility: parameter type `{0}' is less accessible than delegate `{1}'",
- TypeManager.CSharpName (partype), GetSignatureForError ());
+ partype.GetSignatureForError (), GetSignatureForError ());
}
}
@@ -169,7 +169,7 @@ protected override bool DoDefineMembers ()
Report.SymbolRelatedToPreviousError (ret_type);
Report.Error (58, Location,
"Inconsistent accessibility: return type `" +
- TypeManager.CSharpName (ret_type) + "' is less " +
+ ret_type.GetSignatureForError () + "' is less " +
"accessible than delegate `" + GetSignatureForError () + "'");
return false;
}
@@ -297,6 +297,12 @@ public override void PrepareEmit ()
if (!Parameters.IsEmpty) {
parameters.ResolveDefaultValues (this);
}
+
+ InvokeBuilder.PrepareEmit ();
+ if (BeginInvokeBuilder != null) {
+ BeginInvokeBuilder.PrepareEmit ();
+ EndInvokeBuilder.PrepareEmit ();
+ }
}
public override void Emit ()
@@ -522,7 +528,7 @@ protected override Expression DoResolve (ResolveContext ec)
TypeSpec e_type = emg.ExtensionExpression.Type;
if (TypeSpec.IsValueType (e_type)) {
ec.Report.Error (1113, loc, "Extension method `{0}' of value type `{1}' cannot be used to create delegates",
- delegate_method.GetSignatureForError (), TypeManager.CSharpName (e_type));
+ delegate_method.GetSignatureForError (), e_type.GetSignatureForError ());
}
}
@@ -586,8 +592,8 @@ void Error_ConversionFailed (ResolveContext ec, MethodSpec method, Expression re
ec.Report.SymbolRelatedToPreviousError (method);
if (ec.Module.Compiler.Settings.Version == LanguageVersion.ISO_1) {
ec.Report.Error (410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type",
- TypeManager.CSharpName (method.ReturnType), member_name,
- TypeManager.CSharpName (invoke_method.ReturnType), Delegate.FullDelegateDesc (invoke_method));
+ method.ReturnType.GetSignatureForError (), member_name,
+ invoke_method.ReturnType.GetSignatureForError (), Delegate.FullDelegateDesc (invoke_method));
return;
}
@@ -599,7 +605,7 @@ void Error_ConversionFailed (ResolveContext ec, MethodSpec method, Expression re
ec.Report.Error (407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type",
return_type.GetSignatureForError (), member_name,
- TypeManager.CSharpName (invoke_method.ReturnType), Delegate.FullDelegateDesc (invoke_method));
+ invoke_method.ReturnType.GetSignatureForError (), Delegate.FullDelegateDesc (invoke_method));
}
public static bool ImplicitStandardConversionExists (ResolveContext ec, MethodGroupExpr mg, TypeSpec target_type)
Modified: mcs/mcs/dynamic.cs
===================================================================
@@ -447,6 +447,7 @@ protected void EmitCall (EmitContext ec, Expression binder, Arguments arguments,
d.CreateContainer ();
d.DefineContainer ();
d.Define ();
+ d.PrepareEmit ();
site.AddTypeContainer (d);
del_type = new TypeExpression (d.CurrentType, loc);
Modified: mcs/mcs/ecore.cs
===================================================================
@@ -251,7 +251,7 @@ public void Error_ExpressionMustBeConstant (ResolveContext rc, Location loc, str
public void Error_ConstantCanBeInitializedWithNullOnly (ResolveContext rc, TypeSpec type, Location loc, string name)
{
rc.Report.Error (134, loc, "A constant `{0}' of reference type `{1}' can only be initialized with null",
- name, TypeManager.CSharpName (type));
+ name, type.GetSignatureForError ());
}
protected virtual void Error_InvalidExpressionStatement (Report report, Location loc)
@@ -282,7 +282,10 @@ public virtual void Error_ValueCannotBeConverted (ResolveContext ec, TypeSpec ta
protected void Error_ValueCannotBeConvertedCore (ResolveContext ec, Location loc, TypeSpec target, bool expl)
{
// The error was already reported as CS1660
- if (type == InternalType.AnonymousMethod || type == InternalType.ErrorType)
+ if (type == InternalType.AnonymousMethod)
+ return;
+
+ if (type == InternalType.ErrorType || target == InternalType.ErrorType)
return;
string from_type = type.GetSignatureForError ();
@@ -351,13 +354,15 @@ public static void Error_TypeDoesNotContainDefinition (ResolveContext ec, Locati
{
ec.Report.SymbolRelatedToPreviousError (type);
ec.Report.Error (117, loc, "`{0}' does not contain a definition for `{1}'",
- TypeManager.CSharpName (type), name);
+ type.GetSignatureForError (), name);
}
public virtual void Error_ValueAssignment (ResolveContext rc, Expression rhs)
{
if (rhs == EmptyExpression.LValueMemberAccess || rhs == EmptyExpression.LValueMemberOutAccess) {
// Already reported as CS1612
+ } else if (rhs == EmptyExpression.OutAccess) {
+ rc.Report.Error (1510, loc, "A ref or out argument must be an assignable variable");
} else {
rc.Report.Error (131, loc, "The left-hand side of an assignment must be a variable, a property or an indexer");
}
@@ -492,10 +497,7 @@ public Expression ResolveLValue (ResolveContext ec, Expression right_side)
if (e == null) {
if (errors == ec.Report.Errors) {
- if (out_access)
- ec.Report.Error (1510, loc, "A ref or out argument must be an assignable variable");
- else
- Error_ValueAssignment (ec, right_side);
+ Error_ValueAssignment (ec, right_side);
}
return null;
}
@@ -1475,7 +1477,7 @@ public override void EmitSideEffect (EmitContext ec)
public override string GetSignatureForError()
{
- return TypeManager.CSharpName (Type);
+ return Type.GetSignatureForError ();
}
public override object GetValue ()
@@ -3503,7 +3505,7 @@ public void EmitCall (EmitContext ec, Arguments arguments)
public override void Error_ValueCannotBeConverted (ResolveContext ec, TypeSpec target, bool expl)
{
ec.Report.Error (428, loc, "Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using parentheses to invoke the method",
- Name, TypeManager.CSharpName (target));
+ Name, target.GetSignatureForError ());
}
public static bool IsExtensionMethodArgument (Expression expr)
@@ -5045,14 +5047,14 @@ public MethodSpec ResolveOperator (ResolveContext rc, ref Arguments args)
string index = (idx + 1).ToString ();
if (((mod & Parameter.Modifier.RefOutMask) ^ (a.Modifier & Parameter.Modifier.RefOutMask)) != 0) {
if ((mod & Parameter.Modifier.RefOutMask) == 0)
- ec.Report.Error (1615, loc, "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' modifier",
+ ec.Report.Error (1615, a.Expr.Location, "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' modifier",
index, Parameter.GetModifierSignature (a.Modifier));
else
- ec.Report.Error (1620, loc, "Argument `#{0}' is missing `{1}' modifier",
+ ec.Report.Error (1620, a.Expr.Location, "Argument `#{0}' is missing `{1}' modifier",
index, Parameter.GetModifierSignature (mod));
} else {
string p1 = a.GetSignatureForError ();
- string p2 = TypeManager.CSharpName (paramType);
+ string p2 = paramType.GetSignatureForError ();
if (p1 == p2) {
p1 = a.Type.GetSignatureForErrorIncludingAssemblyName ();
Modified: mcs/mcs/enum.cs
===================================================================
@@ -269,7 +269,7 @@ protected override bool VerifyClsCompliance ()
case BuiltinTypeSpec.Type.ULong:
case BuiltinTypeSpec.Type.UShort:
Report.Warning (3009, 1, Location, "`{0}': base type `{1}' is not CLS-compliant",
- GetSignatureForError (), TypeManager.CSharpName (UnderlyingType));
+ GetSignatureForError (), UnderlyingType.GetSignatureForError ());
break;
}
Modified: mcs/mcs/eval.cs
===================================================================
@@ -682,6 +682,7 @@ CompiledMethod CompileBlock (Class host, Undo undo, Report Report)
}
if (host != null){
+ host.PrepareEmit ();
host.EmitContainer ();
}
Modified: mcs/mcs/expression.cs
===================================================================
@@ -1437,10 +1437,10 @@ Expression CreateConstantResult (ResolveContext ec, bool result)
{
if (result)
ec.Report.Warning (183, 1, loc, "The given expression is always of the provided (`{0}') type",
- TypeManager.CSharpName (probe_type_expr));
+ probe_type_expr.GetSignatureForError ());
else
ec.Report.Warning (184, 1, loc, "The given expression is never of the provided (`{0}') type",
- TypeManager.CSharpName (probe_type_expr));
+ probe_type_expr.GetSignatureForError ());
return ReducedExpression.Create (new BoolConstant (ec.BuiltinTypes, result, loc), this);
}
@@ -1630,7 +1630,7 @@ protected override Expression DoResolve (ResolveContext ec)
} else {
ec.Report.Error (77, loc,
"The `as' operator cannot be used with a non-nullable value type `{0}'",
- TypeManager.CSharpName (type));
+ type.GetSignatureForError ());
}
return null;
}
@@ -1663,7 +1663,7 @@ protected override Expression DoResolve (ResolveContext ec)
}
ec.Report.Error (39, loc, "Cannot convert type `{0}' to `{1}' via a built-in conversion",
- TypeManager.CSharpName (etype), TypeManager.CSharpName (type));
+ etype.GetSignatureForError (), type.GetSignatureForError ());
return null;
}
@@ -1702,7 +1702,7 @@ protected override Expression DoResolve (ResolveContext ec)
return null;
if (type.IsStatic) {
- ec.Report.Error (716, loc, "Cannot convert to static type `{0}'", TypeManager.CSharpName (type));
+ ec.Report.Error (716, loc, "Cannot convert to static type `{0}'", type.GetSignatureForError ());
return null;
}
@@ -2255,6 +2255,12 @@ public Binary (Operator oper, Expression left, Expression right)
}
}
+ public override Location StartLocation {
+ get {
+ return left.StartLocation;
+ }
+ }
+
#endregion
/// <summary>
@@ -2340,8 +2346,8 @@ public static void Error_OperatorCannotBeApplied (ResolveContext ec, Expression
return;
string l, r;
- l = TypeManager.CSharpName (left.Type);
- r = TypeManager.CSharpName (right.Type);
+ l = left.Type.GetSignatureForError ();
+ r = right.Type.GetSignatureForError ();
ec.Report.Error (19, loc, "Operator `{0}' cannot be applied to operands of type `{1}' and `{2}'",
oper, l, r);
@@ -2716,9 +2722,10 @@ void CheckBitwiseOrOnSignExtended (ResolveContext ec)
// FIXME: consider constants
+ var ltype = lcast != null ? lcast.UnderlyingType : rcast.UnderlyingType;
ec.Report.Warning (675, 3, loc,
"The operator `|' used on the sign-extended type `{0}'. Consider casting to a smaller unsigned type first",
- TypeManager.CSharpName (lcast != null ? lcast.UnderlyingType : rcast.UnderlyingType));
+ ltype.GetSignatureForError ());
}
public static PredefinedOperator[] CreatePointerOperatorsTable (BuiltinTypes types)
@@ -2931,7 +2938,7 @@ protected override Expression DoResolve (ResolveContext ec)
// FIXME: resolve right expression as unreachable
// right.Resolve (ec);
- ec.Report.Warning (429, 4, loc, "Unreachable expression code detected");
+ ec.Report.Warning (429, 4, right.StartLocation, "Unreachable expression code detected");
return left;
}
@@ -3557,7 +3564,7 @@ protected virtual Expression ResolveOperatorPredefined (ResolveContext ec, Prede
if (best_operator == null) {
ec.Report.Error (34, loc, "Operator `{0}' is ambiguous on operands of type `{1}' and `{2}'",
- OperName (oper), TypeManager.CSharpName (l), TypeManager.CSharpName (r));
+ OperName (oper), l.GetSignatureForError (), r.GetSignatureForError ());
best_operator = po;
break;
@@ -3713,7 +3720,7 @@ void CheckOutOfRangeComparison (ResolveContext ec, Constant c, TypeSpec type)
} catch (OverflowException) {
ec.Report.Warning (652, 2, loc,
"A comparison between a constant and a variable is useless. The constant is out of the range of the variable type `{0}'",
- TypeManager.CSharpName (type));
+ type.GetSignatureForError ());
}
}
}
@@ -4273,7 +4280,7 @@ protected override Expression DoResolve (ResolveContext ec)
if (op_true == null || op_false == null) {
ec.Report.Error (218, loc,
"The type `{0}' must have operator `true' and operator `false' defined when `{1}' is used as a short circuit operator",
- TypeManager.CSharpName (type), oper.GetSignatureForError ());
+ type.GetSignatureForError (), oper.GetSignatureForError ());
return null;
}
@@ -4684,7 +4691,7 @@ protected override Expression DoResolve (ResolveContext ec)
} else {
ec.Report.Error (173, true_expr.Location,
"Type of conditional expression cannot be determined because there is no implicit conversion between `{0}' and `{1}'",
- TypeManager.CSharpName (true_type), TypeManager.CSharpName (false_type));
+ true_type.GetSignatureForError (), false_type.GetSignatureForError ());
return null;
}
}
@@ -5760,7 +5767,7 @@ protected override Expression DoResolve (ResolveContext ec)
if (type.IsPointer) {
ec.Report.Error (1919, loc, "Unsafe type `{0}' cannot be used in an object creation expression",
- TypeManager.CSharpName (type));
+ type.GetSignatureForError ());
return null;
}
@@ -5783,13 +5790,13 @@ protected override Expression DoResolve (ResolveContext ec)
if ((tparam.SpecialConstraint & (SpecialConstraint.Struct | SpecialConstraint.Constructor)) == 0 && !TypeSpec.IsValueType (tparam)) {
ec.Report.Error (304, loc,
"Cannot create an instance of the variable type `{0}' because it does not have the new() constraint",
- TypeManager.CSharpName (type));
+ type.GetSignatureForError ());
}
if ((arguments != null) && (arguments.Count != 0)) {
ec.Report.Error (417, loc,
"`{0}': cannot provide arguments when creating an instance of a variable type",
- TypeManager.CSharpName (type));
+ type.GetSignatureForError ());
}
return this;
@@ -5797,7 +5804,7 @@ protected override Expression DoResolve (ResolveContext ec)
if (type.IsStatic) {
ec.Report.SymbolRelatedToPreviousError (type);
- ec.Report.Error (712, loc, "Cannot create an instance of the static class `{0}'", TypeManager.CSharpName (type));
+ ec.Report.Error (712, loc, "Cannot create an instance of the static class `{0}'", type.GetSignatureForError ());
return null;
}
@@ -5809,7 +5816,7 @@ protected override Expression DoResolve (ResolveContext ec)
}
ec.Report.SymbolRelatedToPreviousError (type);
- ec.Report.Error (144, loc, "Cannot create an instance of the abstract class or interface `{0}'", TypeManager.CSharpName (type));
+ ec.Report.Error (144, loc, "Cannot create an instance of the abstract class or interface `{0}'", type.GetSignatureForError ());
return null;
}
@@ -7797,7 +7804,7 @@ protected override Expression DoResolve (ResolveContext ec)
if (!ec.IsUnsafe) {
ec.Report.Error (233, loc,
"`{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf)",
- TypeManager.CSharpName (type_queried));
+ type_queried.GetSignatureForError ());
}
type =
ec.BuiltinTypes.Int;
@@ -10076,8 +10083,8 @@ protected override Expression DoResolve (ResolveContext ec)
ec.Report.Error (1922, loc, "A field or property `{0}' cannot be initialized with a collection " +
"object initializer because type `{1}' does not implement `{2}' interface",
ec.CurrentInitializerVariable.GetSignatureForError (),
- TypeManager.CSharpName (ec.CurrentInitializerVariable.Type),
- TypeManager.CSharpName (ec.BuiltinTypes.IEnumerable));
+ ec.CurrentInitializerVariable.Type.GetSignatureForError (),
+ ec.BuiltinTypes.IEnumerable.GetSignatureForError ());
return null;
}
is_collection_initialization = true;
@@ -10111,7 +10118,7 @@ protected override Expression DoResolve (ResolveContext ec)
if (is_collection_initialization) {
if (TypeManager.HasElementType (type)) {
ec.Report.Error (1925, loc, "Cannot initialize object of type `{0}' with a collection initializer",
- TypeManager.CSharpName (type));
+ type.GetSignatureForError ());
}
}
Modified: mcs/mcs/field.cs
===================================================================
@@ -482,7 +482,7 @@ void EmitFieldSize (int buffer_size)
if (buffer_size > int.MaxValue / type_size) {
Report.Error (1664, Location, "Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit",
- GetSignatureForError (), buffer_size.ToString (), TypeManager.CSharpName (MemberType));
+ GetSignatureForError (), buffer_size.ToString (), MemberType.GetSignatureForError ());
return;
}
@@ -664,7 +664,7 @@ protected override void DoMemberTypeDependentChecks ()
if ((ModFlags & Modifiers.VOLATILE) != 0) {
if (!CanBeVolatile ()) {
Report.Error (677, Location, "`{0}': A volatile field cannot be of the type `{1}'",
- GetSignatureForError (), TypeManager.CSharpName (MemberType));
+ GetSignatureForError (), MemberType.GetSignatureForError ());
}
if ((ModFlags & Modifiers.READONLY) != 0) {
Modified: mcs/mcs/generic.cs
===================================================================
@@ -312,7 +312,7 @@ public bool Resolve (IMemberContext context, TypeParameter tp)
if (type.IsSealed || !type.IsClass) {
context.Module.Compiler.Report.Error (701, loc,
"`{0}' is not a valid constraint. A constraint must be an interface, a non-sealed class or a type parameter",
- TypeManager.CSharpName (type));
+ type.GetSignatureForError ());
continue;
}
@@ -489,7 +489,7 @@ public TypeParameter (TypeParameterSpec spec, TypeSpec parentSpec, MemberName na
//
// If partial type parameters constraints are not null and we don't
// already have constraints they become our constraints. If we already
- // have constraints, we must check that they're the same.
+ // have constraints, we must check that they're same.
//
public bool AddPartialConstraints (TypeDefinition part, TypeParameter tp)
{
@@ -545,15 +545,19 @@ public override bool Define ()
// with SRE (by calling `DefineGenericParameters()' on the TypeBuilder /
// MethodBuilder).
//
- public void Define (GenericTypeParameterBuilder type, TypeSpec declaringType, TypeContainer parent)
+ public void Create (TypeSpec declaringType, TypeContainer parent)
{
if (builder != null)
throw new InternalErrorException ();
// Needed to get compiler reference
this.Parent = parent;
- this.builder = type;
spec.DeclaringType = declaringType;
+ }
+
+ public void Define (GenericTypeParameterBuilder type)
+ {
+ this.builder = type;
spec.SetMetaInfo (type);
}
@@ -2175,13 +2179,13 @@ public void Add (TypeParameters tparams)
names.AddRange (tparams.names);
}
- public void Define (GenericTypeParameterBuilder[] buiders, TypeSpec declaringType, int parentOffset, TypeContainer parent)
+ public void Create (TypeSpec declaringType, int parentOffset, TypeContainer parent)
{
types = new TypeParameterSpec[Count];
for (int i = 0; i < types.Length; ++i) {
var tp = names[i];
- tp.Define (buiders[i + parentOffset], declaringType, parent);
+ tp.Create (declaringType, parent);
types[i] = tp.Type;
types[i].DeclaredPosition = i + parentOffset;
@@ -2191,6 +2195,14 @@ public void Define (GenericTypeParameterBuilder[] buiders, TypeSpec declaringTyp
}
}
+ public void Define (GenericTypeParameterBuilder[] builders)
+ {
+ for (int i = 0; i < types.Length; ++i) {
+ var tp = names[i];
+ tp.Define (builders [types [i].DeclaredPosition]);
+ }
+ }
+
public TypeParameter this[int index] {
get {
return names [index];
@@ -2230,6 +2242,44 @@ public string GetSignatureForError ()
return sb.ToString ();
}
+
+ public void CheckPartialConstraints (Method part)
+ {
+ var partTypeParameters = part.CurrentTypeParameters;
+
+ for (int i = 0; i < Count; i++) {
+ var tp_a = names[i];
+ var tp_b = partTypeParameters [i];
+ if (tp_a.Constraints == null) {
+ if (tp_b.Constraints == null)
+ continue;
+ } else if (tp_b.Constraints != null && tp_a.Type.HasSameConstraintsDefinition (tp_b.Type)) {
+ continue;
+ }
+
+ part.Compiler.Report.SymbolRelatedToPreviousError (this[i].CurrentMemberDefinition.Location, "");
+ part.Compiler.Report.Error (761, part.Location,
+ "Partial method declarations of `{0}' have inconsistent constraints for type parameter `{1}'",
+ part.GetSignatureForError (), partTypeParameters[i].GetSignatureForError ());
+ }
+ }
+
+ public void UpdateConstraints (TypeDefinition part)
+ {
+ var partTypeParameters = part.MemberName.TypeParameters;
+
+ for (int i = 0; i < Count; i++) {
+ var tp = names [i];
+ if (tp.AddPartialConstraints (part, partTypeParameters [i]))
+ continue;
+
+ part.Compiler.Report.SymbolRelatedToPreviousError (this[i].CurrentMemberDefinition);
+ part.Compiler.Report.Error (265, part.Location,
+ "Partial declarations of `{0}' have inconsistent constraints for type parameter `{1}'",
+ part.GetSignatureForError (), tp.GetSignatureForError ());
+ }
+ }
+
public void VerifyClsCompliance ()
{
foreach (var tp in names) {
@@ -2260,7 +2310,7 @@ public GenericTypeExpr (TypeSpec open_type, TypeArguments args, Location l)
public override string GetSignatureForError ()
{
- return TypeManager.CSharpName (type);
+ return type.GetSignatureForError ();
}
public override TypeSpec ResolveAsType (IMemberContext mc)
@@ -2408,7 +2458,7 @@ bool CheckConstraint (MemberSpec context, TypeSpec atype, TypeParameterSpec tpar
if (mc != null) {
mc.Module.Compiler.Report.Error (452, loc,
"The type `{0}' must be a reference type in order to use it as type parameter `{1}' in the generic type or method `{2}'",
- TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ());
+ atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError ());
}
return false;
@@ -2418,7 +2468,7 @@ bool CheckConstraint (MemberSpec context, TypeSpec atype, TypeParameterSpec tpar
if (mc != null) {
mc.Module.Compiler.Report.Error (453, loc,
"The type `{0}' must be a non-nullable value type in order to use it as type parameter `{1}' in the generic type or method `{2}'",
- TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ());
+ atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError ());
}
return false;
@@ -2479,7 +2529,7 @@ bool CheckConstraint (MemberSpec context, TypeSpec atype, TypeParameterSpec tpar
mc.Module.Compiler.Report.SymbolRelatedToPreviousError (atype);
mc.Module.Compiler.Report.Error (310, loc,
"The type `{0}' must have a public parameterless constructor in order to use it as parameter `{1}' in the generic type or method `{2}'",
- TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ());
+ atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError ());
}
return false;
}
Modified: mcs/mcs/import.cs
===================================================================
@@ -420,7 +420,7 @@ public MethodSpec CreateMethod (MethodBase mb, TypeSpec declaringType)
}
}
- IMemberDefinition definition;
+ IMethodDefinition definition;
if (tparams != null) {
var gmd = new ImportedGenericMethodDefinition ((MethodInfo) mb, returnType, parameters, tparams, this);
foreach (var tp in gmd.TypeParameters) {
@@ -429,10 +429,10 @@ public MethodSpec CreateMethod (MethodBase mb, TypeSpec declaringType)
definition = gmd;
} else {
- definition = new ImportedParameterMemberDefinition (mb, returnType, parameters, this);
+ definition = new ImportedMethodDefinition (mb, returnType, parameters, this);
}
- MethodSpec ms = new MethodSpec (kind, declaringType, definition, returnType, mb, parameters, mod);
+ MethodSpec ms = new MethodSpec (kind, declaringType, definition, returnType, parameters, mod);
if (tparams != null)
ms.IsGeneric = true;
@@ -1683,7 +1683,7 @@ class ImportedParameterMemberDefinition : ImportedMemberDefinition, IParametersM
{
readonly AParametersCollection parameters;
- public ImportedParameterMemberDefinition (MethodBase provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer)
+ protected ImportedParameterMemberDefinition (MethodBase provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer)
: base (provider, type, importer)
{
this.parameters = parameters;
@@ -1706,7 +1706,21 @@ public ImportedParameterMemberDefinition (PropertyInfo provider, TypeSpec type,
#endregion
}
- class ImportedGenericMethodDefinition : ImportedParameterMemberDefinition, IGenericMethodDefinition
+ class ImportedMethodDefinition : ImportedParameterMemberDefinition, IMethodDefinition
+ {
+ public ImportedMethodDefinition (MethodBase provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer)
+ : base (provider, type, parameters, importer)
+ {
+ }
+
+ MethodBase IMethodDefinition.Metadata {
+ get {
+ return (MethodBase) provider;
+ }
+ }
+ }
+
+ class ImportedGenericMethodDefinition : ImportedMethodDefinition, IGenericMethodDefinition
{
readonly TypeParameterSpec[] tparams;
@@ -1877,33 +1891,36 @@ public static void Error_MissingDependency (IMemberContext ctx, List<TypeSpec> t
// or referenced from the user core in which case compilation error has to
// be reported because compiler cannot continue anyway
//
+
+ var report = ctx.Module.Compiler.Report;
+
for (int i = 0; i < types.Count; ++i) {
var t = types [i];
//
- // Report missing types only once per type
+ // Report missing types only once
//
- if (i > 0 && types.IndexOf (t) < i)
+ if (report.Printer.MissingTypeReported (t.MemberDefinition))
continue;
string name = t.GetSignatureForError ();
if (t.MemberDefinition.DeclaringAssembly == ctx.Module.DeclaringAssembly) {
- ctx.Module.Compiler.Report.Error (1683, loc,
+ report.Error (1683, loc,
"Reference to type `{0}' claims it is defined in this assembly, but it is not defined in source or any added modules",
name);
} else if (t.MemberDefinition.DeclaringAssembly.IsMissing) {
if (t.MemberDefinition.IsTypeForwarder) {
- ctx.Module.Compiler.Report.Error (1070, loc,
+ report.Error (1070, loc,
"The type `{0}' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `{1}'",
name, t.MemberDefinition.DeclaringAssembly.FullName);
} else {
- ctx.Module.Compiler.Report.Error (12, loc,
+ report.Error (12, loc,
"The type `{0}' is defined in an assembly that is not referenced. Consider adding a reference to assembly `{1}'",
name, t.MemberDefinition.DeclaringAssembly.FullName);
}
} else {
- ctx.Module.Compiler.Report.Error (1684, loc,
+ report.Error (1684, loc,
"Reference to type `{0}' claims it is defined assembly `{1}', but it could not be found",
name, t.MemberDefinition.DeclaringAssembly.FullName);
}
Modified: mcs/mcs/iterators.cs
===================================================================
@@ -1118,7 +1118,7 @@ public static void CreateIterator (IMethodData method, TypeDefinition parent, Mo
"The body of `{0}' cannot be an iterator block " +
"because `{1}' is not an iterator interface type",
method.GetSignatureForError (),
- TypeManager.CSharpName (ret));
+ ret.GetSignatureForError ());
return;
}
Modified: mcs/mcs/linq.cs
===================================================================
@@ -130,7 +130,7 @@ bool OverloadResolver.IErrorHandler.TypeInferenceFailed (ResolveContext rc, Memb
if (!Convert.ImplicitConversionExists (rc, a.Expr, source_type)) {
rc.Report.Error (1936, loc, "An implementation of `{0}' query expression pattern for source type `{1}' could not be found",
- best.Name, TypeManager.CSharpName (a.Type));
+ best.Name, a.Type.GetSignatureForError ());
return true;
}
}
Modified: mcs/mcs/literal.cs
===================================================================
@@ -61,7 +61,7 @@ public override void Error_ValueCannotBeConverted (ResolveContext ec, TypeSpec t
if (TypeSpec.IsValueType (t)) {
ec.Report.Error(37, loc, "Cannot convert null to `{0}' because it is a value type",
- TypeManager.CSharpName(t));
+ t.GetSignatureForError ());
return;
}
Modified: mcs/mcs/membercache.cs
===================================================================
@@ -1445,9 +1445,12 @@ public bool CheckExistingMembersOverloads (MemberCore member, string name, APara
"A partial method declaration and partial method implementation must be both `static' or neither");
}
- Report.SymbolRelatedToPreviousError (ce);
- Report.Error (764, member.Location,
- "A partial method declaration and partial method implementation must be both `unsafe' or neither");
+ if ((method_a.ModFlags & Modifiers.UNSAFE) != (method_b.ModFlags & Modifiers.UNSAFE)) {
+ Report.SymbolRelatedToPreviousError (ce);
+ Report.Error (764, member.Location,
+ "A partial method declaration and partial method implementation must be both `unsafe' or neither");
+ }
+
return false;
}
Modified: mcs/mcs/method.cs
===================================================================
@@ -188,7 +188,7 @@ protected override bool VerifyClsCompliance ()
}
}
- public interface IGenericMethodDefinition : IMemberDefinition
+ public interface IGenericMethodDefinition : IMethodDefinition
{
TypeParameterSpec[] TypeParameters { get; }
int TypeParametersCount { get; }
@@ -198,18 +198,17 @@ public interface IGenericMethodDefinition : IMemberDefinition
public sealed class MethodSpec : MemberSpec, IParametersMember
{
- MethodBase metaInfo, inflatedMetaInfo;
+ MethodBase inflatedMetaInfo;
AParametersCollection parameters;
TypeSpec returnType;
TypeSpec[] targs;
TypeParameterSpec[] constraints;
- public MethodSpec (MemberKind kind, TypeSpec declaringType, IMemberDefinition details, TypeSpec returnType,
- MethodBase info, AParametersCollection parameters, Modifiers modifiers)
+ public MethodSpec (MemberKind kind, TypeSpec declaringType, IMethodDefinition details, TypeSpec returnType,
+ AParametersCollection parameters, Modifiers modifiers)
: base (kind, declaringType, details, modifiers)
{
- this.metaInfo = info;
this.parameters = parameters;
this.returnType = returnType;
}
@@ -237,6 +236,12 @@ public sealed class MethodSpec : MemberSpec, IParametersMember
}
}
+ public new IMethodDefinition MemberDefinition {
+ get {
+ return (IMethodDefinition) definition;
+ }
+ }
+
public IGenericMethodDefinition GenericDefinition {
get {
return (IGenericMethodDefinition) definition;
@@ -322,21 +327,21 @@ public MethodBase GetMetaInfo ()
if (DeclaringType.IsTypeBuilder) {
if (IsConstructor)
- inflatedMetaInfo = TypeBuilder.GetConstructor (dt_meta, (ConstructorInfo) metaInfo);
+ inflatedMetaInfo = TypeBuilder.GetConstructor (dt_meta, (ConstructorInfo) MemberDefinition.Metadata);
else
- inflatedMetaInfo = TypeBuilder.GetMethod (dt_meta, (MethodInfo) metaInfo);
+ inflatedMetaInfo = TypeBuilder.GetMethod (dt_meta, (MethodInfo) MemberDefinition.Metadata);
} else {
#if STATIC
// it should not be reached
throw new NotImplementedException ();
#else
- inflatedMetaInfo = MethodInfo.GetMethodFromHandle (metaInfo.MethodHandle, dt_meta.TypeHandle);
+ inflatedMetaInfo = MethodInfo.GetMethodFromHandle (MemberDefinition.Metadata.MethodHandle, dt_meta.TypeHandle);
#endif
}
state &= ~StateFlags.PendingMetaInflate;
} else {
- inflatedMetaInfo = metaInfo;
+ inflatedMetaInfo = MemberDefinition.Metadata;
}
}
@@ -518,19 +523,10 @@ public override List<TypeSpec> ResolveMissingDependencies ()
return missing;
}
-
- public void SetMetaInfo (MethodInfo info)
- {
- if (this.metaInfo != null)
- throw new InternalErrorException ("MetaInfo reset");
-
- this.metaInfo = info;
- }
}
- public abstract class MethodOrOperator : MethodCore, IMethodData
+ public abstract class MethodOrOperator : MethodCore, IMethodData, IMethodDefinition
{
- public MethodBuilder MethodBuilder;
ReturnParameter return_attributes;
SecurityType declarative_security;
protected MethodData MethodData;
@@ -583,6 +579,19 @@ public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[]
}
}
+ MethodBase IMethodDefinition.Metadata {
+ get {
+ return MethodData.MethodBuilder;
+ }
+ }
+
+ // TODO: Remove and use MethodData abstraction
+ public MethodBuilder MethodBuilder {
+ get {
+ return MethodData.MethodBuilder;
+ }
+ }
+
protected override bool CheckForDuplications ()
{
return Parent.MemberCache.CheckExistingMembersOverloads (this, parameters);
@@ -609,41 +618,34 @@ public override bool Define ()
else
kind = MemberKind.Method;
+ string explicit_name;
+
if (IsPartialDefinition) {
caching_flags &= ~Flags.Excluded_Undetected;
caching_flags |= Flags.Excluded;
// Add to member cache only when a partial method implementation has not been found yet
- if ((caching_flags & Flags.PartialDefinitionExists) == 0) {
-// MethodBase mb = new PartialMethodDefinitionInfo (this);
+ if ((caching_flags & Flags.PartialDefinitionExists) != 0)
+ return true;
- spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, null, parameters, ModFlags);
- if (MemberName.Arity > 0) {
- spec.IsGeneric = true;
+ if (IsExplicitImpl)
+ return true;
- // TODO: Have to move DefineMethod after Define (ideally to Emit)
- throw new NotImplementedException ("Generic partial methods");
- }
+ explicit_name = null;
+ } else {
+ MethodData = new MethodData (this, ModFlags, flags, this, base_method);
- Parent.MemberCache.AddMember (spec);
- }
+ if (!MethodData.Define (Parent.PartialContainer, GetFullName (MemberName)))
+ return false;
- return true;
+ explicit_name = MethodData.MetadataName;
}
- MethodData = new MethodData (
- this, ModFlags, flags, this, MethodBuilder, base_method);
-
- if (!MethodData.Define (Parent.PartialContainer, GetFullName (MemberName)))
- return false;
-
- MethodBuilder = MethodData.MethodBuilder;
-
- spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, MethodBuilder, parameters, ModFlags);
+ spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, parameters, ModFlags);
if (MemberName.Arity > 0)
spec.IsGeneric = true;
-
- Parent.MemberCache.AddMember (this, MethodBuilder.Name, spec);
+
+ Parent.MemberCache.AddMember (this, explicit_name, spec);
return true;
}
@@ -713,7 +715,8 @@ public override void Emit ()
if (MethodData != null)
MethodData.Emit (Parent);
- Block = null;
+ if ((ModFlags & Modifiers.PARTIAL) == 0)
+ Block = null;
}
protected void Error_ConditionalAttributeIsNotValid ()
@@ -798,9 +801,36 @@ public override string[] ConditionalConditions ()
#endregion
+ public virtual void PrepareEmit ()
+ {
+ var mb = MethodData.DefineMethodBuilder (Parent);
+
+ if (CurrentTypeParameters != null) {
+ string[] gnames = new string[CurrentTypeParameters.Count];
+ for (int i = 0; i < gnames.Length; ++i) {
+ gnames[i] = CurrentTypeParameters[i].Name;
+ }
+
+ var gen_params = MethodBuilder.DefineGenericParameters (gnames);
+
+ for (int i = 0; i < CurrentTypeParameters.Count; ++i) {
+ var tp = CurrentTypeParameters[i];
+
+ tp.Define (gen_params[i]);
+ }
+ }
+
+ //
+ // Generic method has been already defined to resolve method parameters
+ // correctly when they use type parameters
+ //
+ mb.SetParameters (parameters.GetMetaInfo ());
+ mb.SetReturnType (ReturnType.GetMetaInfo ());
+ }
+
public override void WriteDebugSymbol (MonoSymbolFile file)
{
- if (MethodData != null)
+ if (MethodData != null && !IsPartialDefinition)
MethodData.WriteDebugSymbol (file);
}
}
@@ -844,7 +874,7 @@ public Method (TypeDefinition parent, FullNamedExpression return_type, Modifiers
}
}
-#endregion
+ #endregion
public override void Accept (StructuralVisitor visitor)
{
@@ -972,10 +1002,9 @@ public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[]
void CreateTypeParameters ()
{
var tparams = MemberName.TypeParameters;
- string[] snames = new string[MemberName.Arity];
var parent_tparams = Parent.TypeParametersAll;
- for (int i = 0; i < snames.Length; i++) {
+ for (int i = 0; i < MemberName.Arity; i++) {
string type_argument_name = tparams[i].MemberName.Name;
if (block == null) {
@@ -1000,12 +1029,9 @@ void CreateTypeParameters ()
tparams[i].WarningParentNameConflict (tp);
}
}
-
- snames[i] = type_argument_name;
}
- GenericTypeParameterBuilder[] gen_params = MethodBuilder.DefineGenericParameters (snames);
- tparams.Define (gen_params, null, 0, Parent);
+ tparams.Create (null, 0, Parent);
}
protected virtual void DefineTypeParameters ()
@@ -1171,9 +1197,6 @@ public override bool Define ()
"Introducing `Finalize' method can interfere with destructor invocation. Did you intend to declare a destructor?");
}
- if (partialMethodImplementation != null && IsPartialDefinition)
- MethodBuilder = partialMethodImplementation.MethodBuilder;
-
if (Compiler.Settings.StdLib && ReturnType.IsSpecialRuntimeType) {
Error1599 (Location, ReturnType, Report);
return false;
@@ -1208,7 +1231,7 @@ public override bool Define ()
Report.Error (1983, Location, "The return type of an async method must be void, Task, or Task<T>");
}
- block = (ToplevelBlock) block.ConvertToAsyncTask (this, Parent.PartialContainer, parameters, ReturnType, Location);
+ block = (ToplevelBlock) block.ConvertToAsyncTask (this, Parent.PartialContainer, parameters, ReturnType, null, Location);
ModFlags |= Modifiers.DEBUGGER_HIDDEN;
}
@@ -1272,6 +1295,22 @@ public override bool Define ()
return true;
}
+ public override void PrepareEmit ()
+ {
+ if (IsPartialDefinition) {
+ //
+ // Use partial method implementation builder for partial method declaration attributes
+ //
+ if (partialMethodImplementation != null) {
+ MethodData = partialMethodImplementation.MethodData;
+ }
+
+ return;
+ }
+
+ base.PrepareEmit ();
+ }
+
//
// Emits the code
//
@@ -1279,11 +1318,8 @@ public override void Emit ()
{
try {
if (IsPartialDefinition) {
- //
- // Use partial method implementation builder for partial method declaration attributes
- //
- if (partialMethodImplementation != null) {
- MethodBuilder = partialMethodImplementation.MethodBuilder;
+ if (partialMethodImplementation != null && CurrentTypeParameters != null) {
+ CurrentTypeParameters.CheckPartialConstraints (partialMethodImplementation);
}
return;
@@ -1297,6 +1333,7 @@ public override void Emit ()
if (CurrentTypeParameters != null) {
for (int i = 0; i < CurrentTypeParameters.Count; ++i) {
var tp = CurrentTypeParameters [i];
+
tp.CheckGenericConstraints (false);
tp.Emit ();
}
@@ -1312,10 +1349,8 @@ public override void Emit ()
Module.PredefinedAttributes.Extension.EmitAttribute (MethodBuilder);
base.Emit ();
- } catch {
- Console.WriteLine ("Internal compiler error at {0}: exception caught while emitting {1}",
- Location, MethodBuilder);
- throw;
+ } catch (Exception e) {
+ throw new InternalErrorException (this, e);
}
}
@@ -1329,13 +1364,12 @@ public override bool EnableOverloadChecks (MemberCore overload)
public static void Error1599 (Location loc, TypeSpec t, Report Report)
{
- Report.Error (1599, loc, "Method or delegate cannot return type `{0}'", TypeManager.CSharpName (t));
+ Report.Error (1599, loc, "Method or delegate cannot return type `{0}'", t.GetSignatureForError ());
}
protected override bool ResolveMemberType ()
{
if (CurrentTypeParameters != null) {
- MethodBuilder = Parent.TypeBuilder.DefineMethod (GetFullName (MemberName), flags);
CreateTypeParameters ();
}
@@ -1485,7 +1519,7 @@ public class ConstructorThisInitializer : ConstructorInitializer {
}
}
- public class Constructor : MethodCore, IMethodData
+ public class Constructor : MethodCore, IMethodData, IMethodDefinition
{
public ConstructorBuilder ConstructorBuilder;
public ConstructorInitializer Initializer;
@@ -1533,6 +1567,13 @@ public Constructor (TypeDefinition parent, string name, Modifiers mod, Attribute
}
}
+
+ MethodBase IMethodDefinition.Metadata {
+ get {
+ return ConstructorBuilder;
+ }
+ }
+
//
// Returns true if this is a default constructor
//
@@ -1620,7 +1661,7 @@ public override bool Define ()
ca, CallingConventions,
parameters.GetMetaInfo ());
- spec = new MethodSpec (MemberKind.Constructor, Parent.Definition, this, Compiler.BuiltinTypes.Void, ConstructorBuilder, parameters, ModFlags);
+ spec = new MethodSpec (MemberKind.Constructor, Parent.Definition, this, Compiler.BuiltinTypes.Void, parameters, ModFlags);
Parent.MemberCache.AddMember (spec);
@@ -1828,10 +1869,6 @@ public interface IMethodData : IMemberContext
//
public class MethodData
{
-#if !STATIC
- static FieldInfo methodbuilder_attrs_field;
-#endif
-
public readonly IMethodData method;
//
@@ -1848,6 +1885,7 @@ public class MethodData
protected TypeSpec declaring_type;
protected MethodSpec parent_method;
SourceMethodBuilder debug_builder;
+ string full_name;
MethodBuilder builder;
public MethodBuilder MethodBuilder {
@@ -1862,6 +1900,12 @@ public class MethodData
}
}
+ public string MetadataName {
+ get {
+ return full_name;
+ }
+ }
+
public MethodData (InterfaceMemberBase member,
Modifiers modifiers, MethodAttributes flags, IMethodData method)
{
@@ -1874,11 +1918,10 @@ public class MethodData
public MethodData (InterfaceMemberBase member,
Modifiers modifiers, MethodAttributes flags,
- IMethodData method, MethodBuilder builder,
+ IMethodData method,
MethodSpec parent_method)
: this (member, modifiers, flags, method)
{
- this.builder = builder;
this.parent_method = parent_method;
}
@@ -1896,13 +1939,13 @@ public bool Define (TypeDefinition container, string method_full_name)
if (member is PropertyBase) {
container.Compiler.Report.Error (550, method.Location,
"`{0}' is an accessor not found in interface member `{1}{2}'",
- method.GetSignatureForError (), TypeManager.CSharpName (member.InterfaceType),
+ method.GetSignatureForError (), member.InterfaceType.GetSignatureForError (),
member.GetSignatureForError ().Substring (member.GetSignatureForError ().LastIndexOf ('.')));
} else {
container.Compiler.Report.Error (539, method.Location,
"`{0}.{1}' in explicit interface declaration is not a member of interface",
- TypeManager.CSharpName (member.InterfaceType), member.ShortName);
+ member.InterfaceType.GetSignatureForError (), member.ShortName);
}
return false;
}
@@ -1910,7 +1953,7 @@ public bool Define (TypeDefinition container, string method_full_name)
container.Compiler.Report.SymbolRelatedToPreviousError (implementing);
container.Compiler.Report.Error (683, method.Location,
"`{0}' explicit method implementation cannot implement `{1}' because it is an accessor",
- member.GetSignatureForError (), TypeManager.CSharpSignature (implementing));
+ member.GetSignatureForError (), implementing.GetSignatureForError ());
return false;
}
} else {
@@ -2033,58 +2076,45 @@ public bool Define (TypeDefinition container, string method_full_name)
method_full_name =
implementing.MemberDefinition.Name;
}
- DefineMethodBuilder (container, method_full_name, method.ParameterInfo);
+ full_name = method_full_name;
+ declaring_type = container.Definition;
- if (builder == null)
- return false;
+ return true;
+ }
-// if (container.CurrentType != null)
-// declaring_type = container.CurrentType;
-// else
- declaring_type = container.Definition;
+ void DefineOverride (TypeDefinition container)
+ {
+ if (implementing == null)
+ return;
- if (implementing != null && member.IsExplicitImpl) {
- container.TypeBuilder.DefineMethodOverride (builder, (MethodInfo) implementing.GetMetaInfo ());
- }
+ if (!member.IsExplicitImpl)
+ return;
- return true;
+ container.TypeBuilder.DefineMethodOverride (builder, (MethodInfo) implementing.GetMetaInfo ());
}
-
- /// <summary>
- /// Create the MethodBuilder for the method
- /// </summary>
- void DefineMethodBuilder (TypeDefinition container, string method_name, ParametersCompiled param)
+ //
+ // Creates partial MethodBuilder for the method when has generic parameters used
+ // as arguments or return type
+ //
+ public MethodBuilder DefineMethodBuilder (TypeDefinition container)
{
- var return_type = method.ReturnType.GetMetaInfo ();
- var p_types = param.GetMetaInfo ();
+ if (builder != null)
+ throw new InternalErrorException ();
- if (builder == null) {
- builder = container.TypeBuilder.DefineMethod (
- method_name, flags, method.CallingConventions,
- return_type, p_types);
- return;
- }
+ builder = container.TypeBuilder.DefineMethod (full_name, flags, method.CallingConventions);
+ return builder;
+ }
- //
- // Generic method has been already defined to resolve method parameters
- // correctly when they use type parameters
- //
- builder.SetParameters (p_types);
- builder.SetReturnType (return_type);
- if (builder.Attributes != flags) {
-#if STATIC
- builder.__SetAttributes (flags);
-#else
- try {
- if (methodbuilder_attrs_field == null)
- methodbuilder_attrs_field = typeof (MethodBuilder).GetField ("attrs", BindingFlags.NonPublic | BindingFlags.Instance);
- methodbuilder_attrs_field.SetValue (builder, flags);
- } catch {
- container.Compiler.Report.RuntimeMissingSupport (method.Location, "Generic method MethodAttributes");
- }
-#endif
- }
+ //
+ // Creates full MethodBuilder for the method
+ //
+ public MethodBuilder DefineMethodBuilder (TypeDefinition container, ParametersCompiled param)
+ {
+ DefineMethodBuilder (container);
+ builder.SetReturnType (method.ReturnType.GetMetaInfo ());
+ builder.SetParameters (param.GetMetaInfo ());
+ return builder;
}
//
@@ -2092,6 +2122,8 @@ void DefineMethodBuilder (TypeDefinition container, string method_name, Paramete
//
public void Emit (TypeDefinition parent)
{
+ DefineOverride (parent);
+
var mc = (IMemberContext) method;
method.ParameterInfo.ApplyAttributes (mc, MethodBuilder);
@@ -2226,7 +2258,7 @@ protected override bool ResolveMemberType ()
// Ooouh Martin, templates are missing here.
// When it will be possible move here a lot of child code and template method type.
- public abstract class AbstractPropertyEventMethod : MemberCore, IMethodData {
+ public abstract class AbstractPropertyEventMethod : MemberCore, IMethodData, IMethodDefinition {
protected MethodData method_data;
protected ToplevelBlock block;
protected SecurityType declarative_security;
@@ -2292,6 +2324,12 @@ public EmitContext CreateEmitContext (ILGenerator ig, SourceMethodBuilder source
}
}
+ MethodBase IMethodDefinition.Metadata {
+ get {
+ return method_data.MethodBuilder;
+ }
+ }
+
public abstract ParametersCompiled ParameterInfo { get ; }
public abstract TypeSpec ReturnType { get; }
@@ -2302,7 +2340,7 @@ public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[]
if (a.Type == pa.CLSCompliant || a.Type == pa.Obsolete || a.Type == pa.Conditional) {
Report.Error (1667, a.Location,
"Attribute `{0}' is not valid on property or event accessors. It is valid on `{1}' declarations only",
- TypeManager.CSharpName (a.Type), a.GetValidTargets ());
+ a.Type.GetSignatureForError (), a.GetValidTargets ());
return;
}
Modified: mcs/mcs/nullable.cs
===================================================================
@@ -320,7 +320,7 @@ public static Constant Create (TypeSpec nullable, Location loc)
public static Constant CreateFromExpression (ResolveContext ec, Expression e)
{
ec.Report.Warning (458, 2, e.Location, "The result of the expression is always `null' of type `{0}'",
- TypeManager.CSharpName (e.Type));
+ e.Type.GetSignatureForError ());
return ReducedExpression.Create (Create (e.Type, e.Location), e);
}
@@ -592,10 +592,10 @@ Constant CreateNullConstant (ResolveContext ec, Expression expr)
if ((Oper & Operator.EqualityMask) != 0) {
ec.Report.Warning (472, 2, loc, "The result of comparing value type `{0}' with null is always `{1}'",
- TypeManager.CSharpName (expr.Type), c.GetValueAsLiteral ());
+ expr.Type.GetSignatureForError (), c.GetValueAsLiteral ());
} else {
ec.Report.Warning (464, 2, loc, "The result of comparing type `{0}' with null is always `{1}'",
- TypeManager.CSharpName (expr.Type), c.GetValueAsLiteral ());
+ expr.Type.GetSignatureForError (), c.GetValueAsLiteral ());
}
return ReducedExpression.Create (c, this);
Modified: mcs/mcs/parameter.cs
===================================================================
@@ -338,7 +338,7 @@ public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[]
if (HasOptionalExpression) {
a.Report.Error (1745, a.Location,
"Cannot specify `{0}' attribute on optional parameter `{1}'",
- TypeManager.CSharpName (a.Type).Replace ("Attribute", ""), Name);
+ a.Type.GetSignatureForError ().Replace ("Attribute", ""), Name);
}
if (a.Type == pa.DefaultParameterValue)
@@ -406,7 +406,7 @@ public virtual TypeSpec Resolve (IMemberContext rc, int index)
if ((modFlags & Modifier.This) != 0 && (parameter_type.IsPointer || parameter_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic)) {
rc.Module.Compiler.Report.Error (1103, Location, "The extension method cannot be of type `{0}'",
- TypeManager.CSharpName (parameter_type));
+ parameter_type.GetSignatureForError ());
}
return parameter_type;
@@ -582,7 +582,7 @@ public virtual string GetSignatureForError ()
{
string type_name;
if (parameter_type != null)
- type_name = TypeManager.CSharpName (parameter_type);
+ type_name = parameter_type.GetSignatureForError ();
else
type_name = texpr.GetSignatureForError ();
@@ -989,7 +989,7 @@ public string ParameterDesc (int pos)
if (types == null || types [pos] == null)
return ((Parameter)FixedParameters [pos]).GetSignatureForError ();
- string type = TypeManager.CSharpName (types [pos]);
+ string type = types [pos].GetSignatureForError ();
if (FixedParameters [pos].HasExtensionMethodModifier)
return "this " + type;
Modified: mcs/mcs/pending.cs
===================================================================
@@ -534,10 +534,14 @@ bool BaseImplements (TypeSpec iface_type, MethodSpec mi, out MethodSpec base_met
// about mismatch at return type when the check bellow rejects them
//
var parameters = mi.Parameters;
+ MethodSpec close_match = null;
+
while (true) {
var candidates = MemberCache.FindMembers (base_type, mi.Name, false);
- if (candidates == null)
+ if (candidates == null) {
+ base_method = close_match;
return false;
+ }
MethodSpec similar_candidate = null;
foreach (var candidate in candidates) {
@@ -590,19 +594,29 @@ bool BaseImplements (TypeSpec iface_type, MethodSpec mi, out MethodSpec base_met
// From this point the candidate is used for detailed error reporting
// because it's very close match to what we are looking for
//
- base_method = (MethodSpec) candidate;
+ var m = (MethodSpec) candidate;
+
+ if (!m.IsPublic) {
+ if (close_match == null)
+ close_match = m;
- if (!candidate.IsPublic)
- return false;
+ continue;
+ }
- if (!TypeSpecComparer.Override.IsEqual (mi.ReturnType, base_method.ReturnType))
- return false;
+ if (!TypeSpecComparer.Override.IsEqual (mi.ReturnType, m.ReturnType)) {
+ if (close_match == null)
+ close_match = m;
- if (mi.IsGeneric && !Method.CheckImplementingMethodConstraints (container, base_method, mi)) {
+ continue;
+ }
+
+ base_method = m;
+
+ if (mi.IsGeneric && !Method.CheckImplementingMethodConstraints (container, m, mi)) {
return true;
}
}
-
+
if (base_method != null) {
if (similar_candidate != null) {
Report.SymbolRelatedToPreviousError (similar_candidate);
@@ -617,8 +631,10 @@ bool BaseImplements (TypeSpec iface_type, MethodSpec mi, out MethodSpec base_met
}
base_type = candidates[0].DeclaringType.BaseType;
- if (base_type == null)
+ if (base_type == null) {
+ base_method = close_match;
return false;
+ }
}
if (!base_method.IsVirtual) {
Modified: mcs/mcs/property.cs
===================================================================
@@ -201,14 +201,14 @@ public override MethodBuilder Define (TypeContainer parent)
{
base.Define (parent);
- Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, null, ParameterInfo, ModFlags);
+ Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, ParameterInfo, ModFlags);
method_data = new MethodData (method, ModFlags, flags, this);
if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName)))
return null;
- Spec.SetMetaInfo (method_data.MethodBuilder);
+ method_data.DefineMethodBuilder (parent.PartialContainer, ParameterInfo);
return method_data.MethodBuilder;
}
@@ -268,14 +268,14 @@ public override MethodBuilder Define (TypeContainer parent)
base.Define (parent);
- Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, null, ParameterInfo, ModFlags);
+ Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, ParameterInfo, ModFlags);
method_data = new MethodData (method, ModFlags, flags, this);
if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName)))
return null;
- Spec.SetMetaInfo (method_data.MethodBuilder);
+ method_data.DefineMethodBuilder (parent.PartialContainer, ParameterInfo);
return method_data.MethodBuilder;
}
@@ -1198,15 +1198,15 @@ public virtual MethodBuilder Define (TypeContainer parent)
if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName)))
return null;
+ method_data.DefineMethodBuilder (parent.PartialContainer, ParameterInfo);
+
if (Compiler.Settings.WriteMetadataOnly)
block = null;
- MethodBuilder mb = method_data.MethodBuilder;
-
- Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, mb, ParameterInfo, method.ModFlags);
+ Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, ParameterInfo, method.ModFlags);
Spec.IsAccessor = true;
- return mb;
+ return method_data.MethodBuilder;
}
public override TypeSpec ReturnType {
Modified: mcs/mcs/report.cs
===================================================================
@@ -550,6 +550,8 @@ public ErrorMessage (AbstractMessage aMsg)
//
public abstract class ReportPrinter
{
+ protected HashSet<ITypeDefinition> reported_missing_definitions;
+
#region Properties
public int ErrorsCount { get; protected set; }
@@ -605,6 +607,22 @@ protected void Print (AbstractMessage msg, TextWriter output, bool showFullPath)
}
}
+ //
+ // Tracks reported missing types. It needs to be session specific
+ // because we can run in probing mode
+ //
+ public bool MissingTypeReported (ITypeDefinition typeDefinition)
+ {
+ if (reported_missing_definitions == null)
+ reported_missing_definitions = new HashSet<ITypeDefinition> ();
+
+ if (reported_missing_definitions.Contains (typeDefinition))
+ return true;
+
+ reported_missing_definitions.Add (typeDefinition);
+ return false;
+ }
+
public void Reset ()
{
// HACK: Temporary hack for broken repl flow
@@ -735,6 +753,11 @@ public bool Merge (ReportPrinter dest)
error_msg |= !msg.IsWarning;
}
+ if (reported_missing_definitions != null) {
+ foreach (var missing in reported_missing_definitions)
+ dest.MissingTypeReported (missing);
+ }
+
return error_msg;
}
}
Modified: mcs/mcs/statement.cs
===================================================================
@@ -706,6 +706,7 @@ public class StatementErrorExpression : Statement
public StatementErrorExpression (Expression expr)
{
this.expr = expr;
+ this.loc = expr.StartLocation;
}
public Expression Expr {
@@ -714,6 +715,12 @@ public StatementErrorExpression (Expression expr)
}
}
+ public override bool Resolve (BlockContext bc)
+ {
+ expr.Error_InvalidExpressionStatement (bc);
+ return true;
+ }
+
protected override void DoEmit (EmitContext ec)
{
throw new NotSupportedException ();
@@ -903,9 +910,18 @@ protected override bool DoResolve (BlockContext ec)
if (this is ContextualReturn)
return true;
- ec.Report.Error (1997, loc,
- "`{0}': A return keyword must not be followed by an expression when async method returns `Task'. Consider using `Task<T>' return type",
- ec.GetSignatureForError ());
+ // Same error code as .NET but better error message
+ if (async_block.DelegateType != null) {
+ ec.Report.Error (1997, loc,
+ "`{0}': A return keyword must not be followed by an expression when async delegate returns `Task'. Consider using `Task<T>' return type",
+ async_block.DelegateType.GetSignatureForError ());
+ } else {
+ ec.Report.Error (1997, loc,
+ "`{0}': A return keyword must not be followed by an expression when async method returns `Task'. Consider using `Task<T>' return type",
+ ec.GetSignatureForError ());
+
+ }
+
return false;
}
@@ -1252,7 +1268,7 @@ public override bool Resolve (BlockContext ec)
if (!Convert.ImplicitStandardConversionExists (c, type))
ec.Report.Warning (469, 2, loc,
"The `goto case' value is not implicitly convertible to type `{0}'",
- TypeManager.CSharpName (type));
+ type.GetSignatureForError ());
}
@@ -1607,7 +1623,7 @@ public bool Resolve (BlockContext bc, bool resolveDeclaratorInitializers)
bool eval_global = bc.Module.Compiler.Settings.StatementMode && bc.CurrentBlock is ToplevelBlock;
if (eval_global) {
CreateEvaluatorVariable (bc, li);
- } else {
+ } else if (type != InternalType.ErrorType) {
li.PrepareForFlowAnalysis (bc);
}
@@ -1621,7 +1637,7 @@ public bool Resolve (BlockContext bc, bool resolveDeclaratorInitializers)
d.Variable.Type = li.Type;
if (eval_global) {
CreateEvaluatorVariable (bc, d.Variable);
- } else {
+ } else if (type != InternalType.ErrorType) {
d.Variable.PrepareForFlowAnalysis (bc);
}
@@ -2647,6 +2663,7 @@ protected void DefineStoreyContainer (EmitContext ec, AnonymousMethodStorey stor
}
storey.Define ();
+ storey.PrepareEmit ();
storey.Parent.PartialContainer.AddCompilerGeneratedClass (storey);
}
@@ -3115,7 +3132,7 @@ public ToplevelBlock ConvertToIterator (IMethodData method, TypeDefinition host,
return tlb;
}
- public ParametersBlock ConvertToAsyncTask (IMemberContext context, TypeDefinition host, ParametersCompiled parameters, TypeSpec returnType, Location loc)
+ public ParametersBlock ConvertToAsyncTask (IMemberContext context, TypeDefinition host, ParametersCompiled parameters, TypeSpec returnType, TypeSpec delegateType, Location loc)
{
for (int i = 0; i < parameters.Count; i++) {
Parameter p = parameters[i];
@@ -3147,6 +3164,7 @@ public ParametersBlock ConvertToAsyncTask (IMemberContext context, TypeDefinitio
var block_type = host.Module.Compiler.BuiltinTypes.Void;
var initializer = new AsyncInitializer (this, host, block_type);
initializer.Type = block_type;
+ initializer.DelegateType = delegateType;
var stateMachine = new AsyncTaskStorey (this, context, initializer, returnType);
@@ -4116,10 +4134,13 @@ public override bool Resolve (BlockContext ec)
new_expr = SwitchGoverningType (ec, unwrap);
}
- if (new_expr == null){
- ec.Report.Error (151, loc,
- "A switch expression of type `{0}' cannot be converted to an integral type, bool, char, string, enum or nullable type",
- TypeManager.CSharpName (Expr.Type));
+ if (new_expr == null) {
+ if (Expr.Type != InternalType.ErrorType) {
+ ec.Report.Error (151, loc,
+ "A switch expression of type `{0}' cannot be converted to an integral type, bool, char, string, enum or nullable type",
+ Expr.Type.GetSignatureForError ());
+ }
+
return false;
}
@@ -4518,6 +4539,7 @@ protected sealed override void DoEmit (EmitContext ec)
if (finally_host != null) {
finally_host.Define ();
+ finally_host.PrepareEmit ();
finally_host.Emit ();
// Now it's safe to add, to close it properly and emit sequence points
Modified: mcs/mcs/typemanager.cs
===================================================================
@@ -984,15 +984,7 @@ public class AwaiterDefinition
partial class TypeManager {
- /// <summary>
- /// Returns the C# name of a type if possible, or the full type name otherwise
- /// </summary>
- static public string CSharpName (TypeSpec t)
- {
- return t.GetSignatureForError ();
- }
-
- static public string CSharpName (IList<TypeSpec> types)
+ static public string CSharpName(IList<TypeSpec> types)
{
if (types.Count == 0)
return string.Empty;
@@ -1002,7 +994,7 @@ static public string CSharpName (IList<TypeSpec> types)
if (i > 0)
sb.Append (",");
- sb.Append (CSharpName (types [i]));
+ sb.Append (types [i].GetSignatureForError ());
}
return sb.ToString ();
}
@@ -1090,7 +1082,7 @@ public static bool VerifyUnmanaged (ModuleContainer rc, TypeSpec t, Location loc
rc.Compiler.Report.SymbolRelatedToPreviousError (t);
rc.Compiler.Report.Error (208, loc,
"Cannot take the address of, get the size of, or declare a pointer to a managed type `{0}'",
- CSharpName (t));
+ t.GetSignatureForError ());
return false;
}
Added: mcs/tests/gtest-partial-06.cs
===================================================================
@@ -0,0 +1,23 @@
+partial class Test
+{
+ static partial void Foo<T> ();
+
+ static partial void Baz<T> ();
+
+ static partial void Baz<U> ()
+ {
+ }
+
+ static partial void Bar<T> (T t) where T : class;
+
+ static partial void Bar<U> (U u) where U : class
+ {
+ }
+
+ public static void Main ()
+ {
+ Foo<long> ();
+ Baz<string> ();
+ Bar<Test> (null);
+ }
+}
\ No newline at end of file
Added: mcs/tests/test-867.cs
===================================================================
@@ -0,0 +1,35 @@
+class Test
+{
+ public static void Main ()
+ {
+ new BaseJobController ();
+ new JobController ();
+ }
+}
+
+public interface IUser
+{
+}
+
+public class User : IUser
+{
+}
+
+public interface IJobController
+{
+ IUser User { get; }
+}
+
+public class BaseController
+{
+ public virtual IUser User { get; set; }
+}
+
+public class BaseJobController : BaseController
+{
+ public new User User { get; set; }
+}
+
+public class JobController : BaseJobController, IJobController
+{
+}
\ No newline at end of file
Added: mcs/tests/test-async-46.cs
===================================================================
@@ -0,0 +1,16 @@
+using System;
+using System.Threading.Tasks;
+
+partial class X
+{
+ partial void Foo ();
+
+ async partial void Foo ()
+ {
+ await Task.FromResult (1);
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
Modified: mcs/tests/test-debug-01-ref.xml
===================================================================
@@ -5,15 +5,15 @@
</files>
<methods>
<method token="0x6000001">
- <sequencepoints>
- <entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="5" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000002">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="5" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
Modified: mcs/tests/test-debug-02-ref.xml
===================================================================
@@ -60,15 +60,15 @@
<scopes />
</method>
<method token="0x6000007">
- <sequencepoints>
- <entry il="0x0" row="47" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="48" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000008">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="47" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="48" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
Modified: mcs/tests/test-debug-03-ref.xml
===================================================================
@@ -44,15 +44,15 @@
<scopes />
</method>
<method token="0x6000007">
- <sequencepoints>
- <entry il="0x0" row="25" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="26" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000008">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="25" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="26" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
Modified: mcs/tests/test-debug-04-ref.xml
===================================================================
@@ -30,15 +30,15 @@
<scopes />
</method>
<method token="0x6000004">
- <sequencepoints>
- <entry il="0x0" row="22" col="2" file_ref="2" hidden="false" />
- <entry il="0x1" row="23" col="2" file_ref="2" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000005">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="22" col="2" file_ref="2" hidden="false" />
+ <entry il="0x1" row="23" col="2" file_ref="2" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
Modified: mcs/tests/test-debug-05-ref.xml
===================================================================
@@ -6,6 +6,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="5" col="3" file_ref="1" hidden="false" />
@@ -18,7 +23,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="12" col="2" file_ref="1" hidden="false" />
<entry il="0x9" row="55" col="3" file_ref="1" hidden="false" />
@@ -31,7 +36,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="59" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="60" col="3" file_ref="1" hidden="false" />
@@ -44,10 +49,5 @@
</locals>
<scopes />
</method>
- <method token="0x6000004">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-06-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="2" file_ref="1" hidden="false" />
@@ -12,7 +17,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="10" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="12" col="3" file_ref="1" hidden="false" />
@@ -28,7 +33,7 @@
<entry index="1" start="0xa" end="0xa" />
</scopes>
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="22" col="3" file_ref="1" hidden="false" />
@@ -47,7 +52,7 @@
<entry index="1" start="0xa" end="0xc" />
</scopes>
</method>
- <method token="0x6000004">
+ <method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="31" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="33" col="3" file_ref="1" hidden="false" />
@@ -71,7 +76,7 @@
<entry index="2" start="0x14" end="0x19" />
</scopes>
</method>
- <method token="0x6000005">
+ <method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="46" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="48" col="3" file_ref="1" hidden="false" />
@@ -86,7 +91,7 @@
<entry index="1" start="0x9" end="0x9" />
</scopes>
</method>
- <method token="0x6000006">
+ <method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="56" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="58" col="3" file_ref="1" hidden="false" />
@@ -108,10 +113,5 @@
<entry index="2" start="0x13" end="0x13" />
</scopes>
</method>
- <method token="0x6000007">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-07-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="5" col="3" file_ref="1" hidden="false" />
@@ -13,7 +18,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="9" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="10" col="3" file_ref="1" hidden="false" />
@@ -22,7 +27,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="14" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="3" file_ref="1" hidden="false" />
@@ -36,10 +41,5 @@
<entry index="1" start="0x3" end="0xa" />
</scopes>
</method>
- <method token="0x6000004">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-08-ref.xml
===================================================================
@@ -5,25 +5,30 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="7" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints />
<locals />
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="16" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
- <method token="0x6000004">
+ <method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="23" col="5" file_ref="1" hidden="false" />
</sequencepoints>
@@ -33,10 +38,5 @@
<entry index="1" start="0x0" end="0x2" />
</scopes>
</method>
- <method token="0x6000005">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-09-ref.xml
===================================================================
@@ -15,15 +15,15 @@
<scopes />
</method>
<method token="0x6000003">
- <sequencepoints>
- <entry il="0x0" row="10" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="12" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000004">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="10" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="12" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
Modified: mcs/tests/test-debug-10-ref.xml
===================================================================
@@ -6,15 +6,6 @@
<methods>
<method token="0x6000001">
<sequencepoints>
- <entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="5" col="3" file_ref="1" hidden="false" />
- <entry il="0x7" row="6" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
- <locals />
- <scopes />
- </method>
- <method token="0x6000002">
- <sequencepoints>
<entry il="0x0" row="10" col="7" file_ref="1" hidden="false" />
<entry il="0x1" row="11" col="4" file_ref="1" hidden="false" />
<entry il="0x8" row="12" col="3" file_ref="1" hidden="false" />
@@ -22,7 +13,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="14" col="7" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="3" file_ref="1" hidden="false" />
@@ -30,24 +21,33 @@
<locals />
<scopes />
</method>
- <method token="0x6000004">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="20" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
- <method token="0x6000005">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="21" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
- <method token="0x6000006">
+ <method token="0x6000005">
<sequencepoints />
<locals />
<scopes />
</method>
+ <method token="0x6000006">
+ <sequencepoints>
+ <entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="5" col="3" file_ref="1" hidden="false" />
+ <entry il="0x7" row="6" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
+ <locals />
+ <scopes />
+ </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-11-ref.xml
===================================================================
@@ -23,6 +23,11 @@
<scopes />
</method>
<method token="0x6000003">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="2" file_ref="1" hidden="false" />
@@ -30,7 +35,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000004">
+ <method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="24" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="25" col="10" file_ref="1" hidden="false" />
@@ -46,7 +51,7 @@
<entry index="1" start="0xa" end="0xa" />
</scopes>
</method>
- <method token="0x6000005">
+ <method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="31" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="32" col="10" file_ref="1" hidden="false" />
@@ -64,7 +69,7 @@
<entry index="1" start="0x12" end="0x12" />
</scopes>
</method>
- <method token="0x6000006">
+ <method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="38" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="39" col="10" file_ref="1" hidden="false" />
@@ -80,7 +85,7 @@
<entry index="1" start="0x11" end="0x11" />
</scopes>
</method>
- <method token="0x6000007">
+ <method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="45" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="46" col="10" file_ref="1" hidden="false" />
@@ -97,7 +102,7 @@
<entry index="1" start="0x8" end="0x12" />
</scopes>
</method>
- <method token="0x6000008">
+ <method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="53" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="54" col="3" file_ref="1" hidden="false" />
@@ -110,7 +115,7 @@
<entry index="0" start="0xe" end="0xe" />
</scopes>
</method>
- <method token="0x6000009">
+ <method token="0x600000a">
<sequencepoints>
<entry il="0x0" row="60" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="61" col="3" file_ref="1" hidden="false" />
@@ -123,7 +128,7 @@
<entry index="0" start="0xe" end="0x13" />
</scopes>
</method>
- <method token="0x600000a">
+ <method token="0x600000b">
<sequencepoints>
<entry il="0x0" row="68" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="70" col="3" file_ref="1" hidden="false" />
@@ -141,7 +146,7 @@
<entry index="1" start="0x28" end="0x2d" />
</scopes>
</method>
- <method token="0x600000b">
+ <method token="0x600000c">
<sequencepoints>
<entry il="0x0" row="88" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="89" col="3" file_ref="1" hidden="false" />
@@ -158,7 +163,7 @@
<entry index="1" start="0x2e" end="0x33" />
</scopes>
</method>
- <method token="0x600000c">
+ <method token="0x600000d">
<sequencepoints>
<entry il="0x0" row="103" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="105" col="3" file_ref="1" hidden="false" />
@@ -177,7 +182,7 @@
<entry index="1" start="0xb9" end="0xbe" />
</scopes>
</method>
- <method token="0x600000d">
+ <method token="0x600000e">
<sequencepoints>
<entry il="0x0" row="127" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="129" col="3" file_ref="1" hidden="false" />
@@ -191,7 +196,7 @@
<entry index="0" start="0x2c" end="0x3b" />
</scopes>
</method>
- <method token="0x600000e">
+ <method token="0x600000f">
<sequencepoints>
<entry il="0x0" row="140" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="142" col="3" file_ref="1" hidden="false" />
@@ -211,7 +216,7 @@
<entry index="1" start="0x6" end="0x8" />
</scopes>
</method>
- <method token="0x600000f">
+ <method token="0x6000010">
<sequencepoints>
<entry il="0x0" row="153" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="155" col="3" file_ref="1" hidden="false" />
@@ -229,7 +234,7 @@
<entry index="1" start="0xf" end="0xf" />
</scopes>
</method>
- <method token="0x6000010">
+ <method token="0x6000011">
<sequencepoints>
<entry il="0x0" row="165" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="167" col="3" file_ref="1" hidden="false" />
@@ -244,7 +249,7 @@
<entry index="0" start="0x2" end="0x4" />
</scopes>
</method>
- <method token="0x6000011">
+ <method token="0x6000012">
<sequencepoints>
<entry il="0x0" row="174" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="175" col="3" file_ref="1" hidden="false" />
@@ -257,7 +262,7 @@
<entry index="0" start="0x3" end="0xd" />
</scopes>
</method>
- <method token="0x6000012">
+ <method token="0x6000013">
<sequencepoints>
<entry il="0x0" row="182" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="183" col="3" file_ref="1" hidden="false" />
@@ -273,7 +278,7 @@
<entry index="1" start="0x19" end="0x19" />
</scopes>
</method>
- <method token="0x6000013">
+ <method token="0x6000014">
<sequencepoints>
<entry il="0x0" row="192" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="193" col="3" file_ref="1" hidden="false" />
@@ -293,7 +298,7 @@
<entry index="2" start="0x30" end="0x30" />
</scopes>
</method>
- <method token="0x6000014">
+ <method token="0x6000015">
<sequencepoints>
<entry il="0x0" row="205" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="206" col="3" file_ref="1" hidden="false" />
@@ -309,7 +314,7 @@
<entry index="1" start="0x10" end="0x10" />
</scopes>
</method>
- <method token="0x6000015">
+ <method token="0x6000016">
<sequencepoints>
<entry il="0x0" row="215" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="216" col="8" file_ref="1" hidden="false" />
@@ -331,7 +336,7 @@
<entry index="3" start="0x1b" end="0x1b" />
</scopes>
</method>
- <method token="0x6000016">
+ <method token="0x6000017">
<sequencepoints>
<entry il="0x0" row="230" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="231" col="8" file_ref="1" hidden="false" />
@@ -346,7 +351,7 @@
<entry index="1" start="0x9" end="0x9" />
</scopes>
</method>
- <method token="0x6000017">
+ <method token="0x6000018">
<sequencepoints>
<entry il="0x0" row="237" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="238" col="3" file_ref="1" hidden="false" />
@@ -365,7 +370,7 @@
<entry index="1" start="0x10" end="0x10" />
</scopes>
</method>
- <method token="0x6000018">
+ <method token="0x6000019">
<sequencepoints>
<entry il="0x0" row="246" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="247" col="3" file_ref="1" hidden="false" />
@@ -383,7 +388,7 @@
<entry index="1" start="0x17" end="0x17" />
</scopes>
</method>
- <method token="0x6000019">
+ <method token="0x600001a">
<sequencepoints>
<entry il="0x0" row="256" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="257" col="3" file_ref="1" hidden="false" />
@@ -401,7 +406,7 @@
<entry index="1" start="0x17" end="0x17" />
</scopes>
</method>
- <method token="0x600001a">
+ <method token="0x600001b">
<sequencepoints>
<entry il="0x0" row="266" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="267" col="3" file_ref="1" hidden="false" />
@@ -421,10 +426,5 @@
<entry index="1" start="0x30" end="0x30" />
</scopes>
</method>
- <method token="0x600001b">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-12-ref.xml
===================================================================
@@ -5,15 +5,15 @@
</files>
<methods>
<method token="0x6000001">
- <sequencepoints>
- <entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="8" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000002">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="8" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
Modified: mcs/tests/test-debug-13-ref.xml
===================================================================
@@ -5,15 +5,15 @@
</files>
<methods>
<method token="0x6000001">
- <sequencepoints>
- <entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="9" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000002">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="9" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
@@ -43,11 +43,6 @@
<scopes />
</method>
<method token="0x6000008">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
- <method token="0x6000009">
<sequencepoints>
<entry il="0x21" row="12" col="2" file_ref="1" hidden="false" />
<entry il="0x22" row="13" col="3" file_ref="1" hidden="false" />
@@ -56,6 +51,11 @@
<locals />
<scopes />
</method>
+ <method token="0x6000009">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
<method token="0x600000a">
<sequencepoints />
<locals />
@@ -87,11 +87,6 @@
<scopes />
</method>
<method token="0x6000010">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
- <method token="0x6000011">
<sequencepoints>
<entry il="0x12" row="17" col="2" file_ref="1" hidden="false" />
<entry il="0x13" row="18" col="3" file_ref="1" hidden="false" />
@@ -99,6 +94,11 @@
<locals />
<scopes />
</method>
+ <method token="0x6000011">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
<method token="0x6000012">
<sequencepoints />
<locals />
Modified: mcs/tests/test-debug-14-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="2" file_ref="1" hidden="false" />
@@ -12,7 +17,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="10" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="11" col="3" file_ref="1" hidden="false" />
@@ -23,7 +28,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="17" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="18" col="3" file_ref="1" hidden="false" />
@@ -34,7 +39,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000004">
+ <method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="26" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="27" col="3" file_ref="1" hidden="false" />
@@ -45,7 +50,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000005">
+ <method token="0x6000006">
<sequencepoints>
<entry il="0xd" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0xe" row="35" col="3" file_ref="1" hidden="false" />
@@ -56,11 +61,6 @@
</locals>
<scopes />
</method>
- <method token="0x6000006">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
<method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="13" col="3" file_ref="1" hidden="false" />
Modified: mcs/tests/test-debug-15-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="3" file_ref="1" hidden="false" />
@@ -16,7 +21,7 @@
<entry index="1" start="0x15" end="0x1b" />
</scopes>
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="11" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="12" col="3" file_ref="1" hidden="false" />
@@ -25,10 +30,5 @@
<locals />
<scopes />
</method>
- <method token="0x6000003">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-16-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="10" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="11" col="2" file_ref="1" hidden="false" />
@@ -12,7 +17,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="14" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="3" file_ref="1" hidden="false" />
@@ -25,7 +30,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="27" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="28" col="3" file_ref="1" hidden="false" />
@@ -38,10 +43,5 @@
</locals>
<scopes />
</method>
- <method token="0x6000004">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-17-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="8" col="2" file_ref="1" hidden="false" />
@@ -12,7 +17,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x2a" row="11" col="2" file_ref="1" hidden="false" />
<entry il="0x2b" row="12" col="3" file_ref="1" hidden="false" />
@@ -24,7 +29,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
@@ -35,10 +40,5 @@
</locals>
<scopes />
</method>
- <method token="0x6000004">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-18-ref.xml
===================================================================
@@ -15,6 +15,11 @@
<scopes />
</method>
<method token="0x6000003">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="8" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="9" col="2" file_ref="1" hidden="false" />
@@ -22,7 +27,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000004">
+ <method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="12" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="13" col="3" file_ref="1" hidden="false" />
@@ -31,7 +36,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000005">
+ <method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="17" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="18" col="3" file_ref="1" hidden="false" />
@@ -45,7 +50,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000006">
+ <method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="24" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="25" col="3" file_ref="1" hidden="false" />
@@ -57,7 +62,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000007">
+ <method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="30" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="31" col="3" file_ref="1" hidden="false" />
@@ -73,7 +78,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000008">
+ <method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="38" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="39" col="3" file_ref="1" hidden="false" />
@@ -85,11 +90,6 @@
</locals>
<scopes />
</method>
- <method token="0x6000009">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
<method token="0x600000a">
<sequencepoints>
<entry il="0x0" row="40" col="38" file_ref="1" hidden="false" />
Modified: mcs/tests/test-debug-19-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="8" col="2" file_ref="1" hidden="false" />
@@ -12,12 +17,12 @@
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints />
<locals />
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="16" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="17" col="3" file_ref="1" hidden="false" />
@@ -27,12 +32,12 @@
<locals />
<scopes />
</method>
- <method token="0x6000004">
+ <method token="0x6000005">
<sequencepoints />
<locals />
<scopes />
</method>
- <method token="0x6000005">
+ <method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="29" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="30" col="3" file_ref="1" hidden="false" />
@@ -42,11 +47,6 @@
<locals />
<scopes />
</method>
- <method token="0x6000006">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
<method token="0x6000007">
<sequencepoints />
<locals />
Modified: mcs/tests/test-debug-20-ref.xml
===================================================================
@@ -13,15 +13,15 @@
<scopes />
</method>
<method token="0x6000002">
- <sequencepoints>
- <entry il="0x0" row="17" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="18" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000003">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="17" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="18" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
Modified: mcs/tests/test-debug-21-ref.xml
===================================================================
@@ -10,15 +10,15 @@
<scopes />
</method>
<method token="0x6000002">
- <sequencepoints>
- <entry il="0x0" row="22" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="23" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000003">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="22" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="23" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
@@ -38,11 +38,6 @@
<scopes />
</method>
<method token="0x6000007">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
- <method token="0x6000008">
<sequencepoints>
<entry il="0x27" row="7" col="2" file_ref="1" hidden="false" />
<entry il="0x28" row="8" col="3" file_ref="1" hidden="false" />
@@ -58,6 +53,11 @@
<entry index="0" start="0x42" end="0x5f" />
</scopes>
</method>
+ <method token="0x6000008">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
<method token="0x6000009">
<sequencepoints />
<locals />
Modified: mcs/tests/test-debug-22-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="8" col="3" file_ref="1" hidden="false" />
@@ -13,17 +18,17 @@
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints />
<locals />
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints />
<locals />
<scopes />
</method>
- <method token="0x6000004">
+ <method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
@@ -31,7 +36,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000005">
+ <method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="25" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="26" col="2" file_ref="1" hidden="false" />
@@ -39,11 +44,6 @@
<locals />
<scopes />
</method>
- <method token="0x6000006">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
<method token="0x6000007">
<sequencepoints />
<locals />
@@ -65,11 +65,6 @@
<scopes />
</method>
<method token="0x600000b">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
- <method token="0x600000c">
<sequencepoints>
<entry il="0x21" row="15" col="2" file_ref="1" hidden="false" />
<entry il="0x22" row="16" col="3" file_ref="1" hidden="false" />
@@ -78,6 +73,11 @@
<locals />
<scopes />
</method>
+ <method token="0x600000c">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
<method token="0x600000d">
<sequencepoints />
<locals />
Modified: mcs/tests/test-debug-23-ref.xml
===================================================================
@@ -6,6 +6,20 @@
<methods>
<method token="0x6000001">
<sequencepoints>
+ <entry il="0x0" row="39" col="7" file_ref="1" hidden="false" />
+ <entry il="0x1" row="40" col="4" file_ref="1" hidden="false" />
+ <entry il="0x8" row="41" col="3" file_ref="1" hidden="false" />
+ </sequencepoints>
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000003">
+ <sequencepoints>
<entry il="0x0" row="8" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="9" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="9" col="8" file_ref="1" hidden="false" />
@@ -14,7 +28,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="13" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="14" col="3" file_ref="1" hidden="false" />
@@ -24,7 +38,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000003">
+ <method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="18" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="19" col="3" file_ref="1" hidden="false" />
@@ -34,7 +48,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000004">
+ <method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="23" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="24" col="3" file_ref="1" hidden="false" />
@@ -47,7 +61,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000005">
+ <method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="29" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="30" col="3" file_ref="1" hidden="false" />
@@ -56,7 +70,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000006">
+ <method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="35" col="3" file_ref="1" hidden="false" />
@@ -65,16 +79,7 @@
<locals />
<scopes />
</method>
- <method token="0x6000007">
- <sequencepoints>
- <entry il="0x0" row="39" col="7" file_ref="1" hidden="false" />
- <entry il="0x1" row="40" col="4" file_ref="1" hidden="false" />
- <entry il="0x8" row="41" col="3" file_ref="1" hidden="false" />
- </sequencepoints>
- <locals />
- <scopes />
- </method>
- <method token="0x6000008">
+ <method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="45" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="46" col="2" file_ref="1" hidden="false" />
@@ -82,11 +87,6 @@
<locals />
<scopes />
</method>
- <method token="0x6000009">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
<method token="0x600000a">
<sequencepoints>
<entry il="0x0" row="24" col="27" file_ref="1" hidden="false" />
Modified: mcs/tests/test-debug-24-ref.xml
===================================================================
@@ -5,6 +5,11 @@
</files>
<methods>
<method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="3" file_ref="1" hidden="false" />
@@ -17,7 +22,7 @@
</locals>
<scopes />
</method>
- <method token="0x6000002">
+ <method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="11" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="12" col="8" file_ref="1" hidden="false" />
@@ -35,7 +40,7 @@
<entry index="1" start="0x9" end="0x9" />
</scopes>
</method>
- <method token="0x6000003">
+ <method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="16" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="17" col="2" file_ref="1" hidden="false" />
@@ -43,10 +48,5 @@
<locals />
<scopes />
</method>
- <method token="0x6000004">
- <sequencepoints />
- <locals />
- <scopes />
- </method>
</methods>
</symbols>
\ No newline at end of file
Modified: mcs/tests/test-debug-25-ref.xml
===================================================================
@@ -5,15 +5,15 @@
</files>
<methods>
<method token="0x6000001">
- <sequencepoints>
- <entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="7" col="2" file_ref="1" hidden="false" />
- </sequencepoints>
+ <sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000002">
- <sequencepoints />
+ <sequencepoints>
+ <entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="7" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
<locals />
<scopes />
</method>
Added: mcs/tests/test-debug-26-ref.xml
===================================================================
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<symbols>
+ <files>
+ <file id="1" name="test-debug-26.cs" checksum="60257ceb8e5c6406c7a8f74cbc8b9d59" />
+ </files>
+ <methods>
+ <method token="0x6000001">
+ <sequencepoints />
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000002">
+ <sequencepoints>
+ <entry il="0x0" row="9" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="10" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
+ <locals />
+ <scopes />
+ </method>
+ <method token="0x6000003">
+ <sequencepoints>
+ <entry il="0x0" row="13" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1" row="14" col="2" file_ref="1" hidden="false" />
+ </sequencepoints>
+ <locals />
+ <scopes />
+ </method>
+ </methods>
+</symbols>
\ No newline at end of file
Added: mcs/tests/test-debug-26.cs
===================================================================
@@ -0,0 +1,15 @@
+partial class P
+{
+ partial void Foo ();
+}
+
+partial class P
+{
+ partial void Foo ()
+ {
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
Modified: mcs/tests/ver-il-net_4_5.xml
===================================================================
@@ -27341,6 +27341,22 @@
</method>
</type>
</test>
+ <test name="gtest-partial-06.cs">
+ <type name="Test">
+ <method name="Void Baz[U]()" attrs="145">
+ <size>2</size>
+ </method>
+ <method name="Void Bar[U](U)" attrs="145">
+ <size>2</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>13</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-var-04.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
@@ -46755,6 +46771,48 @@
</method>
</type>
</test>
+ <test name="test-867.cs">
+ <type name="Test">
+ <method name="Void Main()" attrs="150">
+ <size>14</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="User">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="BaseController">
+ <method name="IUser get_User()" attrs="2502">
+ <size>14</size>
+ </method>
+ <method name="Void set_User(IUser)" attrs="2502">
+ <size>8</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="BaseJobController">
+ <method name="User get_User()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Void set_User(User)" attrs="2182">
+ <size>8</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="JobController">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-87.cs">
<type name="Top">
<method name="Int32 Main()" attrs="150">
@@ -57915,6 +57973,27 @@
</method>
</type>
</test>
+ <test name="test-async-46.cs">
+ <type name="X">
+ <method name="Void Foo()" attrs="129">
+ <size>27</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X+<Foo>c__async0">
+ <method name="Void MoveNext()" attrs="486">
+ <size>158</size>
+ </method>
+ <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
+ <size>13</size>
+ </method>
+ </type>
+ </test>
<test name="test-cls-00.cs">
<type name="CLSCLass_6">
<method name="Void add_Disposed(Delegate)" attrs="2182">
@@ -59261,6 +59340,19 @@
</method>
</type>
</test>
+ <test name="test-debug-26.cs">
+ <type name="P">
+ <method name="Void Foo()" attrs="129">
+ <size>2</size>
+ </method>
+ <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-externalias-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
Modified: mcs/tools/mkbundle/mkbundle.cs
===================================================================
@@ -11,7 +11,7 @@
using System;
using System.Diagnostics;
using System.Xml;
-using System.Collections.Generic;
+using System.Collections;
using System.Reflection;
using System.IO;
using System.IO.Compression;
@@ -19,14 +19,10 @@
using System.Text;
-#if NET_4_5
-using System.Threading.Tasks;
-#endif
-
class MakeBundle {
static string output = "a.out";
static string object_out = null;
- static List<string> link_paths = new List<string> ();
+ static ArrayList link_paths = new ArrayList ();
static bool autodeps = false;
static bool keeptemp = false;
static bool compile_only = false;
@@ -40,7 +36,7 @@ class MakeBundle {
static int Main (string [] args)
{
- List<string> sources = new List<string> ();
+ ArrayList sources = new ArrayList ();
int top = args.Length;
link_paths.Add (".");
@@ -162,8 +158,8 @@ static int Main (string [] args)
Environment.Exit (1);
}
- List<Assembly> assemblies = LoadAssemblies (sources);
- List<string> files = new List<string> ();
+ ArrayList assemblies = LoadAssemblies (sources);
+ ArrayList files = new ArrayList ();
foreach (Assembly a in assemblies)
QueueAssembly (files, a.CodeBase);
@@ -243,7 +239,7 @@ static void WriteBuffer (StreamWriter ts, Stream stream, byte[] buffer)
ts.WriteLine ();
}
- static void GenerateBundles (List<string> files)
+ static void GenerateBundles (ArrayList files)
{
string temp_s = "temp.s"; // Path.GetTempFileName ();
string temp_c = "temp.c";
@@ -255,8 +251,8 @@ static void GenerateBundles (List<string> files)
temp_o = object_out;
try {
- List<string> c_bundle_names = new List<string> ();
- List<string[]> config_names = new List<string[]> ();
+ ArrayList c_bundle_names = new ArrayList ();
+ ArrayList config_names = new ArrayList ();
byte [] buffer = new byte [8192];
using (StreamWriter ts = new StreamWriter (File.Create (temp_s))) {
@@ -274,19 +270,19 @@ static void GenerateBundles (List<string> files)
tc.WriteLine ("} CompressedAssembly;\n");
}
- object monitor = new object ();
-
- // Do the file reading and compression in parallel
- Action<string> body = delegate (string url) {
+ foreach (string url in files){
string fname = new Uri (url).LocalPath;
string aname = Path.GetFileName (fname);
string encoded = aname.Replace ("-", "_").Replace (".", "_");
if (prog == null)
prog = aname;
-
+
+ Console.WriteLine (" embedding: " + fname);
+
Stream stream = File.OpenRead (fname);
+ // Compression can be parallelized
long real_size = stream.Length;
int n;
if (compress) {
@@ -301,51 +297,39 @@ static void GenerateBundles (List<string> files)
stream = new MemoryStream (bytes, 0, (int) ms.Length, false, false);
}
- // The non-parallel part
- lock (monitor) {
- Console.WriteLine (" embedding: " + fname);
-
- WriteSymbol (ts, "assembly_data_" + encoded, stream.Length);
+ WriteSymbol (ts, "assembly_data_" + encoded, stream.Length);
- WriteBuffer (ts, stream, buffer);
-
- if (compress) {
- tc.WriteLine ("extern const unsigned char assembly_data_{0} [];", encoded);
- tc.WriteLine ("static CompressedAssembly assembly_bundle_{0} = {{{{\"{1}\"," +
- " assembly_data_{0}, {2}}}, {3}}};",
- encoded, aname, real_size, stream.Length);
- double ratio = ((double) stream.Length * 100) / real_size;
- Console.WriteLine (" compression ratio: {0:.00}%", ratio);
- } else {
- tc.WriteLine ("extern const unsigned char assembly_data_{0} [];", encoded);
- tc.WriteLine ("static const MonoBundledAssembly assembly_bundle_{0} = {{\"{1}\", assembly_data_{0}, {2}}};",
- encoded, aname, real_size);
- }
- stream.Close ();
+ WriteBuffer (ts, stream, buffer);
- c_bundle_names.Add ("assembly_bundle_" + encoded);
-
- try {
- FileStream cf = File.OpenRead (fname + ".config");
- Console.WriteLine (" config from: " + fname + ".config");
- tc.WriteLine ("extern const unsigned char assembly_config_{0} [];", encoded);
- WriteSymbol (ts, "assembly_config_" + encoded, cf.Length);
- WriteBuffer (ts, cf, buffer);
- ts.WriteLine ();
- config_names.Add (new string[] {aname, encoded});
- } catch (FileNotFoundException) {
- /* we ignore if the config file doesn't exist */
- }
+ if (compress) {
+ tc.WriteLine ("extern const unsigned char assembly_data_{0} [];", encoded);
+ tc.WriteLine ("static CompressedAssembly assembly_bundle_{0} = {{{{\"{1}\"," +
+ " assembly_data_{0}, {2}}}, {3}}};",
+ encoded, aname, real_size, stream.Length);
+ double ratio = ((double) stream.Length * 100) / real_size;
+ Console.WriteLine (" compression ratio: {0:.00}%", ratio);
+ } else {
+ tc.WriteLine ("extern const unsigned char assembly_data_{0} [];", encoded);
+ tc.WriteLine ("static const MonoBundledAssembly assembly_bundle_{0} = {{\"{1}\", assembly_data_{0}, {2}}};",
+ encoded, aname, real_size);
}
- };
+ stream.Close ();
+
+ c_bundle_names.Add ("assembly_bundle_" + encoded);
-#if NET_4_5
- Parallel.ForEach (files, body);
-#else
- foreach (var url in files)
- body (url);
-#endif
+ try {
+ FileStream cf = File.OpenRead (fname + ".config");
+ Console.WriteLine (" config from: " + fname + ".config");
+ tc.WriteLine ("extern const unsigned char assembly_config_{0} [];", encoded);
+ WriteSymbol (ts, "assembly_config_" + encoded, cf.Length);
+ WriteBuffer (ts, cf, buffer);
+ ts.WriteLine ();
+ config_names.Add (new string[] {aname, encoded});
+ } catch (FileNotFoundException) {
+ /* we ignore if the config file doesn't exist */
+ }
+ }
if (config_file != null){
FileStream conf;
try {
@@ -482,9 +466,9 @@ static void GenerateBundles (List<string> files)
}
}
- static List<Assembly> LoadAssemblies (List<string> sources)
+ static ArrayList LoadAssemblies (ArrayList sources)
{
- List<Assembly> assemblies = new List<Assembly> ();
+ ArrayList assemblies = new ArrayList ();
bool error = false;
foreach (string name in sources){
@@ -504,7 +488,7 @@ static List<Assembly> LoadAssemblies (List<string> sources)
return assemblies;
}
- static void QueueAssembly (List<string> files, string codebase)
+ static void QueueAssembly (ArrayList files, string codebase)
{
if (files.Contains (codebase))
return;
Modified: mono/dis/dump.c
===================================================================
@@ -29,6 +29,11 @@
#endif
+#if defined(__native_client__) && defined(__GLIBC__)
+volatile int __nacl_thread_suspension_needed = 0;
+void __nacl_suspend_thread_if_needed() {}
+#endif
+
void
dump_table_assembly (MonoImage *m)
{
Modified: mono/io-layer/io.c
===================================================================
@@ -708,6 +708,8 @@ static gboolean file_setendoffile(gpointer handle)
}
#endif
+/* Native Client has no ftruncate function, even in standalone sel_ldr. */
+#ifndef __native_client__
/* always truncate, because the extend write() adds an extra
* byte to the end of the file
*/
@@ -722,6 +724,7 @@ static gboolean file_setendoffile(gpointer handle)
_wapi_set_last_error_from_errno ();
return(FALSE);
}
+#endif
return(TRUE);
}
@@ -1512,6 +1515,13 @@ gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
return(INVALID_HANDLE_VALUE);
}
+#ifdef __native_client__
+ /* Workaround: Native Client currently returns the same fake inode
+ * for all files, so do a simple hash on the filename so we don't
+ * use the same share info for each file.
+ */
+ statbuf.st_ino = g_str_hash(filename);
+#endif
if (share_check (&statbuf, sharemode, fileaccess,
&file_handle.share_info, fd) == FALSE) {
@@ -2746,6 +2756,7 @@ gboolean FindNextFile (gpointer handle, WapiFindData *find_data)
goto retry;
}
+#ifndef __native_client__
result = _wapi_lstat (filename, &linkbuf);
if (result != 0) {
DEBUG ("%s: lstat failed: %s", __func__, filename);
@@ -2753,6 +2764,7 @@ gboolean FindNextFile (gpointer handle, WapiFindData *find_data)
g_free (filename);
goto retry;
}
+#endif
utf8_filename = mono_utf8_from_external (filename);
if (utf8_filename == NULL) {
@@ -2776,7 +2788,11 @@ gboolean FindNextFile (gpointer handle, WapiFindData *find_data)
else
create_time = buf.st_ctime;
+#ifdef __native_client__
+ find_data->dwFileAttributes = _wapi_stat_to_file_attributes (utf8_filename, &buf, NULL);
+#else
find_data->dwFileAttributes = _wapi_stat_to_file_attributes (utf8_filename, &buf, &linkbuf);
+#endif
_wapi_time_t_to_filetime (create_time, &find_data->ftCreationTime);
_wapi_time_t_to_filetime (buf.st_atime, &find_data->ftLastAccessTime);
@@ -2999,14 +3015,20 @@ guint32 GetFileAttributes (const gunichar2 *name)
return (INVALID_FILE_ATTRIBUTES);
}
+#ifndef __native_client__
result = _wapi_lstat (utf8_name, &linkbuf);
if (result != 0) {
_wapi_set_last_path_error_from_errno (NULL, utf8_name);
g_free (utf8_name);
return (INVALID_FILE_ATTRIBUTES);
}
+#endif
+#ifdef __native_client__
+ ret = _wapi_stat_to_file_attributes (utf8_name, &buf, NULL);
+#else
ret = _wapi_stat_to_file_attributes (utf8_name, &buf, &linkbuf);
+#endif
g_free (utf8_name);
@@ -3203,6 +3225,12 @@ extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer)
glong count;
gsize bytes;
+#ifdef __native_client__
+ gchar *path = g_get_current_dir ();
+ if (length < strlen(path) + 1 || path == NULL)
+ return 0;
+ memcpy (buffer, path, strlen(path) + 1);
+#else
if (getcwd ((char*)buffer, length) == NULL) {
if (errno == ERANGE) { /*buffer length is not big enough */
gchar *path = g_get_current_dir (); /*FIXME g_get_current_dir doesn't work with broken paths and calling it just to know the path length is silly*/
@@ -3216,6 +3244,7 @@ extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer)
_wapi_set_last_error_from_errno ();
return 0;
}
+#endif
utf16_path = mono_unicode_from_external ((gchar*)buffer, &bytes);
count = (bytes/2)+1;
Modified: mono/io-layer/processes.c
===================================================================
@@ -975,7 +975,7 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
if (startup_pipe [0] != -1) {
/* Wait until the parent has updated it's internal data */
- read (startup_pipe [0], &dummy, 1);
+ ssize_t _i G_GNUC_UNUSED = read (startup_pipe [0], &dummy, 1);
DEBUG ("%s: child: parent has completed its setup", __func__);
close (startup_pipe [0]);
close (startup_pipe [1]);
@@ -1078,7 +1078,7 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
if (startup_pipe [1] != -1) {
/* Write 1 byte, doesn't matter what */
- write (startup_pipe [1], startup_pipe, 1);
+ ssize_t _i G_GNUC_UNUSED = write (startup_pipe [1], startup_pipe, 1);
close (startup_pipe [0]);
close (startup_pipe [1]);
}
Modified: mono/io-layer/shared.c
===================================================================
@@ -18,7 +18,7 @@
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_SYS_SEM_H
+#if defined(HAVE_SYS_SEM_H) && !(defined(__native_client__) && defined(__GLIBC__))
# include <sys/sem.h>
#else
# define DISABLE_SHARED_HANDLES
Modified: mono/io-layer/sockets.c
===================================================================
@@ -902,6 +902,7 @@ guint32 _wapi_socket(int domain, int type, int protocol, void *unused,
if (fd == -1 && domain == AF_INET && type == SOCK_RAW &&
protocol == 0) {
/* Retry with protocol == 4 (see bug #54565) */
+ //
https://bugzilla.novell.com/show_bug.cgi?id=MONO54565 socket_handle.protocol = 4;
fd = socket (AF_INET, SOCK_RAW, 4);
}
@@ -927,6 +928,7 @@ guint32 _wapi_socket(int domain, int type, int protocol, void *unused,
/* .net seems to set this by default for SOCK_STREAM, not for
* SOCK_DGRAM (see bug #36322)
+ *
https://bugzilla.novell.com/show_bug.cgi?id=MONO36322 *
* It seems winsock has a rather different idea of what
* SO_REUSEADDR means. If it's set, then a new socket can be
@@ -937,6 +939,7 @@ guint32 _wapi_socket(int domain, int type, int protocol, void *unused,
* behaves as though any other system would when SO_REUSEADDR
* is true, so we don't need to do anything else here. See
* bug 53992.
+ *
https://bugzilla.novell.com/show_bug.cgi?id=MONO53992 */
{
int ret, true = 1;
Modified: mono/metadata/appdomain.c
===================================================================
@@ -2012,6 +2012,9 @@
*/
if (g_getenv ("MONO_NO_UNLOAD"))
return;
+#ifdef __native_client__
+ return;
+#endif
mono_domain_unload (domain);
}
Modified: mono/metadata/assembly.c
===================================================================
@@ -255,10 +255,10 @@
check_path_env (void)
{
const char* path;
-#ifdef __native_client__
- path = nacl_mono_path;
-#else
path = g_getenv ("MONO_PATH");
+#ifdef __native_client__
+ if (!path)
+ path = nacl_mono_path;
#endif
if (!path || assemblies_path != NULL)
return;
Modified: mono/metadata/boehm-gc.c
===================================================================
@@ -74,7 +74,7 @@
* we used to do this only when running on valgrind,
* but it happens also in other setups.
*/
-#if defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK)
+#if defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK) && !defined(__native_client__)
{
size_t size;
void *sstart;
@@ -923,7 +923,7 @@ enum {
return NULL;
if (!SMALL_ENOUGH (klass->instance_size))
return NULL;
- if (mono_class_has_finalizer (klass) || klass->marshalbyref || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS))
+ if (mono_class_has_finalizer (klass) || mono_class_is_marshalbyref (klass) || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS))
return NULL;
if (klass->rank)
return NULL;
@@ -1145,6 +1145,19 @@ void mono_gc_set_skip_thread (gboolean value)
{
}
+void
+mono_gc_register_for_finalization (MonoObject *obj, void *user_data)
+{
+ guint offset = 0;
+
+#ifndef GC_DEBUG
+ /* This assertion is not valid when GC_DEBUG is defined */
+ g_assert (GC_base (obj) == (char*)obj - offset);
+#endif
+
+ GC_REGISTER_FINALIZER_NO_ORDER ((char*)obj - offset, user_data, GUINT_TO_POINTER (offset), NULL, NULL);
+}
+
/*
* These will call the redefined versions in libgc.
*/
Modified: mono/metadata/class.c
===================================================================
@@ -3737,8 +3737,9 @@ class Input<T> {}
mono_secman_inheritancedemand_method (cm, im);
}
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_check_override (class, cm, im);
+
TRACE_INTERFACE_VTABLE (printf ("[NAME CHECK OK]"));
if (is_wcf_hack_disabled () && !mono_method_can_access_method_full (cm, im, NULL)) {
char *body_name = mono_method_full_name (cm, TRUE);
@@ -3822,9 +3823,9 @@ class Input<T> {}
mono_secman_inheritancedemand_method (cm, im);
}
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_check_override (class, cm, im);
-
+
TRACE_INTERFACE_VTABLE (printf ("[INJECTED INTERFACE CHECK OK]"));
if (is_wcf_hack_disabled () && !mono_method_can_access_method_full (cm, im, NULL)) {
char *body_name = mono_method_full_name (cm, TRUE);
@@ -4054,7 +4055,7 @@ class Input<T> {}
int i, max_vtsize = 0, max_iid, cur_slot = 0;
GPtrArray *ifaces = NULL;
GHashTable *override_map = NULL;
- gboolean security_enabled = mono_is_security_manager_active ();
+ gboolean security_enabled = mono_security_enabled ();
MonoMethod *cm;
gpointer class_iter;
#if (DEBUG_INTERFACE_VTABLE_CODE|TRACE_INTERFACE_VTABLE_CODE)
@@ -4226,7 +4227,7 @@ class Input<T> {}
g_hash_table_insert (override_map, overrides [i * 2], overrides [i * 2 + 1]);
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_check_override (class, vtable [dslot], decl);
}
}
@@ -4406,7 +4407,7 @@ class Input<T> {}
mono_secman_inheritancedemand_method (cm, m1);
}
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_check_override (class, cm, m1);
slot = mono_method_get_vtable_slot (m1);
@@ -4467,7 +4468,7 @@ class Input<T> {}
mono_method_full_name (overrides [i * 2 + 1], 1), overrides [i * 2 + 1]));
g_hash_table_insert (override_map, decl, overrides [i * 2 + 1]);
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_check_override (class, vtable [decl->slot], decl);
}
}
@@ -4894,7 +4895,7 @@ class Input<T> {}
}
/* CAS - SecurityAction.InheritanceDemand */
- if (mono_is_security_manager_active () && class->parent && (class->parent->flags & TYPE_ATTRIBUTE_HAS_SECURITY)) {
+ if (mono_security_enabled () && class->parent && (class->parent->flags & TYPE_ATTRIBUTE_HAS_SECURITY)) {
mono_secman_inheritancedemand_class (class, class->parent);
}
@@ -5077,7 +5078,7 @@ class Input<T> {}
setup_interface_offsets (class, 0, TRUE);
}
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_check_inheritance (class);
if (mono_loader_get_last_error ()) {
@@ -5312,7 +5313,7 @@ class Input<T> {}
init_com_from_comimport (MonoClass *class)
{
/* we don't always allow COM initialization under the CoreCLR (e.g. Moonlight does not require it) */
- if ((mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)) {
+ if (mono_security_core_clr_enabled ()) {
/* but some other CoreCLR user could requires it for their platform (i.e. trusted) code */
if (!mono_security_core_clr_determine_platform_image (class->image)) {
/* but it can not be made available for application (i.e. user code) since all COM calls
@@ -5322,6 +5323,7 @@ class Input<T> {}
return;
}
}
+
/* FIXME : we should add an extra checks to ensure COM can be initialized properly before continuing */
mono_init_com_types ();
}
@@ -9242,6 +9244,7 @@ class Input<T> {}
gpointer exception_data = mono_class_get_exception_data (klass);
switch (klass->exception_type) {
+#ifndef DISABLE_SECURITY
case MONO_EXCEPTION_SECURITY_INHERITANCEDEMAND: {
MonoDomain *domain = mono_domain_get ();
MonoSecurityManager* secman = mono_security_manager_get_methods ();
@@ -9258,6 +9261,7 @@ class Input<T> {}
mono_runtime_invoke (secman->inheritsecurityexception, NULL, args, &exc);
return (MonoException*) exc;
}
+#endif
case MONO_EXCEPTION_TYPE_LOAD: {
MonoString *name;
MonoException *ex;
@@ -9392,7 +9396,7 @@ class Input<T> {}
/* extra safety under CoreCLR - the runtime does not verify the strongname signatures
* anywhere so untrusted friends are not safe to access platform's code internals */
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR) {
+ if (mono_security_core_clr_enabled ()) {
if (!mono_security_core_clr_can_access_internals (accessing->image, accessed->image))
return FALSE;
}
Modified: mono/metadata/decimal.c
===================================================================
@@ -552,11 +552,15 @@ DECINLINE static void rshift192(guint64* pclo, guint64* pcmi, guint64* pchi)
*pchi >>= 1;
}
+#if defined(__native_client__) && (defined(__i386__) || defined(__x86_64))
+#define USE_X86_32BIT_INSTRUCTIONS 1
+#endif
+
static inline gint
my_g_bit_nth_msf (gsize mask)
{
/* Mask is expected to be != 0 */
-#if defined(__i386__) && defined(__GNUC__)
+#if (defined(__i386__) && defined(__GNUC__)) || defined(USE_X86_32BIT_INSTRUCTIONS)
int r;
__asm__("bsrl %1,%0\n\t"
@@ -1580,4 +1584,3 @@ gint32 mono_decimalSetExponent(/*[In, Out]*/decimal_repr* pA, gint32 texp)
}
#endif /* DISABLE_DECIMAL */
-
Modified: mono/metadata/gc.c
===================================================================
@@ -263,20 +263,14 @@
static void
object_register_finalizer (MonoObject *obj, void (*callback)(void *, void*))
{
-#if HAVE_BOEHM_GC
- guint offset = 0;
MonoDomain *domain;
if (obj == NULL)
mono_raise_exception (mono_get_exception_argument_null ("obj"));
-
- domain = obj->vtable->domain;
-#ifndef GC_DEBUG
- /* This assertion is not valid when GC_DEBUG is defined */
- g_assert (GC_base (obj) == (char*)obj - offset);
-#endif
+ domain = obj->vtable->domain;
+#if HAVE_BOEHM_GC
if (mono_domain_is_unloading (domain) && (callback != NULL))
/*
* Can't register finalizers in a dying appdomain, since they
@@ -293,17 +287,14 @@
mono_domain_finalizers_unlock (domain);
- GC_REGISTER_FINALIZER_NO_ORDER ((char*)obj - offset, callback, GUINT_TO_POINTER (offset), NULL, NULL);
+ mono_gc_register_for_finalization (obj, callback);
#elif defined(HAVE_SGEN_GC)
- if (obj == NULL)
- mono_raise_exception (mono_get_exception_argument_null ("obj"));
-
/*
* If we register finalizers for domains that are unloading we might
* end up running them while or after the domain is being cleared, so
* the objects will not be valid anymore.
*/
- if (!mono_domain_is_unloading (obj->vtable->domain))
+ if (!mono_domain_is_unloading (domain))
mono_gc_register_for_finalization (obj, callback);
#endif
}
@@ -342,6 +333,10 @@
HANDLE done_event;
MonoInternalThread *thread = mono_thread_internal_current ();
+#if defined(__native_client__)
+ return FALSE;
+#endif
+
if (mono_thread_internal_current () == gc_thread)
/* We are called from inside a finalizer, not much we can do here */
return FALSE;
Modified: mono/metadata/icall.c
===================================================================
@@ -1807,7 +1807,7 @@
mono_raise_exception (mono_get_exception_invalid_operation (
"It is illegal to get the value on a field on a type loaded using the ReflectionOnly methods."));
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_ensure_reflection_access_field (cf);
return mono_field_get_value_object (domain, cf, obj);
@@ -1827,7 +1827,7 @@
mono_raise_exception (mono_get_exception_invalid_operation (
"It is illegal to set the value on a field on a type loaded using the ReflectionOnly methods."));
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_ensure_reflection_access_field (cf);
type = mono_field_get_type_checked (cf, &error);
@@ -2803,7 +2803,7 @@
*exc = NULL;
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
mono_security_core_clr_ensure_reflection_access_method (m);
if (!(m->flags & METHOD_ATTRIBUTE_STATIC)) {
@@ -4232,16 +4232,17 @@ enum {
if (type->type == MONO_TYPE_CLASS) {
MonoClass *klass = mono_type_get_class (type);
- if (mono_is_security_manager_active () && !klass->exception_type)
+ if (mono_security_enabled () && !klass->exception_type)
/* Some security problems are detected during generic vtable construction */
mono_class_setup_vtable (klass);
+
/* need to report exceptions ? */
if (throwOnError && klass->exception_type) {
/* report SecurityException (or others) that occured when loading the assembly */
MonoException *exc = mono_class_get_exception_for_failure (klass);
mono_loader_clear_error ();
mono_raise_exception (exc);
- } else if (klass->exception_type == MONO_EXCEPTION_SECURITY_INHERITANCEDEMAND) {
+ } else if (mono_security_enabled () && klass->exception_type == MONO_EXCEPTION_SECURITY_INHERITANCEDEMAND) {
return NULL;
}
}
@@ -4853,6 +4854,7 @@ enum {
MONO_ARCH_SAVE_REGS;
mono_stack_walk_no_il (get_executing, &dest);
+ g_assert (dest);
return mono_assembly_get_object (mono_domain_get (), dest->klass->image->assembly);
}
@@ -5850,7 +5852,7 @@ enum {
mono_assert (delegate_class->parent == mono_defaults.multicastdelegate_class);
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR) {
+ if (mono_security_core_clr_enabled ()) {
if (!mono_security_core_clr_ensure_delegate_creation (method, throwOnBindFailure))
return NULL;
}
@@ -6530,6 +6532,11 @@ enum {
{
MONO_ARCH_SAVE_REGS;
+/* FIXME: There are some cleanup hangs that should be worked out, but
+ * if the program is going to exit, everything will be cleaned up when
+ * NaCl exits anyway.
+ */
+#ifndef __native_client__
mono_runtime_shutdown ();
/* This will kill the tp threads which cannot be suspended */
@@ -6539,6 +6546,7 @@ enum {
mono_thread_suspend_all_other_threads ();
mono_runtime_quit ();
+#endif
/* we may need to do some cleanup here... */
exit (result);
@@ -7213,6 +7221,12 @@ enum {
iter->args = (guint8*)(((gsize)iter->args + (align) - 1) & ~(align - 1));
#endif
res.value = iter->args;
+#if defined(__native_client__) && SIZEOF_REGISTER == 8
+ /* Values are stored as 8 byte register sized objects, but 'value'
+ * is dereferenced as a pointer in other routines.
+ */
+ res.value = (char*)res.value + 4;
+#endif
#if G_BYTE_ORDER != G_LITTLE_ENDIAN
if (arg_size <= sizeof (gpointer)) {
int dummy;
Modified: mono/metadata/marshal.c
===================================================================
@@ -585,11 +585,13 @@ struct _MonoRemotingMethods {
gpointer
mono_array_to_lparray (MonoArray *array)
{
+#ifndef DISABLE_COM
gpointer *nativeArray = NULL;
int nativeArraySize = 0;
int i = 0;
MonoClass *klass;
+#endif
if (!array)
return NULL;
@@ -601,14 +603,12 @@ struct _MonoRemotingMethods {
case MONO_TYPE_VOID:
g_assert_not_reached ();
break;
-#ifndef DISABLE_COM
case MONO_TYPE_CLASS:
nativeArraySize = array->max_length;
nativeArray = malloc(sizeof(gpointer) * nativeArraySize);
for(i = 0; i < nativeArraySize; ++i)
nativeArray[i] = ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal(((gpointer*)array->vector)[i]);
return nativeArray;
-#endif
case MONO_TYPE_U1:
case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
@@ -9768,7 +9768,10 @@ struct _MonoRemotingMethods {
static MonoMethodSignature *isint_sig = NULL;
GHashTable *cache;
MonoMethod *res;
- int pos_was_ok, pos_failed, pos_end, pos_end2;
+ int pos_was_ok, pos_end;
+#ifndef DISABLE_REMOTING
+ int pos_end2, pos_failed;
+#endif
char *name;
MonoMethodBuilder *mb;
@@ -9871,7 +9874,9 @@ struct _MonoRemotingMethods {
static MonoMethodSignature *castclass_sig = NULL;
GHashTable *cache;
MonoMethod *res;
+#ifndef DISABLE_REMOTING
int pos_was_ok, pos_was_ok2;
+#endif
char *name;
MonoMethodBuilder *mb;
WrapperInfo *info;
Modified: mono/metadata/metadata-verify.c
===================================================================
@@ -1096,7 +1096,7 @@ enum {
static gboolean
mono_verifier_is_corlib (MonoImage *image)
{
- gboolean trusted_location = (mono_security_get_mode () != MONO_SECURITY_MODE_CORE_CLR) ?
+ gboolean trusted_location = !mono_security_core_clr_enabled () ?
TRUE : mono_security_core_clr_is_platform_image (image);
return trusted_location && image->module_name && !strcmp ("mscorlib.dll", image->module_name);
Modified: mono/metadata/nacl-stub.c
===================================================================
@@ -13,4 +13,35 @@
int fsync(int fd) { errno=EINVAL; return -1; }
dev_t makedev(guint32 maj, guint32 min) { return (maj)*256+(min); }
+#ifdef USE_NEWLIB
+int getdtablesize(void) {
+#ifdef OPEN_MAX
+ return OPEN_MAX;
+#else
+ return 256;
+#endif
+}
+
+size_t getpagesize(void) {
+#ifdef PAGE_SIZE
+ return PAGE_SIZE;
+#else
+ return 4096;
+#endif
+}
+
+#include <semaphore.h>
+
+int sem_trywait(sem_t *sem) {
+ g_assert_not_reached ();
+ return -1;
+}
+
+int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout) {
+ g_assert_not_reached ();
+ return -1;
+}
+
+#endif
+
#endif
Modified: mono/metadata/null-gc.c
===================================================================
@@ -11,6 +11,7 @@
#include <mono/metadata/mono-gc.h>
#include <mono/metadata/gc-internal.h>
#include <mono/metadata/runtime.h>
+#include <mono/utils/mono-threads.h>
#ifdef HAVE_NULL_GC
@@ -22,6 +23,8 @@
memset (&cb, 0, sizeof (cb));
cb.mono_method_is_critical = mono_runtime_is_critical_method;
cb.mono_gc_pthread_create = (gpointer)mono_gc_pthread_create;
+
+ mono_threads_init (&cb, sizeof (MonoThreadInfo));
}
void
Modified: mono/metadata/object.c
===================================================================
@@ -2171,7 +2171,7 @@ gboolean release_type_locks (gpointer key, gpointer value, gpointer user)
mono_loader_unlock ();
/* Initialization is now complete, we can throw if the InheritanceDemand aren't satisfied */
- if (mono_is_security_manager_active () && (class->exception_type == MONO_EXCEPTION_SECURITY_INHERITANCEDEMAND) && raise_on_error)
+ if (mono_security_enabled () && (class->exception_type == MONO_EXCEPTION_SECURITY_INHERITANCEDEMAND) && raise_on_error)
mono_raise_exception (mono_class_get_exception_for_failure (class));
/* make sure the parent is initialized */
Modified: mono/metadata/rand.c
===================================================================
@@ -182,6 +182,8 @@
#elif defined (__native_client__)
+#include <time.h>
+
MonoBoolean
ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (void)
{
Modified: mono/metadata/reflection.c
===================================================================
@@ -11570,7 +11570,7 @@ struct StreamDesc {
ref = resolve_object (mb->module->image, obj, &handle_class, NULL);
if (!ref)
ex = mono_get_exception_type_load (NULL, NULL);
- else if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ else if (mono_security_core_clr_enabled ())
ex = mono_security_core_clr_ensure_dynamic_method_resolved_object (ref, handle_class);
if (ex) {
Modified: mono/metadata/security-core-clr.c
===================================================================
@@ -22,6 +22,106 @@
gboolean mono_security_core_clr_test = FALSE;
+static MonoSecurityCoreCLROptions security_core_clr_options = MONO_SECURITY_CORE_CLR_OPTIONS_DEFAULT;
+
+/**
+ * mono_security_core_clr_set_options:
+ * @options: the new options for the coreclr system to use
+ *
+ * By default, the CoreCLRs security model forbids execution trough reflection of methods not visible from the calling code.
+ * Even if the method being called is not in a platform assembly. For non moonlight CoreCLR users this restriction does not
+ * make a lot of sense, since the author could have just changed the non platform assembly to allow the method to be called.
+ * This function allows specific relaxations from the default behaviour to be set.
+ *
+ * Use MONO_SECURITY_CORE_CLR_OPTIONS_DEFAULT for the default coreclr coreclr behaviour as used in Moonlight.
+ *
+ * Use MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_REFLECTION to allow transparent code to execute methods and access
+ * fields that are not in platformcode, even if those methods and fields are private or otherwise not visible to the calling code.
+ *
+ * Use MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_DELEGATE to allow delegates to be created that point at methods that are not in
+ * platformcode even if those methods and fields are private or otherwise not visible to the calling code.
+ *
+ */
+void
+mono_security_core_clr_set_options (MonoSecurityCoreCLROptions options) {
+ security_core_clr_options = options;
+}
+
+/**
+ * mono_security_core_clr_get_options:
+ *
+ * Retrieves the current options used by the coreclr system.
+ */
+
+MonoSecurityCoreCLROptions
+mono_security_core_clr_get_options ()
+{
+ return security_core_clr_options;
+}
+
+/*
+ * default_platform_check:
+ *
+ * Default platform check. Always TRUE for current corlib (minimum
+ * trust-able subset) otherwise return FALSE. Any real CoreCLR host
+ * should provide its own callback to define platform code (i.e.
+ * this default is meant for test only).
+ */
+static gboolean
+default_platform_check (const char *image_name)
+{
+ if (mono_defaults.corlib) {
+ return (strcmp (mono_defaults.corlib->name, image_name) == 0);
+ } else {
+ /* this can get called even before we load corlib (e.g. the EXE itself) */
+ const char *corlib = "mscorlib.dll";
+ int ilen = strlen (image_name);
+ int clen = strlen (corlib);
+ return ((ilen >= clen) && (strcmp ("mscorlib.dll", image_name + ilen - clen) == 0));
+ }
+}
+
+static MonoCoreClrPlatformCB platform_callback = default_platform_check;
+
+/*
+ * mono_security_core_clr_determine_platform_image:
+ *
+ * Call the supplied callback (from mono_security_set_core_clr_platform_callback)
+ * to determine if this image represents platform code.
+ */
+gboolean
+mono_security_core_clr_determine_platform_image (MonoImage *image)
+{
+ return platform_callback (image->name);
+}
+
+/*
+ * mono_security_set_core_clr_platform_callback:
+ *
+ * Set the callback function that will be used to determine if an image
+ * is part, or not, of the platform code.
+ */
+void
+mono_security_set_core_clr_platform_callback (MonoCoreClrPlatformCB callback)
+{
+ platform_callback = callback;
+}
+
+/*
+ * mono_security_core_clr_is_platform_image:
+ *
+ * Return the (cached) boolean value indicating if this image represent platform code
+ */
+gboolean
+mono_security_core_clr_is_platform_image (MonoImage *image)
+{
+ return image->core_clr_platform_code;
+}
+
+/* Note: The above functions are outside this guard so that the public API isn't affected. */
+
+#ifndef DISABLE_SECURITY
+
static MonoClass*
security_critical_attribute (void)
{
@@ -409,45 +509,6 @@
}
-static MonoSecurityCoreCLROptions security_core_clr_options = MONO_SECURITY_CORE_CLR_OPTIONS_DEFAULT;
-
-/**
- * mono_security_core_clr_set_options:
- * @options: the new options for the coreclr system to use
- *
- * By default, the CoreCLRs security model forbids execution trough reflection of methods not visible from the calling code.
- * Even if the method being called is not in a platform assembly. For non moonlight CoreCLR users this restriction does not
- * make a lot of sense, since the author could have just changed the non platform assembly to allow the method to be called.
- * This function allows specific relaxations from the default behaviour to be set.
- *
- * Use MONO_SECURITY_CORE_CLR_OPTIONS_DEFAULT for the default coreclr coreclr behaviour as used in Moonlight.
- *
- * Use MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_REFLECTION to allow transparent code to execute methods and access
- * fields that are not in platformcode, even if those methods and fields are private or otherwise not visible to the calling code.
- *
- * Use MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_DELEGATE to allow delegates to be created that point at methods that are not in
- * platformcode even if those methods and fields are private or otherwise not visible to the calling code.
- *
- */
-
-void
-mono_security_core_clr_set_options (MonoSecurityCoreCLROptions options) {
- security_core_clr_options = options;
-}
-
-/**
- * mono_security_core_clr_get_options:
- *
- * Retrieves the current options used by the coreclr system.
- */
-
-MonoSecurityCoreCLROptions
-mono_security_core_clr_get_options ()
-{
- return security_core_clr_options;
-}
-
-
/*
* check_field_access:
*
@@ -934,73 +995,90 @@
}
/*
- * mono_security_core_clr_is_platform_image:
+ * mono_security_enable_core_clr:
*
- * Return the (cached) boolean value indicating if this image represent platform code
+ * Enable the verifier and the CoreCLR security model
*/
-gboolean
-mono_security_core_clr_is_platform_image (MonoImage *image)
+void
+mono_security_enable_core_clr ()
{
- return image->core_clr_platform_code;
+ mono_verifier_set_mode (MONO_VERIFIER_MODE_VERIFIABLE);
+ mono_security_set_mode (MONO_SECURITY_MODE_CORE_CLR);
}
-/*
- * default_platform_check:
- *
- * Default platform check. Always TRUE for current corlib (minimum
- * trust-able subset) otherwise return FALSE. Any real CoreCLR host
- * should provide its own callback to define platform code (i.e.
- * this default is meant for test only).
- */
-static gboolean
-default_platform_check (const char *image_name)
+#else
+
+void
+mono_security_core_clr_check_inheritance (MonoClass *class)
{
- if (mono_defaults.corlib) {
- return (strcmp (mono_defaults.corlib->name, image_name) == 0);
- } else {
- /* this can get called even before we load corlib (e.g. the EXE itself) */
- const char *corlib = "mscorlib.dll";
- int ilen = strlen (image_name);
- int clen = strlen (corlib);
- return ((ilen >= clen) && (strcmp ("mscorlib.dll", image_name + ilen - clen) == 0));
- }
}
-static MonoCoreClrPlatformCB platform_callback = default_platform_check;
+void
+mono_security_core_clr_check_override (MonoClass *class, MonoMethod *override, MonoMethod *base)
+{
+}
-/*
- * mono_security_core_clr_determine_platform_image:
- *
- * Call the supplied callback (from mono_security_set_core_clr_platform_callback)
- * to determine if this image represents platform code.
- */
gboolean
-mono_security_core_clr_determine_platform_image (MonoImage *image)
+mono_security_core_clr_require_elevated_permissions (void)
{
- return platform_callback (image->name);
+ return FALSE;
}
-/*
- * mono_security_enable_core_clr:
- *
- * Enable the verifier and the CoreCLR security model
- */
void
-mono_security_enable_core_clr ()
+mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field)
{
- mono_verifier_set_mode (MONO_VERIFIER_MODE_VERIFIABLE);
- mono_security_set_mode (MONO_SECURITY_MODE_CORE_CLR);
}
-/*
- * mono_security_set_core_clr_platform_callback:
- *
- * Set the callback function that will be used to determine if an image
- * is part, or not, of the platform code.
- */
void
-mono_security_set_core_clr_platform_callback (MonoCoreClrPlatformCB callback)
+mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method)
+{
+}
+
+gboolean
+mono_security_core_clr_ensure_delegate_creation (MonoMethod *method, gboolean throwOnBindFailure)
+{
+ return TRUE;
+}
+
+MonoException*
+mono_security_core_clr_ensure_dynamic_method_resolved_object (gpointer ref, MonoClass *handle_class)
+{
+ return NULL;
+}
+
+gboolean
+mono_security_core_clr_can_access_internals (MonoImage *accessing, MonoImage* accessed)
+{
+ return TRUE;
+}
+
+MonoException*
+mono_security_core_clr_is_field_access_allowed (MonoMethod *caller, MonoClassField *field)
+{
+ return NULL;
+}
+
+MonoException*
+mono_security_core_clr_is_call_allowed (MonoMethod *caller, MonoMethod *callee)
+{
+ return NULL;
+}
+
+MonoSecurityCoreCLRLevel
+mono_security_core_clr_class_level (MonoClass *class)
+{
+ return MONO_SECURITY_CORE_CLR_TRANSPARENT;
+}
+
+MonoSecurityCoreCLRLevel
+mono_security_core_clr_method_level (MonoMethod *method, gboolean with_class_level)
+{
+ return MONO_SECURITY_CORE_CLR_TRANSPARENT;
+}
+
+void
+mono_security_enable_core_clr ()
{
- platform_callback = callback;
}
+#endif /* DISABLE_SECURITY */
Modified: mono/metadata/security-manager.c
===================================================================
@@ -9,17 +9,10 @@
#include "security-manager.h"
-
-/* Internal stuff */
-
-static MonoSecurityManager secman;
+static MonoSecurityMode mono_security_mode = MONO_SECURITY_MODE_NONE;
static MonoBoolean mono_security_manager_activated = FALSE;
static MonoBoolean mono_security_manager_enabled = TRUE;
static MonoBoolean mono_security_manager_execution = TRUE;
-static MonoSecurityMode mono_security_mode = MONO_SECURITY_MODE_NONE;
-
-
-/* Public stuff */
void
mono_security_set_mode (MonoSecurityMode mode)
@@ -33,6 +26,26 @@
return mono_security_mode;
}
+/*
+ * Note: The security manager is activate once when executing the Mono. This
+ * is not meant to be a turn on/off runtime switch.
+ */
+void
+mono_activate_security_manager (void)
+{
+ mono_security_manager_activated = TRUE;
+}
+
+gboolean
+mono_is_security_manager_active (void)
+{
+ return mono_security_manager_activated;
+}
+
+#ifndef DISABLE_SECURITY
+
+static MonoSecurityManager secman;
+
MonoSecurityManager*
mono_security_manager_get_methods (void)
{
@@ -160,23 +173,26 @@
}
}
+#else
+
+MonoSecurityManager*
+mono_security_manager_get_methods (void)
+{
+ return NULL;
+}
-/*
- * Note: The security manager is activate once when executing the Mono. This
- * is not meant to be a turn on/off runtime switch.
- */
void
-mono_activate_security_manager (void)
+mono_secman_inheritancedemand_class (MonoClass *klass, MonoClass *parent)
{
- mono_security_manager_activated = TRUE;
}
-gboolean
-mono_is_security_manager_active (void)
+void
+mono_secman_inheritancedemand_method (MonoMethod *override, MonoMethod *base)
{
- return mono_security_manager_activated;
}
+#endif /* DISABLE_SECURITY */
+
/*
* @publickey An encoded (with header) public key
* @size The length of the public key
Modified: mono/metadata/security-manager.h
===================================================================
@@ -63,17 +63,18 @@ enum {
MonoClass *suppressunmanagedcodesecurity; /* System.Security.SuppressUnmanagedCodeSecurityAttribute */
} MonoSecurityManager;
-/* Initialization/utility functions */
-void mono_activate_security_manager (void) MONO_INTERNAL;
-gboolean mono_is_security_manager_active (void) MONO_INTERNAL;
-MonoSecurityManager* mono_security_manager_get_methods (void) MONO_INTERNAL;
gboolean mono_is_ecma_key (const char *publickey, int size) MONO_INTERNAL;
MonoMethod* mono_get_context_capture_method (void) MONO_INTERNAL;
void mono_secman_inheritancedemand_class (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
void mono_secman_inheritancedemand_method (MonoMethod *override, MonoMethod *base) MONO_INTERNAL;
+/* Initialization/utility functions */
+void mono_activate_security_manager (void) MONO_INTERNAL;
+MonoSecurityManager* mono_security_manager_get_methods (void) MONO_INTERNAL;
+
/* Security mode */
+gboolean mono_is_security_manager_active (void) MONO_INTERNAL;
void mono_security_set_mode (MonoSecurityMode mode) MONO_INTERNAL;
MonoSecurityMode mono_security_get_mode (void) MONO_INTERNAL;
@@ -84,5 +85,16 @@ enum {
void ves_icall_System_Security_SecurityManager_set_CheckExecutionRights (MonoBoolean value) MONO_INTERNAL;
MonoBoolean ves_icall_System_Security_SecurityManager_GetLinkDemandSecurity (MonoReflectionMethod *m, MonoDeclSecurityActions *kactions, MonoDeclSecurityActions *mactions) MONO_INTERNAL;
+#ifndef DISABLE_SECURITY
+#define mono_security_enabled() (mono_is_security_manager_active ())
+#define mono_security_cas_enabled() (mono_security_get_mode () == MONO_SECURITY_MODE_CAS)
+#define mono_security_core_clr_enabled() (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+#define mono_security_smcs_hack_enabled() (mono_security_get_mode () == MONO_SECURITY_MODE_SMCS_HACK)
+#else
+#define mono_security_enabled() (FALSE)
+#define mono_security_cas_enabled() (FALSE)
+#define mono_security_core_clr_enabled() (FALSE)
+#define mono_security_smcs_hack_enabled() (FALSE)
+#endif
#endif /* _MONO_METADATA_SECURITY_MANAGER_H_ */
Modified: mono/metadata/sgen-cardtable.c
===================================================================
@@ -47,6 +47,7 @@
guint8 *sgen_cardtable;
+static gboolean need_mod_union;
#ifdef HEAVY_STATISTICS
long long marked_cards;
@@ -82,7 +83,7 @@
sgen_card_table_wbarrier_set_field (MonoObject *obj, gpointer field_ptr, MonoObject* value)
{
*(void**)field_ptr = value;
- if (sgen_ptr_in_nursery (value))
+ if (need_mod_union || sgen_ptr_in_nursery (value))
sgen_card_table_mark_address ((mword)field_ptr);
sgen_dummy_use (value);
}
@@ -91,7 +92,7 @@
sgen_card_table_wbarrier_set_arrayref (MonoArray *arr, gpointer slot_ptr, MonoObject* value)
{
*(void**)slot_ptr = value;
- if (sgen_ptr_in_nursery (value))
+ if (need_mod_union || sgen_ptr_in_nursery (value))
sgen_card_table_mark_address ((mword)slot_ptr);
sgen_dummy_use (value);
}
@@ -111,7 +112,7 @@
for (; dest >= start; --src, --dest) {
gpointer value = *src;
*dest = value;
- if (sgen_ptr_in_nursery (value))
+ if (need_mod_union || sgen_ptr_in_nursery (value))
sgen_card_table_mark_address ((mword)dest);
sgen_dummy_use (value);
}
@@ -120,7 +121,7 @@
for (; dest < end; ++src, ++dest) {
gpointer value = *src;
*dest = value;
- if (sgen_ptr_in_nursery (value))
+ if (need_mod_union || sgen_ptr_in_nursery (value))
sgen_card_table_mark_address ((mword)dest);
sgen_dummy_use (value);
}
@@ -278,6 +279,74 @@
return sgen_card_table_address_is_marked ((mword)addr);
}
+static gboolean
+sgen_card_table_find_address_with_cards (char *cards_start, guint8 *cards, char *addr)
+{
+ cards_start = sgen_card_table_align_pointer (cards_start);
+ return cards [(addr - cards_start) >> CARD_BITS];
+}
+
+static void
+update_mod_union (guint8 *dest, gboolean init, guint8 *start_card, guint8 *end_card)
+{
+ size_t num_cards = end_card - start_card;
+ if (init) {
+ memcpy (dest, start_card, num_cards);
+ } else {
+ int i;
+ for (i = 0; i < num_cards; ++i)
+ dest [i] |= start_card [i];
+ }
+}
+
+static guint8*
+alloc_mod_union (size_t num_cards)
+{
+ return sgen_alloc_internal_dynamic (num_cards, INTERNAL_MEM_CARDTABLE_MOD_UNION, TRUE);
+}
+
+guint8*
+sgen_card_table_update_mod_union (guint8 *dest, char *obj, mword obj_size, size_t *out_num_cards)
+{
+ guint8 *result = dest;
+ guint8 *start_card = sgen_card_table_get_card_address ((mword)obj);
+ guint8 *end_card = sgen_card_table_get_card_address ((mword)obj + obj_size - 1) + 1;
+ gboolean init = dest == NULL;
+ size_t num_cards;
+
+#ifdef SGEN_HAVE_OVERLAPPING_CARDS
+ if (end_card < start_card) {
+ guint8 *edge_card = sgen_cardtable + CARD_COUNT_IN_BYTES;
+ size_t num_cards_to_edge = edge_card - start_card;
+
+ num_cards = (end_card + CARD_COUNT_IN_BYTES) - start_card;
+ if (init) {
+ result = dest = alloc_mod_union (num_cards);
+ //g_print ("%d cards for %d bytes: %p\n", num_cards, num_bytes, dest);
+ }
+
+ update_mod_union (dest, init, start_card, edge_card);
+
+ SGEN_ASSERT (0, num_cards == (edge_card - start_card) + (end_card - sgen_cardtable), "wrong number of cards");
+
+ dest += num_cards_to_edge;
+ start_card = sgen_cardtable;
+ } else
+#endif
+ {
+ num_cards = end_card - start_card;
+ if (init)
+ result = dest = alloc_mod_union (num_cards);
+ }
+
+ update_mod_union (dest, init, start_card, end_card);
+
+ if (out_num_cards)
+ *out_num_cards = num_cards;
+
+ return result;
+}
+
#ifdef SGEN_HAVE_OVERLAPPING_CARDS
static void
@@ -710,26 +779,9 @@
remset->prepare_for_major_collection = sgen_card_table_prepare_for_major_collection;
remset->find_address = sgen_card_table_find_address;
-}
-
-#else
-
-void
-sgen_card_table_mark_address (mword address)
-{
- g_assert_not_reached ();
-}
+ remset->find_address_with_cards = sgen_card_table_find_address_with_cards;
-void
-sgen_card_table_mark_range (mword address, mword size)
-{
- g_assert_not_reached ();
-}
-
-guint8*
-mono_gc_get_card_table (int *shift_bits, gpointer *mask)
-{
- return NULL;
+ need_mod_union = sgen_get_major_collector ()->is_concurrent;
}
#endif /*HAVE_SGEN_GC*/
Modified: mono/metadata/sgen-cardtable.h
===================================================================
@@ -32,6 +32,8 @@ void sgen_cardtable_scan_object (char *obj, mword obj_size, guint8 *cards,
gboolean sgen_card_table_get_card_data (guint8 *dest, mword address, mword cards) MONO_INTERNAL;
+guint8* sgen_card_table_update_mod_union (guint8 *dest, char *obj, mword obj_size, size_t *out_num_cards) MONO_INTERNAL;
+
void sgen_card_table_init (SgenRemeberedSet *remset) MONO_INTERNAL;
/*How many bytes a single card covers*/
Modified: mono/metadata/sgen-debug.c
===================================================================
@@ -200,6 +200,59 @@
g_assert (!missing_remsets);
}
+static gboolean
+is_major_or_los_object_marked (char *obj)
+{
+ if (sgen_safe_object_get_size ((MonoObject*)obj) > SGEN_MAX_SMALL_OBJ_SIZE) {
+ return sgen_los_object_is_pinned (obj);
+ } else {
+ return sgen_get_major_collector ()->is_object_live (obj);
+ }
+}
+
+#undef HANDLE_PTR
+#define HANDLE_PTR(ptr,obj) do { \
+ if (*(ptr) && !sgen_ptr_in_nursery ((char*)*(ptr)) && !is_major_or_los_object_marked ((char*)*(ptr))) { \
+ if (!sgen_get_remset ()->find_address_with_cards (start, cards, (char*)(ptr))) { \
+ SGEN_LOG (0, "major->major reference %p at offset %td in object %p (%s.%s) not found in remsets.", *(ptr), (char*)(ptr) - (char*)(obj), (obj), ((MonoObject*)(obj))->vtable->klass->name_space, ((MonoObject*)(obj))->vtable->klass->name); \
+ binary_protocol_missing_remset ((obj), (gpointer)LOAD_VTABLE ((obj)), (char*)(ptr) - (char*)(obj), *(ptr), (gpointer)LOAD_VTABLE(*(ptr)), object_is_pinned (*(ptr))); \
+ } \
+ } \
+ } while (0)
+
+static void
+check_mod_union_callback (char *start, size_t size, void *dummy)
+{
+ gboolean in_los = (gboolean) (size_t) dummy;
+ GCVTable *vt = (GCVTable*)LOAD_VTABLE (start);
+ guint8 *cards;
+ SGEN_LOG (8, "Scanning object %p, vtable: %p (%s)", start, vt, vt->klass->name);
+
+ if (!is_major_or_los_object_marked (start))
+ return;
+
+ if (in_los)
+ cards = sgen_los_header_for_object (start)->cardtable_mod_union;
+ else
+ cards = sgen_get_major_collector ()->get_cardtable_mod_union_for_object (start);
+
+ SGEN_ASSERT (0, cards, "we must have mod union for marked major objects");
+
+#include "sgen-scan-object.h"
+}
+
+void
+sgen_check_mod_union_consistency (void)
+{
+ missing_remsets = FALSE;
+
+ major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)check_mod_union_callback, (void*)FALSE);
+
+ sgen_los_iterate_objects ((IterateObjectCallbackFunc)check_mod_union_callback, (void*)TRUE);
+
+ if (!binary_protocol_is_enabled ())
+ g_assert (!missing_remsets);
+}
#undef HANDLE_PTR
#define HANDLE_PTR(ptr,obj) do { \
@@ -365,7 +418,7 @@
static void
verify_object_pointers_callback (char *start, size_t size, void *data)
{
- gboolean allow_missing_pinned = (gboolean)data;
+ gboolean allow_missing_pinned = (gboolean) (size_t) data;
#include "sgen-scan-object.h"
}
@@ -381,9 +434,9 @@
setup_valid_nursery_objects ();
broken_heap = FALSE;
- sgen_scan_area_with_callback (nursery_section->data, nursery_section->end_data, verify_object_pointers_callback, (void*)allow_missing_pinned, FALSE);
- major_collector.iterate_objects (TRUE, TRUE, verify_object_pointers_callback, (void*)allow_missing_pinned);
- sgen_los_iterate_objects (verify_object_pointers_callback, (void*)allow_missing_pinned);
+ sgen_scan_area_with_callback (nursery_section->data, nursery_section->end_data, verify_object_pointers_callback, (void*) (size_t) allow_missing_pinned, FALSE);
+ major_collector.iterate_objects (TRUE, TRUE, verify_object_pointers_callback, (void*) (size_t) allow_missing_pinned);
+ sgen_los_iterate_objects (verify_object_pointers_callback, (void*) (size_t) allow_missing_pinned);
g_assert (!broken_heap);
}
@@ -488,7 +541,7 @@
static void
check_marked_callback (char *start, size_t size, void *dummy)
{
- gboolean is_los = (gboolean)dummy;
+ gboolean is_los = (gboolean) (size_t) dummy;
if (is_los) {
if (!sgen_los_object_is_pinned (start))
@@ -513,7 +566,7 @@
static void
check_nursery_objects_pinned_callback (char *obj, size_t size, void *data /* ScanCopyContext *ctx */)
{
- gboolean pinned = (gboolean)data;
+ gboolean pinned = (gboolean) (size_t) data;
g_assert (!SGEN_OBJECT_IS_FORWARDED (obj));
if (pinned)
@@ -527,7 +580,7 @@
{
sgen_clear_nursery_fragments ();
sgen_scan_area_with_callback (nursery_section->data, nursery_section->end_data,
- (IterateObjectCallbackFunc)check_nursery_objects_pinned_callback, (void*)pinned /* (void*)&ctx */, FALSE);
+ (IterateObjectCallbackFunc)check_nursery_objects_pinned_callback, (void*) (size_t) pinned /* (void*)&ctx */, FALSE);
}
#endif /*HAVE_SGEN_GC*/
Modified: mono/metadata/sgen-fin-weak-hash.c
===================================================================
@@ -447,9 +447,13 @@
suspended right in between setting the content to null and staging the unregister.
The rest of this code cannot handle null links as DISLINK_OBJECT (NULL) produces an invalid address.
+
+ We should simply skip the entry as the staged removal will take place during the next GC.
*/
- if (!*link)
+ if (!*link) {
+ SGEN_LOG (5, "Dislink %p was externally nullified", link);
continue;
+ }
track = DISLINK_TRACK (link);
/*
@@ -463,6 +467,13 @@
*/
if (track != before_finalization) {
object = DISLINK_OBJECT (link);
+ /*
+ We should guard against a null object been hidden. This can sometimes happen.
+ */
+ if (!object) {
+ SGEN_LOG (5, "Dislink %p with a hidden null object", link);
+ continue;
+ }
if (!major_collector.is_object_live (object)) {
if (sgen_gc_is_object_ready_for_finalization (object)) {
Modified: mono/metadata/sgen-gc.c
===================================================================
@@ -263,6 +263,8 @@ enum {
static gboolean whole_heap_check_before_collection = FALSE;
/* If set, do a heap consistency check before each minor collection */
static gboolean consistency_check_at_minor_collection = FALSE;
+/* If set, do a mod union consistency check before each finishing collection pause */
+static gboolean mod_union_consistency_check = FALSE;
/* If set, check whether mark bits are consistent after major collections */
static gboolean check_mark_bits_after_major_collection = FALSE;
/* If set, check that all nursery objects are pinned/not pinned, depending on context */
@@ -3315,6 +3317,9 @@ struct _EphemeronLinkNode {
return FALSE;
}
+ if (mod_union_consistency_check)
+ sgen_check_mod_union_consistency ();
+
collect_nursery (&unpin_queue, TRUE);
current_collection_generation = GENERATION_OLD;
@@ -3387,6 +3392,8 @@ struct _EphemeronLinkNode {
const char *overflow_reason = NULL;
MONO_GC_REQUESTED (generation_to_collect, requested_size, wait_to_finish ? 1 : 0);
+ if (wait_to_finish)
+ binary_protocol_collection_force (generation_to_collect);
g_assert (generation_to_collect == GENERATION_NURSERY || generation_to_collect == GENERATION_OLD);
@@ -5169,6 +5176,12 @@ void mono_gc_wbarrier_value_copy_bitmap (gpointer _dest, gpointer _src, int size
} else if (!strcmp (opt, "check-at-minor-collections")) {
consistency_check_at_minor_collection = TRUE;
nursery_clear_policy = CLEAR_AT_GC;
+ } else if (!strcmp (opt, "mod-union-consistency-check")) {
+ if (!major_collector.is_concurrent) {
+ sgen_env_var_error (MONO_GC_DEBUG_NAME, "Ignoring.", "`mod-union-consistency-check` only works with concurrent major collector.");
+ continue;
+ }
+ mod_union_consistency_check = TRUE;
} else if (!strcmp (opt, "check-mark-bits")) {
check_mark_bits_after_major_collection = TRUE;
} else if (!strcmp (opt, "check-nursery-pinned")) {
Modified: mono/metadata/sgen-gc.h
===================================================================
@@ -661,6 +661,7 @@ struct _SgenMajorCollector {
void (*reset_worker_data) (void *data);
gboolean (*is_valid_object) (char *object);
gboolean (*describe_pointer) (char *pointer);
+ guint8* (*get_cardtable_mod_union_for_object) (char *object);
long long (*get_and_reset_num_major_objects_marked) (void);
};
@@ -689,6 +690,7 @@ struct _SgenMajorCollector {
void (*finish_minor_collection) (void);
gboolean (*find_address) (char *addr);
+ gboolean (*find_address_with_cards) (char *cards_start, guint8 *cards, char *addr);
} SgenRemeberedSet;
SgenRemeberedSet *sgen_get_remset (void) MONO_INTERNAL;
@@ -997,6 +999,7 @@ struct _LOSObject {
/* Debug support */
void sgen_check_consistency (void);
+void sgen_check_mod_union_consistency (void);
void sgen_check_major_refs (void);
void sgen_check_whole_heap (gboolean allow_missing_pinning);
void sgen_check_whole_heap_stw (void) MONO_INTERNAL;
Modified: mono/metadata/sgen-internal.c
===================================================================
@@ -181,7 +181,7 @@
mono_lock_free_free (addr);
if (MONO_GC_INTERNAL_DEALLOC_ENABLED ()) {
- int size = allocator_sizes [index];
+ int size G_GNUC_UNUSED = allocator_sizes [index];
MONO_GC_INTERNAL_DEALLOC ((mword)addr, size, type);
}
}
Modified: mono/metadata/sgen-los.c
===================================================================
@@ -554,19 +554,8 @@ struct _LOSSection {
LOSObject *obj;
for (obj = los_object_list; obj; obj = obj->next) {
- guint8 *start_card = sgen_card_table_get_card_scan_address ((mword)obj->data);
- guint8 *end_card = sgen_card_table_get_card_scan_address ((mword)obj->data + obj->size - 1) + 1;
- size_t num_cards = end_card - start_card;
-
- if (!obj->cardtable_mod_union) {
- obj->cardtable_mod_union = sgen_alloc_internal_dynamic (num_cards,
- INTERNAL_MEM_CARDTABLE_MOD_UNION, TRUE);
- memcpy (obj->cardtable_mod_union, start_card, num_cards);
- } else {
- int i;
- for (i = 0; i < num_cards; ++i)
- obj->cardtable_mod_union [i] |= start_card [i];
- }
+ obj->cardtable_mod_union = sgen_card_table_update_mod_union (obj->cardtable_mod_union,
+ obj->data, obj->size, NULL);
}
}
Modified: mono/metadata/sgen-marksweep.c
===================================================================
@@ -2359,25 +2359,21 @@ struct _MSBlockInfo {
MSBlockInfo *block;
FOREACH_BLOCK (block) {
- guint8 *cards;
- gboolean init = FALSE;
+ size_t num_cards;
- if (!block->cardtable_mod_union) {
- block->cardtable_mod_union = sgen_alloc_internal_dynamic (CARDS_PER_BLOCK,
- INTERNAL_MEM_CARDTABLE_MOD_UNION, TRUE);
- init = TRUE;
- }
+ block->cardtable_mod_union = sgen_card_table_update_mod_union (block->cardtable_mod_union,
+ block->block, MS_BLOCK_SIZE, &num_cards);
- cards = sgen_card_table_get_card_scan_address ((mword)block->block);
- if (init) {
- memcpy (block->cardtable_mod_union, cards, CARDS_PER_BLOCK);
- } else {
- int i;
- for (i = 0; i < CARDS_PER_BLOCK; ++i)
- block->cardtable_mod_union [i] |= cards [i];
- }
+ SGEN_ASSERT (0, num_cards == CARDS_PER_BLOCK, "Number of cards calculation is wrong");
} END_FOREACH_BLOCK;
}
+
+static guint8*
+major_get_cardtable_mod_union_for_object (char *obj)
+{
+ MSBlockInfo *block = MS_BLOCK_FOR_OBJ (obj);
+ return &block->cardtable_mod_union [(obj - (char*)sgen_card_table_align_pointer (block->block)) >> CARD_BITS];
+}
#endif
static void
@@ -2555,8 +2551,10 @@ struct _MSBlockInfo {
collector->scan_card_table = major_scan_card_table;
collector->iterate_live_block_ranges = (void*)(void*) major_iterate_live_block_ranges;
#ifdef SGEN_HAVE_CONCURRENT_MARK
- if (is_concurrent)
+ if (is_concurrent) {
collector->update_cardtable_mod_union = update_cardtable_mod_union;
+ collector->get_cardtable_mod_union_for_object = major_get_cardtable_mod_union_for_object;
+ }
#endif
collector->init_to_space = major_init_to_space;
collector->sweep = major_sweep;
Modified: mono/metadata/sgen-pinning.c
===================================================================
@@ -306,7 +306,7 @@ struct _CementHashEntry {
++hash [i].count;
if (hash [i].count == SGEN_CEMENT_THRESHOLD) {
if (G_UNLIKELY (MONO_GC_OBJ_CEMENTED_ENABLED())) {
- MonoVTable *vt = (MonoVTable*)SGEN_LOAD_VTABLE (obj);
+ MonoVTable *vt G_GNUC_UNUSED = (MonoVTable*)SGEN_LOAD_VTABLE (obj);
MONO_GC_OBJ_CEMENTED ((mword)obj, sgen_safe_object_get_size ((MonoObject*)obj),
vt->klass->name_space, vt->klass->name);
}
Modified: mono/metadata/sgen-protocol.c
===================================================================
@@ -33,18 +33,19 @@
/* If not null, dump binary protocol to this file */
static FILE *binary_protocol_file = NULL;
-static int binary_protocol_use_count = 0;
+/* We set this to -1 to indicate an exclusive lock */
+static volatile int binary_protocol_use_count = 0;
#define BINARY_PROTOCOL_BUFFER_SIZE (65536 - 2 * 8)
typedef struct _BinaryProtocolBuffer BinaryProtocolBuffer;
struct _BinaryProtocolBuffer {
- BinaryProtocolBuffer *next;
- int index;
+ BinaryProtocolBuffer * volatile next;
+ volatile int index;
unsigned char buffer [BINARY_PROTOCOL_BUFFER_SIZE];
};
-static BinaryProtocolBuffer *binary_protocol_buffers = NULL;
+static BinaryProtocolBuffer * volatile binary_protocol_buffers = NULL;
void
binary_protocol_init (const char *filename)
@@ -58,6 +59,53 @@ struct _BinaryProtocolBuffer {
return binary_protocol_file != NULL;
}
+static gboolean
+try_lock_exclusive (void)
+{
+ do {
+ if (binary_protocol_use_count)
+ return FALSE;
+ } while (InterlockedCompareExchange (&binary_protocol_use_count, -1, 0) != 0);
+ mono_memory_barrier ();
+ return TRUE;
+}
+
+static void
+unlock_exclusive (void)
+{
+ mono_memory_barrier ();
+ SGEN_ASSERT (0, binary_protocol_use_count == -1, "Exclusively locked count must be -1");
+ if (InterlockedCompareExchange (&binary_protocol_use_count, 0, -1) != -1)
+ SGEN_ASSERT (0, FALSE, "Somebody messed with the exclusive lock");
+}
+
+static void
+lock_recursive (void)
+{
+ int old_count;
+ do {
+ retry:
+ old_count = binary_protocol_use_count;
+ if (old_count < 0) {
+ /* Exclusively locked - retry */
+ /* FIXME: short back-off */
+ goto retry;
+ }
+ } while (InterlockedCompareExchange (&binary_protocol_use_count, old_count + 1, old_count) != old_count);
+ mono_memory_barrier ();
+}
+
+static void
+unlock_recursive (void)
+{
+ int old_count;
+ mono_memory_barrier ();
+ do {
+ old_count = binary_protocol_use_count;
+ SGEN_ASSERT (0, old_count > 0, "Locked use count must be at least 1");
+ } while (InterlockedCompareExchange (&binary_protocol_use_count, old_count - 1, old_count) != old_count);
+}
+
static void
binary_protocol_flush_buffers_rec (BinaryProtocolBuffer *buffer)
{
@@ -78,12 +126,15 @@ struct _BinaryProtocolBuffer {
if (!binary_protocol_file)
return;
- if (!force && binary_protocol_use_count != 0)
+ if (!force && !try_lock_exclusive ())
return;
binary_protocol_flush_buffers_rec (binary_protocol_buffers);
binary_protocol_buffers = NULL;
+ if (!force)
+ unlock_exclusive ();
+
fflush (binary_protocol_file);
}
@@ -115,15 +166,11 @@ struct _BinaryProtocolBuffer {
{
int index;
BinaryProtocolBuffer *buffer;
- int old_count;
if (!binary_protocol_file)
return;
- do {
- old_count = binary_protocol_use_count;
- g_assert (old_count >= 0);
- } while (InterlockedCompareExchange (&binary_protocol_use_count, old_count + 1, old_count) != old_count);
+ lock_recursive ();
retry:
buffer = binary_protocol_get_buffer (size + 1);
@@ -144,10 +191,15 @@ struct _BinaryProtocolBuffer {
g_assert (index <= BINARY_PROTOCOL_BUFFER_SIZE);
- do {
- old_count = binary_protocol_use_count;
- g_assert (old_count > 0);
- } while (InterlockedCompareExchange (&binary_protocol_use_count, old_count - 1, old_count) != old_count);
+ unlock_recursive ();
+}
+
+void
+binary_protocol_collection_force (int generation)
+{
+ SGenProtocolCollectionForce entry = { generation };
+ binary_protocol_flush_buffers (FALSE);
+ protocol_entry (SGEN_PROTOCOL_COLLECTION_FORCE, &entry, sizeof (SGenProtocolCollectionForce));
}
void
Modified: mono/metadata/sgen-protocol.h
===================================================================
@@ -25,6 +25,7 @@
#ifdef SGEN_BINARY_PROTOCOL
enum {
+ SGEN_PROTOCOL_COLLECTION_FORCE,
SGEN_PROTOCOL_COLLECTION_BEGIN,
SGEN_PROTOCOL_COLLECTION_END,
SGEN_PROTOCOL_ALLOC,
@@ -52,6 +53,10 @@ enum {
};
typedef struct {
+ int generation;
+} SGenProtocolCollectionForce;
+
+typedef struct {
int index, generation;
} SGenProtocolCollection;
@@ -171,6 +176,7 @@ enum {
void binary_protocol_flush_buffers (gboolean force) MONO_INTERNAL;
+void binary_protocol_collection_force (int generation) MONO_INTERNAL;
void binary_protocol_collection_begin (int index, int generation) MONO_INTERNAL;
void binary_protocol_collection_end (int index, int generation) MONO_INTERNAL;
void binary_protocol_alloc (gpointer obj, gpointer vtable, int size) MONO_INTERNAL;
@@ -202,6 +208,7 @@ void binary_protocol_missing_remset (gpointer obj, gpointer obj_vtable, int offs
#define binary_protocol_is_enabled() FALSE
#define binary_protocol_flush_buffers(force)
+#define binary_protocol_collection_force(generation)
#define binary_protocol_collection_begin(index, generation)
#define binary_protocol_collection_end(index, generation)
#define binary_protocol_alloc(obj, vtable, size)
Modified: mono/metadata/sgen-stw.c
===================================================================
@@ -116,7 +116,7 @@
if (!info->thread_is_dying && (!info->stack_start || info->in_critical_region ||
is_ip_in_managed_allocator (info->stopped_domain, info->stopped_ip))) {
binary_protocol_thread_restart ((gpointer)mono_thread_info_get_tid (info));
- SGEN_LOG (3, "thread %p resumed.", (void*)info->info.native_handle);
+ SGEN_LOG (3, "thread %p resumed.", (void*) (size_t) info->info.native_handle);
result = sgen_resume_thread (info);
if (result) {
++restart_count;
Modified: mono/metadata/socket-io.c
===================================================================
@@ -2045,6 +2045,8 @@ static struct in6_addr ipaddress_to_struct_in6_addr(MonoObject *ipaddr)
#endif /* AF_INET6 */
#endif
+#if defined(__APPLE__)
+
#if defined(HAVE_GETIFADDRS) && defined(HAVE_IF_NAMETOINDEX)
static int
get_local_interface_id (int family)
@@ -2081,6 +2083,8 @@ static struct in6_addr ipaddress_to_struct_in6_addr(MonoObject *ipaddr)
}
#endif
+#endif /* __APPLE__ */
+
void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *error)
{
struct linger linger;
Modified: mono/metadata/threads.c
===================================================================
@@ -399,6 +399,15 @@ static void thread_cleanup (MonoInternalThread *thread)
mono_profiler_thread_end (thread->tid);
+ if (thread == mono_thread_internal_current ()) {
+ /*
+ * This will signal async signal handlers that the thread has exited.
+ * The profiler callback needs this to be set, so it cannot be done earlier.
+ */
+ mono_domain_unset ();
+ mono_memory_barrier ();
+ }
+
if (thread == mono_thread_internal_current ())
mono_thread_pop_appdomain_ref ();
@@ -608,8 +617,6 @@ static guint32 WINAPI start_wrapper_internal(void *data)
THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Start wrapper terminating", __func__, GetCurrentThreadId ()));
- thread_cleanup (internal);
-
/* Do any cleanup needed for apartment state. This
* cannot be done in thread_cleanup since thread_cleanup could be
* called for a thread other than the current thread.
@@ -617,6 +624,8 @@ static guint32 WINAPI start_wrapper_internal(void *data)
* for the current thead */
mono_thread_cleanup_apartment_state ();
+ thread_cleanup (internal);
+
/* Remove the reference to the thread object in the TLS data,
* so the thread object can be finalized. This won't be
* reached if the thread threw an uncaught exception, so those
@@ -626,7 +635,6 @@ static guint32 WINAPI start_wrapper_internal(void *data)
* to TLS data.)
*/
SET_CURRENT_OBJECT (NULL);
- mono_domain_unset ();
return(0);
}
@@ -798,6 +806,18 @@ gpointer mono_create_thread (WapiSecurityAttributes *security,
mono_thread_create_internal (domain, func, arg, FALSE, FALSE, 0);
}
+#if defined(HOST_WIN32) && defined(__GNUC__) && defined(TARGET_X86)
+static __inline__ __attribute__((always_inline))
+/* This is not defined by gcc */
+unsigned long long
+__readfsdword (unsigned long long offset)
+{
+ unsigned long long value;
+ __asm__("movl %%fs:%a[offset], %k[value]" : [value] "=q" (value) : [offset] "irm" (offset));
+ return value;
+}
+#endif
+
/*
* mono_thread_get_stack_bounds:
*
@@ -816,10 +836,27 @@ gpointer mono_create_thread (WapiSecurityAttributes *security,
*staddr = (guint8*)((gssize)*staddr & ~(mono_pagesize () - 1));
return;
/* FIXME: simplify the mess below */
-#elif !defined(HOST_WIN32)
+#elif defined(HOST_WIN32)
+#ifdef TARGET_X86
+ /*
http://en.wikipedia.org/wiki/Win32_Thread_Information_Block */
+ void* tib = (void*)__readfsdword(0x18);
+ guint8 *stackTop = (guint8*)*(int*)((char*)tib + 4);
+ guint8 *stackBottom = (guint8*)*(int*)((char*)tib + 8);
+
+ *staddr = stackBottom;
+ *stsize = stackTop - stackBottom;
+#else
+ *staddr = NULL;
+ *stsize = (size_t)-1;
+#endif
+ return;
+#else
pthread_attr_t attr;
guint8 *current = (guint8*)&attr;
+ *staddr = NULL;
+ *stsize = (size_t)-1;
+
pthread_attr_init (&attr);
# ifdef HAVE_PTHREAD_GETATTR_NP
pthread_getattr_np (pthread_self(), &attr);
@@ -854,9 +891,6 @@ gpointer mono_create_thread (WapiSecurityAttributes *security,
# endif
pthread_attr_destroy (&attr);
-#else
- *staddr = NULL;
- *stsize = (size_t)-1;
#endif
/* When running under emacs, sometimes staddr is not aligned to a page size */
@@ -3466,6 +3500,10 @@ struct ref_stack {
gboolean
mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout)
{
+#ifdef __native_client__
+ return FALSE;
+#endif
+
abort_appdomain_data user_data;
guint32 start_time;
int orig_timeout = timeout;
@@ -4441,6 +4479,10 @@ gint32* mono_thread_interruption_request_flag ()
int
mono_thread_kill (MonoInternalThread *thread, int signal)
{
+#ifdef __native_client__
+ /* Workaround pthread_kill abort() in NaCl glibc. */
+ return -1;
+#endif
#ifdef HOST_WIN32
/* Win32 uses QueueUserAPC and callers of this are guarded */
g_assert_not_reached ();
Modified: mono/metadata/verify.c
===================================================================
@@ -6004,7 +6004,7 @@ enum {
mono_verifier_is_class_full_trust (MonoClass *klass)
{
/* under CoreCLR code is trusted if it is part of the "platform" otherwise all code inside the GAC is trusted */
- gboolean trusted_location = (mono_security_get_mode () != MONO_SECURITY_MODE_CORE_CLR) ?
+ gboolean trusted_location = !mono_security_core_clr_enabled () ?
(klass->image->assembly && klass->image->assembly->in_gac) : mono_security_core_clr_is_platform_image (klass->image);
if (verify_all && verifier_mode == MONO_VERIFIER_MODE_OFF)
Modified: mono/mini/
Makefile.am.in
===================================================================
@@ -414,6 +414,10 @@ test_sources = \
gshared.cs
regtests=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe
+if NACL_CODEGEN
+test_sources += nacl.cs
+regtests += nacl.exe
+endif
if X86
if MONO_DEBUGGER_SUPPORTED
@@ -553,10 +557,10 @@ libmonoinclude_HEADERS = jit.h
CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
-basic-simd.exe: basic-simd.cs
+basic-simd.exe: basic-simd.cs TestDriver.dll
$(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
-nacl.exe: nacl.cs
+nacl.exe: nacl.cs TestDriver.dll
$(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll
generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
@@ -591,7 +595,11 @@ endif !NACL_CODEGEN
if CROSS_COMPILING
GENMDESC_PRG=perl $(srcdir)/
genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
else !CROSS_COMPILING
+if NACL_CODEGEN
+GENMDESC_PRG=perl $(srcdir)/
genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
+else
GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
+endif
endif !CROSS_COMPILING
cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
@@ -632,7 +640,11 @@ checktests: $(regtests)
for i in $(regtests); do $(RUNTIME) $$i; done
rcheck: mono $(regtests)
+if NACL_CODEGEN
+ for i in $(regtests); do echo "running test $$i"; $(RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
+else
$(RUNTIME) --regression $(regtests)
+endif
gctest: mono gc-test.exe
MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
Modified: mono/mini/aot-compiler.c
===================================================================
@@ -1336,6 +1336,7 @@ struct _ReadOnlyValue {
fprintf (acfg->fp, "add r0, r0, #%d\n", (int)sizeof (MonoObject));
fprintf (acfg->fp, "b %s\n", call_target);
fprintf (acfg->fp, ".arm\n");
+ fprintf (acfg->fp, ".align 2\n");
return;
}
Modified: mono/mini/aot-runtime.c
===================================================================
@@ -1519,7 +1519,7 @@
if (assembly->image->dynamic || assembly->ref_only)
return;
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS)
+ if (mono_security_cas_enabled ())
return;
mono_aot_lock ();
@@ -1840,7 +1840,9 @@
InitializeCriticalSection (&aot_page_mutex);
aot_modules = g_hash_table_new (NULL, NULL);
+#ifndef __native_client__
mono_install_assembly_load_hook (load_aot_module, NULL);
+#endif
if (g_getenv ("MONO_LASTAOT"))
mono_last_aot_method = atoi (g_getenv ("MONO_LASTAOT"));
Modified: mono/mini/arrays.cs
===================================================================
@@ -25,8 +25,8 @@
class Tests {
- static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_10_create () {
Modified: mono/mini/basic-calls.cs
===================================================================
@@ -25,8 +25,8 @@
class Tests {
- static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
static void dummy () {
Modified: mono/mini/basic-float.cs
===================================================================
@@ -28,8 +28,8 @@
class Tests {
- public static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_0_beq () {
Modified: mono/mini/basic-long.cs
===================================================================
@@ -25,8 +25,8 @@
class Tests {
- public static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_10_simple_cast () {
Modified: mono/mini/basic-math.cs
===================================================================
@@ -25,8 +25,8 @@
class Tests {
- public static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_0_sin_precision () {
Modified: mono/mini/basic.cs
===================================================================
@@ -25,8 +25,8 @@
class Tests {
- static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_0_return () {
@@ -1361,4 +1361,4 @@ public static int test_1_rem_un_cfold ()
return k == -32768 ? 0 : 1;
}
-}
\ No newline at end of file
+}
Modified: mono/mini/debugger-agent.c
===================================================================
@@ -4038,11 +4038,13 @@ static void CALLBACK notify_thread_apc (ULONG_PTR param)
if (error) {
mono_error_set_error (error, MONO_ERROR_GENERIC, "%s", s);
+ g_warning ("%s", s);
g_free (s);
return;
} else {
- g_error ("%s", s);
+ g_warning ("%s", s);
g_free (s);
+ return;
}
}
Modified: mono/mini/declsec.c
===================================================================
@@ -11,7 +11,8 @@
#include "declsec.h"
#include "mini.h"
-#ifndef DISABLE_VERIFIER
+#ifndef DISABLE_SECURITY
+
/*
* Does the methods (or it's class) as any declarative security attribute ?
* Is so are they applicable ? (e.g. static class constructor)
@@ -406,7 +407,7 @@
return violation;
}
-#else /* DISABLE_JIT */
+#else /* DISABLE_SECURITY */
void
mono_declsec_cache_stack_modifiers (MonoJitInfo *jinfo)
Modified: mono/mini/declsec.h
===================================================================
@@ -60,4 +60,10 @@ enum {
guint32 mono_declsec_linkdemand (MonoDomain *domain, MonoMethod *caller, MonoMethod *callee) MONO_INTERNAL;
+#ifndef DISABLE_SECURITY
+#define mono_security_method_has_declsec(method) (mono_method_has_declsec(method))
+#else
+#define mono_security_method_has_declsec(method) (FALSE)
+#endif
+
#endif /* _MONO_MINI_DECLSEC_H_ */
Modified: mono/mini/driver.c
===================================================================
@@ -1147,8 +1147,10 @@ static void main_thread_handler (gpointer user_data)
" --runtime=VERSION Use the VERSION runtime, instead of autodetecting\n"
" --optimize=OPT Turns on or off a specific optimization\n"
" Use --list-opt to get a list of optimizations\n"
+#ifndef DISABLE_SECURITY
" --security[=mode] Turns on the unsupported security manager (off by default)\n"
" mode is one of cas, core-clr, verifiable or validil\n"
+#endif
" --attach=OPTIONS Pass OPTIONS to the attach agent in the runtime.\n"
" Currently the only supported option is 'disable'.\n"
" --llvm, --nollvm Controls whenever the runtime uses LLVM to compile code.\n"
@@ -1423,6 +1425,9 @@ BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
#ifdef HOST_WIN32
int mixed_mode = FALSE;
#endif
+#ifdef __native_client__
+ gboolean nacl_null_checks_off = FALSE;
+#endif
#ifdef MOONLIGHT
#ifndef HOST_WIN32
@@ -1663,28 +1668,51 @@ BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
opt->mdb_optimizations = TRUE;
enable_debugging = TRUE;
} else if (strcmp (argv [i], "--security") == 0) {
+#ifndef DISABLE_SECURITY
mono_verifier_set_mode (MONO_VERIFIER_MODE_VERIFIABLE);
mono_security_set_mode (MONO_SECURITY_MODE_CAS);
mono_activate_security_manager ();
+#else
+ fprintf (stderr, "error: --security: not compiled with security manager support");
+ return 1;
+#endif
} else if (strncmp (argv [i], "--security=", 11) == 0) {
+ /* Note: temporary-smcs-hack, validil, and verifiable need to be
+ accepted even if DISABLE_SECURITY is defined. */
+
if (strcmp (argv [i] + 11, "temporary-smcs-hack") == 0) {
mono_security_set_mode (MONO_SECURITY_MODE_SMCS_HACK);
} else if (strcmp (argv [i] + 11, "core-clr") == 0) {
+#ifndef DISABLE_SECURITY
mono_verifier_set_mode (MONO_VERIFIER_MODE_VERIFIABLE);
mono_security_set_mode (MONO_SECURITY_MODE_CORE_CLR);
+#else
+ fprintf (stderr, "error: --security: not compiled with CoreCLR support");
+ return 1;
+#endif
} else if (strcmp (argv [i] + 11, "core-clr-test") == 0) {
+#ifndef DISABLE_SECURITY
/* fixme should we enable verifiable code here?*/
mono_security_set_mode (MONO_SECURITY_MODE_CORE_CLR);
mono_security_core_clr_test = TRUE;
- } else if (strcmp (argv [i] + 11, "cas") == 0){
+#else
+ fprintf (stderr, "error: --security: not compiled with CoreCLR support");
+ return 1;
+#endif
+ } else if (strcmp (argv [i] + 11, "cas") == 0) {
+#ifndef DISABLE_SECURITY
mono_verifier_set_mode (MONO_VERIFIER_MODE_VERIFIABLE);
mono_security_set_mode (MONO_SECURITY_MODE_CAS);
mono_activate_security_manager ();
- } else if (strcmp (argv [i] + 11, "validil") == 0) {
+#else
+ fprintf (stderr, "error: --security: not compiled with CAS support");
+ return 1;
+#endif
+ } else if (strcmp (argv [i] + 11, "validil") == 0) {
mono_verifier_set_mode (MONO_VERIFIER_MODE_VALID);
- } else if (strcmp (argv [i] + 11, "verifiable") == 0) {
+ } else if (strcmp (argv [i] + 11, "verifiable") == 0) {
mono_verifier_set_mode (MONO_VERIFIER_MODE_VERIFIABLE);
- } else {
+ } else {
fprintf (stderr, "error: --security= option has invalid argument (cas, core-clr, verifiable or validil)\n");
return 1;
}
@@ -1727,6 +1755,8 @@ BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
#ifdef __native_client__
} else if (strcmp (argv [i], "--nacl-mono-path") == 0){
nacl_mono_path = g_strdup(argv[++i]);
+ } else if (strcmp (argv [i], "--nacl-null-checks-off") == 0){
+ nacl_null_checks_off = TRUE;
#endif
} else {
fprintf (stderr, "Unknown command line option: '%s'\n", argv [i]);
@@ -1739,6 +1769,10 @@ BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
{
nacl_align_byte = -1; /* 0xff */
}
+ if (!nacl_null_checks_off) {
+ MonoDebugOptions *opt = mini_get_debug_options ();
+ opt->explicit_null_checks = TRUE;
+ }
#endif
if (!argv [i]) {
@@ -1950,7 +1984,7 @@ BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
* This used to be an amd64 only crash, but it looks like now most glibc targets do unwinding
* that requires reading the target code.
*/
-#ifdef __linux__
+#if defined( __linux__ ) || defined( __native_client__ )
mono_dont_free_global_codeman = TRUE;
#endif
Modified: mono/mini/exceptions-arm.c
===================================================================
@@ -493,6 +493,7 @@
return FALSE;
}
+#if MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
void
mono_arch_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
{
@@ -504,6 +505,7 @@
{
mono_monoctx_to_sigctx (mctx, ctx);
}
+#endif /* MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX */
/*
* handle_exception:
@@ -546,7 +548,7 @@
gboolean
mono_arch_handle_exception (void *ctx, gpointer obj)
{
-#if defined(MONO_CROSS_COMPILE)
+#if defined(MONO_CROSS_COMPILE) || !defined(MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX)
g_assert_not_reached ();
#elif defined(MONO_ARCH_USE_SIGACTION)
arm_ucontext *sigctx = ctx;
@@ -598,6 +600,8 @@
{
#ifdef MONO_CROSS_COMPILE
g_assert_not_reached ();
+#elif defined(__native_client__)
+ g_assert_not_reached ();
#else
arm_ucontext *my_uc = sigctx;
return (void*) UCONTEXT_REG_PC (my_uc);
Modified: mono/mini/exceptions.cs
===================================================================
@@ -26,8 +26,8 @@
class Tests {
- public static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_0_catch () {
@@ -1455,6 +1455,7 @@ class Tests {
return 0;
}
+ [Category ("NaClDisable")]
public static int test_0_div_zero () {
int d = 1;
int q = 0;
@@ -1560,6 +1561,7 @@ class Tests {
return 0;
}
+ [Category ("NaClDisable")]
public static int test_0_long_div_zero () {
long d = 1;
long q = 0;
Removed: mono/mini/fsacheck.c
===================================================================
@@ -1,269 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/assembly.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/object.h>
-#include <mono/jit/jit.h>
-#include <mono/utils/mono-logger.h>
-
-extern void* mono_aot_module_mscorlib_info;
-extern void* mono_aot_module_System_Core_info;
-extern void* mono_aot_module_System_info;
-extern void* mono_aot_module_Mono_Posix_info;
-extern void* mono_aot_module_System_Configuration_info;
-extern void* mono_aot_module_System_Security_info;
-extern void* mono_aot_module_System_Xml_info;
-/* extern void* mono_aot_module_System_Threading_info; */
-extern void* mono_aot_module_Mono_Security_info;
-extern void* mono_aot_module_Mono_Simd_info;
-extern void* mono_aot_module_TestDriver_info;
-
-extern void* mono_aot_module_basic_info;
-extern void* mono_aot_module_basic_float_info;
-extern void* mono_aot_module_basic_long_info;
-extern void* mono_aot_module_basic_calls_info;
-extern void* mono_aot_module_basic_simd_info;
-extern void* mono_aot_module_objects_info;
-extern void* mono_aot_module_arrays_info;
-extern void* mono_aot_module_basic_math_info;
-extern void* mono_aot_module_exceptions_info;
-extern void* mono_aot_module_devirtualization_info;
-extern void* mono_aot_module_generics_info;
-extern void* mono_aot_module_generics_variant_types_info;
-extern void* mono_aot_module_basic_simd_info;
-extern void* mono_aot_module_gc_stress_info;
-extern void* mono_aot_module_imt_big_iface_test_info;
-extern void* mono_aot_module_make_imt_test_info;
-/* extern void* mono_aot_module_thread_stress_info; */
-extern void* mono_aot_module_iltests_info;
-
-extern void mono_aot_register_module(void *aot_info);
-extern void mono_aot_init(void);
-extern void mono_jit_set_aot_only(mono_bool aot_only);
-extern MonoDomain * mini_init (const char *filename, const char *runtime_version);
-
-int run_all_test_methods(MonoClass *klass) {
- void * iter = NULL;
- MonoMethod *mm = NULL;
- int count = 0;
- int passed = 0;
- printf("Running test methods without reflection\n");
- while (NULL != (mm = mono_class_get_methods(klass, &iter))) {
- long expected_result;
- const char *name = mono_method_get_name(mm);
- char *end = NULL;
- if (strncmp(name, "test_", 5)) continue;
- printf("=== Test %d, method %s\n", count, mono_method_get_name(mm));
- expected_result = strtol(name + 5, &end, 10);
- if (name == end) {
- printf(" warning: could not determine expected return value\n");
- expected_result = 0;
- }
- MonoObject *mo = mono_runtime_invoke(mm, NULL, NULL, NULL);
- int *ret = mono_object_unbox(mo);
- if (ret && *ret == expected_result) {
- printf(" passed!\n");
- passed++;
- } else {
- printf(" FAILED, expected %d, returned %p, %d\n", expected_result, ret,
- ret != NULL ? *ret : 0);
- }
- count++;
- }
- if (count > 0) {
- printf("============================================\n");
- printf("Final count: %d tests, %d pass, %.2f%%\n", count, passed,
- (double)passed / count * 100.0);
- } else {
- printf("no test methods found.\n");
- }
- return count;
-}
-
-#if defined(__native_client__)
-extern void* mono_aot_module_nacl_info;
-extern char* nacl_mono_path;
-char *load_corlib_data() {
- FILE *mscorlib;
- static char *corlib_data = NULL;
- if (corlib_data) return corlib_data;
-
- mscorlib = fopen("mscorlib.dll", "r");
- if (NULL != mscorlib) {
- size_t size;
- struct stat st;
- if (0 == stat("mscorlib.dll", &st)) {
- size = st.st_size;
- printf("reading mscorlib.dll, size %ld\n", size);
- corlib_data = malloc(size);
- if (corlib_data != NULL) {
- while (fread(corlib_data, 1, size, mscorlib) != 0) ;
- if (!ferror(mscorlib)) {
- mono_set_corlib_data(corlib_data, size);
- } else {
- perror("error reading mscorlib.dll");
- free(corlib_data);
- corlib_data = NULL;
- }
- } else {
- perror("Could not allocate memory");
- }
- } else {
- perror("stat error");
- }
- fclose(mscorlib);
- }
- return corlib_data;
-}
-#endif
-
-/* Initialize Mono. Must run only once per process */
-MonoDomain *init_mono(char *mname) {
- MonoDomain *domain = NULL;
-#ifdef AOT_VERSION
- mono_jit_set_aot_only(1);
- mono_aot_register_module(mono_aot_module_mscorlib_info);
- mono_aot_register_module(mono_aot_module_TestDriver_info);
- mono_aot_register_module(mono_aot_module_System_Core_info);
- mono_aot_register_module(mono_aot_module_System_info);
- mono_aot_register_module(mono_aot_module_Mono_Posix_info);
- mono_aot_register_module(mono_aot_module_System_Configuration_info);
- mono_aot_register_module(mono_aot_module_System_Security_info);
- mono_aot_register_module(mono_aot_module_System_Xml_info);
- mono_aot_register_module(mono_aot_module_Mono_Security_info);
- /* mono_aot_register_module(mono_aot_module_System_Threading_info); */
- mono_aot_register_module(mono_aot_module_Mono_Simd_info);
-
- mono_aot_register_module(mono_aot_module_basic_info);
- mono_aot_register_module(mono_aot_module_basic_float_info);
- mono_aot_register_module(mono_aot_module_basic_long_info);
- mono_aot_register_module(mono_aot_module_basic_calls_info);
- mono_aot_register_module(mono_aot_module_basic_simd_info);
- mono_aot_register_module(mono_aot_module_objects_info);
- mono_aot_register_module(mono_aot_module_arrays_info);
- mono_aot_register_module(mono_aot_module_basic_math_info);
- mono_aot_register_module(mono_aot_module_exceptions_info);
- mono_aot_register_module(mono_aot_module_devirtualization_info);
- mono_aot_register_module(mono_aot_module_generics_info);
- mono_aot_register_module(mono_aot_module_generics_variant_types_info);
- mono_aot_register_module(mono_aot_module_gc_stress_info);
- mono_aot_register_module(mono_aot_module_imt_big_iface_test_info);
- mono_aot_register_module(mono_aot_module_iltests_info);
-#endif
- /* mono_aot_register_module(mono_aot_module_make_imt_test_info); */
- /* mono_aot_register_module(mono_aot_module_thread_stress_info); */
-#if defined(__native_client__)
-#ifdef AOT_VERSION
- mono_aot_register_module(mono_aot_module_nacl_info);
-#endif
-
- /* Test file-less shortcut for loading mscorlib metadata */
- load_corlib_data();
- nacl_mono_path = strdup(".");
-#endif
- /* Uncomment the following if something is going wrong */
- /* mono_trace_set_level_string("info"); */
- domain = mono_jit_init(mname);
- if (NULL == domain) {
- printf("ERROR: mono_jit_init failure\n");
- exit(-1);
- }
- return domain;
-}
-
-/* Run all tests from one assembly file */
-int try_one(char *mname, MonoDomain *domain) {
- MonoAssembly *ma;
- MonoImage *mi;
- MonoClass *mc;
- MonoMethodDesc *mmd;
- MonoMethod *mm;
- MonoObject *mo;
- MonoString *monostring_arg;
- MonoArray *arg_array;
- int *failures = NULL;
- const int kUseTestDriver = 1;
- int test_count = 0;
- void *args [1];
- char *cstr_arg = "--timing";
-
- ma = mono_domain_assembly_open(domain, mname);
- if (NULL == ma) {
- printf("ERROR: could not open mono assembly\n");
- exit(-1);
- }
-
- mi = mono_assembly_get_image(ma);
- if (NULL == mi) {
- printf("ERROR: could not get assembly image\n");
- exit(-1);
- }
-
- monostring_arg = mono_string_new(domain, cstr_arg);
- mc = mono_class_from_name(mono_get_corlib(), "System", "String");
- if (0 == mc) {
- printf("ERROR: could not mono string class\n");
- exit(-1);
- }
-
- // to pass a string argument, change the 0 to a 1 and uncomment
- // mono_array_setref below
- arg_array = mono_array_new(domain, mc, 0);
- //mono_array_setref(arg_array, 0, monostring_arg);
- args[0] = arg_array;
-
- if (!kUseTestDriver) {
- mc = mono_class_from_name(mi, "", "Tests");
- if (NULL == mc) {
- printf("could not open Tests class\n");
- exit(-1);
- }
- test_count = run_all_test_methods(mc);
- }
- /* If run_all_test_methods didn't find any tests, try Main */
- if (kUseTestDriver || test_count == 0) {
- mmd = mono_method_desc_new("Tests:Main()", 1);
- mm = mono_method_desc_search_in_image(mmd, mi);
- if (0 == mm) {
- mmd = mono_method_desc_new("Tests:Main(string[])", 1);
- mm = mono_method_desc_search_in_image(mmd, mi);
- if (0 == mm) {
- printf("Couldn't find Tests:Main() or Tests:Main(string[])\n");
- exit(-1);
- }
- }
-
- mo = mono_runtime_invoke(mm, NULL, args, NULL);
- failures = mo != NULL ? mono_object_unbox(mo) : NULL;
- if (NULL == failures || *failures != 0) {
- printf("--------------------> Failed");
- }
- }
- return failures != NULL ? failures : 1;
-}
-
-int main(int argc, char *argv[]) {
- MonoDomain *domain;
- int failures = 0;
-
- if (argc < 2) {
- printf("no test specified; running basic.exe\n");
- printf("================================\n");
- domain = init_mono("basic.exe");
- try_one("basic.exe", domain);
- } else {
- domain = init_mono(argv[1]);
- int i;
- for (i = 1; i < argc; i++) {
- printf("\nRunning tests from %s:\n", argv[i]);
- printf("===============================\n\n");
- failures += try_one(argv[i], domain);
- }
- }
- mono_jit_cleanup(domain);
- return failures;
-}
Modified: mono/mini/genmdesc.c
===================================================================
@@ -11,6 +11,11 @@
#include <string.h>
#include <mono/metadata/opcodes.h>
+#if defined(__native_client__) || defined(__native_client_codegen__)
+volatile int __nacl_thread_suspension_needed = 0;
+void __nacl_suspend_thread_if_needed() {}
+#endif
+
#define MINI_OP(a,b,dest,src1,src2) b,
#define MINI_OP3(a,b,dest,src1,src2,src3) b,
/* keep in sync with the enum in mini.h */
Modified: mono/mini/graph.c
===================================================================
@@ -314,6 +314,7 @@
char *com;
const char *fn;
FILE *fp;
+ int _i G_GNUC_UNUSED;
fn = "/tmp/minidtree.graph";
fp = fopen (fn, "w+");
@@ -337,7 +338,7 @@
//com = g_strdup_printf ("dot %s -Tpng -o %s.png; eog %s.png", fn, fn, fn);
com = g_strdup_printf ("dot %s -Tps -o %
s.ps;gv %
s.ps", fn, fn, fn);
- system (com);
+ _i = system (com);
g_free (com);
}
Modified: mono/mini/helpers.c
===================================================================
@@ -130,6 +130,9 @@
void
mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
{
+#if defined(__native_client__)
+ return;
+#endif
#ifndef DISABLE_LOGGING
GHashTable *offset_to_bb_hash = NULL;
int i, cindex, bb_num;
Modified: mono/mini/ldscript
===================================================================
@@ -5,6 +5,9 @@ VER_1 {
GC_start_blocking;
GC_end_blocking;
gc_thread_vtable;
+ __nacl_suspend_thread_if_needed;
+ __nacl_thread_suspension_needed;
+ nacl_mono_path;
local:
*;
};
Modified: mono/mini/method-to-ir.c
===================================================================
@@ -2413,7 +2413,9 @@
mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSignature *sig,
MonoInst **args, MonoInst *this, MonoInst *imt_arg, MonoInst *rgctx_arg)
{
+#ifndef DISABLE_REMOTING
gboolean might_be_remote = FALSE;
+#endif
gboolean virtual = this != NULL;
gboolean enable_for_aot = TRUE;
int context_used;
@@ -4219,7 +4221,7 @@
* CAS - do not inline methods with declarative security
* Note: this has to be before any possible return TRUE;
*/
- if (mono_method_has_declsec (method))
+ if (mono_security_method_has_declsec (method))
return FALSE;
#ifdef MONO_ARCH_SOFT_FLOAT
@@ -5692,7 +5694,7 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
{
guint32 result;
- if ((cfg->method != caller) && mono_method_has_declsec (callee)) {
+ if ((cfg->method != caller) && mono_security_method_has_declsec (callee)) {
return TRUE;
}
@@ -6191,7 +6193,7 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
dont_verify |= method->wrapper_type == MONO_WRAPPER_COMINTEROP;
dont_verify |= method->wrapper_type == MONO_WRAPPER_COMINTEROP_INVOKE;
- dont_verify |= mono_security_get_mode () == MONO_SECURITY_MODE_SMCS_HACK;
+ dont_verify |= mono_security_smcs_hack_enabled ();
/* still some type unsafety issues in marshal wrappers... (unknown is PtrToStructure) */
dont_verify_stloc = method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE;
@@ -6456,10 +6458,10 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
}
}
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS)
+ if (mono_security_cas_enabled ())
secman = mono_security_manager_get_methods ();
- security = (secman && mono_method_has_declsec (method));
+ security = (secman && mono_security_method_has_declsec (method));
/* at this point having security doesn't mean we have any code to generate */
if (security && (cfg->method == method)) {
/* Only Demand, NonCasDemand and DemandChoice requires code generation.
@@ -6547,7 +6549,7 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
mono_emit_method_call (cfg, secman->demandunmanaged, NULL, NULL);
}
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR) {
+ if (mono_security_core_clr_enabled ()) {
/* check if this is native code, e.g. an icall or a p/invoke */
if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) {
MonoMethod *wrapped = mono_marshal_method_from_wrapper (method);
@@ -7050,7 +7052,7 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
if (cfg->generic_sharing_context && mono_method_check_context_used (cmethod))
GENERIC_SHARING_FAILURE (CEE_JMP);
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS)
+ if (mono_security_cas_enabled ())
CHECK_CFG_EXCEPTION;
#ifdef MONO_ARCH_USE_OP_TAIL_CALL
@@ -7185,7 +7187,7 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
METHOD_ACCESS_FAILURE;
}
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
ensure_method_is_allowed_to_call_method (cfg, method, cil_method, bblock, ip);
if (!virtual && (cmethod->flags & METHOD_ATTRIBUTE_ABSTRACT))
@@ -7257,7 +7259,7 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
}
*/
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS) {
+ if (mono_security_cas_enabled ()) {
if (check_linkdemand (cfg, method, cmethod))
INLINE_FAILURE ("linkdemand");
CHECK_CFG_EXCEPTION;
@@ -8715,11 +8717,11 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
context_used = mini_method_check_context_used (cfg, cmethod);
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS) {
+ if (mono_security_cas_enabled ()) {
if (check_linkdemand (cfg, method, cmethod))
INLINE_FAILURE ("linkdemand");
CHECK_CFG_EXCEPTION;
- } else if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR) {
+ } else if (mono_security_core_clr_enabled ()) {
ensure_method_is_allowed_to_call_method (cfg, method, cmethod, bblock, ip);
}
@@ -9325,7 +9327,9 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
case CEE_LDSFLDA:
case CEE_STSFLD: {
MonoClassField *field;
+#ifndef DISABLE_REMOTING
int costs;
+#endif
guint foffset;
gboolean is_instance;
int op;
@@ -9376,12 +9380,12 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
UNVERIFIED;
/* if the class is Critical then transparent code cannot access it's fields */
- if (!is_instance && mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (!is_instance && mono_security_core_clr_enabled ())
ensure_method_is_allowed_to_access_field (cfg, method, field, bblock, ip);
/* XXX this is technically required but, so far (SL2), no [SecurityCritical] types (not many exists) have
any visible *instance* field (in fact there's a single case for a static field in Marshal) XXX
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
ensure_method_is_allowed_to_access_field (cfg, method, field, bblock, ip);
*/
@@ -10940,13 +10944,13 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
if (!dont_verify && !cfg->skip_visibility && !mono_method_can_access_method (method, cmethod))
METHOD_ACCESS_FAILURE;
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS) {
+ if (mono_security_cas_enabled ()) {
if (check_linkdemand (cfg, method, cmethod))
INLINE_FAILURE ("linkdemand");
CHECK_CFG_EXCEPTION;
- } else if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR) {
+ } else if (mono_security_core_clr_enabled ()) {
ensure_method_is_allowed_to_call_method (cfg, method, cmethod, bblock, ip);
- }
+ }
/*
* Optimize the common case of ldftn+delegate creation
@@ -10966,7 +10970,7 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
target_ins = sp [-1];
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR)
+ if (mono_security_core_clr_enabled ())
ensure_method_is_allowed_to_call_method (cfg, method, ctor_method, bblock, ip);
if (!(cmethod->flags & METHOD_ATTRIBUTE_STATIC)) {
@@ -11015,11 +11019,11 @@ gboolean check_linkdemand (MonoCompile *cfg, MonoMethod *caller, MonoMethod *cal
context_used = mini_method_check_context_used (cfg, cmethod);
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS) {
+ if (mono_security_cas_enabled ()) {
if (check_linkdemand (cfg, method, cmethod))
INLINE_FAILURE ("linkdemand");
CHECK_CFG_EXCEPTION;
- } else if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR) {
+ } else if (mono_security_core_clr_enabled ()) {
ensure_method_is_allowed_to_call_method (cfg, method, cmethod, bblock, ip);
}
Modified: mono/mini/mini-amd64.h
===================================================================
@@ -15,7 +15,15 @@
/* image-writer.c doesn't happen */
#define kNaClLengthOfCallImm kNaClAlignmentAMD64
-int is_nacl_call_reg_sequence(guint8* code);
+int is_nacl_call_reg_sequence (guint8* code);
+void amd64_nacl_clear_legacy_prefix_tag ();
+void amd64_nacl_tag_legacy_prefix (guint8* code);
+void amd64_nacl_tag_rex (guint8* code);
+guint8* amd64_nacl_get_legacy_prefix_tag ();
+guint8* amd64_nacl_get_rex_tag ();
+void amd64_nacl_instruction_pre ();
+void amd64_nacl_instruction_post (guint8 **start, guint8 **end);
+void amd64_nacl_membase_handler (guint8** code, gint8 basereg, gint32 offset, gint8 dreg);
#endif
#ifdef HOST_WIN32
Modified: mono/mini/mini-arm.c
===================================================================
@@ -25,7 +25,7 @@
#include "mono/arch/arm/arm-fpa-codegen.h"
#include "mono/arch/arm/arm-vfp-codegen.h"
-#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID)
+#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID) && !defined(__native_client__)
#define HAVE_AEABI_READ_TP 1
#endif
@@ -51,6 +51,29 @@
#define IS_SOFT_FLOAT 0
#endif
+#ifdef __native_client_codegen__
+const guint kNaClAlignment = kNaClAlignmentARM;
+const guint kNaClAlignmentMask = kNaClAlignmentMaskARM;
+gint8 nacl_align_byte = -1; /* 0xff */
+
+guint8 *
+mono_arch_nacl_pad (guint8 *code, int pad)
+{
+ /* Not yet properly implemented. */
+ g_assert_not_reached ();
+ return code;
+}
+
+guint8 *
+mono_arch_nacl_skip_nops (guint8 *code)
+{
+ /* Not yet properly implemented. */
+ g_assert_not_reached ();
+ return code;
+}
+
+#endif /* __native_client_codegen__ */
+
#define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1))
#if __APPLE__
@@ -198,8 +221,8 @@
return "unknown";
}
-#ifndef DISABLE_JIT
+#ifndef DISABLE_JIT
static guint8*
emit_big_add (guint8 *code, int dreg, int sreg, int imm)
{
@@ -762,11 +785,14 @@
mono_arch_init (void)
{
InitializeCriticalSection (&mini_arch_mutex);
-
+#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
if (mini_get_debug_options ()->soft_breakpoints) {
single_step_func_wrapper = create_function_wrapper (debugger_agent_single_step_from_context);
breakpoint_func_wrapper = create_function_wrapper (debugger_agent_breakpoint_from_context);
} else {
+#else
+ {
+#endif
ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT);
bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT);
mono_mprotect (bp_trigger_page, mono_pagesize (), 0);
@@ -988,6 +1014,11 @@
void
mono_arch_flush_icache (guint8 *code, gint size)
{
+#if defined(__native_client__)
+ // For Native Client we don't have to flush i-cache here,
+ // as it's being done by dyncode interface.
+#else
+
#ifdef MONO_CROSS_COMPILE
#elif __APPLE__
sys_icache_invalidate (code, size);
@@ -1014,6 +1045,7 @@
: "r" (code), "r" (code + size), "r" (0)
: "r0", "r1", "r3" );
#endif
+#endif /* !__native_client__ */
}
typedef enum {
@@ -6353,6 +6385,8 @@ enum {
return mono_arm_get_exception_trampolines (aot);
}
+
+#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
/*
* mono_arch_set_breakpoint:
*
@@ -6539,6 +6573,8 @@ enum {
MONO_CONTEXT_SET_IP (ctx, (guint8*)MONO_CONTEXT_GET_IP (ctx) + 4);
}
+#endif /* MONO_ARCH_SOFT_DEBUG_SUPPORTED */
+
/*
* mono_arch_get_seq_point_info:
*
Modified: mono/mini/mini-arm.h
===================================================================
@@ -9,6 +9,12 @@
#include <mono/utils/mono-context.h>
#include <glib.h>
+#ifdef __native_client_codegen__
+#define kNaClAlignmentARM 16
+#define kNaClAlignmentMaskARM (kNaClAlignmentARM - 1)
+#define kNaClLengthOfCallImm 4
+#endif
+
#if defined(ARM_FPU_NONE) || (defined(__ARM_EABI__) && !defined(ARM_FPU_VFP) && !defined(ARM_FPU_VFP_HARD))
#define MONO_ARCH_SOFT_FLOAT 1
#endif
@@ -188,6 +194,11 @@ struct MonoLMF {
#define ARM_LAST_ARG_REG 3
#define MONO_ARCH_USE_SIGACTION 1
+
+#if defined(__native_client__)
+#undef MONO_ARCH_USE_SIGACTION
+#endif
+
#define MONO_ARCH_NEED_DIV_CHECK 1
#define MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
@@ -221,8 +232,14 @@ struct MonoLMF {
#define MONO_ARCH_GSHAREDVT_SUPPORTED 1
#define MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE 1
+#if defined(__native_client__)
+#undef MONO_ARCH_SOFT_DEBUG_SUPPORTED
+#undef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
+#undef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG
+#endif
+
/* Matches the HAVE_AEABI_READ_TP define in mini-arm.c */
-#if defined(__ARM_EABI__) && defined(__linux__) && !defined(TARGET_ANDROID)
+#if defined(__ARM_EABI__) && defined(__linux__) && !defined(TARGET_ANDROID) && !defined(__native_client__)
#define MONO_ARCH_HAVE_TLS_GET 1
#endif
@@ -274,4 +291,3 @@ struct MonoLMF {
#endif
#endif /* __MONO_MINI_ARM_H__ */
-
Modified: mono/mini/mini-gc.c
===================================================================
@@ -603,8 +603,12 @@
} else {
tls->unwind_state.unwind_data [MONO_UNWIND_DATA_LMF] = mono_get_lmf ();
if (sigctx) {
+#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
mono_arch_sigctx_to_monoctx (sigctx, &tls->unwind_state.ctx);
tls->unwind_state.valid = TRUE;
+#else
+ tls->unwind_state.valid = FALSE;
+#endif
} else if (ctx) {
memcpy (&tls->unwind_state.ctx, ctx, sizeof (MonoContext));
tls->unwind_state.valid = TRUE;
Modified: mono/mini/mini-generic-sharing.c
===================================================================
@@ -1868,6 +1868,20 @@ class_type_info (MonoDomain *domain, MonoClass *class, MonoRgctxInfoType info_ty
*/
}
+static gboolean
+mini_method_is_open (MonoMethod *method)
+{
+ if (method->is_inflated) {
+ MonoGenericContext *ctx = mono_method_get_context (method);
+
+ if (ctx->class_inst && ctx->class_inst->is_open)
+ return TRUE;
+ if (ctx->method_inst && ctx->method_inst->is_open)
+ return TRUE;
+ }
+ return FALSE;
+}
+
static G_GNUC_UNUSED gboolean
is_async_state_machine_class (MonoClass *klass)
{
@@ -1978,8 +1992,12 @@ class_type_info (MonoDomain *domain, MonoClass *class, MonoRgctxInfoType info_ty
return FALSE;
/* This does potentially expensive cattr checks, so do it at the end */
- if (is_async_method (method))
+ if (is_async_method (method)) {
+ if (mini_method_is_open (method))
+ /* The JIT can't compile these without sharing */
+ return TRUE;
return FALSE;
+ }
return TRUE;
}
Modified: mono/mini/mini-llvm.h
===================================================================
@@ -106,9 +106,10 @@
#endif
if (binl != -1) {
char *base;
- char *name;
+ char *resolvedname, *name;
buf [binl] = 0;
- base = g_path_get_dirname (buf);
+ resolvedname = mono_path_resolve_symlinks (buf);
+ base = g_path_get_dirname (resolvedname);
name = g_strdup_printf ("%s/.libs", base);
err = NULL;
llvm_lib = try_llvm_load (name, &err);
@@ -121,6 +122,7 @@
g_free (name);
}
g_free (base);
+ g_free (resolvedname);
}
if (!llvm_lib) {
llvm_lib = try_llvm_load (NULL, &err);
Modified: mono/mini/mini-ops.h
===================================================================
@@ -925,7 +925,7 @@
/* #if defined(__native_client_codegen__) || defined(__native_client__) */
/* We have to define these in terms of the TARGET defines, not NaCl defines */
/* because
genmdesc.pl doesn't have multiple defines per platform. */
-#if defined(TARGET_AMD64) || defined(TARGET_X86)
+#if defined(TARGET_AMD64) || defined(TARGET_X86) || defined(TARGET_ARM)
MINI_OP(OP_NACL_GC_SAFE_POINT, "nacl_gc_safe_point", IREG, NONE, NONE)
#endif
Modified: mono/mini/mini-posix.c
===================================================================
@@ -100,7 +100,17 @@
{
}
+pid_t
+mono_runtime_syscall_fork (void)
+{
+ g_assert_not_reached();
+ return 0;
+}
+void
+mono_gdb_render_native_backtraces (pid_t crashed_pid)
+{
+}
#else
Modified: mono/mini/mini-trampolines.c
===================================================================
@@ -1680,7 +1680,9 @@
"aot_plt",
"delegate",
"restore_stack_prot",
+#ifndef DISABLE_REMOTING
"generic_virtual_remoting",
+#endif
"monitor_enter",
"monitor_exit",
"vcall",
Modified: mono/mini/mini.c
===================================================================
@@ -54,6 +54,7 @@
#include <mono/utils/mono-counters.h>
#include <mono/utils/mono-logger-internal.h>
#include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-path.h>
#include <mono/utils/mono-tls.h>
#include <mono/utils/dtrace.h>
@@ -1525,7 +1526,7 @@ void *mono_global_codeman_reserve (int size)
return FALSE;
if (assembly->in_gac || assembly->image == mono_defaults.corlib)
return FALSE;
- if (mono_security_get_mode () != MONO_SECURITY_MODE_NONE)
+ if (mono_security_enabled ())
return FALSE;
return mono_assembly_has_skip_verification (assembly);
}
@@ -3394,7 +3395,7 @@ void *mono_global_codeman_reserve (int size)
break;
}
case MONO_PATCH_INFO_JIT_TLS_ID: {
- target = (gpointer)mono_jit_tls_id;
+ target = (gpointer) (size_t) mono_jit_tls_id;
break;
}
default:
@@ -4060,7 +4061,7 @@ void *mono_global_codeman_reserve (int size)
printf ("Number of try block holes %d\n", num_holes);
}
- if (mono_method_has_declsec (cfg->method_to_register)) {
+ if (mono_security_method_has_declsec (cfg->method_to_register)) {
cas_size = sizeof (MonoMethodCasInfo);
}
@@ -5697,6 +5698,7 @@ void *mono_global_codeman_reserve (int size)
case MONO_EXCEPTION_FIELD_ACCESS:
ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "FieldAccessException", cfg->exception_message);
break;
+#ifndef DISABLE_SECURITY
/* this can only be set if the security manager is active */
case MONO_EXCEPTION_SECURITY_LINKDEMAND: {
MonoSecurityManager* secman = mono_security_manager_get_methods ();
@@ -5710,6 +5712,7 @@ void *mono_global_codeman_reserve (int size)
ex = (MonoException*)exc;
break;
}
+#endif
case MONO_EXCEPTION_OBJECT_SUPPLIED: {
MonoException *exp = cfg->exception_ptr;
MONO_GC_UNREGISTER_ROOT (cfg->exception_ptr);
@@ -5798,8 +5801,15 @@ void *mono_global_codeman_reserve (int size)
patch_info.data.method = method;
g_hash_table_remove (domain_jit_info (target_domain)->jump_target_hash, method);
+#if defined(__native_client_codegen__) && defined(__native_client__)
+ /* These patches are applied after a method has been installed, no target munging is needed. */
+ nacl_allow_target_modification (FALSE);
+#endif
for (tmp = jlist->list; tmp; tmp = tmp->next)
mono_arch_patch_code (NULL, target_domain, tmp->data, &patch_info, NULL, TRUE);
+#if defined(__native_client_codegen__) && defined(__native_client__)
+ nacl_allow_target_modification (TRUE);
+#endif
}
}
@@ -6094,7 +6104,7 @@ void *mono_global_codeman_reserve (int size)
mono_domain_unlock (domain);
if (!info) {
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR) {
+ if (mono_security_core_clr_enabled ()) {
/*
* This might be redundant since mono_class_vtable () already does this,
* but keep it just in case for moonlight.
@@ -7205,7 +7215,7 @@ void *mono_global_codeman_reserve (int size)
g_print ("JIT info table lookups: %ld\n", mono_stats.jit_info_table_lookup_count);
g_print ("Hazardous pointers: %ld\n", mono_stats.hazardous_pointer_count);
- if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS) {
+ if (mono_security_cas_enabled ()) {
g_print ("\nDecl security check : %ld\n", mono_jit_stats.cas_declsec_check);
g_print ("LinkDemand (user) : %ld\n", mono_jit_stats.cas_linkdemand);
g_print ("LinkDemand (icall) : %ld\n", mono_jit_stats.cas_linkdemand_icall);
Modified: mono/mini/mini.h
===================================================================
@@ -39,6 +39,11 @@
#include "mini-unwind.h"
#include "jit.h"
+#ifdef __native_client_codegen__
+#include <nacl/nacl_dyncode.h>
+#endif
+
+
/*
* The mini code should not have any compile time dependencies on the GC being used, so the same object file from mini/
* can be linked into both mono and mono-sgen.
@@ -1957,6 +1962,8 @@ enum {
#endif
#if defined(__native_client__) || defined(__native_client_codegen__)
+extern volatile int __nacl_thread_suspension_needed;
+extern void __nacl_suspend_thread_if_needed();
void mono_nacl_gc();
#endif
Modified: mono/mini/nacl.cs
===================================================================
@@ -1,67 +1,145 @@
using System;
using Mono.Simd;
+using System.Threading;
+
+class A {
+ public void Print() { Console.WriteLine("A"); }
+}
+
+class B : A {
+ public void Print() { Console.WriteLine("B"); }
+}
+
+class ThreadRunner {
+ public Int32 Inc2(Int32 a) { return Inc1(a); }
+ public Int32 Inc1(Int32 a) { return a + 2; }
+ public void PrintA(A a) { a.Print(); ((B)a).Print(); }
+ public void Run() {
+ Console.WriteLine("Running thread" );
+ B b = new B();
+ Int32 a=0;
+ for(int i = 0; i < 1000000; i++) {
+ a = Inc2(a);
+ if(i % 100000 == 0) PrintA(b);
+ }
+ Console.WriteLine("Ending thread");
+ }
+}
+
+
+class Extensions { public static string BogusProperty { get; set; } }
+
+class RuntimeServices {
+ public System.Reflection.MemberInfo[] members = typeof(Extensions).GetMembers();
+ public void Run() {
+ foreach (var m in members) System.Console.WriteLine(m);
+ }
+}
class Tests {
struct myvt {
- public int X;
- public int Y;
+ public int X;
+ public int Y;
}
static int test_0_vector4i_cmp_gt () {
- Vector4i a = new Vector4i (10, 5, 12, -1);
+ Vector4i a = new Vector4i (10, 5, 12, -1);
Vector4i b = new Vector4i (-1, 5, 10, 10);
Vector4i c = a.CompareGreaterThan (b);
-
+
if (c.X != -1)
return 1;
if (c.Y != 0)
return 2;
if (c.Z != -1)
- return 3;
+ return 3;
if (c.W != 0)
- return 4;
+ return 4;
return 0;
}
static myvt CompareGT(myvt a, myvt b) {
- myvt r;
- r.X = a.X > b.X ? -1 : 0;
- r.Y = a.Y > b.Y ? -1 : 0;
- return r;
+ myvt r;
+ r.X = a.X > b.X ? -1 : 0;
+ r.Y = a.Y > b.Y ? -1 : 0;
+ return r;
}
static int test_0_struct2i_cmp_gt() {
- myvt a;
- myvt b;
- a.X = 10;
- a.Y = 5;
- b.X = -1;
- b.Y = 5;
- myvt c = CompareGT(a, b);
- if (c.X != -1)
- return 1;
- if (c.Y != 0)
- return 2;
- return 0;
+ myvt a;
+ myvt b;
+ a.X = 10;
+ a.Y = 5;
+ b.X = -1;
+ b.Y = 5;
+ myvt c = CompareGT(a, b);
+ if (c.X != -1)
+ return 1;
+ if (c.Y != 0)
+ return 2;
+ return 0;
}
static int vararg_sum(params int[] args) {
- int sum = 0;
- foreach(int arg in args) {
- sum += arg;
- }
- return sum;
+ int sum = 0;
+ foreach(int arg in args) {
+ sum += arg;
+ }
+ return sum;
}
static int test_21_vararg_test() {
- int sum = 0;
- sum += vararg_sum();
- sum += vararg_sum(1);
- sum += vararg_sum(2, 3);
- sum += vararg_sum(4, 5, 6);
- return sum;
+ int sum = 0;
+ sum += vararg_sum();
+ sum += vararg_sum(1);
+ sum += vararg_sum(2, 3);
+ sum += vararg_sum(4, 5, 6);
+ return sum;
}
+
+ static int test_0_threads() {
+ // Run a bunch of threads, make them JIT some code and
+ // do some casts
+ ThreadRunner runner = new ThreadRunner();
+ Thread[] threads = new Thread[10];
+ for (int i = 0; i < 10; i++) {
+ threads[i] = new Thread(new ThreadStart(runner.Run));
+ threads[i].Start();
+ }
+ for (int i = 0; i < 10; i++) {
+ threads[i].Join();
+ }
+ return 0;
+ }
+
+
+ static int test_0_reflection() {
+ RuntimeServices r = new RuntimeServices();
+ r.Run();
+ return 0;
+ }
+
+ public class BaseClass {
+ }
+
+ public class LongClass : BaseClass {
+ public long Value;
+ public LongClass(long val) { Value = val; }
+ }
+
+ static public long add_two_LongClass(BaseClass l1, BaseClass l2) {
+ long l = checked (((LongClass)l1).Value + ((LongClass)l2).Value);
+ return l;
+ }
+
+ static int test_0_laddcc() {
+ long l = add_two_LongClass(new LongClass(System.Int64.MinValue), new LongClass(1234));
+ if (l == 1234)
+ return 1;
+ return 0;
+ }
+
public static int Main(String[] args) {
- return TestDriver.RunTests(typeof(Tests));
+ return TestDriver.RunTests(typeof(Tests));
}
}
Modified: mono/mini/objects.cs
===================================================================
@@ -114,8 +114,8 @@ struct Gamma {
class Tests {
- static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_0_return () {
Modified: mono/mini/regalloc.h
===================================================================
@@ -1,5 +1,8 @@
-
+#if defined(__native_client__) && defined(__x86_64__)
+typedef guint64 regmask_t;
+#else
typedef size_t regmask_t;
+#endif
enum {
MONO_REG_INT,
Modified: mono/mini/wapihandles.c
===================================================================
@@ -3,7 +3,7 @@
#include "mini.h"
-#if defined(HOST_WIN32) || !defined(HAVE_SYS_IPC_H) || !defined(HAVE_SYS_SEM_H)
+#if defined(HOST_WIN32) || !defined(HAVE_SYS_IPC_H) || !defined(HAVE_SYS_SEM_H) || (defined(__native_client__) && defined(__GLIBC__))
int mini_wapi_hps (int argc, char **argv)
{
Modified: mono/monograph/monograph.c
===================================================================
@@ -18,6 +18,11 @@
static int verbose = 0;
static const char *graph_properties = "\tnode [fontsize=8.0]\n\tedge [len=2,color=red]\n";
+#if defined(__native_client__) || defined(__native_client_codegen__)
+volatile int __nacl_thread_suspension_needed = 0;
+void __nacl_suspend_thread_if_needed() {}
+#endif
+
static void
output_type_edge (MonoClass *first, MonoClass *second) {
if (include_namespace)
@@ -1200,5 +1205,3 @@ enum {
fclose (output);
return 0;
}
-
-
Modified: mono/profiler/Makefile.am
===================================================================
@@ -82,7 +82,11 @@ MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162 -now
testlog: $(PLOG_TESTS)
$(with_mono_path) perl $(srcdir)/
ptestrunner.pl $(top_builddir)
+if NACL_CODEGEN
+check-local:
+else
check-local: testlog
+endif
EXTRA_DIST=utils.c utils.h proflog.h log-profiler.txt perf_event.h \
$(PLOG_TESTS_SRC)
ptestrunner.pl
Modified: mono/profiler/decode.c
===================================================================
@@ -27,6 +27,11 @@
#define HASH_SIZE 9371
#define SMALL_HASH_SIZE 31
+#if defined(__native_client__) || defined(__native_client_codegen__)
+volatile int __nacl_thread_suspension_needed = 0;
+void __nacl_suspend_thread_if_needed() {}
+#endif
+
static int debug = 0;
static int collect_traces = 0;
static int show_traces = 0;
Modified: mono/tests/Makefile.am
===================================================================
@@ -446,6 +446,91 @@ PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe
#PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe exception17.exe
endif
+if NACL_CODEGEN
+# Tests that use Thread.Abort()
+PLATFORM_DISABLED_TESTS= abort-stress-1.exe \
+ abort-stress-2.exe \
+ abort-stress-3.exe \
+ appdomain-thread-abort.exe \
+ async-exc-compilation.exe \
+ bug-561239.exe \
+ bug-70561.exe \
+ finalizer-abort.exe \
+ finally_guard.exe \
+ main-returns-abort-resetabort.exe \
+ main-returns-background-abort-resetabort.exe \
+ thread6.exe \
+ threadpool-exceptions5.exe \
+ threadpool-exceptions6.exe
+
+# Tests that rely on AppDomain.Unload
+PLATFORM_DISABLED_TESTS+= appdomain-async-invoke.exe \
+ appdomain-exit.exe \
+ appdomain-unload-callback.exe \
+ appdomain-unload.exe \
+ domain-stress.exe \
+ generic-unloading.2.exe \
+ monitor.exe \
+ remoting4.exe \
+ threadpool-exceptions7.exe \
+ xdomain-threads.exe
+
+# pinvoke2 attaches a thread to the runtime, but
+# doesn't 'unattach' it and it hangs in GC on exit
+PLATFORM_DISABLED_TESTS+= pinvoke2.exe
+
+# Tests that currently hang waiting for non-main threads
+# to exit in NaCl, need to investigate. Most are AppDomain
+# creation and Delegate tests.
+PLATFORM_DISABLED_TESTS+= appdomain1.exe \
+ delegate9.exe \
+ marshal-valuetypes.exe \
+ cross-domain.exe \
+ stackframes-async.2.exe \
+ generic-marshalbyref.2.exe \
+ generic-xdomain.2.exe \
+ bug-415577.exe
+
+# Tests that fail trying to write files (appdomain create mostly)
+PLATFORM_DISABLED_TESTS+= bug-335131.2.exe \
+ bug-349190.2.exe \
+ bug-80307.exe \
+ bug-462592.exe
+
+# FIXME: don't know why delegate2.exe fails, it shouldn't
+PLATFORM_DISABLED_TESTS+= delegate2.exe
+
+# These tests newly fail with the latest revision. pinvoke3 fails because
+# of a thread attach, the others have not been investigated. TODO revisit.
+PLATFORM_DISABLED_TESTS+= pinvoke3.exe \
+ async_read.exe \
+ async-with-cb-throws.exe \
+ appdomain-unload-doesnot-raise-pending-events.exe \
+ gsharing-valuetype-layout.exe
+
+if X86
+# FIXME: There are problems with async callbacks and results on NaCl 32-bit
+PLATFORM_DISABLED_TESTS+= delegate1.exe \
+ delegate3.exe \
+ delegate5.exe \
+ delegate8.exe \
+ threadpool.exe \
+ threadpool1.exe \
+ threadpool-exceptions3.exe \
+ bug-323114.exe \
+ delegate-exit.exe \
+ bug-80392.2.exe
+
+# FIXME: These tests hang/fail for unknown reasons, deal with exiting
+PLATFORM_DISABLED_TESTS+= main-returns-background-resetabort.exe \
+ main-returns-background.exe \
+ main-returns-background-change.exe
+endif
+
+endif
+
+# The two finalizer tests only work under sgen
+# gc-altstack.exe fails under boehm because it has no support for altstack
# bug-459094.exe creates an extremely deep directory tree
# delegate-invoke.exe depends on 929c6bc9b6d76a273f251e6f5dfacac36e9c38bd which was
# reverted.
@@ -599,17 +684,25 @@ tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS)
libtest.la $(PREREQSI_IL) $(PREREQSI_
# Test that no symbols are missed in eglib-remap.h
#
OK_G_SYMBOLS='g_list\|g_slist\|g_concat_dir_and_file'
+if NACL_CODEGEN
+test-eglib-remap:
+else
test-eglib-remap:
@echo "Testing eglib remap..."
@if which nm > /dev/null; then if nm $(top_builddir)/mono/mini/mono | grep -v $(OK_G_SYMBOLS) | grep 't g_'; then exit 1; else exit 0; fi; fi
+endif
#
# Tests that the internals in mono/io-layer/messages.c are ok by triggering the
# code that checks that the table is properly sorted
#
+if NACL_CODEGEN
+test-messages:
+else
test-messages: w32message.exe
> test_messages.zero
$(with_mono_path) $(JITTEST_PROG_RUN) w32message.exe >& w32message.allout && cmp test_messages.zero w32message.allout
+endif
if MOONLIGHT
test_2_1 : test-coreclr-security
@@ -1039,8 +1132,12 @@ test-generic-sharing-normal: $(GSHARED_TESTS)
test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
@$(RUNTIME) ./test-runner.exe -j a --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
+if NACL_CODEGEN
+test-generic-sharing:
+else
test-generic-sharing:
@if test x$(M) != x; then $(MAKE) test-generic-sharing-managed; else $(MAKE) test-generic-sharing-normal; fi
+endif
EXTRA_DIST += async-exceptions.cs
async-exceptions.exe : async-exceptions.cs
@@ -1062,6 +1159,10 @@ patch-libtool:
sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = bash ./libtool" > 1 && cat 1 2 > Makefile
touch libtest.c
+
+if NACL_CODEGEN
+test-process-exit:
+else
EXTRA_DIST += bug-438454.cs bug-438454.exe.stdout.expected threadpool-in-processexit.cs threadpool-in-processexit.exe.stdout.expected
test-process-exit:
@$(MCS) $(srcdir)/bug-438454.cs -out:bug-438454.exe
@@ -1072,6 +1173,7 @@ test-process-exit:
@echo "Testing threadpool-in-processexit.exe..."
@$(RUNTIME) threadpool-in-processexit.exe > threadpool-in-processexit.exe.stdout
@diff -w threadpool-in-processexit.exe.stdout $(srcdir)/threadpool-in-processexit.exe.stdout.expected
+endif
OOM_TESTS = \
gc-oom-handling.exe \
Modified: mono/utils/atomic.h
===================================================================
@@ -733,6 +733,14 @@ static inline gint32 InterlockedExchangeAdd(volatile gint32 *dest, gint32 add)
#elif defined(__arm__)
+#ifdef __native_client__
+#define MASK_REGISTER(reg, cond) "bic" cond " " reg ", " reg ", #0xc0000000\n"
+#define NACL_ALIGN() ".align 4\n"
+#else
+#define MASK_REGISTER(reg, cond)
+#define NACL_ALIGN()
+#endif
+
/*
* Atomic operations on ARM doesn't contain memory barriers, and the runtime code
* depends on this, so we add them explicitly.
@@ -743,11 +751,16 @@ static inline gint32 InterlockedCompareExchange(volatile gint32 *dest, gint32 ex
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7S__)
gint32 ret, tmp;
__asm__ __volatile__ ( "1:\n"
+ NACL_ALIGN()
"dmb\n"
"mov %0, #0\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"ldrex %1, [%2]\n"
"teq %1, %3\n"
"it eq\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "eq")
"strexeq %0, %4, [%2]\n"
"teq %0, #0\n"
"bne 1b\n"
@@ -761,12 +774,18 @@ static inline gint32 InterlockedCompareExchange(volatile gint32 *dest, gint32 ex
gint32 a, b;
__asm__ __volatile__ ( "0:\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"ldr %1, [%2]\n\t"
"cmp %1, %4\n\t"
"mov %0, %1\n\t"
"bne 1f\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"swp %0, %3, [%2]\n\t"
"cmp %0, %1\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "ne")
"swpne %3, %0, [%2]\n\t"
"bne 0b\n\t"
"1:"
@@ -785,10 +804,15 @@ static inline gpointer InterlockedCompareExchangePointer(volatile gpointer *dest
__asm__ __volatile__ (
"dmb\n"
"1:\n"
+ NACL_ALIGN()
"mov %0, #0\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"ldrex %1, [%2]\n"
"teq %1, %3\n"
"it eq\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "eq")
"strexeq %0, %4, [%2]\n"
"teq %0, #0\n"
"bne 1b\n"
@@ -802,12 +826,18 @@ static inline gpointer InterlockedCompareExchangePointer(volatile gpointer *dest
gpointer a, b;
__asm__ __volatile__ ( "0:\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"ldr %1, [%2]\n\t"
"cmp %1, %4\n\t"
"mov %0, %1\n\t"
"bne 1f\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "eq")
"swpeq %0, %3, [%2]\n\t"
"cmp %0, %1\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "ne")
"swpne %3, %0, [%2]\n\t"
"bne 0b\n\t"
"1:"
@@ -826,8 +856,12 @@ static inline gint32 InterlockedIncrement(volatile gint32 *dest)
__asm__ __volatile__ (
"dmb\n"
"1:\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"ldrex %0, [%2]\n"
"add %0, %0, %3\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"strex %1, %0, [%2]\n"
"teq %1, #0\n"
"bne 1b\n"
@@ -841,10 +875,16 @@ static inline gint32 InterlockedIncrement(volatile gint32 *dest)
gint32 a, b, c;
__asm__ __volatile__ ( "0:\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"ldr %0, [%3]\n\t"
"add %1, %0, %4\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"swp %2, %1, [%3]\n\t"
"cmp %0, %2\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "ne")
"swpne %1, %2, [%3]\n\t"
"bne 0b"
: "=&r" (a), "=&r" (b), "=&r" (c)
@@ -862,8 +902,12 @@ static inline gint32 InterlockedDecrement(volatile gint32 *dest)
__asm__ __volatile__ (
"dmb\n"
"1:\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"ldrex %0, [%2]\n"
"sub %0, %0, %3\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%2", "al")
"strex %1, %0, [%2]\n"
"teq %1, #0\n"
"bne 1b\n"
@@ -877,10 +921,16 @@ static inline gint32 InterlockedDecrement(volatile gint32 *dest)
gint32 a, b, c;
__asm__ __volatile__ ( "0:\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"ldr %0, [%3]\n\t"
"add %1, %0, %4\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"swp %2, %1, [%3]\n\t"
"cmp %0, %2\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "ne")
"swpne %1, %2, [%3]\n\t"
"bne 0b"
: "=&r" (a), "=&r" (b), "=&r" (c)
@@ -898,7 +948,11 @@ static inline gint32 InterlockedExchange(volatile gint32 *dest, gint32 exch)
__asm__ __volatile__ (
"dmb\n"
"1:\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"ldrex %0, [%3]\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"strex %1, %2, [%3]\n"
"teq %1, #0\n"
"bne 1b\n"
@@ -910,7 +964,9 @@ static inline gint32 InterlockedExchange(volatile gint32 *dest, gint32 exch)
#else
gint32 a;
- __asm__ __volatile__ ( "swp %0, %2, [%1]"
+ __asm__ __volatile__ ( NACL_ALIGN()
+ MASK_REGISTER("%1", "al")
+ "swp %0, %2, [%1]"
: "=&r" (a)
: "r" (dest), "r" (exch));
@@ -925,7 +981,11 @@ static inline gpointer InterlockedExchangePointer(volatile gpointer *dest, gpoin
__asm__ __volatile__ (
"dmb\n"
"1:\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"ldrex %0, [%3]\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"strex %1, %2, [%3]\n"
"teq %1, #0\n"
"bne 1b\n"
@@ -937,7 +997,9 @@ static inline gpointer InterlockedExchangePointer(volatile gpointer *dest, gpoin
#else
gpointer a;
- __asm__ __volatile__ ( "swp %0, %2, [%1]"
+ __asm__ __volatile__ ( NACL_ALIGN()
+ MASK_REGISTER("%1", "al")
+ "swp %0, %2, [%1]"
: "=&r" (a)
: "r" (dest), "r" (exch));
@@ -952,8 +1014,12 @@ static inline gint32 InterlockedExchangeAdd(volatile gint32 *dest, gint32 add)
__asm__ __volatile__ (
"dmb\n"
"1:\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"ldrex %0, [%3]\n"
"add %1, %0, %4\n"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"strex %2, %1, [%3]\n"
"teq %2, #0\n"
"bne 1b\n"
@@ -967,10 +1033,16 @@ static inline gint32 InterlockedExchangeAdd(volatile gint32 *dest, gint32 add)
int a, b, c;
__asm__ __volatile__ ( "0:\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"ldr %0, [%3]\n\t"
"add %1, %0, %4\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "al")
"swp %2, %1, [%3]\n\t"
"cmp %0, %2\n\t"
+ NACL_ALIGN()
+ MASK_REGISTER("%3", "ne")
"swpne %1, %2, [%3]\n\t"
"bne 0b"
: "=&r" (a), "=&r" (b), "=&r" (c)
Modified: mono/utils/mono-codeman.c
===================================================================
@@ -91,7 +91,7 @@ struct _MonoCodeManager {
CodeChunk *current;
CodeChunk *full;
#if defined(__native_client_codegen__) && defined(__native_client__)
- MonoGHashTable *hash;
+ GHashTable *hash;
#endif
};
@@ -228,14 +228,16 @@ struct _MonoCodeManager {
if (next_dynamic_code_addr == NULL) {
const guint kPageMask = 0xFFFF; /* 64K pages */
next_dynamic_code_addr = (uintptr_t)(etext + kPageMask) & ~kPageMask;
+#if defined (__GLIBC__)
+ /* TODO: For now, just jump 64MB ahead to avoid dynamic libraries. */
+ next_dynamic_code_addr += (uintptr_t)0x4000000;
+#else
/* Workaround bug in service runtime, unable to allocate */
/* from the first page in the dynamic code section. */
- /* TODO: remove */
next_dynamic_code_addr += (uintptr_t)0x10000;
+#endif
}
- cman->hash = mono_g_hash_table_new (NULL, NULL);
- /* Keep the hash table from being collected */
- mono_gc_register_root (&cman->hash, sizeof (void*), NULL);
+ cman->hash = g_hash_table_new (NULL, NULL);
if (patch_source_base == NULL) {
patch_source_base = g_malloc (kMaxPatchDepth * sizeof(unsigned char *));
patch_dest_base = g_malloc (kMaxPatchDepth * sizeof(unsigned char *));
@@ -546,7 +548,7 @@ struct _MonoCodeManager {
/* Allocate code space from the service runtime */
code_ptr = allocate_code (size);
/* Insert pointer to code space in hash, keyed by buffer ptr */
- mono_g_hash_table_insert (cman->hash, temp_ptr, code_ptr);
+ g_hash_table_insert (cman->hash, temp_ptr, code_ptr);
nacl_jit_check_init ();
@@ -598,7 +600,7 @@ struct _MonoCodeManager {
unsigned char *code;
int status;
g_assert (newsize <= size);
- code = mono_g_hash_table_lookup (cman->hash, data);
+ code = g_hash_table_lookup (cman->hash, data);
g_assert (code != NULL);
/* Pad space after code with HLTs */
/* TODO: this is x86/amd64 specific */
@@ -608,9 +610,15 @@ struct _MonoCodeManager {
}
status = nacl_dyncode_create (code, data, newsize);
if (status != 0) {
+ unsigned char *codep;
+ fprintf(stderr, "Error creating Native Client dynamic code section attempted to be\n"
+ "emitted at %p (hex dissasembly of code follows):\n", code);
+ for (codep = data; codep < data + newsize; codep++)
+ fprintf(stderr, "%02x ", *codep);
+ fprintf(stderr, "\n");
g_assert_not_reached ();
}
- mono_g_hash_table_remove (cman->hash, data);
+ g_hash_table_remove (cman->hash, data);
g_assert (data == patch_source_base[patch_current_depth]);
g_assert (code == patch_dest_base[patch_current_depth]);
patch_current_depth--;
@@ -623,7 +631,7 @@ struct _MonoCodeManager {
void *
nacl_code_manager_get_code_dest (MonoCodeManager *cman, void *data)
{
- return mono_g_hash_table_lookup (cman->hash, data);
+ return g_hash_table_lookup (cman->hash, data);
}
#endif
Modified: mono/utils/mono-context.c
===================================================================
@@ -252,6 +252,8 @@
{
#ifdef MONO_CROSS_COMPILE
g_assert_not_reached ();
+#elif defined(__native_client__)
+ g_assert_not_reached ();
#else
arm_ucontext *my_uc = sigctx;
@@ -270,6 +272,8 @@
{
#ifdef MONO_CROSS_COMPILE
g_assert_not_reached ();
+#elif defined(__native_client__)
+ g_assert_not_reached ();
#else
arm_ucontext *my_uc = ctx;
Modified: mono/utils/mono-mmap.c
===================================================================
@@ -405,6 +405,20 @@
*
* Returns: 0 on success.
*/
+#if defined(__native_client__)
+int
+mono_mprotect (void *addr, size_t length, int flags)
+{
+ int prot = prot_from_flags (flags);
+ void *new_addr;
+
+ if (flags & MONO_MMAP_DISCARD) memset (addr, 0, length);
+
+ new_addr = mmap(addr, length, prot, MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
+ if (new_addr == addr) return 0;
+ return -1;
+}
+#else
int
mono_mprotect (void *addr, size_t length, int flags)
{
@@ -427,6 +441,7 @@
}
return mprotect (addr, length, prot);
}
+#endif // __native_client__
#else
Modified: mono/utils/mono-path.c
===================================================================
@@ -44,14 +44,9 @@
if (g_path_is_absolute (path)) {
abspath = g_strdup (path);
} else {
-#ifdef __native_client__
- gchar *tmpdir = ".";
- abspath = g_build_filename (tmpdir, path, NULL);
-#else
gchar *tmpdir = g_get_current_dir ();
abspath = g_build_filename (tmpdir, path, NULL);
g_free (tmpdir);
-#endif
}
#ifdef HOST_WIN32
Modified: mono/utils/mono-threads-mach.c
===================================================================
@@ -49,13 +49,18 @@
mono_threads_core_suspend (MonoThreadInfo *info)
{
kern_return_t ret;
+ gboolean res;
+
g_assert (info);
ret = thread_suspend (info->native_handle);
if (ret != KERN_SUCCESS)
return FALSE;
- return mono_threads_get_runtime_callbacks ()->
+ res = mono_threads_get_runtime_callbacks ()->
thread_state_init_from_handle (&info->suspend_state, mono_thread_info_get_tid (info), info->native_handle);
+ if (!res)
+ thread_resume (info->native_handle);
+ return res;
}
gboolean
Modified: mono/utils/mono-threads-posix.c
===================================================================
@@ -169,6 +169,9 @@
errno = old_errno;
}
return result;
+#elif defined(__native_client__)
+ /* Workaround pthread_kill abort() in NaCl glibc. */
+ return 0;
#else
return pthread_kill (mono_thread_info_get_tid (info), signum);
#endif
Modified: mono/utils/monobitset.c
===================================================================
@@ -285,7 +285,11 @@
if ((mask == 0) || (nth_bit == BITS_PER_CHUNK))
return -1;
-#if defined(__i386__) && defined(__GNUC__)
+#if defined(__native_client__) && (defined(__i386__) || defined(__x86_64))
+#define USE_X86_32BIT_INSTRUCTIONS 1
+#endif
+
+#if (defined(__i386__) && defined(__GNUC__)) || defined(USE_X86_32BIT_INSTRUCTIONS)
{
int r;
/* This depends on mask != 0 */
@@ -315,7 +319,7 @@
my_g_bit_nth_lsf_nomask (gsize mask)
{
/* Mask is expected to be != 0 */
-#if defined(__i386__) && defined(__GNUC__)
+#if (defined(__i386__) && defined(__GNUC__)) || defined(USE_X86_32BIT_INSTRUCTIONS)
int r;
__asm__("bsfl %1,%0\n\t"
@@ -817,4 +821,3 @@
}
#endif
-
Modified: msvc/libmonoruntime.vcxproj
===================================================================
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="
http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug_SGen|Win32">
@@ -96,7 +96,6 @@
<ClCompile Include="..\mono\metadata\sgen-hash-table.c" />
<ClCompile Include="..\mono\metadata\sgen-internal.c" />
<ClCompile Include="..\mono\metadata\sgen-los.c" />
- <ClCompile Include="..\mono\metadata\sgen-major-copying.c" />
<ClCompile Include="..\mono\metadata\sgen-marksweep-fixed-par.c" />
<ClCompile Include="..\mono\metadata\sgen-marksweep-fixed.c" />
<ClCompile Include="..\mono\metadata\sgen-marksweep-par.c" />
@@ -112,7 +111,6 @@
<ClCompile Include="..\mono\metadata\sgen-protocol.c" />
<ClCompile Include="..\mono\metadata\sgen-simple-nursery.c" />
<ClCompile Include="..\mono\metadata\sgen-split-nursery.c" />
- <ClCompile Include="..\mono\metadata\sgen-ssb.c" />
<ClCompile Include="..\mono\metadata\sgen-toggleref.c" />
<ClCompile Include="..\mono\metadata\sgen-workers.c" />
<ClCompile Include="..\mono\metadata\socket-io.c" />
@@ -198,7 +196,6 @@
<ClInclude Include="..\mono\metadata\sgen-pinning.h" />
<ClInclude Include="..\mono\metadata\sgen-protocol.h" />
<ClInclude Include="..\mono\metadata\sgen-scan-object.h" />
- <ClInclude Include="..\mono\metadata\sgen-ssb.h" />
<ClInclude Include="..\mono\metadata\sgen-toggleref.h" />
<ClInclude Include="..\mono\metadata\sgen-workers.h" />
<ClInclude Include="..\mono\metadata\socket-io.h" />
Modified: runtime/Makefile.am
===================================================================
@@ -169,8 +169,12 @@ mcs-compileall: mono-wrapper etc/mono/config
fi; done; done; \
$$ok
+if NACL_CODEGEN
+check-local:
+else
check-local: mcs-compileall mcs-do-test-profiles
$(MAKE) $(test_select) mcs-do-run-test-profiles
+endif
# Compile all mcs tests
test: mcs-do-test-profiles
Modified: runtime/
mono-wrapper.in
===================================================================
@@ -4,4 +4,13 @@ MONO_CFG_DIR='@mono_cfg_dir@'
PATH="$r/runtime/_tmpinst/bin:$PATH"
MONO_SHARED_DIR=$r/runtime
export MONO_CFG_DIR MONO_SHARED_DIR PATH
+if [ -n "@nacl_self_host@" ]; then
+ case "$@" in
+ # gacutil.exe and mdoc.exe require filesystem functionality not
+ # exposed in NaCl.
+ # mcs.exe was added to the list recently because mcs under NaCl
+ # no longer produces equivalent output. TODO: investigate
+ */mcs.exe* | */gacutil.exe* | */mdoc.exe* ) exec /usr/local/bin/mono "$@";;
+ esac
+fi
exec "$r/libtool" --mode=execute "$r/@mono_runtime@" --config "@mono_cfg_dir@/mono/config" "$@"
Modified: tools/sgen/sgen-grep-binprot.c
===================================================================
@@ -19,6 +19,7 @@
if (fread (&type, 1, 1, in) != 1)
return SGEN_PROTOCOL_EOF;
switch (type) {
+ case SGEN_PROTOCOL_COLLECTION_FORCE: size = sizeof (SGenProtocolCollectionForce); break;
case SGEN_PROTOCOL_COLLECTION_BEGIN: size = sizeof (SGenProtocolCollection); break;
case SGEN_PROTOCOL_COLLECTION_END: size = sizeof (SGenProtocolCollection); break;
case SGEN_PROTOCOL_ALLOC: size = sizeof (SGenProtocolAlloc); break;
@@ -61,6 +62,11 @@
print_entry (int type, void *data)
{
switch (type) {
+ case SGEN_PROTOCOL_COLLECTION_FORCE: {
+ SGenProtocolCollectionForce *entry = data;
+ printf ("collection force generation %d\n", entry->generation);
+ break;
+ }
case SGEN_PROTOCOL_COLLECTION_BEGIN: {
SGenProtocolCollection *entry = data;
printf ("collection begin %d generation %d\n", entry->index, entry->generation);
@@ -201,6 +207,7 @@
is_match (gpointer ptr, int type, void *data)
{
switch (type) {
+ case SGEN_PROTOCOL_COLLECTION_FORCE:
case SGEN_PROTOCOL_COLLECTION_BEGIN:
case SGEN_PROTOCOL_COLLECTION_END:
case SGEN_PROTOCOL_THREAD_SUSPEND:
@@ -278,17 +285,26 @@
}
}
+static gboolean dump_all = FALSE;
+
int
main (int argc, char *argv[])
{
int type;
void *data;
- int num_nums = argc - 1;
+ int num_args = argc - 1;
+ int num_nums = 0;
int i;
- long nums [num_nums];
+ long nums [num_args];
- for (i = 0; i < num_nums; ++i)
- nums [i] = strtoul (argv [i + 1], NULL, 16);
+ for (i = 0; i < num_args; ++i) {
+ char *arg = argv [i + 1];
+ if (!strcmp (arg, "--all")) {
+ dump_all = TRUE;
+ } else {
+ nums [num_nums++] = strtoul (arg, NULL, 16);
+ }
+ }
while ((type = read_entry (stdin, &data)) != SGEN_PROTOCOL_EOF) {
gboolean match = FALSE;
@@ -298,7 +314,9 @@
break;
}
}
- if (match)
+ if (dump_all)
+ printf (match ? "* " : " ");
+ if (match || dump_all)
print_entry (type, data);
free (data);
}