Merge branch 'upstream'
Former-commit-id: 7198d2ff44ee04d932a4e0560eddf0afd8de7ccb
This commit is contained in:
commit
898ce516ba
File diff suppressed because it is too large
Load Diff
@ -221,7 +221,7 @@ namespace Mono.Data.Sqlite
|
||||
case SQLiteDateFormats.UnixEpoch:
|
||||
return ((long)(dateValue.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond)).ToString();
|
||||
default:
|
||||
return dateValue.ToString(_datetimeFormats[5], CultureInfo.InvariantCulture);
|
||||
return dateValue.ToString(_datetimeFormats[19], CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ namespace MonoTests.System.Threading {
|
||||
// this bucket is used to avoid non-theadlocal issues
|
||||
class Bucket {
|
||||
public int count;
|
||||
public ManualResetEventSlim mre = new ManualResetEventSlim (false);
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
@ -36,51 +37,22 @@ namespace MonoTests.System.Threading {
|
||||
{
|
||||
}
|
||||
|
||||
private void Callback2 (object foo)
|
||||
{
|
||||
Bucket b = foo as Bucket;
|
||||
Interlocked.Increment (ref b.count);
|
||||
b.mre.Set ();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestDueTime ()
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
|
||||
using (Timer t = new Timer (o => Callback (o), bucket, 200, Timeout.Infinite)) {
|
||||
Thread.Sleep (50);
|
||||
Assert.AreEqual (0, bucket.count, "#1");
|
||||
Thread.Sleep (200);
|
||||
Assert.AreEqual (1, bucket.count, "#2");
|
||||
Thread.Sleep (500);
|
||||
Assert.AreEqual (1, bucket.count, "#3");
|
||||
t.Change (10, 10);
|
||||
Thread.Sleep (1000);
|
||||
Assert.IsTrue(bucket.count > 20, "#4");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChange ()
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
|
||||
using (Timer t = new Timer (o => Callback (o), bucket, 10, 10)) {
|
||||
Thread.Sleep (500);
|
||||
int c = bucket.count;
|
||||
Assert.IsTrue (c > 20, "#1 " + c.ToString ());
|
||||
t.Change (100, 100);
|
||||
c = bucket.count;
|
||||
Thread.Sleep (500);
|
||||
Assert.IsTrue (bucket.count <= c + 20, "#2 " + c.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZeroDueTime ()
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
|
||||
using (Timer t = new Timer (o => Callback (o), bucket, 0, Timeout.Infinite)) {
|
||||
Thread.Sleep (100);
|
||||
using (Timer t = new Timer (o => Callback2 (o), bucket, 200, Timeout.Infinite)) {
|
||||
Assert.IsTrue (bucket.mre.Wait (5000), "#-1");
|
||||
Assert.AreEqual (1, bucket.count, "#1");
|
||||
t.Change (0, Timeout.Infinite);
|
||||
Thread.Sleep (100);
|
||||
Assert.AreEqual (2, bucket.count, "#2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,15 +61,44 @@ namespace MonoTests.System.Threading {
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
|
||||
using (Timer t = new Timer (o => Callback (o), bucket, 10, 10)) {
|
||||
Thread.Sleep (200);
|
||||
using (Timer t = new Timer (o => Callback2 (o), bucket, 10, 10)) {
|
||||
Assert.IsTrue (bucket.mre.Wait (5000), "#-1");
|
||||
}
|
||||
|
||||
Thread.Sleep (20);
|
||||
//If the callback is called after dispose, it will NRE and be reported
|
||||
bucket.mre = null;
|
||||
int c = bucket.count;
|
||||
Assert.IsTrue (bucket.count > 5, "#1");
|
||||
Thread.Sleep (200);
|
||||
Assert.AreEqual (c, bucket.count, "#2");
|
||||
Assert.IsTrue (c > 0, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChange ()
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
|
||||
using (Timer t = new Timer (o => Callback2 (o), bucket, 10, 10)) {
|
||||
Assert.IsTrue (bucket.mre.Wait (5000), "#-1");
|
||||
int c = bucket.count;
|
||||
Assert.IsTrue (c > 0, "#1 " + c);
|
||||
t.Change (100000, 1000000);
|
||||
c = bucket.count;
|
||||
Thread.Sleep (500);
|
||||
Assert.IsTrue (bucket.count <= c + 1, "#2 " + c);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZeroDueTime ()
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
|
||||
using (Timer t = new Timer (o => Callback2 (o), bucket, 0, Timeout.Infinite)) {
|
||||
Assert.IsTrue (bucket.mre.Wait (5000), "#-1");
|
||||
bucket.mre.Reset ();
|
||||
Assert.AreEqual (1, bucket.count, "#1");
|
||||
t.Change (0, Timeout.Infinite);
|
||||
Assert.IsTrue (bucket.mre.Wait (5000), "#1.5");
|
||||
Assert.AreEqual (2, bucket.count, "#2");
|
||||
}
|
||||
}
|
||||
|
||||
[Test] // bug #320950
|
||||
|
@ -27,6 +27,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NUnit.Framework;
|
||||
@ -57,7 +58,10 @@ namespace MonoTests.System {
|
||||
[Test]
|
||||
public void ReRegisterForFinalizeTest ()
|
||||
{
|
||||
Run_ReRegisterForFinalizeTest ();
|
||||
var thread = new Thread (Run_ReRegisterForFinalizeTest);
|
||||
thread.Start ();
|
||||
thread.Join ();
|
||||
|
||||
var t = Task.Factory.StartNew (() => {
|
||||
do {
|
||||
GC.Collect ();
|
||||
|
@ -24,10 +24,11 @@ test-simple: simple.exe
|
||||
mono --debug $(the_lib) --cross default simple.exe -o foo && ./foo
|
||||
mono --debug $(the_lib) --sdk `dirname \`which mono\``/.. simple.exe -o foo && ./foo
|
||||
-rm DEMO.zip
|
||||
mono-package-runtime `dirname \`which mono\``/.. DEMO
|
||||
$(topdir)/../scripts/mono-package-runtime `dirname \`which mono\``/.. DEMO
|
||||
mkdir -p ~/.mono/targets/DEMO
|
||||
unzip -d ~/.mono/targets/DEMO DEMO.zip
|
||||
mono --debug $(the_lib) --cross DEMO simple.exe -o foo && ./foo
|
||||
mono --debug $(the_lib) --cross DEMO simple.exe -o foo | grep "Assembly.*mscorlib.dll"
|
||||
./foo
|
||||
|
||||
simple.exe: Makefile
|
||||
echo 'class X { static void Main () { System.Console.WriteLine ("OK");}}' > simple.cs && mcs simple.cs
|
||||
|
@ -1082,14 +1082,14 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
|
||||
static void LoadLocalizedAssemblies (List<string> assemblies)
|
||||
{
|
||||
var other = i18n.Select (x => "I18N." + x + (x.Length > 0 ? "." : "") + "dll");
|
||||
bool error = false;
|
||||
string error = null;
|
||||
|
||||
foreach (string name in other) {
|
||||
try {
|
||||
Assembly a = LoadAssembly (name);
|
||||
|
||||
if (a == null) {
|
||||
error = true;
|
||||
error = "Failed to load " + name;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1105,8 +1105,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
|
||||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
Error ("Couldn't load one or more of the i18n assemblies.");
|
||||
if (error != null) {
|
||||
Error ("Couldn't load one or more of the i18n assemblies: " + error);
|
||||
Environment.Exit (1);
|
||||
}
|
||||
}
|
||||
@ -1114,6 +1114,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
|
||||
|
||||
static readonly Universe universe = new Universe ();
|
||||
static readonly Dictionary<string, string> loaded_assemblies = new Dictionary<string, string> ();
|
||||
static readonly string resourcePathSeparator = (Path.DirectorySeparatorChar == '\\') ? $"\\{Path.DirectorySeparatorChar}" : $"{Path.DirectorySeparatorChar}";
|
||||
|
||||
public static string GetAssemblyName (string path)
|
||||
{
|
||||
@ -1126,7 +1127,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
|
||||
string dir = Path.GetDirectoryName (path);
|
||||
int idx = dir.LastIndexOf (Path.DirectorySeparatorChar);
|
||||
if (idx >= 0) {
|
||||
name = dir.Substring (idx + 1) + Path.DirectorySeparatorChar + name;
|
||||
name = dir.Substring (idx + 1) + resourcePathSeparator + name;
|
||||
Console.WriteLine ($"Storing satellite assembly '{path}' with name '{name}'");
|
||||
} else if (!quiet)
|
||||
Console.WriteLine ($"Warning: satellite assembly {path} doesn't have locale path prefix, name conflicts possible");
|
||||
@ -1158,7 +1159,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
|
||||
Assembly a = universe.LoadFile (path);
|
||||
|
||||
foreach (AssemblyName an in a.GetReferencedAssemblies ()) {
|
||||
LoadAssembly (an.FullName);
|
||||
a = universe.Load (an.FullName);
|
||||
if (!QueueAssembly (files, a.CodeBase))
|
||||
return false;
|
||||
}
|
||||
@ -1220,7 +1221,6 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
|
||||
static void Error (string msg, params object [] args)
|
||||
{
|
||||
Console.Error.WriteLine ("ERROR: {0}", string.Format (msg, args));
|
||||
throw new Exception ();
|
||||
Environment.Exit (1);
|
||||
}
|
||||
|
||||
|
@ -1970,7 +1970,7 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname, MonoBoolean re
|
||||
if (!is_ok (&error))
|
||||
goto leave;
|
||||
|
||||
ass = mono_assembly_open_full (filename, &status, refOnly);
|
||||
ass = mono_assembly_open_a_lot (filename, &status, refOnly, TRUE);
|
||||
|
||||
if (!ass) {
|
||||
if (status == MONO_IMAGE_IMAGE_INVALID)
|
||||
|
@ -1 +1 @@
|
||||
6319d6539ae88d35e1b1c3ac49c5be5c39e309a0
|
||||
b304894d059baf706e16a1cf96e1fab367d91a79
|
@ -10,4 +10,13 @@
|
||||
MonoImage *
|
||||
mono_find_image_owner (void *ptr);
|
||||
|
||||
MonoImage*
|
||||
mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError *error);
|
||||
|
||||
MonoImage*
|
||||
mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error);
|
||||
|
||||
MonoImage *
|
||||
mono_image_open_a_lot (const char *fname, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context);
|
||||
|
||||
#endif /* __MONO_METADATA_IMAGE_INTERNALS_H__ */
|
||||
|
@ -1188,9 +1188,13 @@ do_mono_image_load (MonoImage *image, MonoImageOpenStatus *status,
|
||||
goto invalid_image;
|
||||
|
||||
if (!image->ref_only && is_problematic_image (image)) {
|
||||
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Denying load of problematic image %s", image->name);
|
||||
*status = MONO_IMAGE_IMAGE_INVALID;
|
||||
goto invalid_image;
|
||||
if (image->load_from_context) {
|
||||
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Loading problematic image %s", image->name);
|
||||
} else {
|
||||
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Denying load of problematic image %s", image->name);
|
||||
*status = MONO_IMAGE_IMAGE_INVALID;
|
||||
goto invalid_image;
|
||||
}
|
||||
}
|
||||
|
||||
if (image->loader == &pe_loader && !image->metadata_only && !mono_verifier_verify_table_data (image, &errors))
|
||||
@ -1220,7 +1224,7 @@ invalid_image:
|
||||
|
||||
static MonoImage *
|
||||
do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
|
||||
gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly, gboolean metadata_only)
|
||||
gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly, gboolean metadata_only, gboolean load_from_context)
|
||||
{
|
||||
MonoCLIImageInfo *iinfo;
|
||||
MonoImage *image;
|
||||
@ -1264,6 +1268,7 @@ do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
|
||||
image->name = mono_path_resolve_symlinks (fname);
|
||||
image->ref_only = refonly;
|
||||
image->metadata_only = metadata_only;
|
||||
image->load_from_context = load_from_context;
|
||||
image->ref_count = 1;
|
||||
/* if MONO_SECURITY_MODE_CORE_CLR is set then determine if this image is platform code */
|
||||
image->core_clr_platform_code = mono_security_core_clr_determine_platform_image (image);
|
||||
@ -1460,6 +1465,12 @@ mono_image_open_from_module_handle (HMODULE module_handle, char* fname, gboolean
|
||||
|
||||
MonoImage *
|
||||
mono_image_open_full (const char *fname, MonoImageOpenStatus *status, gboolean refonly)
|
||||
{
|
||||
return mono_image_open_a_lot (fname, status, refonly, FALSE);
|
||||
}
|
||||
|
||||
MonoImage *
|
||||
mono_image_open_a_lot (const char *fname, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context)
|
||||
{
|
||||
MonoImage *image;
|
||||
GHashTable *loaded_images = get_loaded_images_hash (refonly);
|
||||
@ -1559,7 +1570,7 @@ mono_image_open_full (const char *fname, MonoImageOpenStatus *status, gboolean r
|
||||
mono_images_unlock ();
|
||||
|
||||
// Image not loaded, load it now
|
||||
image = do_mono_image_open (fname, status, TRUE, TRUE, refonly, FALSE);
|
||||
image = do_mono_image_open (fname, status, TRUE, TRUE, refonly, FALSE, load_from_context);
|
||||
if (image == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -1598,7 +1609,7 @@ mono_pe_file_open (const char *fname, MonoImageOpenStatus *status)
|
||||
{
|
||||
g_return_val_if_fail (fname != NULL, NULL);
|
||||
|
||||
return do_mono_image_open (fname, status, FALSE, TRUE, FALSE, FALSE);
|
||||
return do_mono_image_open (fname, status, FALSE, TRUE, FALSE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1615,7 +1626,7 @@ mono_image_open_raw (const char *fname, MonoImageOpenStatus *status)
|
||||
{
|
||||
g_return_val_if_fail (fname != NULL, NULL);
|
||||
|
||||
return do_mono_image_open (fname, status, FALSE, FALSE, FALSE, FALSE);
|
||||
return do_mono_image_open (fname, status, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1626,7 +1637,7 @@ mono_image_open_raw (const char *fname, MonoImageOpenStatus *status)
|
||||
MonoImage *
|
||||
mono_image_open_metadata_only (const char *fname, MonoImageOpenStatus *status)
|
||||
{
|
||||
return do_mono_image_open (fname, status, TRUE, TRUE, FALSE, TRUE);
|
||||
return do_mono_image_open (fname, status, TRUE, TRUE, FALSE, TRUE, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1 +1 @@
|
||||
7b980453c593408f829e7098dc333ad5087a8865
|
||||
aec93dfd6da7c7fdca217573f4c4110135f3d6e6
|
@ -330,7 +330,7 @@ MonoMethodSignature*
|
||||
mono_marshal_get_string_ctor_signature (MonoMethod *method);
|
||||
|
||||
MonoMethod *
|
||||
mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc);
|
||||
mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc, MonoError *exernal_error);
|
||||
|
||||
gpointer
|
||||
mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type);
|
||||
|
@ -210,6 +210,9 @@ struct _MonoImage {
|
||||
/* Whenever this image contains metadata only without PE data */
|
||||
guint8 metadata_only : 1;
|
||||
|
||||
/* Whether this image belongs to load-from context */
|
||||
guint8 load_from_context: 1;
|
||||
|
||||
guint8 checked_module_cctor : 1;
|
||||
guint8 has_module_cctor : 1;
|
||||
|
||||
@ -913,5 +916,8 @@ mono_find_image_set_owner (void *ptr);
|
||||
void
|
||||
mono_loader_register_module (const char *name, MonoDl *module);
|
||||
|
||||
MonoAssembly *
|
||||
mono_assembly_open_a_lot (const char *filename, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context);
|
||||
|
||||
#endif /* __MONO_METADATA_INTERNALS_H__ */
|
||||
|
||||
|
@ -1041,7 +1041,7 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
|
||||
{
|
||||
int p_var, size_var, thread_var G_GNUC_UNUSED;
|
||||
gboolean slowpath = variant == MANAGED_ALLOCATOR_SLOW_PATH;
|
||||
guint32 slowpath_branch, max_size_branch;
|
||||
guint32 slowpath_branch, max_size_branch, no_oom_branch;
|
||||
MonoMethodBuilder *mb;
|
||||
MonoMethod *res;
|
||||
MonoMethodSignature *csig;
|
||||
@ -1330,6 +1330,13 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* if (ret == NULL) throw OOM; */
|
||||
mono_mb_emit_byte (mb, CEE_DUP);
|
||||
no_oom_branch = mono_mb_emit_branch (mb, CEE_BRTRUE);
|
||||
mono_mb_emit_exception (mb, "OutOfMemoryException", NULL);
|
||||
|
||||
mono_mb_patch_branch (mb, no_oom_branch);
|
||||
mono_mb_emit_byte (mb, CEE_RET);
|
||||
|
||||
/* Fastpath */
|
||||
|
@ -117,7 +117,7 @@ restart_threads_until_none_in_managed_allocator (void)
|
||||
if (info->client_info.skip || info->client_info.gc_disabled || info->client_info.suspend_done)
|
||||
continue;
|
||||
if (mono_thread_info_is_live (info) &&
|
||||
(!info->client_info.stack_start || info->client_info.in_critical_region || info->client_info.info.inside_critical_region ||
|
||||
(info->client_info.in_critical_region || info->client_info.info.inside_critical_region ||
|
||||
is_ip_in_managed_allocator (info->client_info.stopped_domain, info->client_info.stopped_ip))) {
|
||||
binary_protocol_thread_restart ((gpointer)mono_thread_info_get_tid (info));
|
||||
SGEN_LOG (3, "thread %p resumed.", (void*) (size_t) info->client_info.info.native_handle);
|
||||
|
@ -861,7 +861,7 @@ EXTRA_DIST = TestDriver.cs \
|
||||
Makefile.am.in
|
||||
|
||||
version.h: Makefile
|
||||
echo "#define FULL_VERSION \"Stable 4.8.0.495/e4a3cf3\"" > version.h
|
||||
echo "#define FULL_VERSION \"Stable 4.8.0.520/8f6d0f6\"" > version.h
|
||||
|
||||
# Utility target for patching libtool to speed up linking
|
||||
patch-libtool:
|
||||
|
@ -861,7 +861,7 @@ EXTRA_DIST = TestDriver.cs \
|
||||
Makefile.am.in
|
||||
|
||||
version.h: Makefile
|
||||
echo "#define FULL_VERSION \"Stable 4.8.0.495/e4a3cf3\"" > version.h
|
||||
echo "#define FULL_VERSION \"Stable 4.8.0.520/8f6d0f6\"" > version.h
|
||||
|
||||
# Utility target for patching libtool to speed up linking
|
||||
patch-libtool:
|
||||
|
@ -1 +1 @@
|
||||
1d2d50a79752da03d88b373dcfa4536e767c289d
|
||||
0dc0111f92ce7928cc8fae909326c9c778d14418
|
@ -1 +1 @@
|
||||
c4f44c2ecbc5dc6f0532c59ad55c2f46f1ed7f73
|
||||
12111cac30226110a818b7d30ed37495129ceefa
|
@ -1 +1 @@
|
||||
2fd57cf8561234d38c90801e15fa271c5a719a82
|
||||
c9cf297db00016d19274c670f130a224b78f28e0
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user