diff --git a/configure.REMOVED.git-id b/configure.REMOVED.git-id
index 9d85dbac82..dc6ce318a4 100644
--- a/configure.REMOVED.git-id
+++ b/configure.REMOVED.git-id
@@ -1 +1 @@
-62dc0af03655563a8fea1115dcadaa9a3dd95399
\ No newline at end of file
+0d2865058e8904b609431e735d1a6a58dd269476
\ No newline at end of file
diff --git a/configure.ac.REMOVED.git-id b/configure.ac.REMOVED.git-id
index 14886c6724..b569026b33 100644
--- a/configure.ac.REMOVED.git-id
+++ b/configure.ac.REMOVED.git-id
@@ -1 +1 @@
-cb8a0a6dc718f29977f2e6e37b92839c51c7e80b
\ No newline at end of file
+e26c88521f1fb3392393ffb4a102d2f9441ab54f
\ No newline at end of file
diff --git a/mcs/build/common/Consts.cs b/mcs/build/common/Consts.cs
index c63ff16cc1..e738b8d395 100644
--- a/mcs/build/common/Consts.cs
+++ b/mcs/build/common/Consts.cs
@@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
- public const string MonoVersion = "4.0.1.0";
+ public const string MonoVersion = "4.0.2.0";
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssemblyResolver.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssemblyResolver.cs
index 9c1d478eb1..bf14075f7f 100644
--- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssemblyResolver.cs
+++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssemblyResolver.cs
@@ -256,9 +256,8 @@ namespace Microsoft.Build.Tasks {
{
PackageAssemblyInfo pkg = null;
- if (specific_version) {
- pkg = PcCache.GetAssemblyLocation (reference.ItemSpec);
- } else {
+ pkg = PcCache.GetAssemblyLocation (reference.ItemSpec);
+ if (pkg == null && !specific_version) {
// if not specific version, then just match simple name
string name = reference.ItemSpec;
if (name.IndexOf (',') > 0)
diff --git a/mcs/class/System.Xml.Linq/System.Xml.Linq/XAttribute.cs b/mcs/class/System.Xml.Linq/System.Xml.Linq/XAttribute.cs
index 7fcdd61e63..822db5b987 100644
--- a/mcs/class/System.Xml.Linq/System.Xml.Linq/XAttribute.cs
+++ b/mcs/class/System.Xml.Linq/System.Xml.Linq/XAttribute.cs
@@ -26,6 +26,8 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
using System.Text;
using System.Xml;
@@ -334,34 +336,29 @@ namespace System.Xml.Linq
static readonly char [] escapeChars = new char [] {'<', '>', '&', '"', '\r', '\n', '\t'};
+ private static string GetPrefixOfNamespace (XNamespace ns)
+ {
+ string namespaceName = ns.NamespaceName;
+ if (namespaceName.Length == 0)
+ return string.Empty;
+ if (namespaceName == XNamespace.Xml.NamespaceName)
+ return "xml";
+ if (namespaceName == XNamespace.Xmlns.NamespaceName)
+ return "xmlns";
+ return null;
+ }
+
public override string ToString ()
{
- StringBuilder sb = new StringBuilder ();
- sb.Append (name.ToString ());
- sb.Append ("=\"");
- int start = 0;
- do {
- int idx = value.IndexOfAny (escapeChars, start);
- if (idx < 0) {
- if (start > 0)
- sb.Append (value, start, value.Length - start);
- else
- sb.Append (value);
- sb.Append ("\"");
- return sb.ToString ();
+ using (StringWriter sw = new StringWriter (CultureInfo.InvariantCulture)) {
+ XmlWriterSettings ws = new XmlWriterSettings ();
+ ws.ConformanceLevel = ConformanceLevel.Fragment;
+ using (XmlWriter w = XmlWriter.Create (sw, ws)) {
+ w.WriteAttributeString (GetPrefixOfNamespace (Name.Namespace), Name.LocalName,
+ Name.NamespaceName, Value);
}
- sb.Append (value, start, idx - start);
- switch (value [idx]) {
- case '&': sb.Append ("&"); break;
- case '<': sb.Append ("<"); break;
- case '>': sb.Append (">"); break;
- case '"': sb.Append ("""); break;
- case '\r': sb.Append ("
"); break;
- case '\n': sb.Append ("
"); break;
- case '\t': sb.Append (" "); break;
- }
- start = idx + 1;
- } while (true);
+ return sw.ToString ().Trim ();
+ }
}
}
}
diff --git a/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs b/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs
index 7d1e8302b6..b8327d3158 100644
--- a/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs
+++ b/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs
@@ -205,6 +205,14 @@ namespace MonoTests.System.Xml.Linq
Assert.AreEqual ("a=\" >_< \"", a.ToString ());
}
+ [Test]
+ public void ToString_Xamarin29935 ()
+ {
+ var doc = XDocument.Parse ("");
+ Assert.AreEqual ("xmlns:test=\"http://test.example.com\"",
+ doc.Root.Attributes ().Select (s => s.ToString ()).First ());
+ }
+
[Test]
public void DateTimeAttribute ()
{
diff --git a/mcs/class/corlib/System.Text/EncodingHelper.cs b/mcs/class/corlib/System.Text/EncodingHelper.cs
index f077e44e25..c30ceff5b9 100644
--- a/mcs/class/corlib/System.Text/EncodingHelper.cs
+++ b/mcs/class/corlib/System.Text/EncodingHelper.cs
@@ -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,6 +71,7 @@ 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;
@@ -105,6 +106,7 @@ internal static class EncodingHelper
}
return enc;
}
+#endif
// Loaded copy of the "I18N" assembly. We need to move
// this into a class in "System.Private" eventually.
diff --git a/mcs/class/corlib/System/TimeZoneInfo.cs b/mcs/class/corlib/System/TimeZoneInfo.cs
index e6765bcb71..d4a16dbc9d 100644
--- a/mcs/class/corlib/System/TimeZoneInfo.cs
+++ b/mcs/class/corlib/System/TimeZoneInfo.cs
@@ -592,7 +592,7 @@ namespace System
public AdjustmentRule [] GetAdjustmentRules ()
{
- if (!supportsDaylightSavingTime)
+ if (!supportsDaylightSavingTime || adjustmentRules == null)
return new AdjustmentRule [0];
else
return (AdjustmentRule []) adjustmentRules.Clone ();
@@ -1254,8 +1254,10 @@ namespace System
tz = CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName, daylightDisplayName, ValidateRules (adjustmentRules).ToArray ());
}
- if (storeTransition)
+ if (storeTransition && transitions.Count > 0) {
tz.transitions = transitions;
+ tz.supportsDaylightSavingTime = true;
+ }
return tz;
}
diff --git a/mcs/class/lib/monolite/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite/Mono.Security.dll.REMOVED.git-id
index 1650993bf0..d1ce8f6145 100644
--- a/mcs/class/lib/monolite/Mono.Security.dll.REMOVED.git-id
+++ b/mcs/class/lib/monolite/Mono.Security.dll.REMOVED.git-id
@@ -1 +1 @@
-a7e75eef6368c6220420fa94b92d9f18efdc954b
\ No newline at end of file
+f38526856d8b1842bd8d401eb0d67765bff4c2cb
\ No newline at end of file
diff --git a/mcs/class/lib/monolite/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite/System.Xml.dll.REMOVED.git-id
index 9eac1b44fe..4437e303bb 100644
--- a/mcs/class/lib/monolite/System.Xml.dll.REMOVED.git-id
+++ b/mcs/class/lib/monolite/System.Xml.dll.REMOVED.git-id
@@ -1 +1 @@
-2eb43af5239e63316874341249c70a7aaaa21548
\ No newline at end of file
+c5f8a1c26efb5e43b4537118287011b39e48146e
\ No newline at end of file
diff --git a/mcs/class/lib/monolite/System.dll.REMOVED.git-id b/mcs/class/lib/monolite/System.dll.REMOVED.git-id
index a185151aeb..50e0445342 100644
--- a/mcs/class/lib/monolite/System.dll.REMOVED.git-id
+++ b/mcs/class/lib/monolite/System.dll.REMOVED.git-id
@@ -1 +1 @@
-1e8e4cd027b107938b2ccffcb417211866ad1223
\ No newline at end of file
+fab1f967bd41df8741fe07faecefc4570b2fa0a0
\ No newline at end of file
diff --git a/mcs/class/lib/monolite/basic.exe.REMOVED.git-id b/mcs/class/lib/monolite/basic.exe.REMOVED.git-id
index 564b2b10a3..b212d5b675 100644
--- a/mcs/class/lib/monolite/basic.exe.REMOVED.git-id
+++ b/mcs/class/lib/monolite/basic.exe.REMOVED.git-id
@@ -1 +1 @@
-c662727d3b509939685f97c0494d303020cc0725
\ No newline at end of file
+02bc04de3431cb4492836a94aa678ff49f7a43b2
\ No newline at end of file
diff --git a/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id
index 5b5b0d2ac1..7c5a073aba 100644
--- a/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id
+++ b/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id
@@ -1 +1 @@
-134f3a9815c9cb89f775b433dcde3143b910e93c
\ No newline at end of file
+b65949d5a9390ad455d5f54e6afffd8dedd94429
\ No newline at end of file
diff --git a/mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs b/mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs
index d7be23ac9e..808d09255f 100644
--- a/mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs
+++ b/mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs
@@ -100,7 +100,8 @@ namespace Mono.Linker.Steps {
var references = assembly.MainModule.AssemblyReferences;
for (int i = 0; i < references.Count; i++) {
var reference = references [i];
- if (!AreSameReference (reference, target.Name))
+ var r = Context.Resolver.Resolve (reference);
+ if (!AreSameReference (r.Name, target.Name))
continue;
references.RemoveAt (i);
diff --git a/mcs/tools/monop/Makefile b/mcs/tools/monop/Makefile
index 4be186fbcb..6fc37c3427 100644
--- a/mcs/tools/monop/Makefile
+++ b/mcs/tools/monop/Makefile
@@ -8,3 +8,9 @@ LOCAL_MCS_FLAGS += -d:NO_AUTHENTICODE,STATIC,NO_SYMBOL_WRITER
CLEAN_FILES = monop.exe monop2.exe *.mdb
include ../../build/executable.make
+
+run-test-local : basic-tests
+
+basic-tests:
+ for type in System.Array System.String 'System.Collections.Generic.List`1'; do \
+ echo $$type; $(RUNTIME) $(build_lib) $$type >/dev/null || exit 1; done
\ No newline at end of file
diff --git a/mcs/tools/monop/monop.cs b/mcs/tools/monop/monop.cs
index 9fe98ed6d1..1f0b253321 100644
--- a/mcs/tools/monop/monop.cs
+++ b/mcs/tools/monop/monop.cs
@@ -301,10 +301,10 @@ class MonoP {
static Options options = new Options ();
- static void Main (string [] args)
+ static int Main (string [] args)
{
if (!options.ProcessArgs (args))
- return;
+ return 1;
if (options.Style == null)
mscorlib = universe.LoadFile (typeof (int).Assembly.Location);
@@ -318,14 +318,14 @@ class MonoP {
if (options.ShowAll){
ShowAll (assembly, options.ShowPrivate, options.FilterObsolete);
- return;
+ return 0;
} else {
if (options.Type == null) {
if (options.PrintRefs)
PrintRefs (assembly);
else
PrintTypes (assembly, options.ShowPrivate, options.FilterObsolete);
- return;
+ return 0;
}
}
}
@@ -348,7 +348,7 @@ class MonoP {
if (count > 1){
Console.WriteLine ("Found " + count + " types that match:");
Console.WriteLine (matches);
- return;
+ return 0;
}
}
@@ -394,7 +394,7 @@ class MonoP {
notfound:
if (t == null) {
Console.WriteLine ("Could not find {0}", tname);
- return;
+ return 1;
}
found:
//
@@ -406,6 +406,7 @@ class MonoP {
if (message != null)
Console.WriteLine (message);
+ return 0;
}
}
diff --git a/mcs/tools/monop/outline.cs b/mcs/tools/monop/outline.cs
index 63b2359b3d..1e1dc25ae6 100644
--- a/mcs/tools/monop/outline.cs
+++ b/mcs/tools/monop/outline.cs
@@ -42,6 +42,19 @@ using System.Reflection;
#endif
namespace Mono.CSharp {
+
+public static class TypeExtensions {
+ public static string GetNamespace (this Type t)
+ {
+ // IKVM crashes here with a null ref sometimes
+ try {
+ return t.Namespace;
+ } catch {
+ return null;
+ }
+ }
+}
+
public class Outline {
bool declared_only;
bool show_private;
@@ -636,7 +649,7 @@ public class Outline {
if (!type.StartsWith ("System.")) {
if (type.IndexOf (".") == -1)
return type;
- if (t.Namespace == this.t.Namespace)
+ if (t.GetNamespace () == this.t.GetNamespace ())
return t.Name;
return type;
}
@@ -745,7 +758,8 @@ public class Outline {
}
if (!recursed) {
- string ns = t.Namespace;
+ string ns;
+ ns = t.GetNamespace ();
if ((ns != null) && (ns != "")) {
sb.Append (ns);
sb.Append (".");
diff --git a/mono-core.spec b/mono-core.spec
index 47bae23566..19579bb652 100644
--- a/mono-core.spec
+++ b/mono-core.spec
@@ -15,7 +15,7 @@ License: LGPL v2.1 only
Group: Development/Languages/Mono
Summary: A .NET Runtime Environment
Url: http://www.mono-project.com
-Version: 4.0.1
+Version: 4.0.2
Release: 0
Source0: mono-%{version}.tar.bz2
BuildRequires: bison
diff --git a/mono/metadata/class.c.REMOVED.git-id b/mono/metadata/class.c.REMOVED.git-id
index 5b7310995f..3dc0edc0cf 100644
--- a/mono/metadata/class.c.REMOVED.git-id
+++ b/mono/metadata/class.c.REMOVED.git-id
@@ -1 +1 @@
-b70897dccb00767160a66906636e4a11d355eba9
\ No newline at end of file
+1296ed12123a12950e6d9b97c95d1d2eda6c2b2a
\ No newline at end of file
diff --git a/mono/metadata/marshal.c.REMOVED.git-id b/mono/metadata/marshal.c.REMOVED.git-id
index db4a0d3cab..874b6a4191 100644
--- a/mono/metadata/marshal.c.REMOVED.git-id
+++ b/mono/metadata/marshal.c.REMOVED.git-id
@@ -1 +1 @@
-0b3265de9b69f018f6bbdbc74247de6151f934c1
\ No newline at end of file
+57cf909b79c9925e99852392121898be48f52512
\ No newline at end of file
diff --git a/mono/metadata/marshal.h b/mono/metadata/marshal.h
index eb10aebac1..c404b1dd64 100644
--- a/mono/metadata/marshal.h
+++ b/mono/metadata/marshal.h
@@ -308,6 +308,9 @@ mono_marshal_get_delegate_end_invoke (MonoMethod *method) MONO_INTERNAL;
MonoMethod *
mono_marshal_get_delegate_invoke (MonoMethod *method, MonoDelegate *del) MONO_INTERNAL;
+MonoMethod *
+mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt, gboolean static_method_with_first_arg_bound, MonoMethod *target_method) MONO_INTERNAL;
+
MonoMethod *
mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean is_virtual) MONO_INTERNAL;
diff --git a/mono/mini/Makefile.am b/mono/mini/Makefile.am
index 4dee163e43..cf79769ca4 100644
--- a/mono/mini/Makefile.am
+++ b/mono/mini/Makefile.am
@@ -758,16 +758,7 @@ EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
Makefile.am.in
version.h: Makefile
- if test -d $(top_srcdir)/.git; then \
- (cd $(top_srcdir); \
- LANG=C; export LANG; \
- branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
- version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
- echo "#define FULL_VERSION \"$$branch/$$version\""; \
- ); \
- else \
- echo "#define FULL_VERSION \"tarball\""; \
- fi > version.h
+ echo "#define FULL_VERSION \"Stable 4.0.2.4/198235d\"" > version.h
# Utility target for patching libtool to speed up linking
patch-libtool:
diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in
index 4dee163e43..cf79769ca4 100755
--- a/mono/mini/Makefile.am.in
+++ b/mono/mini/Makefile.am.in
@@ -758,16 +758,7 @@ EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
Makefile.am.in
version.h: Makefile
- if test -d $(top_srcdir)/.git; then \
- (cd $(top_srcdir); \
- LANG=C; export LANG; \
- branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
- version=`git log --no-color --first-parent -n1 --pretty=format:%h`; \
- echo "#define FULL_VERSION \"$$branch/$$version\""; \
- ); \
- else \
- echo "#define FULL_VERSION \"tarball\""; \
- fi > version.h
+ echo "#define FULL_VERSION \"Stable 4.0.2.4/198235d\"" > version.h
# Utility target for patching libtool to speed up linking
patch-libtool:
diff --git a/mono/mini/Makefile.in.REMOVED.git-id b/mono/mini/Makefile.in.REMOVED.git-id
index e73e749a5a..33620ec1da 100644
--- a/mono/mini/Makefile.in.REMOVED.git-id
+++ b/mono/mini/Makefile.in.REMOVED.git-id
@@ -1 +1 @@
-8046fb5169b2fc7fb8a247a8ea7b9577f1666b9f
\ No newline at end of file
+c39e0c15b49d478226e1a68b24c751029eb0cd2b
\ No newline at end of file
diff --git a/mono/mini/aot-compiler.c.REMOVED.git-id b/mono/mini/aot-compiler.c.REMOVED.git-id
index 00912746cb..a6a9068897 100644
--- a/mono/mini/aot-compiler.c.REMOVED.git-id
+++ b/mono/mini/aot-compiler.c.REMOVED.git-id
@@ -1 +1 @@
-eff409c294acd4fb9800517fd4fedf8558e63ee9
\ No newline at end of file
+746324b102b743279f76bc697ae22671f330cd68
\ No newline at end of file
diff --git a/mono/mini/basic-float.cs b/mono/mini/basic-float.cs
index ed62046b8a..a5ccf787e7 100644
--- a/mono/mini/basic-float.cs
+++ b/mono/mini/basic-float.cs
@@ -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;
diff --git a/mono/mini/exceptions-arm.c b/mono/mini/exceptions-arm.c
index 2c9e748454..7b0e40278c 100644
--- a/mono/mini/exceptions-arm.c
+++ b/mono/mini/exceptions-arm.c
@@ -401,7 +401,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
if (ji != NULL) {
int i;
- gssize regs [MONO_MAX_IREGS + 1 + 8];
+ mono_unwind_reg_t regs [MONO_MAX_IREGS + 1 + 8];
guint8 *cfa;
guint32 unwind_info_len;
guint8 *unwind_info;
@@ -420,7 +420,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
#ifdef TARGET_IOS
/* On IOS, d8..d15 are callee saved. They are mapped to 8..15 in unwind.c */
for (i = 0; i < 8; ++i)
- regs [MONO_MAX_IREGS + i] = new_ctx->fregs [8 + i];
+ regs [MONO_MAX_IREGS + i] = *(guint64*)&(new_ctx->fregs [8 + i]);
#endif
mono_unwind_frame (unwind_info, unwind_info_len, ji->code_start,
@@ -434,7 +434,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
new_ctx->regs [ARMREG_SP] = (gsize)cfa;
#ifdef TARGET_IOS
for (i = 0; i < 8; ++i)
- new_ctx->fregs [8 + i] = regs [MONO_MAX_IREGS + i];
+ new_ctx->fregs [8 + i] = *(double*)&(regs [MONO_MAX_IREGS + i]);
#endif
/* Clear thumb bit */
diff --git a/mono/mini/mini-arm.h b/mono/mini/mini-arm.h
index e9f9901461..13a812af21 100644
--- a/mono/mini/mini-arm.h
+++ b/mono/mini/mini-arm.h
@@ -124,6 +124,9 @@
* reproduceable results for benchmarks */
#define MONO_ARCH_CODE_ALIGNMENT 32
+/* This needs to hold both a 32 bit int and a 64 bit double */
+#define mono_unwind_reg_t guint64
+
/* Argument marshallings for calls between gsharedvt and normal code */
typedef enum {
GSHAREDVT_ARG_NONE = 0,
diff --git a/mono/mini/mini-unwind.h b/mono/mini/mini-unwind.h
index 1085cbe0e3..e1d24cf4d2 100644
--- a/mono/mini/mini-unwind.h
+++ b/mono/mini/mini-unwind.h
@@ -12,6 +12,11 @@
#include "mini.h"
+/* This is the same as mgreg_t, except on 32 bit bit platforms with callee saved fp regs */
+#ifndef mono_unwind_reg_t
+#define mono_unwind_reg_t mgreg_t
+#endif
+
/*
* This is a platform-independent interface for unwinding through stack frames
* based on the Dwarf unwinding interface.
@@ -145,7 +150,7 @@ mono_unwind_ops_encode (GSList *unwind_ops, guint32 *out_len) MONO_INTERNAL;
void
mono_unwind_frame (guint8 *unwind_info, guint32 unwind_info_len,
guint8 *start_ip, guint8 *end_ip, guint8 *ip, guint8 **mark_locations,
- mgreg_t *regs, int nregs,
+ mono_unwind_reg_t *regs, int nregs,
mgreg_t **save_locations, int save_locations_len,
guint8 **out_cfa) MONO_INTERNAL;
diff --git a/mono/mini/mini.c.REMOVED.git-id b/mono/mini/mini.c.REMOVED.git-id
index cb4dc05f1b..f68da0ff9d 100644
--- a/mono/mini/mini.c.REMOVED.git-id
+++ b/mono/mini/mini.c.REMOVED.git-id
@@ -1 +1 @@
-9c391bd627650570aa4f69767e44703f6d8e5f7e
\ No newline at end of file
+2db8d861eff4843bacec8f1b86cc931e68850d75
\ No newline at end of file
diff --git a/mono/mini/unwind.c b/mono/mini/unwind.c
index 584fb81508..512c60513d 100644
--- a/mono/mini/unwind.c
+++ b/mono/mini/unwind.c
@@ -51,11 +51,12 @@ static int map_hw_reg_to_dwarf_reg [] = { 0, 2, 1, 3, 7, 6, 4, 5, 8, 9, 10, 11,
#define DWARF_PC_REG (mono_hw_reg_to_dwarf_reg (AMD64_RIP))
#elif defined(TARGET_ARM)
// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040a/IHI0040A_aadwarf.pdf
-/* Assign d8..d15 to hregs 16..24 */
+/* Assign d8..d15 to hregs 16..24 (dwarf regs 264..271) */
static int map_hw_reg_to_dwarf_reg [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 264, 265, 266, 267, 268, 269, 270, 271 };
#define NUM_REGS 272
#define DWARF_DATA_ALIGN (-4)
#define DWARF_PC_REG (mono_hw_reg_to_dwarf_reg (ARMREG_LR))
+#define IS_DOUBLE_REG(dwarf_reg) (((dwarf_reg) >= 264) && ((dwarf_reg) <= 271))
#elif defined(TARGET_ARM64)
#define NUM_REGS 96
#define DWARF_DATA_ALIGN (-8)
@@ -109,6 +110,10 @@ static int map_hw_reg_to_dwarf_reg [16];
#define DWARF_PC_REG -1
#endif
+#ifndef IS_DOUBLE_REG
+#define IS_DOUBLE_REG(dwarf_reg) 0
+#endif
+
static gboolean dwarf_reg_to_hw_reg_inited;
static int map_dwarf_reg_to_hw_reg [NUM_REGS];
@@ -480,7 +485,7 @@ typedef struct {
void
mono_unwind_frame (guint8 *unwind_info, guint32 unwind_info_len,
guint8 *start_ip, guint8 *end_ip, guint8 *ip, guint8 **mark_locations,
- mgreg_t *regs, int nregs,
+ mono_unwind_reg_t *regs, int nregs,
mgreg_t **save_locations, int save_locations_len,
guint8 **out_cfa)
{
@@ -602,7 +607,10 @@ mono_unwind_frame (guint8 *unwind_info, guint32 unwind_info_len,
if (reg_saved [i] && locations [i].loc_type == LOC_OFFSET) {
int hreg = mono_dwarf_reg_to_hw_reg (i);
g_assert (hreg < nregs);
- regs [hreg] = *(mgreg_t*)(cfa_val + locations [i].offset);
+ if (IS_DOUBLE_REG (i))
+ regs [hreg] = *(guint64*)(cfa_val + locations [i].offset);
+ else
+ regs [hreg] = *(mgreg_t*)(cfa_val + locations [i].offset);
if (save_locations && hreg < save_locations_len)
save_locations [hreg] = (mgreg_t*)(cfa_val + locations [i].offset);
}
diff --git a/mono/mini/version.h b/mono/mini/version.h
index a61cd6b5e7..d858c42352 100644
--- a/mono/mini/version.h
+++ b/mono/mini/version.h
@@ -1 +1 @@
-#define FULL_VERSION "(detached/ed1d3ec"
+#define FULL_VERSION "Stable 4.0.2.4/198235d"
diff --git a/mono/profiler/proflog.c b/mono/profiler/proflog.c
index 8a3f075bd8..a9d3179ebb 100644
--- a/mono/profiler/proflog.c
+++ b/mono/profiler/proflog.c
@@ -93,7 +93,8 @@ static int use_zip = 0;
static int do_report = 0;
static int do_heap_shot = 0;
static int max_call_depth = 100;
-static int runtime_inited = 0;
+static volatile int runtime_inited = 0;
+static int need_helper_thread = 0;
static int command_port = 0;
static int heapshot_requested = 0;
static int sample_type = 0;
@@ -623,11 +624,8 @@ find_method (MonoDomain *domain, void *user_data)
}
static void
-register_method_local (MonoProfiler *prof, MonoDomain *domain, MonoMethod *method, MonoJitInfo *ji)
+register_method_local (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *ji)
{
- if (!domain)
- g_assert (ji);
-
if (!mono_conc_hashtable_lookup (prof->method_table, method)) {
if (!ji) {
MethodSearch search = { method, NULL };
@@ -649,12 +647,19 @@ register_method_local (MonoProfiler *prof, MonoDomain *domain, MonoMethod *metho
}
static void
-emit_method (MonoProfiler *prof, LogBuffer *logbuffer, MonoDomain *domain, MonoMethod *method)
+emit_method (MonoProfiler *prof, LogBuffer *logbuffer, MonoMethod *method)
{
- register_method_local (prof, domain, method, NULL);
+ register_method_local (prof, method, NULL);
emit_method_inner (logbuffer, method);
}
+static void
+emit_method_as_ptr (MonoProfiler *prof, LogBuffer *logbuffer, MonoMethod *method)
+{
+ register_method_local (prof, method, NULL);
+ emit_ptr (logbuffer, method);
+}
+
static void
emit_obj (LogBuffer *logbuffer, void *ptr)
{
@@ -802,24 +807,22 @@ process_requests (MonoProfiler *profiler)
static void counters_init (MonoProfiler *profiler);
static void counters_sample (MonoProfiler *profiler, uint64_t timestamp);
-static void
-runtime_initialized (MonoProfiler *profiler)
-{
- runtime_inited = 1;
-#ifndef DISABLE_HELPER_THREAD
- counters_init (profiler);
- counters_sample (profiler, 0);
-#endif
- /* ensure the main thread data and startup are available soon */
- safe_send (profiler, ensure_logbuf (0));
-}
-
/*
* Can be called only at safe callback locations.
*/
static void
safe_send (MonoProfiler *profiler, LogBuffer *logbuffer)
{
+ /* We need the runtime initialized so that we have threads and hazard
+ * pointers available. Otherwise, the lock free queue will not work and
+ * there won't be a thread to process the data.
+ *
+ * While the runtime isn't initialized, we just accumulate data in the
+ * thread local buffer list.
+ */
+ if (!InterlockedRead (&runtime_inited))
+ return;
+
int cd = logbuffer->call_depth;
send_buffer (profiler, TLS_GET (GPtrArray, tlsmethodlist), TLS_GET (LogBuffer, tlsbuffer));
@@ -967,7 +970,7 @@ collect_bt (FrameData *data)
}
static void
-emit_bt (LogBuffer *logbuffer, FrameData *data)
+emit_bt (MonoProfiler *prof, LogBuffer *logbuffer, FrameData *data)
{
/* FIXME: this is actually tons of data and we should
* just output it the first time and use an id the next
@@ -979,7 +982,7 @@ emit_bt (LogBuffer *logbuffer, FrameData *data)
//if (*p != data.count) {
// printf ("bad num frames enc at %d: %d -> %d\n", count, data.count, *p); printf ("frames end: %p->%p\n", p, logbuffer->data); exit(0);}
while (data->count) {
- emit_ptr (logbuffer, data->methods [--data->count]);
+ emit_method_as_ptr (prof, logbuffer, data->methods [--data->count]);
}
}
@@ -988,7 +991,7 @@ gc_alloc (MonoProfiler *prof, MonoObject *obj, MonoClass *klass)
{
uint64_t now;
uintptr_t len;
- int do_bt = (nocalls && runtime_inited && !notraces)? TYPE_ALLOC_BT: 0;
+ int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces)? TYPE_ALLOC_BT: 0;
FrameData data;
LogBuffer *logbuffer;
len = mono_object_get_size (obj);
@@ -1006,7 +1009,7 @@ gc_alloc (MonoProfiler *prof, MonoObject *obj, MonoClass *klass)
emit_obj (logbuffer, obj);
emit_value (logbuffer, len);
if (do_bt)
- emit_bt (logbuffer, &data);
+ emit_bt (prof, logbuffer, &data);
EXIT_LOG (logbuffer);
if (logbuffer->next)
safe_send (prof, logbuffer);
@@ -1144,7 +1147,7 @@ class_loaded (MonoProfiler *prof, MonoClass *klass, int result)
LogBuffer *logbuffer;
if (result != MONO_PROFILE_OK)
return;
- if (runtime_inited)
+ if (InterlockedRead (&runtime_inited))
name = mono_type_get_name (mono_class_get_type (klass));
else
name = type_name (klass);
@@ -1183,7 +1186,7 @@ method_enter (MonoProfiler *prof, MonoMethod *method)
ENTER_LOG (logbuffer, "enter");
emit_byte (logbuffer, TYPE_ENTER | TYPE_METHOD);
emit_time (logbuffer, now);
- emit_method (prof, logbuffer, mono_domain_get (), method);
+ emit_method (prof, logbuffer, method);
EXIT_LOG (logbuffer);
process_requests (prof);
}
@@ -1199,7 +1202,7 @@ method_leave (MonoProfiler *prof, MonoMethod *method)
ENTER_LOG (logbuffer, "leave");
emit_byte (logbuffer, TYPE_LEAVE | TYPE_METHOD);
emit_time (logbuffer, now);
- emit_method (prof, logbuffer, mono_domain_get (), method);
+ emit_method (prof, logbuffer, method);
EXIT_LOG (logbuffer);
if (logbuffer->next)
safe_send (prof, logbuffer);
@@ -1220,7 +1223,7 @@ method_exc_leave (MonoProfiler *prof, MonoMethod *method)
ENTER_LOG (logbuffer, "eleave");
emit_byte (logbuffer, TYPE_EXC_LEAVE | TYPE_METHOD);
emit_time (logbuffer, now);
- emit_method (prof, logbuffer, mono_domain_get (), method);
+ emit_method (prof, logbuffer, method);
EXIT_LOG (logbuffer);
process_requests (prof);
}
@@ -1231,7 +1234,7 @@ method_jitted (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *ji, int resu
if (result != MONO_PROFILE_OK)
return;
- register_method_local (prof, NULL, method, ji);
+ register_method_local (prof, method, ji);
}
static void
@@ -1267,7 +1270,7 @@ code_buffer_new (MonoProfiler *prof, void *buffer, int size, MonoProfilerCodeBuf
static void
throw_exc (MonoProfiler *prof, MonoObject *object)
{
- int do_bt = (nocalls && runtime_inited && !notraces)? TYPE_EXCEPTION_BT: 0;
+ int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces)? TYPE_EXCEPTION_BT: 0;
uint64_t now;
FrameData data;
LogBuffer *logbuffer;
@@ -1280,7 +1283,7 @@ throw_exc (MonoProfiler *prof, MonoObject *object)
emit_time (logbuffer, now);
emit_obj (logbuffer, object);
if (do_bt)
- emit_bt (logbuffer, &data);
+ emit_bt (prof, logbuffer, &data);
EXIT_LOG (logbuffer);
process_requests (prof);
}
@@ -1296,14 +1299,14 @@ clause_exc (MonoProfiler *prof, MonoMethod *method, int clause_type, int clause_
emit_time (logbuffer, now);
emit_value (logbuffer, clause_type);
emit_value (logbuffer, clause_num);
- emit_method (prof, logbuffer, mono_domain_get (), method);
+ emit_method (prof, logbuffer, method);
EXIT_LOG (logbuffer);
}
static void
monitor_event (MonoProfiler *profiler, MonoObject *object, MonoProfilerMonitorEvent event)
{
- int do_bt = (nocalls && runtime_inited && !notraces && event == MONO_PROFILER_MONITOR_CONTENTION)? TYPE_MONITOR_BT: 0;
+ int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces && event == MONO_PROFILER_MONITOR_CONTENTION)? TYPE_MONITOR_BT: 0;
uint64_t now;
FrameData data;
LogBuffer *logbuffer;
@@ -1316,7 +1319,7 @@ monitor_event (MonoProfiler *profiler, MonoObject *object, MonoProfilerMonitorEv
emit_time (logbuffer, now);
emit_obj (logbuffer, object);
if (do_bt)
- emit_bt (logbuffer, &data);
+ emit_bt (profiler, logbuffer, &data);
EXIT_LOG (logbuffer);
process_requests (profiler);
}
@@ -1829,10 +1832,9 @@ dump_sample_hits (MonoProfiler *prof, StatBuffer *sbuf)
emit_uvalue (logbuffer, mbt_count);
for (i = 0; i < mbt_count; ++i) {
MonoMethod *method = (MonoMethod *) sample [i * 4 + 0];
- MonoDomain *domain = (MonoDomain *) sample [i * 4 + 1];
uintptr_t native_offset = sample [i * 4 + 3];
- emit_method (prof, logbuffer, domain, method);
+ emit_method (prof, logbuffer, method);
emit_svalue (logbuffer, 0); /* il offset will always be 0 from now on */
emit_svalue (logbuffer, native_offset);
}
@@ -2724,7 +2726,7 @@ helper_thread (void* arg)
if (strcmp (buf, "heapshot\n") == 0) {
heapshot_requested = 1;
//fprintf (stderr, "perform heapshot\n");
- if (runtime_inited && !thread) {
+ if (InterlockedRead (&runtime_inited) && !thread) {
thread = mono_thread_attach (mono_get_root_domain ());
/*fprintf (stderr, "attached\n");*/
}
@@ -2878,13 +2880,33 @@ start_writer_thread (MonoProfiler* prof)
return !pthread_create (&prof->writer_thread, NULL, writer_thread, prof);
}
+static void
+runtime_initialized (MonoProfiler *profiler)
+{
+#ifndef DISABLE_HELPER_THREAD
+ if (hs_mode_ondemand || need_helper_thread) {
+ if (!start_helper_thread (profiler))
+ profiler->command_port = 0;
+ }
+#endif
+
+ start_writer_thread (profiler);
+
+ InterlockedWrite (&runtime_inited, 1);
+#ifndef DISABLE_HELPER_THREAD
+ counters_init (profiler);
+ counters_sample (profiler, 0);
+#endif
+ /* ensure the main thread data and startup are available soon */
+ safe_send (profiler, ensure_logbuf (0));
+}
+
static MonoProfiler*
create_profiler (const char *filename)
{
MonoProfiler *prof;
char *nf;
int force_delete = 0;
- int need_helper_thread = 0;
prof = calloc (1, sizeof (MonoProfiler));
prof->command_port = command_port;
@@ -2943,12 +2965,7 @@ create_profiler (const char *filename)
if (do_counters && !need_helper_thread) {
need_helper_thread = 1;
}
-#ifndef DISABLE_HELPER_THREAD
- if (hs_mode_ondemand || need_helper_thread) {
- if (!start_helper_thread (prof))
- prof->command_port = 0;
- }
-#else
+#ifdef DISABLE_HELPER_THREAD
if (hs_mode_ondemand)
fprintf (stderr, "Ondemand heapshot unavailable on this arch.\n");
#endif
@@ -2957,8 +2974,6 @@ create_profiler (const char *filename)
mono_mutex_init (&prof->method_table_mutex);
prof->method_table = mono_conc_hashtable_new (&prof->method_table_mutex, NULL, NULL);
- start_writer_thread (prof);
-
prof->startup_time = current_time ();
return prof;
}
diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am
index 6a1a76a8fd..8b0ab538b6 100644
--- a/mono/tests/Makefile.am
+++ b/mono/tests/Makefile.am
@@ -307,6 +307,7 @@ BASE_TEST_CS_SRC= \
generic-typedef.2.cs \
generic-marshalbyref.2.cs \
generic-xdomain.2.cs \
+ dynamic-generic-size.cs \
bug-431413.2.cs \
bug-459285.2.cs \
generic-virtual-invoke.2.cs \
diff --git a/mono/tests/Makefile.in b/mono/tests/Makefile.in
index eb04e9880d..2be68b3663 100644
--- a/mono/tests/Makefile.in
+++ b/mono/tests/Makefile.in
@@ -726,6 +726,7 @@ BASE_TEST_CS_SRC = \
generic-typedef.2.cs \
generic-marshalbyref.2.cs \
generic-xdomain.2.cs \
+ dynamic-generic-size.cs \
bug-431413.2.cs \
bug-459285.2.cs \
generic-virtual-invoke.2.cs \
diff --git a/mono/tests/dynamic-generic-size.cs b/mono/tests/dynamic-generic-size.cs
new file mode 100644
index 0000000000..3a26f728d1
--- /dev/null
+++ b/mono/tests/dynamic-generic-size.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Threading;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Collections.Generic;
+
+namespace GenericSize
+{
+ class GenericSize
+ {
+ static int Iterations = 10000;
+ static AssemblyBuilder assembly;
+ static ModuleBuilder module;
+ static string ASSEMBLY_NAME = "MonoTests.System.Reflection.Emit.TypeBuilderTest";
+
+ static void SetUp ()
+ {
+ AssemblyName assemblyName = new AssemblyName ();
+ assemblyName.Name = ASSEMBLY_NAME;
+
+ assembly =
+ Thread.GetDomain ().DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.Run);
+
+ module = assembly.DefineDynamicModule ("module1");
+ }
+
+ static int Main()
+ {
+ SetUp ();
+
+ TypeBuilder tb = module.DefineType ("Test", TypeAttributes.Public);
+ tb.DefineGenericParameters ("T");
+ var tb_ctor = tb.DefineDefaultConstructor (MethodAttributes.Public);
+
+ var tb2 = module.DefineType ("Test2", TypeAttributes.Public);
+ var g0 = tb2.DefineGenericParameters ("T");
+
+ var mb = tb2.DefineMethod ("Foo", MethodAttributes.Public | MethodAttributes.Static, typeof (object), new Type [0]);
+
+ var il = mb.GetILGenerator();
+ il.Emit(OpCodes.Newobj, TypeBuilder.GetConstructor (tb.MakeGenericType (g0), tb_ctor));
+ il.Emit(OpCodes.Ret);
+
+ var t1 = tb.CreateType ();
+ var t2 = tb2.CreateType ();
+
+ var ginst = t2.MakeGenericType (typeof (string));
+ var method = ginst.GetMethod ("Foo", BindingFlags.Public | BindingFlags.Static);
+
+ var lst = new List