Compare commits

...
Author SHA1 Message Date
Radek Doulik 53ae105755 Instead of preserving every method with a [Register] attribute...
[merged from monodroid by rodo]

part of

commit 0b9c100b60fc2502a0d6347d50cac444bb82b285
Author: Jonathan Pobst <[email protected]>
Date:   Wed Sep 28 15:50:39 2011 -0500

    Instead of preserving every method with a [Register] attribute on it in Mono.Android.dll, only save the things that the user actually uses.  Reduces HelloWorld release apk by ~1.3MB.
2015-06-05 13:54:39 +02:00
Radek Doulik 569dabc96c return count of marked methods
[merged from monodroid by rodo]

 - part of

commit 216f75038afee2105182fc6af329f1fc83c4298f
Author: Radek Doulik <[email protected]>
Date:   Sun Nov 23 11:40:42 2014 +0100

    [linker] mark methods (from Register attr) in base type when needed

     - fixes #10268
     - methods from these Register attributes were not marked:

       https://github.com/xamarin/monodroid/blob/master/src/Mono.Android/src/Android.Widget/AdapterView.cs#L132-135

       because the app used class derived from BaseAdapter class and the methods
       existed only in the base class and were not marked
2015-06-05 13:54:33 +02:00
Radek Doulik 28a9d7be6d fix Linking for assemblies with type forwarders (like PCL)
[merged from monodroid by rodo]

commit 840487dd904a5552f77dcc7388b27c37ca09169f
Author: Radek Doulik <[email protected]>
Date:   Thu Oct 16 20:03:58 2014 +0200

     - sometime the assemblies with action set to Copy still might
       contain type references to forwarders and thus point to
       Delete assemblies, which are removed during linking, resulting
       in unresolvable type references

     - fixes https://bugzilla.xamarin.com/show_bug.cgi?id=23617
       XA forms template now builds and works OK
       XA app template builds and works OK
2015-06-05 13:54:21 +02:00
Radek Doulik b6cb370f53 process only .xml files, catch xml exceptions
[merged from monodroid by rodo]

commit f51f044e30b822f191777a395563ef9d46f8b69d
Author: Radek Doulik <[email protected]>
Date:   Wed Mar 4 18:28:59 2015 +0100

     - fixes #27620

     - in this case we were trying to process Application.java
       as linker an assembly XML linker description, which led
       to uncaught XmlException
2015-06-05 13:54:15 +02:00
Radek Doulik 7e1e640a1d In ResolveFromXmlStep, bail if no <linker> element is found.
[merged from monodroid by rodo]

commit 2edecdc39ca55c65de4f57557e5e31b5d432eaa4
Author: Alex Rønne Petersen <[email protected]>
Date:   Mon Jul 1 15:35:59 2013 +0200

    The BlacklistStep pass will feed the ResolveFromXmlStep pass XML files
    that may not necessarily *be* linker descriptor files. This can happen
    if an embedded file happens to be named "Foo.Bar.xml" and an assembly
    called Foo.Bar is referenced in a project. The chances of this happening
    are probably very low, but better safe than sorry.
2015-06-05 13:54:09 +02:00
Radek Doulik 796d4db8e6 Fortify the BlacklistStep.
[merged from monodroid by rodo]

commit 3001f693c52be0da673446179daf498265024867
Author: Alex Rønne Petersen <[email protected]>
Date:   Tue Jul 30 20:06:21 2013 +0200

    1. Catch XmlExceptions in case of broken XML files.
    2. Only process files that actually end in ".xml".
2015-06-05 13:54:03 +02:00
Radek Doulik df5314261a Support linker descriptor files embedded in the assemblies being linked.
[merged from monodroid by rodo]

commit 3e19b22eb24ff9faeebe1ace7461d8f91f807041
Author: Alex Rønne Petersen <[email protected]>
Date:   Mon Jul 1 15:34:26 2013 +0200

    This is in addition to those files that are already embedded in the linker assembly
    itself (such as mscorlib.xml). People can use this feature to tell the linker that
    certain methods/fields/types must be kept if a particular assembly is being referenced
    by embedding a descriptor file in it.
2015-06-05 13:53:56 +02:00
Zoltan Varga 5b6de39a50 [sdb] Avoid marking seq points as nonempty-stack if they have a sym seq point. Fix the linking of seq points when an endfinally instruction is in a separate bblock. Fixes #30617. 2015-06-04 16:46:00 -04:00
Zoltan Varga 42e96afeaf [llvm] Decrease the basic block size cutoff to 3000 instructions, 5000 still leads to large slowdowns in llc on armv7 (TypeTest.GetProperties_Flags ()). 2015-06-04 15:11:21 -04:00
Zoltan Varga 36bea2eb89 [arm] Implement support for nullable arguments in the dyncall code. Fixes #29491. 2015-06-04 12:46:45 -04:00
Zoltan Varga b4699f502c [aot] Enable the direct emission of llvm object files in asmonly mode if the llvm output file ends with .o. 2015-06-03 22:46:22 -04:00
Zoltan Varga ec6d139b34 [jit] Emulate OP_RREM if OP_FREM is emulated. Fixes #30698. 2015-06-03 14:41:03 -04:00
Zoltan Varga f44aad5858 [sdb] Fix interface/virtual calls to valuetype methods. 2015-06-03 13:53:12 -04:00
Marek Safar eb30bf4d7b [mcs] Recursivelly check for left-hand side of an assignment of a null propagating operator. Fixes #30695 2015-06-03 12:05:48 +02:00
Alexis Christoforides 3efa960646 [System.IO.KeventWatcher] Fix handling some cases where an item is moved out of the watched path.
If a file or directory are moved out of the watcher's path they are removed from the index, but they might still have events in the kevent() changelist. This would sometimes cause an exception.
2015-06-02 19:12:34 -04:00
Marek Safar 88819a77c4 [mcs] Apply explicit property param target to correct parameter index. Fixes #30587 2015-06-02 20:38:45 +02:00
Marek Safar 8b0de8ed79 [mcs] Add special HostProtection handling to deletes 2015-06-02 20:38:33 +02:00
Rolf Bjarne Kvinge 1e6c314632 [corlib] Fix test after 5cee52916. 2015-06-02 12:47:37 +02:00
Alexis Christoforides 39ae01c371 [System.IO.KeventWatcher] Disable the watcher when the root directory is deleted. Fixes #30043
This matches MS.NET behavior.
2015-06-01 23:06:31 -04:00
Zoltan Varga b46ece87c4 [jit] Fix the hashing/equals check for MONO_PATCH_INFO_JIT_ICALL_ADDR. 2015-06-01 17:36:08 -04:00
Zoltan Varga 5cee52916f [corlib] Make corlib use the v4 runtime version in mobile profiles. 2015-06-01 17:36:03 -04:00
Sebastien Pouliot 3330042f61 [corlib] Xamarin.Mac to continue default to the OS default codepage
XM 2.0 was the first version to ship the mobile (w/unified) and it used
the OS default codepage.

The previous, system mono, profile was already using the OS default
codepage so it make sense for XM to be consistent across profiles (
including the 4.5 subset)
2015-06-01 15:20:18 -04:00
Zoltan Varga ad175181c7 [aot] Fix thumb support after the separate llvm changes. Fixes #30472. 2015-06-01 14:30:32 -04:00
Marek Safar 02af095bba [corlib] Update failing test 2015-06-01 16:59:21 +02:00
Marek Safar 9ee2fc25b9 Bump reference sources 2015-06-01 16:24:49 +02:00
Marek Safar 6ba04348ed [System.Runtime.Serialization] Update public api 2015-06-01 16:24:33 +02:00
Marek Safar 17c2350bbf [ilasm] Add support for undocumented modopt/modreq using primitive types 2015-06-01 16:24:22 +02:00
Sebastien Pouliot 6f7acc8359 Bump reference sources 2015-05-29 16:02:21 -04:00
Zoltan Varga ac002af782 [sdb] Fix reading/writing locals when not all of the them have associated debug info. Fixes #30529. 2015-05-29 14:21:55 -04:00
Marek Safar 65d1edb98e [PEAPI] Fixes custom attributes with byte array constant 2015-05-29 17:42:41 +02:00
Sebastien Pouliot b6a54b0948 Bump reference sources 2015-05-29 10:56:45 -04:00
Zoltan Varga 33d4582c89 [corlib] Avoid a nullref in CustomAttributeData.ToString () if its called without calling ConstructorArguments/NamedArguments. 2015-05-29 10:08:16 -04:00
Marek Safar a580873769 [corlib] Add timeout to NestedLeakingSynchronizationContext 2015-05-29 13:51:43 +02:00
Marek Safar 0de821c16f [mcs] Double closing parens don't have priority inside interpolated string. Fixes #30469 2015-05-29 13:49:58 +02:00
Marek Safar f0e0a7d127 [ilasm] Extend syntax of custom attribute constructor constants 2015-05-29 13:49:39 +02:00
Marek Safar 6b901f4a7d [corlib] Add role based security to desktop only 2015-05-28 15:42:20 +02:00
Marek Safar 7a80fdddc0 [mcs] Await in finally clause with user catch block needs additional try scope. Fixes #30478 2015-05-28 15:42:06 +02:00
Zoltan Varga 6ec454d4a9 [runtime] Print wrapper methods in the same format as normal methods in stack traces. Fixes #30507. 2015-05-27 17:21:01 -04:00
Zoltan Varga bf09f2f261 [arm] Set more information in cinfo for fp returns, gsharedvt depends on it. 2015-05-27 15:34:57 -04:00
Marek Safar 0a4d95e844 [corlib] Improve SynchronizationContext test dependency 2015-05-27 21:01:07 +02:00
Marek Safar f4c71b0da0 Bump reference sources 2015-05-27 20:32:05 +02:00
Sebastien Pouliot de359f3060 [corlib] Let XI and XM define their own default encoding [#29928]
605192528d used UTF8Unmarked for MONOTOUCH
and XAMMAC. However it's initialized differently (than the old UTF8) and
caused unit test regressions in System and System.Net.Http unit tests

This new logic moves the default encoding creation into the products
themselves.
2015-05-27 13:36:46 -04:00
Sebastien Pouliot 1c27f353c0 Revert "[corlib] Restore UTF8 as the default encoding for XI and XM [#29928]"
This reverts commit 605192528d.

Using EncodingHelper.UTF8Unmarked cause regressions in System and
System.Net.Http unit tests
2015-05-27 13:36:34 -04:00
Ludovic Henry 4524946f7b [corlib] Fix tests for System.Runtime.InteropServices.SafeHandle
These tests would tend to leave non disposed SafeHandle which would later be finalized, then throwing ObjectDisposedException. They would also crash on .NET.
2015-05-27 13:54:02 -03:00
Zoltan Varga ffcc75194e [llvm] Fix rethrowing exceptions on x86. 2015-05-27 11:25:04 -04:00
Marek Safar f66aa9625f [corlib] Clone all levels of captures ExceptionDispatchInfos 2015-05-27 17:14:31 +02:00
Marek Safar ebf71e4a1c [corlib] Add more obsolete and not working types to MonoDroid 2015-05-27 11:33:20 +02:00
Marek Safar 84fd3de793 [system] Fixes incorrect tests 2015-05-27 10:50:28 +02:00
Zoltan Varga 3fbcb6ca2d [jit] Properly compute the layout of generic instances created by partial sharing. Fixes #30204. 2015-05-26 20:23:50 -04:00
Zoltan Varga 5493b0a73b Bump version to 4.2.0. 2015-05-26 15:13:34 -04:00
72 changed files with 823 additions and 154 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [4.1.0],
AC_INIT(mono, [4.2.0],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
+10 -1
View File
@@ -80,7 +80,7 @@ public class Tests2 {
}
}
public struct AStruct {
public struct AStruct : ITest2 {
public int i;
public string s;
public byte k;
@@ -116,6 +116,14 @@ public struct AStruct {
public void invoke_mutate () {
l = 5;
}
public int invoke_iface () {
return i;
}
public override string ToString () {
return i.ToString ();
}
}
public class GClass<T> {
@@ -716,6 +724,7 @@ public class Tests : TestsBase, ITest2
astruct = new AStruct ();
}
rs = "A";
List<int> alist = new List<int> () { 12 };
}
+21 -3
View File
@@ -526,7 +526,11 @@ public class DebuggerTests
e = step_over ();
assert_location (e, "ss_nested");
e = step_into ();
assert_location (e, "ss_nested_3");
assert_location (e, "ss_nested_1");
e = step_into ();
assert_location (e, "ss_nested_1");
e = step_into ();
assert_location (e, "ss_nested");
req.Disable ();
// Check DebuggerStepThrough support
@@ -1515,8 +1519,8 @@ public class DebuggerTests
StackFrame frame = e.Thread.GetFrames () [0];
var locals = frame.Method.GetLocals ();
Assert.AreEqual (8, locals.Length);
for (int i = 0; i < 8; ++i) {
Assert.AreEqual (9, locals.Length);
for (int i = 0; i < 9; ++i) {
if (locals [i].Name == "args") {
Assert.IsTrue (locals [i].IsArg);
Assert.AreEqual ("String[]", locals [i].Type.Name);
@@ -1540,6 +1544,7 @@ public class DebuggerTests
Assert.IsTrue (locals [i].IsArg);
Assert.AreEqual ("String", locals [i].Type.Name);
} else if (locals [i].Name == "astruct") {
} else if (locals [i].Name == "alist") {
} else {
Assert.Fail ();
}
@@ -1624,6 +1629,8 @@ public class DebuggerTests
AssertValue ("AB", vals [i]);
if (locals [i].Name == "t")
AssertValue ("ABC", vals [i]);
if (locals [i].Name == "alist") {
}
}
// Argument checking
@@ -2266,6 +2273,17 @@ public class DebuggerTests
task = s.InvokeMethodAsyncWithResult (e.Thread, m, null);
out_this = task.Result.OutThis as StructMirror;
Assert.AreEqual (null, out_this);
// interface method
var cl1 = frame.Method.DeclaringType.Assembly.GetType ("ITest2");
m = cl1.GetMethod ("invoke_iface");
v = s.InvokeMethod (e.Thread, m, null);
AssertValue (42, v);
// virtual method
m = vm.RootDomain.Corlib.GetType ("System.Object").GetMethod ("ToString");
v = s.InvokeMethod (e.Thread, m, null, InvokeOptions.Virtual);
AssertValue ("42", v);
#endif
}
+40 -2
View File
@@ -443,6 +443,10 @@ namespace PEAPI {
type = constrType;
cVal = val;
tabIx = MDTable.CustomAttribute;
var bac = val as ByteArrConst;
if (bac != null)
byteVal = bac.val;
}
internal CustomAttribute(MetaDataElement paren, Method constrType,
@@ -2945,7 +2949,7 @@ namespace PEAPI {
}
public class ByteArrConst : DataConstant {
byte[] val;
internal byte[] val;
public ByteArrConst(byte[] val)
{
@@ -3310,6 +3314,7 @@ namespace PEAPI {
Type type;
Class cmodType;
PrimitiveTypeRef cmodPrimType;
/// <summary>
/// Create a new custom modifier for a type
@@ -3324,10 +3329,23 @@ namespace PEAPI {
this.cmodType = cmodType;
}
public CustomModifiedType(Type type, CustomModifier cmod, PrimitiveTypeRef cmodType)
: base((byte)cmod)
{
this.type = type;
this.cmodPrimType = cmodType;
}
internal sealed override void TypeSig(MemoryStream str)
{
str.WriteByte(typeIndex);
MetaData.CompressNum(cmodType.TypeDefOrRefToken(),str);
if (cmodType != null) {
MetaData.CompressNum(cmodType.TypeDefOrRefToken(),str);
} else {
MetaData.CompressNum(cmodPrimType.TypeDefOrRefToken(),str);
}
type.TypeSig(str);
}
@@ -4466,6 +4484,26 @@ namespace PEAPI {
}
public class PrimitiveTypeRef : Type
{
PrimitiveType type;
MetaData metaData;
internal PrimitiveTypeRef(PrimitiveType type, MetaData md)
: base (0)
{
this.type = type;
this.metaData = md;
}
internal uint TypeDefOrRefToken()
{
uint cIx = type.GetTypeSpec (metaData).Row;
cIx = (cIx << 2) | 0x2;
return cIx;
}
}
/**************************************************************************/
/// <summary>
/// Descriptor for an pointer (type * or type &)
+11
View File
@@ -923,6 +923,11 @@ namespace PEAPI {
return file;
}
public PrimitiveTypeRef AddPrimitiveType (PrimitiveType type)
{
return new PrimitiveTypeRef (type, metaData);
}
/// <summary>
/// Add a manifest resource to this PEFile NOT YET IMPLEMENTED
/// </summary>
@@ -940,6 +945,12 @@ namespace PEAPI {
element.HasCustomAttr = true;
}
public void AddCustomAttribute (Method meth, Constant constant, MetaDataElement element)
{
metaData.AddCustomAttribute (new CustomAttribute (element, meth, constant));
element.HasCustomAttr = true;
}
public void AddDeclSecurity (SecurityAction sec_action, byte [] data, MetaDataElement element)
{
metaData.AddDeclSecurity (new DeclSecurity (element, (ushort) sec_action, data));
@@ -2,7 +2,7 @@ using System;
namespace System.Runtime.Serialization
{
public class BitFlagsGenerator
class BitFlagsGenerator
{
int bitCount;
byte [] locals;
@@ -3,9 +3,8 @@ using System.Reflection;
namespace System.Runtime.Serialization
{
public class CodeInterpreter
static class CodeInterpreter
{
internal static object ConvertValue(object arg, Type source, Type target)
{
return InternalConvert(arg, source, target, false);
@@ -1,6 +1,4 @@
../../build/common/Consts.cs
../../build/common/Locale.cs
../../build/common/MonoTODOAttribute.cs
../../build/common/SR.cs
Assembly/AssemblyInfo.cs
+9 -1
View File
@@ -274,7 +274,6 @@ namespace System.IO {
started = false;
inDispatch = false;
fsw.EnableRaisingEvents = false;
throw exc;
}
if (exc != null)
fsw.DispatchErrorEvents (new ErrorEventArgs (exc));
@@ -373,6 +372,11 @@ namespace System.IO {
for (var i = 0; i < numEvents; i++) {
var kevt = eventBuffer [i];
if (!fdsDict.ContainsKey ((int)kevt.ident))
// The event is for a file that was removed
continue;
var pathData = fdsDict [(int)kevt.ident];
if ((kevt.flags & EventFlags.Error) == EventFlags.Error) {
@@ -382,6 +386,10 @@ namespace System.IO {
}
if ((kevt.fflags & FilterFlags.VNodeDelete) == FilterFlags.VNodeDelete || (kevt.fflags & FilterFlags.VNodeRevoke) == FilterFlags.VNodeRevoke) {
if (pathData.Path == fullPathNoLastSlash)
// The root path is deleted; exit silently
return;
removeQueue.Add (pathData);
continue;
}
@@ -74,9 +74,9 @@ public class SslStreamTest {
state.ServerIOException = !server;
try {
Thread serverThread = new Thread (() => StartServerAndAuthenticate (state));
serverThread.Start (null);
serverThread.Start ();
Thread clientThread = new Thread (() => StartClientAndAuthenticate (state, endPoint));
clientThread.Start (null);
clientThread.Start ();
Assert.AreEqual (server, state.ServerAuthenticated.WaitOne (TimeSpan.FromSeconds (2)),
"server not authenticated");
Assert.AreEqual (client, state.ClientAuthenticated.WaitOne (TimeSpan.FromSeconds (2)),
+4 -4
View File
@@ -12,7 +12,7 @@ LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%)
#LIBRARY_USE_INTERMEDIATE_FILE = yes
ifeq (2, $(FRAMEWORK_VERSION_MAJOR))
LIB_MCS_FLAGS += --runtime:v2
LIB_MCS_FLAGS += --runtime:v4
else
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
LIB_MCS_FLAGS += --runtime:v4
@@ -41,7 +41,7 @@ REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,F
MOBILE_STATIC := $(filter mobile_static monotouch monotouch_runtime, $(PROFILE))
ifndef MOBILE_STATIC
REFERENCE_SOURCES_FLAGS += -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP
REFERENCE_SOURCES_FLAGS += -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY
endif
LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS)
@@ -175,9 +175,9 @@ EXTRA_DISTFILES += \
TMP_FILE1=tzi1.tmp
TMP_FILE2=tzi2.tmp
# Remove some code that is protected so we don't have to include all the corlib files.
tzi.exe:System/AndroidPlatform.cs $(wildcard System/TimeZone*.cs) ../../build/common/Consts.cs ../../build/common/Locale.cs ../Mono.Options/Mono.Options/Options.cs
# Remove some code that is protected so we don't have to include all the corlib files.
trap "rm -f $(TMP_FILE1) $(TMP_FILE2)" EXIT INT QUIT TERM && \
sed 's/Environment\.GetResourceString/string.Format/g' ../../../external/referencesource/mscorlib/system/timezoneinfo.cs > $(TMP_FILE1) && \
sed 's/StringBuilder\.DefaultCapacity/100/g' ../../../external/referencesource/mscorlib/system/text/stringbuildercache.cs > $(TMP_FILE2) && \
@@ -137,6 +137,8 @@ namespace System.Reflection {
public override string ToString ()
{
ResolveArguments ();
StringBuilder sb = new StringBuilder ();
sb.Append ("[" + ctorInfo.DeclaringType.FullName + "(");
@@ -30,7 +30,7 @@
using System;
#if !MOBILE
#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
@@ -578,7 +578,7 @@ namespace System.Runtime.InteropServices
throw new NotImplementedException ();
}
#if !MOBILE
#if !FULL_AOT_RUNTIME
[Obsolete]
[MonoTODO]
public static string GetTypeInfoName (UCOMITypeInfo pTI)
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
@@ -28,7 +28,7 @@
//
// (C) 2002 Ximian, Inc.
#if !MOBILE
#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
@@ -28,7 +28,7 @@
//
// (C) 2002 Ximian, Inc.
#if !MOBILE
#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
@@ -28,7 +28,7 @@
//
// (C) 2002 Ximian, Inc.
#if !MOBILE
#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
@@ -7,7 +7,7 @@ using System.Security;
namespace System.Text
{
internal static class EncodingHelper
internal static partial class EncodingHelper
{
//
// Only internal, to be used by the class libraries: Unmarked and non-input-validating
@@ -71,12 +71,10 @@ internal static class EncodingHelper
[MethodImpl (MethodImplOptions.InternalCall)]
extern internal static string InternalCodePage (ref int code_page);
#if !MONOTOUCH
internal static Encoding GetDefaultEncoding ()
{
Encoding enc = null;
#if (MONOTOUCH || XAMMAC)
enc = EncodingHelper.UTF8Unmarked;
#else
// See if the underlying system knows what
// code page handler we should be using.
int code_page = 1;
@@ -106,9 +104,9 @@ internal static class EncodingHelper
// not supported by underlying OS
enc = EncodingHelper.UTF8Unmarked;
}
#endif
return enc;
}
#endif
// Loaded copy of the "I18N" assembly. We need to move
// this into a class in "System.Private" eventually.
@@ -506,7 +506,9 @@ namespace System.Threading {
void StartInternal (IPrincipal principal, ref StackCrawlMark stackMark)
{
#if FEATURE_ROLE_BASED_SECURITY
Internal._serialized_principal = CurrentThread.Internal._serialized_principal;
#endif
// Thread_internal creates and starts the new thread,
if (Thread_internal(m_Delegate) == IntPtr.Zero)
+1 -1
View File
@@ -67,7 +67,7 @@ namespace System
internal int hresult = -2146233088;
string source;
IDictionary _data;
StackTrace[] captured_traces;
internal StackTrace[] captured_traces;
IntPtr[] native_trace_ips;
#endregion
#pragma warning restore 169, 649
@@ -195,11 +195,7 @@ namespace MonoTests.System.Reflection
Assert.IsTrue (corlib_test.GetReferencedAssemblies ().Length > 0, "GetReferencedAssemblies");
Assert.AreEqual (0, corlib_test.HostContext, "HostContext");
#if NET_4_0 && !MOBILE
Assert.AreEqual ("v4.0.30319", corlib_test.ImageRuntimeVersion, "ImageRuntimeVersion");
#else
Assert.AreEqual ("v2.0.50727", corlib_test.ImageRuntimeVersion, "ImageRuntimeVersion");
#endif
Assert.IsNotNull (corlib_test.ManifestModule, "ManifestModule");
Assert.IsFalse (corlib_test.ReflectionOnly, "ReflectionOnly");
@@ -367,14 +367,18 @@ namespace MonoTests.System.Runtime.CompilerServices
[Test]
public void NestedLeakingSynchronizationContext ()
{
NestedLeakingSynchronizationContext_MainAsync ().GetAwaiter ().GetResult ();
var sc = SynchronizationContext.Current;
if (sc == null)
Assert.IsTrue (NestedLeakingSynchronizationContext_MainAsync (sc).Wait (5000), "#1");
else
Assert.Ignore ("NestedSynchronizationContext may never complete on custom context");
}
static async Task NestedLeakingSynchronizationContext_MainAsync ()
static async Task NestedLeakingSynchronizationContext_MainAsync (SynchronizationContext sc)
{
Assert.IsNull (SynchronizationContext.Current, "#1");
Assert.AreSame (sc, SynchronizationContext.Current, "#1");
await NestedLeakingSynchronizationContext_DoWorkAsync ();
Assert.IsNull (SynchronizationContext.Current, "#2");
Assert.AreSame (sc, SynchronizationContext.Current, "#2");
}
static async Task NestedLeakingSynchronizationContext_DoWorkAsync ()
@@ -123,6 +123,34 @@ namespace MonoTests.System.Runtime.ExceptionServices
Assert.IsTrue (split [1].Contains ("---"), "#2");
}
}
[Test]
public void ThrowMultipleCaptures ()
{
Exception e;
try {
throw new Exception ("test");
} catch (Exception e2) {
e = e2;
}
var edi = ExceptionDispatchInfo.Capture (e);
try {
edi.Throw ();
} catch (Exception e3) {
edi = ExceptionDispatchInfo.Capture (e3);
}
try {
edi.Throw ();
} catch (Exception ex) {
var split = ex.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
Assert.AreEqual (7, split.Length, "#1");
Assert.IsTrue (split [1].Contains ("---"), "#2");
Assert.IsTrue (split [4].Contains ("---"), "#3");
}
}
}
}
@@ -51,15 +51,28 @@ namespace MonoTests.System.Runtime.InteropServices
base.Dispose (manual);
}
}
[Test]
public void SimpleDispose ()
{
FakeSafeHandle sf = new FakeSafeHandle ();
sf.Dispose ();
}
[Test]
[ExpectedException (typeof (ObjectDisposedException))]
public void BadDispose1 ()
{
FakeSafeHandle sf = new FakeSafeHandle ();
sf.DangerousRelease ();
sf.DangerousRelease ();
try {
sf.DangerousRelease ();
Assert.Fail ("#1");
} catch (ObjectDisposedException) {
}
GC.SuppressFinalize (sf);
}
[Test]
@@ -130,6 +143,8 @@ namespace MonoTests.System.Runtime.InteropServices
Assert.IsTrue (sf.IsClosed, "closed");
//Handle value is not changed, so the value itself is still valid (not 0 or -1)
Assert.IsFalse (sf.IsInvalid, "invalid");
GC.SuppressFinalize (sf);
}
[Test]
@@ -0,0 +1 @@
#include corlib.dll.sources
+17
View File
@@ -0,0 +1,17 @@
// CS9030: The left-hand side of an assignment cannot contain a null propagating operator
// Line: 15
public class Test1
{
public class Test2
{
public System.EventHandler<System.EventArgs> E;
}
public Test2 test2 = new Test2 ();
static void Main ()
{
new Test1 ()?.test2.E += null;
}
}
+5 -6
View File
@@ -20,18 +20,17 @@ namespace Mono.ILASM {
public class CustomAttr {
private BaseMethodRef method_ref;
private byte[] data;
public CustomAttr (BaseMethodRef method_ref, byte[] data)
PEAPI.Constant constant;
public CustomAttr (BaseMethodRef method_ref, PEAPI.Constant constant)
{
this.method_ref = method_ref;
this.data = data;
this.method_ref = method_ref;
this.constant = constant;
}
public void AddTo (CodeGen code_gen, PEAPI.MetaDataElement elem)
{
method_ref.Resolve (code_gen);
code_gen.PEFile.AddCustomAttribute (method_ref.PeapiMethod, data, elem);
code_gen.PEFile.AddCustomAttribute (method_ref.PeapiMethod, constant, elem);
}
public bool IsSuppressUnmanaged (CodeGen codegen)
+2 -2
View File
@@ -104,7 +104,7 @@ namespace Mono.ILASM {
}
public void MakeCustomModified (CodeGen code_gen, PEAPI.CustomModifier modifier,
BaseClassRef klass)
BaseTypeRef klass)
{
use_type_spec = true;
conversion_list.Add (ConversionMethod.MakeCustomModified);
@@ -143,7 +143,7 @@ namespace Mono.ILASM {
break;
case ConversionMethod.MakeCustomModified:
peapi_type.MakeCustomModified (code_gen, (PEAPI.CustomModifier) conversion_list[++i],
(BaseClassRef) conversion_list[++i]);
(BaseTypeRef) conversion_list[++i]);
break;
}
+15 -4
View File
@@ -196,7 +196,7 @@ namespace Mono.ILASM {
}
public void MakeCustomModified (CodeGen code_gen, PEAPI.CustomModifier modifier,
BaseClassRef klass)
BaseTypeRef klass)
{
PEAPI.Type type;
@@ -205,14 +205,25 @@ namespace Mono.ILASM {
Pair p = new Pair (peapi_type, modifier.ToString ());
type = type_table [p] as PEAPI.Type;
if (type == null) {
klass.Resolve (code_gen);
type = new PEAPI.CustomModifiedType (peapi_type,
modifier, klass.PeapiClass);
type = GetType (code_gen, modifier, klass);
type_table [p] = type;
}
peapi_type = type;
}
PEAPI.Type GetType (CodeGen code_gen, PEAPI.CustomModifier modifier, BaseTypeRef klass)
{
klass.Resolve (code_gen);
var bcr = klass as BaseClassRef;
if (bcr != null)
return new PEAPI.CustomModifiedType (peapi_type, modifier, bcr.PeapiClass);
var pt = klass as PrimitiveTypeRef;
return new PEAPI.CustomModifiedType (peapi_type, modifier, code_gen.PEFile.AddPrimitiveType ((PEAPI.PrimitiveType) pt.PeapiType));
throw new NotSupportedException (klass.GetType ().ToString ());
}
public void MakePinned ()
{
use_type_spec = true;
+27 -18
View File
@@ -981,18 +981,18 @@ type : generic_class_ref
base_type.MakePinned ();
$$ = base_type;
}
| type K_MODREQ OPEN_PARENS class_ref CLOSE_PARENS
| type K_MODREQ OPEN_PARENS custom_modifier_type CLOSE_PARENS
{
BaseTypeRef base_type = GetTypeRef ((BaseTypeRef) $1);
BaseClassRef class_ref = (BaseClassRef) $4;
BaseTypeRef class_ref = (BaseTypeRef) $4;
base_type.MakeCustomModified (codegen,
CustomModifier.modreq, class_ref);
$$ = base_type;
}
| type K_MODOPT OPEN_PARENS class_ref CLOSE_PARENS
| type K_MODOPT OPEN_PARENS custom_modifier_type CLOSE_PARENS
{
BaseTypeRef base_type = GetTypeRef ((BaseTypeRef) $1);
BaseClassRef class_ref = (BaseClassRef) $4;
BaseTypeRef class_ref = (BaseTypeRef) $4;
base_type.MakeCustomModified (codegen,
CustomModifier.modopt, class_ref);
$$ = base_type;
@@ -1485,6 +1485,11 @@ variant_type : /* EMPTY */
| K_CLSID
;
custom_modifier_type
: primitive_type
| class_ref
;
field_decl : D_FIELD repeat_opt field_attr type id at_opt init_opt
{
FieldDef field_def = new FieldDef((FieldAttr) $3,
@@ -1652,11 +1657,14 @@ field_init_primitive : K_FLOAT32 OPEN_PARENS float64 CLOSE_PARENS
}
;
field_init : field_init_primitive
field_init_full : field_init_primitive
| K_BYTEARRAY bytes_list
{
$$ = new ByteArrConst ((byte[]) $2);
}
;
field_init : field_init_full
| comp_qstring
{
// ******** THIS IS NOT IN THE DOCUMENTATION ******** //
@@ -1668,6 +1676,13 @@ field_init : field_init_primitive
}
;
member_init : field_init_full
| K_STRING OPEN_PARENS SQSTRING CLOSE_PARENS
{
$$ = new StringConst ((string) $3);
}
;
data_decl : data_head data_body
{
DataDef datadef = (DataDef) $1;
@@ -2781,13 +2796,15 @@ customattr_decl : D_CUSTOM custom_type
| D_CUSTOM custom_type ASSIGN comp_qstring
| D_CUSTOM custom_type ASSIGN bytes_list
{
$$ = new CustomAttr ((BaseMethodRef) $2,
(byte[]) $4);
$$ = new CustomAttr ((BaseMethodRef) $2, new ByteArrConst ((byte[]) $4));
}
| D_CUSTOM custom_type ASSIGN OPEN_BRACE member_init CLOSE_BRACE
{
$$ = new CustomAttr ((BaseMethodRef) $2, null);
}
| D_CUSTOM OPEN_PARENS owner_type CLOSE_PARENS custom_type
| D_CUSTOM OPEN_PARENS owner_type CLOSE_PARENS custom_type ASSIGN comp_qstring
| D_CUSTOM OPEN_PARENS owner_type CLOSE_PARENS custom_type ASSIGN
bytes_list
| D_CUSTOM OPEN_PARENS owner_type CLOSE_PARENS custom_type ASSIGN bytes_list
;
custom_type : call_conv type type_spec DOUBLE_COLON method_name OPEN_PARENS type_list CLOSE_PARENS
@@ -2892,18 +2909,10 @@ permission_member : prop_or_field primitive_type perm_mbr_nameval_pair
}
;
perm_mbr_nameval_pair : SQSTRING ASSIGN field_init_primitive
perm_mbr_nameval_pair : SQSTRING ASSIGN member_init
{
$$ = new NameValuePair ((string) $1, (PEAPI.Constant) $3);
}
| SQSTRING ASSIGN K_BYTEARRAY bytes_list
{
$$ = new NameValuePair ((string) $1, new ByteArrConst ((byte[]) $4));
}
| SQSTRING ASSIGN K_STRING OPEN_PARENS SQSTRING CLOSE_PARENS
{
$$ = new NameValuePair ((string) $1, new StringConst ((string) $5));
}
;
prop_or_field : K_PROPERTY
+27
View File
@@ -0,0 +1,27 @@
.assembly extern mscorlib
{
}
.assembly 'custom-attrs-01'
{
}
.class interface public abstract auto ansi I1
{
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string)
= {bytearray(55 05)}
.method public hidebysig newslot specialname abstract virtual
instance int32 get_A(int32 x) cil managed
{
}
}
.class interface public abstract auto ansi I2
{
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string)
= {string('B')}
.method public hidebysig newslot specialname abstract virtual
instance int32 get_B(int32 x) cil managed
{
}
}
+46
View File
@@ -0,0 +1,46 @@
.assembly extern mscorlib
{
}
.assembly 'test-custom-mod-2'
{
}
.class interface public abstract auto ansi I
{
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string)
= {string('Item')}
.method public hidebysig newslot specialname abstract virtual instance char
get_P() cil managed
{
}
.method public hidebysig newslot specialname abstract virtual instance void
set_P(char 'value') cil managed
{
}
.method public hidebysig newslot specialname abstract virtual instance int32
get_Item(bool x) cil managed
{
}
.method public hidebysig newslot specialname abstract virtual instance void
set_Item(bool x,
int32 'value') cil managed
{
}
.property instance char modopt(int8) P()
{
.get instance char I::get_P()
.set instance void I::set_P(char)
}
.property instance int32 modopt(int8) Item(bool modopt(int16))
{
.get instance int32 I::get_Item(bool)
.set instance void I::set_Item(bool,
int32)
}
}
+2 -6
View File
@@ -3368,12 +3368,8 @@ namespace Mono.CSharp
return Token.OPEN_BRACE;
case '}':
if (parsing_string_interpolation > 0) {
if (peek_char () != '}') {
--parsing_string_interpolation;
return TokenizeInterpolatedString ();
}
continue;
--parsing_string_interpolation;
return TokenizeInterpolatedString ();
}
val = ltb.Create (current_source, ref_line, col);
+19
View File
@@ -16,9 +16,11 @@
using System;
#if STATIC
using SecurityType = System.Collections.Generic.List<IKVM.Reflection.Emit.CustomAttributeBuilder>;
using IKVM.Reflection;
using IKVM.Reflection.Emit;
#else
using SecurityType = System.Collections.Generic.Dictionary<System.Security.Permissions.SecurityAction, System.Security.PermissionSet>;
using System.Reflection;
using System.Reflection.Emit;
#endif
@@ -45,6 +47,8 @@ namespace Mono.CSharp {
Expression instance_expr;
ReturnParameter return_attributes;
SecurityType declarative_security;
const Modifiers MethodModifiers = Modifiers.PUBLIC | Modifiers.VIRTUAL;
const Modifiers AllowedModifiers =
@@ -104,6 +108,11 @@ namespace Mono.CSharp {
return;
}
if (a.IsValidSecurityAttribute ()) {
a.ExtractSecurityPermissionSet (ctor, ref declarative_security);
return;
}
base.ApplyAttributeBuilder (a, ctor, cdata, pa);
}
@@ -308,6 +317,16 @@ namespace Mono.CSharp {
{
base.Emit ();
if (declarative_security != null) {
foreach (var de in declarative_security) {
#if STATIC
TypeBuilder.__AddDeclarativeSecurity (de);
#else
TypeBuilder.AddDeclarativeSecurity (de.Key, de.Value);
#endif
}
}
if (ReturnType.Type != null) {
if (ReturnType.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
+3 -3
View File
@@ -6385,7 +6385,7 @@ namespace Mono.CSharp {
public override Expression DoResolveLValue (ResolveContext ec, Expression right_side)
{
if (ConditionalAccess)
if (HasConditionalAccess ())
Error_NullPropagatingLValue (ec);
if (spec is FixedFieldSpec) {
@@ -7144,7 +7144,7 @@ namespace Mono.CSharp {
public override Expression DoResolveLValue (ResolveContext rc, Expression right_side)
{
if (ConditionalAccess)
if (HasConditionalAccess ())
Error_NullPropagatingLValue (rc);
if (right_side == EmptyExpression.OutAccess) {
@@ -7390,7 +7390,7 @@ namespace Mono.CSharp {
return null;
}
if (ConditionalAccess)
if (HasConditionalAccess ())
Error_NullPropagatingLValue (ec);
op = CandidateToBaseOverride (ec, op);
+1 -1
View File
@@ -10374,7 +10374,7 @@ namespace Mono.CSharp
public override Expression DoResolveLValue (ResolveContext ec, Expression right_side)
{
if (ConditionalAccess)
if (HasConditionalAccess ())
Error_NullPropagatingLValue (ec);
return DoResolve (ec);
+1 -1
View File
@@ -246,7 +246,7 @@ namespace Mono.CSharp
protected override void ApplyToExtraTarget (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.Parameter) {
parameters[0].ApplyAttributeBuilder (a, ctor, cdata, pa);
parameters[parameters.Count - 1].ApplyAttributeBuilder (a, ctor, cdata, pa);
return;
}
+18 -1
View File
@@ -5862,6 +5862,11 @@ namespace Mono.CSharp {
this.loc = loc;
}
protected virtual void EmitBeginException (EmitContext ec)
{
ec.BeginExceptionBlock ();
}
protected virtual void EmitTryBodyPrepare (EmitContext ec)
{
StateMachineInitializer state_machine = null;
@@ -5872,7 +5877,7 @@ namespace Mono.CSharp {
ec.Emit (OpCodes.Stloc, state_machine.CurrentPC);
}
ec.BeginExceptionBlock ();
EmitBeginException (ec);
if (resume_points != null) {
ec.MarkLabel (resume_point);
@@ -6845,6 +6850,14 @@ namespace Mono.CSharp {
return ok;
}
protected override void EmitBeginException (EmitContext ec)
{
if (fini.HasAwait && stmt is TryCatch)
ec.BeginExceptionBlock ();
base.EmitBeginException (ec);
}
protected override void EmitTryBody (EmitContext ec)
{
if (fini.HasAwait) {
@@ -6853,6 +6866,10 @@ namespace Mono.CSharp {
ec.TryFinallyUnwind.Add (this);
stmt.Emit (ec);
if (stmt is TryCatch)
ec.EndExceptionBlock ();
ec.TryFinallyUnwind.Remove (this);
if (start_fin_label != null)
+3
View File
@@ -1,6 +1,9 @@
using System.Security;
using System.Security.Permissions;
[HostProtection]
delegate void D ();
[HostProtection]
class X
{
+43
View File
@@ -0,0 +1,43 @@
using System;
using System.Linq;
using System.Reflection;
class Program
{
public static int Main ()
{
var setter = typeof (MyClass).GetMember("set_Item")[0] as MethodInfo;
var sp = setter.GetParameters ();
var first = sp [0].GetCustomAttributes ();
var value = sp [2].GetCustomAttributes ();
if (first.Count () != 0)
return 1;
if (value.Count () != 1)
return 2;
return 0;
}
}
[AttributeUsage(AttributeTargets.All)]
public class MyAttribute2Attribute : Attribute
{
}
public class MyClass
{
public string this[int index1, int index2]
{
get
{
return "";
}
[param: MyAttribute2]
set
{
}
}
}
+40
View File
@@ -0,0 +1,40 @@
using System;
using System.Threading.Tasks;
class Test
{
public int in_catch, in_finally;
async Task ExecuteCore ()
{
try {
await Task.Run (() => {
throw new ApplicationException ();
});
} catch (Exception ex) {
++in_catch;
throw;
} finally {
++in_finally;
await Task.Yield ();
}
}
public static int Main ()
{
var t = new Test ();
try {
t.ExecuteCore ().Wait ();
return 3;
} catch (AggregateException) {
}
if (t.in_catch != 1)
return 1;
if (t.in_finally != 1)
return 2;
return 0;
}
}
+4
View File
@@ -60,6 +60,10 @@ public class Test
if (s != "b = 3")
return 13;
s = $"{{fo!o = {res}}}";
if (s != "{fo!o = 5}")
return 14;
Console.WriteLine ("ok");
return 0;
}
+65 -1
View File
@@ -51278,6 +51278,20 @@
<size>7</size>
</method>
</type>
<type name="D">
<method name="Void Invoke()" attrs="454">
<size>0</size>
</method>
<method name="System.IAsyncResult BeginInvoke(System.AsyncCallback, System.Object)" attrs="454">
<size>0</size>
</method>
<method name="Void EndInvoke(System.IAsyncResult)" attrs="454">
<size>0</size>
</method>
<method name="Void .ctor(Object, IntPtr)" attrs="6278">
<size>0</size>
</method>
</type>
</test>
<test name="test-911.cs">
<type name="N">
@@ -51544,6 +51558,32 @@
</method>
</type>
</test>
<test name="test-925.cs">
<type name="Program">
<method name="Int32 Main()" attrs="150">
<size>104</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="MyAttribute2Attribute">
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="MyClass">
<method name="System.String get_Item(Int32, Int32)" attrs="2182">
<size>14</size>
</method>
<method name="Void set_Item(Int32, Int32, System.String)" attrs="2182">
<size>2</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
<test name="test-93.cs">
<type name="N1.C">
<method name="Void .ctor()" attrs="6278">
@@ -65097,6 +65137,30 @@
</method>
</type>
</test>
<test name="test-async-79.cs">
<type name="Test">
<method name="System.Threading.Tasks.Task ExecuteCore()" attrs="129">
<size>41</size>
</method>
<method name="Int32 Main()" attrs="150">
<size>81</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="Test+&lt;ExecuteCore&gt;c__async0">
<method name="Void MoveNext()" attrs="486">
<size>380</size>
</method>
<method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
<method name="System.Threading.Tasks.Task &lt;&gt;m__0()" attrs="145">
<size>7</size>
</method>
</type>
</test>
<test name="test-cls-00.cs">
<type name="CLSCLass_6">
<method name="Void add_Disposed(Delegate)" attrs="2182">
@@ -66959,7 +67023,7 @@
<test name="test-interpolation-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
<size>540</size>
<size>581</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
@@ -26,8 +26,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Linq;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.XPath;
using Mono.Cecil;
@@ -44,10 +47,37 @@ namespace Mono.Linker.Steps {
protected override void Process ()
{
foreach (string name in Assembly.GetExecutingAssembly ().GetManifestResourceNames ()) {
if (!IsReferenced (GetAssemblyName (name)))
if (Path.GetExtension (name) != ".xml" || !IsReferenced (GetAssemblyName (name)))
continue;
Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetResolveStep (name));
try {
if (Context.LogInternalExceptions)
Console.WriteLine ("Processing resource linker descriptor: {0}", name);
Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetResolveStep (name));
} catch (XmlException ex) {
/* This could happen if some broken XML file is included. */
if (Context.LogInternalExceptions)
Console.WriteLine ("Error processing {0}: {1}", name, ex);
}
}
foreach (var rsc in Context.GetAssemblies ()
.SelectMany (asm => asm.Modules)
.SelectMany (mod => mod.Resources)
.Where (res => res.ResourceType == ResourceType.Embedded)
.Where (res => Path.GetExtension (res.Name) == ".xml")
.Where (res => IsReferenced (GetAssemblyName (res.Name)))
.Cast<EmbeddedResource> ()) {
try {
if (Context.LogInternalExceptions)
Console.WriteLine ("Processing embedded resource linker descriptor: {0}", rsc.Name);
Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetExternalResolveStep (rsc));
} catch (XmlException ex) {
/* This could happen if some broken XML file is embedded. */
if (Context.LogInternalExceptions)
Console.WriteLine ("Error processing {0}: {1}", rsc.Name, ex);
}
}
}
@@ -69,11 +99,23 @@ namespace Mono.Linker.Steps {
return false;
}
static ResolveFromXmlStep GetExternalResolveStep (EmbeddedResource resource)
{
return new ResolveFromXmlStep (GetExternalDescriptor (resource));
}
static ResolveFromXmlStep GetResolveStep (string descriptor)
{
return new ResolveFromXmlStep (GetDescriptor (descriptor));
}
static XPathDocument GetExternalDescriptor (EmbeddedResource resource)
{
using (var sr = new StreamReader (resource.GetResourceStream ())) {
return new XPathDocument (new StringReader (sr.ReadToEnd ()));
}
}
static XPathDocument GetDescriptor (string descriptor)
{
using (StreamReader sr = new StreamReader (GetResource (descriptor))) {
+20 -2
View File
@@ -514,6 +514,8 @@ namespace Mono.Linker.Steps {
MarkMethodsIf (type.Methods, IsStaticConstructorPredicate);
}
DoAdditionalTypeProcessing (type);
Annotations.Mark (type);
ApplyPreserveInfo (type);
@@ -521,6 +523,11 @@ namespace Mono.Linker.Steps {
return type;
}
// Allow subclassers to mark additional things when marking a method
protected virtual void DoAdditionalTypeProcessing (TypeDefinition method)
{
}
void MarkTypeSpecialCustomAttributes (TypeDefinition type)
{
if (!type.HasCustomAttributes)
@@ -570,17 +577,21 @@ namespace Mono.Linker.Steps {
return argument != null;
}
protected void MarkNamedMethod (TypeDefinition type, string method_name)
protected int MarkNamedMethod (TypeDefinition type, string method_name)
{
if (!type.HasMethods)
return;
return 0;
int count = 0;
foreach (MethodDefinition method in type.Methods) {
if (method.Name != method_name)
continue;
MarkMethod (method);
count++;
}
return count;
}
void MarkSoapHeader (MethodDefinition method, CustomAttribute attribute)
@@ -957,11 +968,18 @@ namespace Mono.Linker.Steps {
if (ShouldParseMethodBody (method))
MarkMethodBody (method.Body);
DoAdditionalMethodProcessing (method);
Annotations.Mark (method);
ApplyPreserveMethods (method);
}
// Allow subclassers to mark additional things when marking a method
protected virtual void DoAdditionalMethodProcessing (MethodDefinition method)
{
}
void MarkBaseMethods (MethodDefinition method)
{
IList base_methods = Annotations.GetBaseMethods (method);
@@ -57,6 +57,12 @@ namespace Mono.Linker.Steps {
{
XPathNavigator nav = _document.CreateNavigator ();
nav.MoveToFirstChild ();
// This step can be created with XML files that aren't necessarily
// linker descriptor files. So bail if we don't have a <linker> element.
if (nav.LocalName != "linker")
return;
ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns));
}
@@ -42,8 +42,17 @@ namespace Mono.Linker.Steps {
protected override void Process ()
{
assemblies = Context.GetAssemblies ();
foreach (var assembly in assemblies)
foreach (var assembly in assemblies) {
SweepAssembly (assembly);
if (Annotations.GetAction (assembly) == AssemblyAction.Copy) {
// Copy assemblies can still contain Type references with
// type forwarders from Delete assemblies
// thus try to resolve all the type references and see
// if some changed the scope. if yes change the action to Save
if (ResolveAllTypeReferences (assembly))
Annotations.SetAction (assembly, AssemblyAction.Save);
}
}
}
void SweepAssembly (AssemblyDefinition assembly)
@@ -124,15 +133,16 @@ namespace Mono.Linker.Steps {
}
}
void ResolveAllTypeReferences (AssemblyDefinition assembly)
bool ResolveAllTypeReferences (AssemblyDefinition assembly)
{
if (resolvedTypeReferences == null)
resolvedTypeReferences = new HashSet<AssemblyDefinition> ();
if (resolvedTypeReferences.Contains (assembly))
return;
return false;
resolvedTypeReferences.Add (assembly);
var hash = new Dictionary<TypeReference,IMetadataScope> ();
bool changes = false;
foreach (TypeReference tr in assembly.MainModule.GetTypeReferences ()) {
if (hash.ContainsKey (tr))
@@ -141,8 +151,11 @@ namespace Mono.Linker.Steps {
IMetadataScope scope = tr.Scope;
// at this stage reference might include things that can't be resolved
// and if it is (resolved) it needs to be kept only if marked (#16213)
if ((td != null) && Annotations.IsMarked (td))
if ((td != null) && Annotations.IsMarked (td)) {
scope = assembly.MainModule.Import (td).Scope;
if (tr.Scope != scope)
changes = true;
}
hash.Add (tr, scope);
}
if (assembly.MainModule.HasExportedTypes) {
@@ -163,6 +176,8 @@ namespace Mono.Linker.Steps {
foreach (var e in hash) {
e.Key.Scope = e.Value;
}
return changes;
}
void SweepType (TypeDefinition type)
@@ -93,6 +93,8 @@ namespace Mono.Linker {
set { _symbolWriterProvider = value; }
}
public bool LogInternalExceptions { get; set; } = false;
public LinkContext (Pipeline pipeline)
: this (pipeline, new AssemblyResolver ())
{
+3
View File
@@ -1285,6 +1285,9 @@ mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
char*
mono_type_get_full_name (MonoClass *klass);
char *
mono_method_get_name_full (MonoMethod *method, gboolean signature, MonoTypeNameFormat format);
MonoArrayType *mono_dup_array_type (MonoImage *image, MonoArrayType *a);
MonoMethodSignature *mono_metadata_signature_deep_dup (MonoImage *image, MonoMethodSignature *sig);
+21 -7
View File
@@ -1597,7 +1597,7 @@ mono_class_setup_fields (MonoClass *class)
return;
}
if (layout == TYPE_ATTRIBUTE_AUTO_LAYOUT && !(class->image == mono_defaults.corlib && !strcmp (class->name_space, "System") && !strcmp (class->name, "ValueType")))
if (layout == TYPE_ATTRIBUTE_AUTO_LAYOUT && !(mono_is_corlib_image (class->image) && !strcmp (class->name_space, "System") && !strcmp (class->name, "ValueType")))
blittable = FALSE;
/* Prevent infinite loops if the class references itself */
@@ -1772,6 +1772,20 @@ mono_type_get_basic_type_from_generic (MonoType *type)
return type;
}
static gboolean
type_has_references (MonoClass *klass, MonoType *ftype)
{
if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (klass, ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype)))))
return TRUE;
if (!ftype->byref && (ftype->type == MONO_TYPE_VAR || ftype->type == MONO_TYPE_MVAR)) {
MonoGenericParam *gparam = ftype->data.generic_param;
if (gparam->gshared_constraint)
return mono_class_has_references (mono_class_from_mono_type (gparam->gshared_constraint));
}
return FALSE;
}
/*
* mono_class_layout_fields:
* @class: a class
@@ -1832,7 +1846,7 @@ mono_class_layout_fields (MonoClass *class)
if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
ftype = mono_type_get_underlying_type (field->type);
ftype = mono_type_get_basic_type_from_generic (ftype);
if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype)))))
if (type_has_references (class, ftype))
class->has_references = TRUE;
}
}
@@ -1845,7 +1859,7 @@ mono_class_layout_fields (MonoClass *class)
if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
ftype = mono_type_get_underlying_type (field->type);
ftype = mono_type_get_basic_type_from_generic (ftype);
if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype)))))
if (type_has_references (class, ftype))
class->has_static_refs = TRUE;
}
}
@@ -1857,7 +1871,7 @@ mono_class_layout_fields (MonoClass *class)
ftype = mono_type_get_underlying_type (field->type);
ftype = mono_type_get_basic_type_from_generic (ftype);
if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype))))) {
if (type_has_references (class, ftype)) {
if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
class->has_static_refs = TRUE;
else
@@ -1908,7 +1922,7 @@ mono_class_layout_fields (MonoClass *class)
ftype = mono_type_get_underlying_type (field->type);
ftype = mono_type_get_basic_type_from_generic (ftype);
if (gc_aware_layout) {
if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype))))) {
if (type_has_references (class, ftype)) {
if (pass == 1)
continue;
} else {
@@ -1930,7 +1944,7 @@ mono_class_layout_fields (MonoClass *class)
/* if the field has managed references, we need to force-align it
* see bug #77788
*/
if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype)))))
if (type_has_references (class, ftype))
align = MAX (align, sizeof (gpointer));
class->min_align = MAX (align, class->min_align);
@@ -1985,7 +1999,7 @@ mono_class_layout_fields (MonoClass *class)
field->offset += sizeof (MonoObject);
ftype = mono_type_get_underlying_type (field->type);
ftype = mono_type_get_basic_type_from_generic (ftype);
if (MONO_TYPE_IS_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype))))) {
if (type_has_references (class, ftype)) {
if (field->offset % sizeof (gpointer)) {
mono_class_set_failure (class, MONO_EXCEPTION_TYPE_LOAD, NULL);
}
+24 -6
View File
@@ -748,18 +748,24 @@ mono_field_full_name (MonoClassField *field)
}
char *
mono_method_full_name (MonoMethod *method, gboolean signature)
mono_method_get_name_full (MonoMethod *method, gboolean signature, MonoTypeNameFormat format)
{
char *res;
char wrapper [64];
char *klass_desc = mono_type_full_name (&method->klass->byval_arg);
char *klass_desc = mono_type_get_name_full (&method->klass->byval_arg, format);
char *inst_desc = NULL;
if (method->is_inflated && ((MonoMethodInflated*)method)->context.method_inst) {
GString *str = g_string_new ("");
g_string_append (str, "<");
if (format == MONO_TYPE_NAME_FORMAT_IL)
g_string_append (str, "<");
else
g_string_append (str, "[");
ginst_get_desc (str, ((MonoMethodInflated*)method)->context.method_inst);
g_string_append (str, ">");
if (format == MONO_TYPE_NAME_FORMAT_IL)
g_string_append_c (str, '>');
else
g_string_append_c (str, ']');
inst_desc = str->str;
g_string_free (str, FALSE);
@@ -767,9 +773,15 @@ mono_method_full_name (MonoMethod *method, gboolean signature)
MonoGenericContainer *container = mono_method_get_generic_container (method);
GString *str = g_string_new ("");
g_string_append (str, "<");
if (format == MONO_TYPE_NAME_FORMAT_IL)
g_string_append (str, "<");
else
g_string_append (str, "[");
ginst_get_desc (str, container->context.method_inst);
g_string_append (str, ">");
if (format == MONO_TYPE_NAME_FORMAT_IL)
g_string_append_c (str, '>');
else
g_string_append_c (str, ']');
inst_desc = str->str;
g_string_free (str, FALSE);
@@ -801,6 +813,12 @@ mono_method_full_name (MonoMethod *method, gboolean signature)
return res;
}
char *
mono_method_full_name (MonoMethod *method, gboolean signature)
{
return mono_method_get_name_full (method, signature, MONO_TYPE_NAME_FORMAT_IL);
}
static const char*
print_name_space (MonoClass *klass)
{
+1 -1
View File
@@ -62,7 +62,7 @@
} while (0)
/* useful until we keep track of gc-references in corlib etc. */
#define IS_GC_REFERENCE(t) (mono_gc_is_moving () ? FALSE : ((t)->type == MONO_TYPE_U && class->image == mono_defaults.corlib))
#define IS_GC_REFERENCE(class,t) (mono_gc_is_moving () ? FALSE : ((t)->type == MONO_TYPE_U && (class)->image == mono_defaults.corlib))
void mono_object_register_finalizer (MonoObject *obj);
void ves_icall_System_GC_InternalCollect (int generation);
+14 -21
View File
@@ -8520,11 +8520,6 @@ emit_file_info (MonoAotCompile *acfg)
emit_pointer (acfg, NULL);
emit_pointer (acfg, NULL);
}
if (acfg->thumb_mixed) {
emit_pointer (acfg, "thumb_end");
} else {
emit_pointer (acfg, NULL);
}
if (acfg->aot_opts.static_link) {
emit_pointer (acfg, "globals");
} else {
@@ -9361,8 +9356,14 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
* Emit all LLVM code into a separate assembly/object file and link with it
* normally.
*/
if (!acfg->aot_opts.asm_only)
if (!acfg->aot_opts.asm_only) {
acfg->llvm_owriter = TRUE;
} else if (acfg->aot_opts.llvm_outfile) {
int len = strlen (acfg->aot_opts.llvm_outfile);
if (len >= 2 && acfg->aot_opts.llvm_outfile [len - 2] == '.' && acfg->aot_opts.llvm_outfile [len - 1] == 'o')
acfg->llvm_owriter = TRUE;
}
}
if (mono_aot_mode_is_full (&acfg->aot_opts))
@@ -9392,6 +9393,9 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
arch_init (acfg);
if (acfg->llvm && acfg->thumb_mixed)
acfg->flags |= MONO_AOT_FILE_FLAG_LLVM_THUMB;
acfg->assembly_name_sym = g_strdup (acfg->image->assembly->aname.name);
/* Get rid of characters which cannot occur in symbols */
for (p = acfg->assembly_name_sym; *p; ++p) {
@@ -9489,6 +9493,10 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
}
g_assert (acfg->aot_opts.llvm_outfile);
acfg->llvm_sfile = g_strdup (acfg->aot_opts.llvm_outfile);
if (acfg->llvm_owriter)
acfg->llvm_ofile = g_strdup (acfg->aot_opts.llvm_outfile);
else
acfg->llvm_sfile = g_strdup (acfg->aot_opts.llvm_outfile);
} else {
acfg->tmpbasename = g_strdup_printf ("%s", "temp");
acfg->tmpfname = g_strdup_printf ("%s.s", acfg->tmpbasename);
@@ -9581,21 +9589,6 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
if (acfg->dwarf)
mono_dwarf_writer_emit_base_info (acfg->dwarf, g_path_get_basename (acfg->image->name), mono_unwind_get_cie_program ());
if (acfg->thumb_mixed) {
char symbol [256];
/*
* This global symbol marks the end of THUMB code, and the beginning of ARM
* code generated by our JIT.
*/
sprintf (symbol, "thumb_end");
emit_section_change (acfg, ".text", 0);
emit_alignment_code (acfg, 8);
emit_label (acfg, symbol);
emit_zero_bytes (acfg, 16);
fprintf (acfg->fp, ".arm\n");
}
emit_code (acfg);
emit_info (acfg);
+17 -9
View File
@@ -123,7 +123,6 @@ typedef struct MonoAotModule {
guint32 *unbox_trampolines_end;
guint32 *unbox_trampoline_addresses;
guint8 *unwind_info;
guint8 *thumb_end;
/* Points to the mono EH data created by LLVM */
guint8 *mono_eh_frame;
@@ -1960,7 +1959,6 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
amodule->trampolines [MONO_AOT_TRAMP_STATIC_RGCTX] = info->static_rgctx_trampolines;
amodule->trampolines [MONO_AOT_TRAMP_IMT_THUNK] = info->imt_thunks;
amodule->trampolines [MONO_AOT_TRAMP_GSHAREDVT_ARG] = info->gsharedvt_arg_trampolines;
amodule->thumb_end = info->thumb_end;
/* Compute code_offsets from the method addresses */
amodule->code_offsets = g_malloc0 (amodule->info.nmethods * sizeof (gint32));
@@ -2407,6 +2405,15 @@ compute_llvm_code_range (MonoAotModule *amodule, guint8 **code_start, guint8 **c
}
}
static gboolean
is_thumb_code (MonoAotModule *amodule, guint8 *code)
{
if ((amodule->info.flags & MONO_AOT_FILE_FLAG_LLVM_THUMB) && (guint8*)code >= amodule->llvm_code_start && (guint8*)code < amodule->llvm_code_end)
return TRUE;
else
return FALSE;
}
/*
* decode_mono_eh_frame:
*
@@ -2491,7 +2498,7 @@ decode_llvm_mono_eh_frame (MonoAotModule *amodule, MonoDomain *domain,
g_assert (code >= code_start && code < code_end);
if (amodule->thumb_end && (guint8*)code_start < amodule->thumb_end)
if (is_thumb_code (amodule, code_start))
/* Clear thumb flag */
code_start = (guint8*)(((mgreg_t)code_start) & ~1);
@@ -2557,9 +2564,12 @@ decode_llvm_mono_eh_frame (MonoAotModule *amodule, MonoDomain *domain,
jei->handler_start = ei [i].handler_start;
jei->clause_index = clause_index;
/* Make sure we transition to thumb when a handler starts */
if (amodule->thumb_end && (guint8*)jei->handler_start < amodule->thumb_end)
if (is_thumb_code (amodule, jei->try_start)) {
jei->try_start = (void*)((mgreg_t)jei->try_start & ~1);
jei->try_end = (void*)((mgreg_t)jei->try_end & ~1);
/* Make sure we transition to thumb when a handler starts */
jei->handler_start = (void*)((mgreg_t)jei->handler_start + 1);
}
}
/* See exception_cb () in mini-llvm.c as to why this is needed */
@@ -4345,10 +4355,8 @@ mono_aot_get_plt_entry (guint8 *code)
return NULL;
#ifdef TARGET_ARM
if (amodule->thumb_end) {
if (code >= amodule->llvm_code_start && code < amodule->llvm_code_end)
return mono_arm_get_thumb_plt_entry (code);
}
if (is_thumb_code (amodule, code))
return mono_arm_get_thumb_plt_entry (code);
#endif
#ifdef MONO_ARCH_AOT_SUPPORTED
+41
View File
@@ -3,6 +3,7 @@ using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
/*
* Regression tests for the AOT/FULL-AOT code.
@@ -199,4 +200,44 @@ class Tests
return 0;
}
static int test_0_partial_sharing_regress_30204 () {
var t = typeof (System.Collections.Generic.Comparer<System.Collections.Generic.KeyValuePair<string, string>>);
var d = new SortedDictionary<string, string> ();
d.Add ("key1", "banana");
return d ["key1"] == "banana" ? 0 : 1;
}
class NullableMethods {
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static bool GetHasValue<T>(Nullable<T> value) where T : struct {
return value.HasValue;
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static T GetValue<T>(Nullable<T> value) where T : struct {
return value.Value;
}
}
[Category ("DYNCALL")]
public static int test_0_dyncall_nullable () {
int? v;
v = 42;
NullableMethods.GetHasValue (v);
bool b = (bool)typeof (NullableMethods).GetMethod ("GetHasValue").MakeGenericMethod (new Type [] { typeof (int) }).Invoke (null, new object [] { v });
if (!b)
return 1;
v = null;
b = (bool)typeof (NullableMethods).GetMethod ("GetHasValue").MakeGenericMethod (new Type [] { typeof (int) }).Invoke (null, new object [] { v });
if (b)
return 2;
v = 42;
NullableMethods.GetValue (v);
var res = (int)typeof (NullableMethods).GetMethod ("GetValue").MakeGenericMethod (new Type [] { typeof (int) }).Invoke (null, new object [] { v });
if (res != 42)
return 3;
return 0;
}
}
+6
View File
@@ -704,6 +704,12 @@ class Tests
return (int)(f1 / f2);
}
public static int test_1_frem_r4 () {
float f1 = 7.0f;
float f2 = 2.0f;
return (int)(f1 % f2);
}
public static int test_0_fcmp_eq_r4 () {
float f1 = 1.0f;
float f2 = 1.0f;
+29
View File
@@ -6535,12 +6535,21 @@ do_invoke_method (DebuggerTlsData *tls, Buffer *buf, InvokeData *invoke, guint8
return ERR_INVALID_ARGUMENT;
}
m = mono_object_get_virtual_method (this, m);
/* Transform this to the format the rest of the code expects it to be */
if (m->klass->valuetype) {
this_buf = g_alloca (mono_class_instance_size (m->klass));
memcpy (this_buf, mono_object_unbox (this), mono_class_instance_size (m->klass));
}
} else if ((m->flags & METHOD_ATTRIBUTE_VIRTUAL) && !m->klass->valuetype && invoke->flags & INVOKE_FLAG_VIRTUAL) {
if (!this) {
DEBUG_PRINTF (1, "[%p] Error: invoke with INVOKE_FLAG_VIRTUAL flag set without this argument.\n", (gpointer)GetCurrentThreadId ());
return ERR_INVALID_ARGUMENT;
}
m = mono_object_get_virtual_method (this, m);
if (m->klass->valuetype) {
this_buf = g_alloca (mono_class_instance_size (m->klass));
memcpy (this_buf, mono_object_unbox (this), mono_class_instance_size (m->klass));
}
}
DEBUG_PRINTF (1, "[%p] Invoking method '%s' on receiver '%s'.\n", (gpointer)GetCurrentThreadId (), mono_method_full_name (m, TRUE), this ? this->vtable->klass->name : "<null>");
@@ -8958,12 +8967,24 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
if (pos < 0) {
pos = - pos - 1;
DEBUG_PRINTF (4, "[dbg] send arg %d.\n", pos);
g_assert (pos >= 0 && pos < jit->num_params);
add_var (buf, jit, sig->params [pos], &jit->params [pos], &frame->ctx, frame->domain, FALSE);
} else {
MonoDebugLocalsInfo *locals;
locals = mono_debug_lookup_locals (frame->method);
if (locals) {
g_assert (pos < locals->num_locals);
pos = locals->locals [pos].index;
mono_debug_free_locals (locals);
}
g_assert (pos >= 0 && pos < jit->num_locals);
DEBUG_PRINTF (4, "[dbg] send local %d.\n", pos);
add_var (buf, jit, header->locals [pos], &jit->locals [pos], &frame->ctx, frame->domain, FALSE);
}
}
@@ -9007,6 +9028,14 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
t = sig->params [pos];
var = &jit->params [pos];
} else {
MonoDebugLocalsInfo *locals;
locals = mono_debug_lookup_locals (frame->method);
if (locals) {
g_assert (pos < locals->num_locals);
pos = locals->locals [pos].index;
mono_debug_free_locals (locals);
}
g_assert (pos >= 0 && pos < jit->num_locals);
t = header->locals [pos];
+1 -1
View File
@@ -745,7 +745,7 @@ mono_arch_exceptions_init (void)
tramp = get_throw_trampoline ("llvm_throw_exception_trampoline", FALSE, TRUE, FALSE, FALSE, FALSE, NULL, FALSE);
mono_register_jit_icall (tramp, "llvm_throw_exception_trampoline", NULL, TRUE);
tramp = get_throw_trampoline ("llvm_rethrow_exception_trampoline", FALSE, TRUE, FALSE, FALSE, FALSE, NULL, FALSE);
tramp = get_throw_trampoline ("llvm_rethrow_exception_trampoline", TRUE, TRUE, FALSE, FALSE, FALSE, NULL, FALSE);
mono_register_jit_icall (tramp, "llvm_rethrow_exception_trampoline", NULL, TRUE);
tramp = get_throw_trampoline ("llvm_throw_corlib_exception_trampoline", FALSE, TRUE, TRUE, FALSE, FALSE, NULL, FALSE);
+21
View File
@@ -2795,6 +2795,27 @@ class Tests
}
return 1;
}
static bool finally_called = false;
static void regress_30472 (int a, int b) {
checked {
try {
int sum = a + b;
} finally {
finally_called = true;
}
}
}
public static int test_0_regress_30472 () {
finally_called = false;
try {
regress_30472 (Int32.MaxValue - 1, 2);
} catch (Exception ex) {
}
return finally_called ? 0 : 1;
}
}
#if !MOBILE
+2 -1
View File
@@ -8158,12 +8158,13 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
* Backward branches are handled at the end of method-to-ir ().
*/
gboolean intr_loc = ip == header->code || (!cfg->cbb->last_ins && cfg->header->num_clauses);
gboolean sym_seq_point = sym_seq_points && mono_bitset_test_fast (seq_point_locs, ip - header->code);
/* Avoid sequence points on empty IL like .volatile */
// FIXME: Enable this
//if (!(cfg->cbb->last_ins && cfg->cbb->last_ins->opcode == OP_SEQ_POINT)) {
NEW_SEQ_POINT (cfg, ins, ip - header->code, intr_loc);
if (sp != stack_start)
if ((sp != stack_start) && !sym_seq_point)
ins->flags |= MONO_INST_NONEMPTY_STACK;
MONO_ADD_INS (cfg->cbb, ins);
+22 -1
View File
@@ -1386,6 +1386,11 @@ get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSign
case MONO_TYPE_R8:
cinfo->ret.storage = RegTypeFP;
if (t->type == MONO_TYPE_R4)
cinfo->ret.size = 4;
else
cinfo->ret.size = 8;
if (IS_HARD_FLOAT) {
cinfo->ret.reg = ARM_VFP_F0;
} else {
@@ -2858,7 +2863,23 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g
p->regs [slot] = (mgreg_t)*arg;
break;
} else {
/* Fall though */
if (t->type == MONO_TYPE_GENERICINST && mono_class_is_nullable (mono_class_from_mono_type (t))) {
MonoClass *klass = mono_class_from_mono_type (t);
guint8 *nullable_buf;
int size;
size = mono_class_value_size (klass, NULL);
nullable_buf = g_alloca (size);
g_assert (nullable_buf);
/* The argument pointed to by arg is either a boxed vtype or null */
mono_nullable_init (nullable_buf, (MonoObject*)arg, klass);
arg = (gpointer*)nullable_buf;
/* Fall though */
} else {
/* Fall though */
}
}
case MONO_TYPE_VALUETYPE:
g_assert (ainfo->storage == RegTypeStructByVal);
+1 -1
View File
@@ -702,7 +702,7 @@ mono_print_ins_index (int i, MonoInst *ins)
break;
case OP_IL_SEQ_POINT:
case OP_SEQ_POINT:
printf (" il: %x", (int)ins->inst_imm);
printf (" il: 0x%x%s", (int)ins->inst_imm, ins->flags & MONO_INST_NONEMPTY_STACK ? ", nonempty-stack" : "");
break;
default:
break;
+1 -1
View File
@@ -694,7 +694,7 @@ ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info
char *s;
sf->method = NULL;
s = mono_method_full_name (method, TRUE);
s = mono_method_get_name_full (method, TRUE, MONO_TYPE_NAME_FORMAT_REFLECTION);
MONO_OBJECT_SETREF (sf, internal_method_name, mono_string_new (domain, s));
g_free (s);
}
+5
View File
@@ -2247,6 +2247,11 @@ mono_method_is_generic_sharable_full (MonoMethod *method, gboolean allow_type_va
if (!mono_method_is_generic_impl (method))
return FALSE;
/*
if (!mono_debug_count ())
allow_partial = FALSE;
*/
if (!partial_sharing_supported ())
allow_partial = FALSE;
+1 -1
View File
@@ -2709,7 +2709,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
emit_dbg_loc (ctx, builder, ins->cil_code);
nins ++;
if (nins > 5000 && builder == starting_builder) {
if (nins > 3000 && builder == starting_builder) {
/* some steps in llc are non-linear in the size of basic blocks, see #5714 */
LLVM_FAILURE (ctx, "basic block too long");
}
+8 -2
View File
@@ -1179,7 +1179,6 @@ mono_patch_info_hash (gconstpointer data)
case MONO_PATCH_INFO_METHOD:
case MONO_PATCH_INFO_METHOD_JUMP:
case MONO_PATCH_INFO_IMAGE:
case MONO_PATCH_INFO_JIT_ICALL_ADDR:
case MONO_PATCH_INFO_ICALL_ADDR:
case MONO_PATCH_INFO_FIELD:
case MONO_PATCH_INFO_SFLDA:
@@ -1225,6 +1224,8 @@ mono_patch_info_hash (gconstpointer data)
return (ji->type << 8) | (gssize)info->klass | (gssize)info->method;
}
case MONO_PATCH_INFO_JIT_ICALL_ADDR:
return (ji->type << 8) | g_str_hash (ji->data.target);
default:
printf ("info type: %d\n", ji->type);
mono_print_ji (ji); printf ("\n");
@@ -1284,6 +1285,10 @@ mono_patch_info_equal (gconstpointer ka, gconstpointer kb)
return ji1->data.index == ji2->data.index;
case MONO_PATCH_INFO_VIRT_METHOD:
return ji1->data.virt_method->klass == ji2->data.virt_method->klass && ji1->data.virt_method->method == ji2->data.virt_method->method;
case MONO_PATCH_INFO_JIT_ICALL_ADDR:
if (ji1->data.target == ji2->data.target)
return 1;
return strcmp (ji1->data.target, ji2->data.target) == 0 ? 1 : 0;
default:
if (ji1->data.target != ji2->data.target)
return 0;
@@ -2267,7 +2272,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
for (i = 0; i < sig->param_count; ++i) {
MonoType *t = sig->params [i];
if (t->type == MONO_TYPE_GENERICINST && mono_class_is_nullable (mono_class_from_mono_type (t)))
if (t->byref && t->type == MONO_TYPE_GENERICINST && mono_class_is_nullable (mono_class_from_mono_type (t)))
supported = FALSE;
}
@@ -3315,6 +3320,7 @@ register_icalls (void)
#ifdef MONO_ARCH_EMULATE_FREM
#if defined(__default_codegen__)
register_opcode_emulation (OP_FREM, "__emul_frem", "double double double", fmod, "fmod", FALSE);
register_opcode_emulation (OP_RREM, "__emul_rrem", "float float float", fmodf, "fmodf", FALSE);
#elif defined(__native_client_codegen__)
register_opcode_emulation (OP_FREM, "__emul_frem", "double double double", mono_fmod, "mono_fmod", FALSE);
#endif
+2 -5
View File
@@ -113,7 +113,7 @@
#endif
/* Version number of the AOT file format */
#define MONO_AOT_FILE_VERSION 115
#define MONO_AOT_FILE_VERSION 116
//TODO: This is x86/amd64 specific.
#define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
@@ -174,6 +174,7 @@ typedef enum {
MONO_AOT_FILE_FLAG_WITH_LLVM = 1,
MONO_AOT_FILE_FLAG_FULL_AOT = 2,
MONO_AOT_FILE_FLAG_DEBUG = 4,
MONO_AOT_FILE_FLAG_LLVM_THUMB = 8,
} MonoAotFileFlags;
/* This structure is stored in the AOT file */
@@ -226,10 +227,6 @@ typedef struct MonoAotFileInfo
gpointer static_rgctx_trampolines;
gpointer imt_thunks;
gpointer gsharedvt_arg_trampolines;
/*
* The end of LLVM generated thumb code, or NULL.
*/
gpointer thumb_end;
/* In static mode, points to a table of global symbols for trampolines etc */
gpointer globals;
/* Points to a string containing the assembly name*/
+2 -1
View File
@@ -98,7 +98,8 @@ mono_save_seq_point_info (MonoCompile *cfg)
last = ins;
}
if (bb->last_ins && bb->last_ins->opcode == OP_ENDFINALLY && bb->seq_points) {
/* The second case handles endfinally opcodes which are in a separate bb by themselves */
if ((bb->last_ins && bb->last_ins->opcode == OP_ENDFINALLY && bb->seq_points) || (bb->out_count == 1 && bb->out_bb [0]->code && bb->out_bb [0]->code->opcode == OP_ENDFINALLY)) {
MonoBasicBlock *bb2;
MonoInst *endfinally_seq_point = NULL;