From: Aleksey Kliger (λgeek) Date: Tue, 27 Jun 2017 14:44:30 +0000 (-0400) Subject: Merge pull request #5120 from lambdageek/bug-57744 X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=af2b3eb197868b4aa8a223260ad64373ce8605f8;hp=bebd8dc438788db0631a9409a162793e60b5f4a4;p=mono.git Merge pull request #5120 from lambdageek/bug-57744 [reflection] Convert correct MonoError to an exn in Assembly.GetTypes () --- diff --git a/eglib/src/glib.h b/eglib/src/glib.h index 6f16fcb292b..060b99e51ae 100644 --- a/eglib/src/glib.h +++ b/eglib/src/glib.h @@ -14,6 +14,7 @@ #endif #include +#include #include #ifndef EGLIB_NO_REMAP diff --git a/external/api-snapshot b/external/api-snapshot index c905d71a70f..fd9e7e3ba78 160000 --- a/external/api-snapshot +++ b/external/api-snapshot @@ -1 +1 @@ -Subproject commit c905d71a70fb1611bda9b2a32241fbbba7a9381f +Subproject commit fd9e7e3ba7848fedf4a5e6a3bb08d91de8f9df32 diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs index 4adaaf514fe..45d6c4541eb 100644 --- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs +++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs @@ -310,19 +310,20 @@ namespace System.IO.MemoryMappedFiles [MonoLimitation ("Named mappings scope is process local")] public static MemoryMappedFile OpenExisting (string mapName) { - throw new NotImplementedException (); + return OpenExisting (mapName, MemoryMappedFileRights.ReadWrite); } [MonoLimitation ("Named mappings scope is process local")] public static MemoryMappedFile OpenExisting (string mapName, MemoryMappedFileRights desiredAccessRights) { - throw new NotImplementedException (); + return OpenExisting (mapName, desiredAccessRights, HandleInheritability.None); } [MonoLimitation ("Named mappings scope is process local")] public static MemoryMappedFile OpenExisting (string mapName, MemoryMappedFileRights desiredAccessRights, HandleInheritability inheritability) { - throw new NotImplementedException (); + // FIXME: Actually use desiredAccessRights + return CoreShmCreate (mapName, 0, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None, null, inheritability, FileMode.Open); } public MemoryMappedViewStream CreateViewStream () @@ -393,10 +394,9 @@ namespace System.IO.MemoryMappedFiles throw new NotImplementedException (); } - [MonoTODO] public SafeMemoryMappedFileHandle SafeMemoryMappedFileHandle { get { - throw new NotImplementedException (); + return handle; } } diff --git a/mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs b/mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs index c192c397fa8..e533f0144b5 100644 --- a/mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs +++ b/mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs @@ -301,9 +301,12 @@ namespace MonoTests.System.IO.MemoryMappedFiles { var name = MkNamedMapping (); using (var m0 = MemoryMappedFile.CreateNew(name, 4096, MemoryMappedFileAccess.ReadWrite)) { using (var m1 = MemoryMappedFile.CreateOrOpen (name, 4096, MemoryMappedFileAccess.ReadWrite)) { - using (MemoryMappedViewAccessor v0 = m0.CreateViewAccessor (), v1 = m1.CreateViewAccessor ()) { - v0.Write (10, 0x12345); - Assert.AreEqual (0x12345, v1.ReadInt32 (10)); + using (var m2 = MemoryMappedFile.OpenExisting (name)) { + using (MemoryMappedViewAccessor v0 = m0.CreateViewAccessor (), v1 = m1.CreateViewAccessor (), v2 = m2.CreateViewAccessor ()) { + v0.Write (10, 0x12345); + Assert.AreEqual (0x12345, v1.ReadInt32 (10)); + Assert.AreEqual (0x12345, v2.ReadInt32 (10)); + } } } } @@ -466,5 +469,13 @@ namespace MonoTests.System.IO.MemoryMappedFiles { } } } + + [Test] + public void OpenExistingWithNoExistingThrows() + { + Assert.Throws(() => { + MemoryMappedFile.OpenExisting (MkNamedMapping ()); + }); + } } } diff --git a/mcs/tools/cil-strip/Makefile b/mcs/tools/cil-strip/Makefile index e84d78325e6..80a4caf2a95 100644 --- a/mcs/tools/cil-strip/Makefile +++ b/mcs/tools/cil-strip/Makefile @@ -5,6 +5,9 @@ include ../../build/rules.make LOCAL_MCS_FLAGS = LIB_REFS = System +# IMPORTANT: we need to keep the old copy of Cecil we have in this folder since newer Cecil +# doesn't support keeping metadata tokens the same which would break AOT compilation + PROGRAM = mono-cil-strip.exe include ../../build/executable.make diff --git a/mcs/tools/cil-strip/mono-cil-strip.exe.sources b/mcs/tools/cil-strip/mono-cil-strip.exe.sources index ebc3922f3cb..5ea4d803027 100644 --- a/mcs/tools/cil-strip/mono-cil-strip.exe.sources +++ b/mcs/tools/cil-strip/mono-cil-strip.exe.sources @@ -1,7 +1,5 @@ ./cilstrip.cs ./AssemblyStripper.cs -# IMPORTANT: we need to keep this old copy of Cecil since newer Cecil -# doesn't support keeping metadata tokens the same which would break AOT compilation ./Mono.Cecil/AggressiveReflectionReader.cs ./Mono.Cecil/ArrayDimension.cs ./Mono.Cecil/ArrayDimensionCollection.cs diff --git a/mono/btls/btls-util.c b/mono/btls/btls-util.c index 7c7f4ca5b41..955b8c85aec 100644 --- a/mono/btls/btls-util.c +++ b/mono/btls/btls-util.c @@ -27,12 +27,12 @@ mono_btls_util_asn1_time_to_ticks (ASN1_TIME *time) ASN1_GENERALIZEDTIME *gtime; struct tm tm; int64_t epoch; - int ret; memset (&tm, 0, sizeof (tm)); gtime = ASN1_TIME_to_generalizedtime (time, NULL); - ret = asn1_generalizedtime_to_tm (&tm, gtime); + /* FIXME: check return value of asn1_generalizedtime_to_tm () */ + asn1_generalizedtime_to_tm (&tm, gtime); ASN1_GENERALIZEDTIME_free (gtime); epoch = btls_timegm64 (&tm); diff --git a/mono/metadata/boehm-gc.c b/mono/metadata/boehm-gc.c index acbd4eae4b0..abbea870830 100644 --- a/mono/metadata/boehm-gc.c +++ b/mono/metadata/boehm-gc.c @@ -102,7 +102,7 @@ static void on_gc_heap_resize (size_t new_size); void mono_gc_base_init (void) { - const char *env; + char *env; if (gc_initialized) return; @@ -465,7 +465,7 @@ on_gc_notification (GC_EventType event) } #endif gc_stats.major_gc_time += mono_100ns_ticks () - gc_start_time; - mono_trace_message (MONO_TRACE_GC, "gc took %d usecs", (mono_100ns_ticks () - gc_start_time) / 10); + mono_trace_message (MONO_TRACE_GC, "gc took %" G_GINT64_FORMAT " usecs", (mono_100ns_ticks () - gc_start_time) / 10); break; default: break; diff --git a/mono/metadata/file-mmap-posix.c b/mono/metadata/file-mmap-posix.c index c6c906bc098..3c971a091b5 100644 --- a/mono/metadata/file-mmap-posix.c +++ b/mono/metadata/file-mmap-posix.c @@ -303,7 +303,7 @@ static void* open_memory_map (const char *c_mapName, int mode, gint64 *capacity, int access, int options, int *ioerror) { MmapHandle *handle; - if (*capacity <= 0) { + if (*capacity <= 0 && mode != FILE_MODE_OPEN) { *ioerror = CAPACITY_MUST_BE_POSITIVE; return NULL; } diff --git a/mono/metadata/file-mmap-windows.c b/mono/metadata/file-mmap-windows.c index e6d8cfd9a1e..59abd6686ff 100644 --- a/mono/metadata/file-mmap-windows.c +++ b/mono/metadata/file-mmap-windows.c @@ -140,7 +140,7 @@ static void *open_handle (void *handle, MonoString *mapName, int mode, gint64 *c HANDLE result = NULL; if (handle == INVALID_HANDLE_VALUE) { - if (*capacity <= 0) { + if (*capacity <= 0 && mode != FILE_MODE_OPEN) { *error = CAPACITY_MUST_BE_POSITIVE; return NULL; } diff --git a/mono/metadata/handle.c b/mono/metadata/handle.c index 4fc959c242a..5e32a478a38 100644 --- a/mono/metadata/handle.c +++ b/mono/metadata/handle.c @@ -71,7 +71,7 @@ Combine: MonoDefaults, GENERATE_GET_CLASS_WITH_CACHE, TYPED_HANDLE_DECL and frie #if defined(HAVE_BOEHM_GC) || defined(HAVE_NULL_GC) static HandleStack* -new_handle_stack () +new_handle_stack (void) { return (HandleStack *)mono_gc_alloc_fixed (sizeof (HandleStack), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_HANDLE, "Thread Handle Stack"); } @@ -83,7 +83,7 @@ free_handle_stack (HandleStack *stack) } static HandleChunk* -new_handle_chunk () +new_handle_chunk (void) { #if defined(HAVE_BOEHM_GC) return (HandleChunk *)GC_MALLOC (sizeof (HandleChunk)); @@ -101,7 +101,7 @@ free_handle_chunk (HandleChunk *chunk) } #else static HandleStack* -new_handle_stack () +new_handle_stack (void) { return g_new (HandleStack, 1); } @@ -113,7 +113,7 @@ free_handle_stack (HandleStack *stack) } static HandleChunk* -new_handle_chunk () +new_handle_chunk (void) { return g_new (HandleChunk, 1); } diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index 48e0f67c56a..76ccc633aac 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -7866,7 +7866,7 @@ ves_icall_System_Runtime_InteropServices_Marshal_GetRawIUnknownForComObjectNoAdd } ICALL_EXPORT MonoObject* -ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_GetRestrictedErrorInfo() +ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_GetRestrictedErrorInfo(void) { mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.GetRestrictedErrorInfo internal call is not implemented.")); return NULL; diff --git a/mono/metadata/sgen-bridge.c b/mono/metadata/sgen-bridge.c index 9bfb7245a63..9d7809a211a 100644 --- a/mono/metadata/sgen-bridge.c +++ b/mono/metadata/sgen-bridge.c @@ -94,7 +94,7 @@ bridge_processor_name (const char *name) } static gboolean -bridge_processor_started () +bridge_processor_started (void) { return bridge_processor.reset_data != NULL; } @@ -139,7 +139,7 @@ init_bridge_processor (SgenBridgeProcessor *processor, BridgeProcessorSelection * is done initing. Actual initialization then only occurs if it is ready. */ void -sgen_init_bridge () +sgen_init_bridge (void) { if (sgen_gc_initialized ()) { // This lock is not initialized until the GC is diff --git a/mono/metadata/sgen-tarjan-bridge.c b/mono/metadata/sgen-tarjan-bridge.c index 8df0c6600ec..77ea9f8a701 100644 --- a/mono/metadata/sgen-tarjan-bridge.c +++ b/mono/metadata/sgen-tarjan-bridge.c @@ -180,7 +180,7 @@ static DynPtrArray color_merge_array; // Running hash of the contents of the color_merge_array. static unsigned int color_merge_array_hash; -static void color_merge_array_empty () +static void color_merge_array_empty (void) { dyn_array_ptr_empty (&color_merge_array); color_merge_array_hash = 0; diff --git a/mono/metadata/threadpool-worker-default.c b/mono/metadata/threadpool-worker-default.c index 6c851db7370..87256b51187 100644 --- a/mono/metadata/threadpool-worker-default.c +++ b/mono/metadata/threadpool-worker-default.c @@ -387,7 +387,8 @@ worker_park (void) gboolean timeout = FALSE; gboolean interrupted = FALSE; - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker parking", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker parking", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); mono_coop_mutex_lock (&worker.parked_threads_lock); @@ -431,7 +432,7 @@ done: mono_coop_mutex_unlock (&worker.parked_threads_lock); mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s", - mono_native_thread_id_get (), timeout ? "yes" : "no", interrupted ? "yes" : "no"); + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), timeout ? "yes" : "no", interrupted ? "yes" : "no"); return timeout; } @@ -441,7 +442,8 @@ worker_try_unpark (void) { gboolean res = FALSE; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); mono_coop_mutex_lock (&worker.parked_threads_lock); if (worker.parked_threads_count > 0) { @@ -450,7 +452,8 @@ worker_try_unpark (void) } mono_coop_mutex_unlock (&worker.parked_threads_lock); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker, success? %s", mono_native_thread_id_get (), res ? "yes" : "no"); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker, success? %s", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), res ? "yes" : "no"); return res; } @@ -461,7 +464,8 @@ worker_thread (gpointer unused) MonoInternalThread *thread; ThreadPoolWorkerCounter counter; - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker starting", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker starting", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); if (!mono_refcount_tryinc (&worker)) return 0; @@ -489,7 +493,7 @@ worker_thread (gpointer unused) } mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker executing", - mono_native_thread_id_get ()); + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); worker.callback (); } @@ -498,7 +502,8 @@ worker_thread (gpointer unused) counter._.working --; }); - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker finishing", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker finishing", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); mono_refcount_dec (&worker); @@ -519,7 +524,8 @@ worker_try_create (void) mono_coop_mutex_lock (&worker.worker_creation_lock); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); current_ticks = mono_100ns_ticks (); if (0 == current_ticks) { @@ -533,7 +539,7 @@ worker_try_create (void) g_assert (worker.worker_creation_current_count <= WORKER_CREATION_MAX_PER_SEC); if (worker.worker_creation_current_count == WORKER_CREATION_MAX_PER_SEC) { mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, failed: maximum number of worker created per second reached, current count = %d", - mono_native_thread_id_get (), worker.worker_creation_current_count); + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), worker.worker_creation_current_count); mono_coop_mutex_unlock (&worker.worker_creation_lock); return FALSE; } @@ -543,7 +549,7 @@ worker_try_create (void) COUNTER_ATOMIC (counter, { if (counter._.working >= counter._.max_working) { mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, failed: maximum number of working threads reached", - mono_native_thread_id_get ()); + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); mono_coop_mutex_unlock (&worker.worker_creation_lock); return FALSE; } @@ -552,7 +558,8 @@ worker_try_create (void) thread = mono_thread_create_internal (mono_get_root_domain (), worker_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL, &error); if (!thread) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, failed: could not create thread due to %s", mono_native_thread_id_get (), mono_error_get_message (&error)); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, failed: could not create thread due to %s", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), mono_error_get_message (&error)); mono_error_cleanup (&error); COUNTER_ATOMIC (counter, { @@ -567,7 +574,7 @@ worker_try_create (void) worker.worker_creation_current_count += 1; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, created %p, now = %d count = %d", - mono_native_thread_id_get (), (gpointer) thread->tid, now, worker.worker_creation_current_count); + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), (gpointer) thread->tid, now, worker.worker_creation_current_count); mono_coop_mutex_unlock (&worker.worker_creation_lock); return TRUE; @@ -584,16 +591,19 @@ worker_request (void) monitor_ensure_running (); if (worker_try_unpark ()) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] request worker, unparked", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] request worker, unparked", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); return; } if (worker_try_create ()) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] request worker, created", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] request worker, created", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); return; } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] request worker, failed", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] request worker, failed", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); } static gboolean @@ -668,7 +678,8 @@ monitor_thread (gpointer unused) // printf ("monitor_thread: start\n"); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, started", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, started", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); do { ThreadPoolWorkerCounter counter; @@ -731,12 +742,14 @@ monitor_thread (gpointer unused) break; if (worker_try_unpark ()) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, unparked", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, unparked", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); break; } if (worker_try_create ()) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, created", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, created", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); break; } } @@ -744,7 +757,8 @@ monitor_thread (gpointer unused) // printf ("monitor_thread: stop\n"); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, finished", mono_native_thread_id_get ()); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, finished", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); mono_refcount_dec (&worker); return 0; @@ -790,7 +804,8 @@ hill_climbing_change_thread_count (gint16 new_thread_count, ThreadPoolHeuristicS hc = &worker.heuristic_hill_climbing; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] hill climbing, change max number of threads %d", mono_native_thread_id_get (), new_thread_count); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] hill climbing, change max number of threads %d", + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), new_thread_count); hc->last_thread_count = new_thread_count; hc->current_sample_interval = rand_next (&hc->random_interval_generator, hc->sample_interval_low, hc->sample_interval_high); diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.c index fbdd359394a..1c8c1f401a8 100644 --- a/mono/metadata/threadpool.c +++ b/mono/metadata/threadpool.c @@ -339,7 +339,7 @@ worker_callback (void) g_assert (tpdomain->outstanding_request >= 0); mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker running in domain %p (outstanding requests %d)", - mono_native_thread_id_get (), tpdomain->domain, tpdomain->outstanding_request); + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), tpdomain->domain, tpdomain->outstanding_request); g_assert (tpdomain->threadpool_jobs >= 0); tpdomain->threadpool_jobs ++; diff --git a/mono/metadata/w32file-unix.c b/mono/metadata/w32file-unix.c index 8c97b06cc8c..64e46c2d588 100644 --- a/mono/metadata/w32file-unix.c +++ b/mono/metadata/w32file-unix.c @@ -1368,19 +1368,20 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, #ifdef HAVE_LARGE_FILE_SUPPORT if(highmovedistance==NULL) { offset=movedistance; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting offset to %lld (low %d)", __func__, + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting offset to %" G_GINT64_FORMAT " (low %" G_GINT32_FORMAT ")", __func__, offset, movedistance); } else { offset=((gint64) *highmovedistance << 32) | (guint32)movedistance; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting offset to %lld 0x%llx (high %d 0x%x, low %d 0x%x)", __func__, offset, offset, *highmovedistance, *highmovedistance, movedistance, movedistance); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting offset to %" G_GINT64_FORMAT " 0x%" PRIx64 " (high %" G_GINT32_FORMAT " 0x%" PRIx32 ", low %" G_GINT32_FORMAT " 0x%" PRIx32 ")", + __func__, offset, offset, *highmovedistance, *highmovedistance, movedistance, movedistance); } #else offset=movedistance; #endif - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: moving handle %p by %lld bytes from %d", __func__, - handle, (long long)offset, whence); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: moving handle %p by %" G_GINT64_FORMAT " bytes from %d", __func__, + handle, offset, whence); #ifdef PLATFORM_ANDROID /* bionic doesn't support -D_FILE_OFFSET_BITS=64 */ @@ -1400,7 +1401,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, return(INVALID_SET_FILE_POINTER); } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lseek returns %lld", __func__, newpos); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lseek returns %" G_GINT64_FORMAT, __func__, newpos); #ifdef HAVE_LARGE_FILE_SUPPORT ret=newpos & 0xFFFFFFFF; @@ -1415,7 +1416,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, } #endif - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: move of handle %p returning %d/%d", __func__, + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: move of handle %p returning %" G_GUINT32_FORMAT "/%" G_GINT32_FORMAT, __func__, handle, ret, highmovedistance==NULL?0:*highmovedistance); return(ret); @@ -1604,7 +1605,7 @@ static guint32 file_getfilesize(gpointer handle, guint32 *highsize) *highsize = bigsize>>32; } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning block device size %d/%d", + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning block device size %" G_GUINT32_FORMAT "/%" G_GUINT32_FORMAT, __func__, size, *highsize); return(size); @@ -1624,7 +1625,7 @@ static guint32 file_getfilesize(gpointer handle, guint32 *highsize) size = statbuf.st_size; #endif - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning size %d/%d", __func__, size, *highsize); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning size %" G_GUINT32_FORMAT "/%" G_GUINT32_FORMAT, __func__, size, *highsize); return(size); } @@ -1690,7 +1691,7 @@ static gboolean file_getfiletime(gpointer handle, FILETIME *create_time, access_ticks=((guint64)statbuf.st_atime*10000000)+116444736000000000ULL; write_ticks=((guint64)statbuf.st_mtime*10000000)+116444736000000000ULL; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: aticks: %llu cticks: %llu wticks: %llu", __func__, + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: aticks: %" G_GUINT64_FORMAT " cticks: %" G_GUINT64_FORMAT " wticks: %" G_GUINT64_FORMAT, __func__, access_ticks, create_ticks, write_ticks); if(create_time!=NULL) { @@ -2056,7 +2057,7 @@ pipe_read (gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesrea return(FALSE); } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: reading up to %d bytes from pipe %p", __func__, + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: reading up to %" G_GUINT32_FORMAT " bytes from pipe %p", __func__, numbytes, handle); do { @@ -2117,8 +2118,8 @@ pipe_write(gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byt return(FALSE); } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: writing up to %d bytes to pipe %p", __func__, numbytes, - handle); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: writing up to %" G_GUINT32_FORMAT " bytes to pipe %p", __func__, + numbytes, handle); do { MONO_ENTER_GC_SAFE; @@ -2161,7 +2162,7 @@ static gint convert_flags(guint32 fileaccess, guint32 createmode) flags=O_RDWR; break; default: - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unknown access type 0x%x", __func__, + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unknown access type 0x%" PRIx32, __func__, fileaccess); break; } @@ -2182,7 +2183,7 @@ static gint convert_flags(guint32 fileaccess, guint32 createmode) flags|=O_TRUNC; break; default: - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unknown create mode 0x%x", __func__, + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unknown create mode 0x%" PRIx32, __func__, createmode); break; } @@ -2222,7 +2223,7 @@ static gboolean share_allows_open (struct stat *statbuf, guint32 sharemode, */ if (file_existing_share == 0) { /* Quick and easy, no possibility to share */ - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%x, file has sharing = NONE", __func__, fileaccess); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%" PRIx32 ", file has sharing = NONE", __func__, fileaccess); file_share_release (*share_info); @@ -2234,7 +2235,7 @@ static gboolean share_allows_open (struct stat *statbuf, guint32 sharemode, ((file_existing_share == FILE_SHARE_WRITE) && (fileaccess != GENERIC_WRITE))) { /* New access mode doesn't match up */ - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%x, file has sharing: 0x%x", __func__, fileaccess, file_existing_share); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%" PRIx32 ", file has sharing: 0x%" PRIx32, __func__, fileaccess, file_existing_share); file_share_release (*share_info); @@ -2246,7 +2247,7 @@ static gboolean share_allows_open (struct stat *statbuf, guint32 sharemode, ((file_existing_access & GENERIC_WRITE) && !(sharemode & FILE_SHARE_WRITE))) { /* New share mode doesn't match up */ - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Access mode prevents open: requested share: 0x%x, file has access: 0x%x", __func__, sharemode, file_existing_access); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Access mode prevents open: requested share: 0x%" PRIx32 ", file has access: 0x%" PRIx32, __func__, sharemode, file_existing_access); file_share_release (*share_info); @@ -2275,7 +2276,7 @@ share_allows_delete (struct stat *statbuf, FileShare **share_info) */ if (file_existing_share == 0) { /* Quick and easy, no possibility to share */ - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%x, file has sharing = NONE", __func__, (*share_info)->access); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%" PRIx32 ", file has sharing = NONE", __func__, (*share_info)->access); file_share_release (*share_info); @@ -2284,7 +2285,7 @@ share_allows_delete (struct stat *statbuf, FileShare **share_info) if (!(file_existing_share & FILE_SHARE_DELETE)) { /* New access mode doesn't match up */ - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%x, file has sharing: 0x%x", __func__, (*share_info)->access, file_existing_share); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%" PRIx32 ", file has sharing: 0x%" PRIx32, __func__, (*share_info)->access, file_existing_share); file_share_release (*share_info); @@ -2338,7 +2339,7 @@ mono_w32file_create(const gunichar2 *name, guint32 fileaccess, guint32 sharemode return(INVALID_HANDLE_VALUE); } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening %s with share 0x%x and access 0x%x", __func__, + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening %s with share 0x%" PRIx32 " and access 0x%" PRIx32, __func__, filename, sharemode, fileaccess); fd = _wapi_open (filename, flags, perms); @@ -3278,21 +3279,23 @@ mono_w32file_filetime_to_systemtime(const FILETIME *file_time, SYSTEMTIME *syste totaldays=(file_ticks / TICKS_PER_DAY); rem = file_ticks % TICKS_PER_DAY; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %lld rem: %lld", __func__, totaldays, rem); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %" G_GINT64_FORMAT " rem: %" G_GINT64_FORMAT, __func__, + totaldays, rem); system_time->wHour=rem/TICKS_PER_HOUR; rem %= TICKS_PER_HOUR; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Hour: %d rem: %lld", __func__, system_time->wHour, rem); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Hour: %d rem: %" G_GINT64_FORMAT, __func__, + system_time->wHour, rem); system_time->wMinute = rem / TICKS_PER_MINUTE; rem %= TICKS_PER_MINUTE; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Minute: %d rem: %lld", __func__, system_time->wMinute, - rem); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Minute: %d rem: %" G_GINT64_FORMAT, __func__, + system_time->wMinute, rem); system_time->wSecond = rem / TICKS_PER_SECOND; rem %= TICKS_PER_SECOND; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Second: %d rem: %lld", __func__, system_time->wSecond, - rem); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Second: %d rem: %" G_GINT64_FORMAT, __func__, + system_time->wSecond, rem); system_time->wMilliseconds = rem / TICKS_PER_MILLISECOND; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Milliseconds: %d", __func__, @@ -3313,19 +3316,19 @@ mono_w32file_filetime_to_systemtime(const FILETIME *file_time, SYSTEMTIME *syste while(totaldays < 0 || totaldays >= (isleap(y)?366:365)) { /* Guess a corrected year, assuming 365 days per year */ gint64 yg = y + totaldays / 365 - (totaldays % 365 < 0); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %lld yg: %lld y: %lld", __func__, - totaldays, yg, - y); - g_message("%s: LEAPS(yg): %lld LEAPS(y): %lld", __func__, + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %" G_GINT64_FORMAT " yg: %" G_GINT64_FORMAT " y: %" G_GINT64_FORMAT, __func__, + totaldays, yg, y); + g_message("%s: LEAPS(yg): %li LEAPS(y): %li", __func__, LEAPS_THRU_END_OF(yg-1), LEAPS_THRU_END_OF(y-1)); /* Adjust days and y to match the guessed year. */ totaldays -= ((yg - y) * 365 + LEAPS_THRU_END_OF (yg - 1) - LEAPS_THRU_END_OF (y - 1)); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %lld", __func__, totaldays); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %" G_GINT64_FORMAT, + __func__, totaldays); y = yg; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: y: %lld", __func__, y); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: y: %" G_GINT64_FORMAT, __func__, y); } system_time->wYear = y; @@ -3337,7 +3340,7 @@ mono_w32file_filetime_to_systemtime(const FILETIME *file_time, SYSTEMTIME *syste continue; } totaldays-=ip[y]; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %lld", __func__, totaldays); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %" G_GINT64_FORMAT, __func__, totaldays); system_time->wMonth = y + 1; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Month: %d", __func__, system_time->wMonth); @@ -4967,7 +4970,8 @@ LockFile (gpointer handle, guint32 offset_low, guint32 offset_high, guint32 leng offset = ((gint64)offset_high << 32) | offset_low; length = ((gint64)length_high << 32) | length_low; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking handle %p, offset %lld, length %lld", __func__, handle, offset, length); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking handle %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, + handle, (gint64) offset, (gint64) length); #else if (offset_high > 0 || length_high > 0) { mono_w32error_set_last (ERROR_INVALID_PARAMETER); @@ -4976,7 +4980,8 @@ LockFile (gpointer handle, guint32 offset_low, guint32 offset_high, guint32 leng offset = offset_low; length = length_low; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking handle %p, offset %ld, length %ld", __func__, handle, offset, length); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking handle %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, + handle, (gint64) offset, (gint64) length); #endif return _wapi_lock_file_region (GPOINTER_TO_UINT(handle), offset, length); @@ -5004,12 +5009,13 @@ UnlockFile (gpointer handle, guint32 offset_low, guint32 offset_high, guint32 le offset = ((gint64)offset_high << 32) | offset_low; length = ((gint64)length_high << 32) | length_low; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking handle %p, offset %lld, length %lld", __func__, handle, offset, length); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking handle %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, + handle, (gint64) offset, (gint64) length); #else offset = offset_low; length = length_low; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking handle %p, offset %ld, length %ld", __func__, handle, offset, length); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking handle %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, handle, (gint64) offset, (gint64) length); #endif return _wapi_unlock_file_region (GPOINTER_TO_UINT(handle), offset, length); diff --git a/mono/metadata/w32process-unix.c b/mono/metadata/w32process-unix.c index 596af9b321d..559939c9b61 100644 --- a/mono/metadata/w32process-unix.c +++ b/mono/metadata/w32process-unix.c @@ -610,7 +610,7 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) Process *process; gboolean res; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u)", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT ")", __func__, handle, timeout); if (alerted) *alerted = FALSE; @@ -623,21 +623,21 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) if (process_handle->exited) { /* We've already done this one */ - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Process already exited", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): Process already exited", __func__, handle, timeout); return MONO_W32HANDLE_WAIT_RET_SUCCESS_0; } pid = process_handle->pid; if (pid == mono_process_current_pid ()) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on current process", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): waiting on current process", __func__, handle, timeout); return MONO_W32HANDLE_WAIT_RET_TIMEOUT; } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): PID: %d", __func__, handle, timeout, pid); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): PID: %d", __func__, handle, timeout, pid); if (!process_handle->child) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on non-child process", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): waiting on non-child process", __func__, handle, timeout); if (!process_is_alive (pid)) { /* assume the process has exited */ @@ -645,11 +645,11 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) process_handle->exitstatus = -1; mono_w32handle_set_signal_state (handle, TRUE, TRUE); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): non-child process is not alive anymore (2)", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): non-child process is not alive anymore (2)", __func__, handle, timeout); return MONO_W32HANDLE_WAIT_RET_SUCCESS_0; } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): non-child process wait failed, error : %s (%d))", __func__, handle, timeout, g_strerror (errno), errno); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): non-child process wait failed, error : %s (%d))", __func__, handle, timeout, g_strerror (errno), errno); return MONO_W32HANDLE_WAIT_RET_FAILED; } @@ -663,11 +663,11 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) while (1) { if (timeout != MONO_INFINITE_WAIT) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on semaphore for %li ms...", - __func__, handle, timeout, (long)(timeout - (now - start))); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): waiting on semaphore for %" G_GINT64_FORMAT " ms...", + __func__, handle, timeout, timeout - (now - start)); ret = mono_os_sem_timedwait (&process->exit_sem, (timeout - (now - start)), alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE); } else { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on semaphore forever...", + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): waiting on semaphore forever...", __func__, handle, timeout); ret = mono_os_sem_wait (&process->exit_sem, alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE); } @@ -679,25 +679,25 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) } if (ret == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): wait timeout (timeout = 0)", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): wait timeout (timeout = 0)", __func__, handle, timeout); return MONO_W32HANDLE_WAIT_RET_TIMEOUT; } now = mono_msec_ticks (); if (now - start >= timeout) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): wait timeout", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): wait timeout", __func__, handle, timeout); return MONO_W32HANDLE_WAIT_RET_TIMEOUT; } if (alerted && ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): wait alerted", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): wait alerted", __func__, handle, timeout); *alerted = TRUE; return MONO_W32HANDLE_WAIT_RET_ALERTED; } } /* Process must have exited */ - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Waited successfully", __func__, handle, timeout); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): Waited successfully", __func__, handle, timeout); status = process->status; if (WIFSIGNALED (status)) @@ -709,7 +709,7 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) process_handle->exited = TRUE; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Setting pid %d signalled, exit status %d", + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %" G_GUINT32_FORMAT "): Setting pid %d signalled, exit status %d", __func__, handle, timeout, process_handle->pid, process_handle->exitstatus); mono_w32handle_set_signal_state (handle, TRUE, TRUE); @@ -1053,7 +1053,7 @@ match_procname_to_modulename (char *procname, char *modulename) g_free (pname); g_free (mname); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: result is %d", __func__, result); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: result is %" G_GINT32_FORMAT, __func__, result); return result; } @@ -1171,10 +1171,10 @@ mono_w32process_module_get_filename (gpointer process, gpointer module, gunichar bytes += 2; if (size < bytes) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%zd); truncating", __func__, size, bytes); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %" G_GUINT32_FORMAT " smaller than needed (%zd); truncating", __func__, size, bytes); memcpy (basename, proc_path, size); } else { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%zd)", __func__, size, bytes); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %" G_GUINT32_FORMAT " larger than needed (%zd)", __func__, size, bytes); memcpy (basename, proc_path, bytes); } @@ -1197,7 +1197,7 @@ mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *b char *pname = NULL; gboolean res; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Getting module base name, process handle %p module %p basename %p size %d", + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Getting module base name, process handle %p module %p basename %p size %" G_GUINT32_FORMAT, __func__, process, module, basename, size); size = size * sizeof (gunichar2); /* adjust for unicode characters */ @@ -1268,11 +1268,11 @@ mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *b bytes += 2; if (size < bytes) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%zd); truncating", __func__, size, bytes); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %" G_GUINT32_FORMAT " smaller than needed (%zd); truncating", __func__, size, bytes); memcpy (basename, procname, size); } else { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%zd)", + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %" G_GUINT32_FORMAT " larger than needed (%zd)", __func__, size, bytes); memcpy (basename, procname, bytes); @@ -1968,10 +1968,10 @@ process_create (const gunichar2 *appname, const gunichar2 *cmdline, mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: exec()ing [%s] in dir [%s]", __func__, cmd, dir == NULL?".":dir); for (i = 0; argv[i] != NULL; i++) - g_message ("arg %d: [%s]", i, argv[i]); + g_message ("arg %" G_GUINT32_FORMAT ": [%s]", i, argv[i]); for (i = 0; env_strings[i] != NULL; i++) - g_message ("env %d: [%s]", i, env_strings[i]); + g_message ("env %" G_GUINT32_FORMAT ": [%s]", i, env_strings[i]); #endif /* set cwd */ @@ -2753,7 +2753,7 @@ find_pe_file_resources32 (gpointer file_map, guint32 map_size, guint32 res_id, g } if (map_size < sizeof(IMAGE_NT_HEADERS32) + GUINT32_FROM_LE (dos_header->e_lfanew)) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File is too small: %d", __func__, map_size); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File is too small: %" G_GUINT32_FORMAT, __func__, map_size); mono_w32error_set_last (ERROR_BAD_LENGTH); return(NULL); @@ -2825,7 +2825,7 @@ find_pe_file_resources64 (gpointer file_map, guint32 map_size, guint32 res_id, g } if (map_size < sizeof(IMAGE_NT_HEADERS64) + GUINT32_FROM_LE (dos_header->e_lfanew)) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File is too small: %d", __func__, map_size); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File is too small: %" G_GUINT32_FORMAT, __func__, map_size); mono_w32error_set_last (ERROR_BAD_LENGTH); return(NULL); @@ -2958,7 +2958,7 @@ map_pe_file (gunichar2 *filename, gint32 *map_size, void **handle) /* Check basic file size */ if (statbuf.st_size < sizeof(IMAGE_DOS_HEADER)) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File %s is too small: %lld", __func__, filename_ext, statbuf.st_size); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File %s is too small: %lld", __func__, filename_ext, (long long) statbuf.st_size); mono_w32error_set_last (ERROR_BAD_LENGTH); g_free (filename_ext); diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index b887931ac0e..0c1a63db2e7 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -4792,7 +4792,7 @@ set_set_notification_for_wait_completion_flag (StackFrame *frame) static MonoMethod* notify_debugger_of_wait_completion_method_cache = NULL; static MonoMethod* -get_notify_debugger_of_wait_completion_method () +get_notify_debugger_of_wait_completion_method (void) { if (notify_debugger_of_wait_completion_method_cache != NULL) return notify_debugger_of_wait_completion_method_cache; diff --git a/mono/mini/ir-emit.h b/mono/mini/ir-emit.h index d535f25b6d3..4402816aa5f 100644 --- a/mono/mini/ir-emit.h +++ b/mono/mini/ir-emit.h @@ -231,16 +231,13 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) (dest)->inst_imm = (imm); \ } while (0) -#ifdef MONO_ARCH_NEED_GOT_VAR - #define NEW_PATCH_INFO(cfg,dest,el1,el2) do { \ MONO_INST_NEW ((cfg), (dest), OP_PATCH_INFO); \ (dest)->inst_left = (gpointer)(el1); \ (dest)->inst_right = (gpointer)(el2); \ } while (0) -/* FIXME: Add the PUSH_GOT_ENTRY optimizations */ -#define NEW_AOTCONST(cfg,dest,patch_type,cons) do { \ +#define NEW_AOTCONST_GOT_VAR(cfg,dest,patch_type,cons) do { \ MONO_INST_NEW ((cfg), (dest), cfg->compile_aot ? OP_GOT_ENTRY : OP_PCONST); \ if (cfg->compile_aot) { \ MonoInst *group, *got_loc; \ @@ -256,7 +253,7 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) (dest)->dreg = alloc_dreg ((cfg), STACK_PTR); \ } while (0) -#define NEW_AOTCONST_TOKEN(cfg,dest,patch_type,image,token,generic_context,stack_type,stack_class) do { \ +#define NEW_AOTCONST_TOKEN_GOT_VAR(cfg,dest,patch_type,image,token,generic_context,stack_type,stack_class) do { \ MonoInst *group, *got_loc; \ MONO_INST_NEW ((cfg), (dest), OP_GOT_ENTRY); \ got_loc = mono_get_got_var (cfg); \ @@ -269,27 +266,31 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) (dest)->dreg = alloc_dreg ((cfg), (stack_type)); \ } while (0) -#else - #define NEW_AOTCONST(cfg,dest,patch_type,cons) do { \ + if (cfg->backend->need_got_var && !cfg->llvm_only) { \ + NEW_AOTCONST_GOT_VAR ((cfg), (dest), (patch_type), (cons)); \ + } else { \ MONO_INST_NEW ((cfg), (dest), cfg->compile_aot ? OP_AOTCONST : OP_PCONST); \ (dest)->inst_p0 = (cons); \ (dest)->inst_i1 = (MonoInst *)(patch_type); \ (dest)->type = STACK_PTR; \ (dest)->dreg = alloc_dreg ((cfg), STACK_PTR); \ + } \ } while (0) #define NEW_AOTCONST_TOKEN(cfg,dest,patch_type,image,token,generic_context,stack_type,stack_class) do { \ + if (cfg->backend->need_got_var && !cfg->llvm_only) { \ + NEW_AOTCONST_TOKEN_GOT_VAR ((cfg), (dest), (patch_type), (image), (token), (generic_context), (stack_type), (stack_class)); \ + } else { \ MONO_INST_NEW ((cfg), (dest), OP_AOTCONST); \ (dest)->inst_p0 = mono_jump_info_token_new2 ((cfg)->mempool, (image), (token), (generic_context)); \ (dest)->inst_p1 = (gpointer)(patch_type); \ (dest)->type = (stack_type); \ (dest)->klass = (stack_class); \ (dest)->dreg = alloc_dreg ((cfg), (stack_type)); \ + } \ } while (0) -#endif - #define NEW_CLASSCONST(cfg,dest,val) NEW_AOTCONST ((cfg), (dest), MONO_PATCH_INFO_CLASS, (val)) #define NEW_IMAGECONST(cfg,dest,val) NEW_AOTCONST ((cfg), (dest), MONO_PATCH_INFO_IMAGE, (val)) diff --git a/mono/mini/main.c b/mono/mini/main.c index 41511ce34b0..bd4f6674dfb 100644 --- a/mono/mini/main.c +++ b/mono/mini/main.c @@ -136,7 +136,7 @@ static GSList *bundle_library_paths; static char *bundled_dylibrary_directory; static void -delete_bundled_libraries () +delete_bundled_libraries (void) { GSList *list; @@ -147,7 +147,7 @@ delete_bundled_libraries () } static void -bundle_save_library_initialize () +bundle_save_library_initialize (void) { bundle_save_library_initialized = 1; char *path = g_build_filename (g_get_tmp_dir (), "mono-bundle-XXXXXX", NULL); diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 5c1c7d2db05..7ae63f25aa2 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -1264,7 +1264,7 @@ mono_get_domainvar (MonoCompile *cfg) MonoInst * mono_get_got_var (MonoCompile *cfg) { - if (!cfg->compile_aot || !cfg->backend->need_got_var) + if (!cfg->compile_aot || !cfg->backend->need_got_var || cfg->llvm_only) return NULL; if (!cfg->got_var) { cfg->got_var = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL); diff --git a/mono/unit-tests/test-mono-handle.c b/mono/unit-tests/test-mono-handle.c index 95ebae349c2..0d8febaa709 100644 --- a/mono/unit-tests/test-mono-handle.c +++ b/mono/unit-tests/test-mono-handle.c @@ -13,14 +13,12 @@ #include static void -test2_arena_push_pop () +test2_arena_push_pop (void) { HandleStack *h = mono_handle_stack_alloc (); mono_handle_stack_free (h); } - - int main (int argc, const char* argv[]) { diff --git a/mono/utils/mono-os-mutex.h b/mono/utils/mono-os-mutex.h index d6c5250256a..3888d26441d 100644 --- a/mono/utils/mono-os-mutex.h +++ b/mono/utils/mono-os-mutex.h @@ -215,7 +215,7 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_ res = pthread_cond_timedwait (cond, mutex, &ts); if (G_UNLIKELY (res != 0 && res != ETIMEDOUT)) - g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d)", __func__, g_strerror (res), res); + g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d) %ld %ld %d", __func__, g_strerror (res), res, ts.tv_sec, ts.tv_nsec, timeout_ms); return res != 0 ? -1 : 0; } diff --git a/packaging/MacSDK/msbuild.py b/packaging/MacSDK/msbuild.py index fada54c789a..131c3494c13 100644 --- a/packaging/MacSDK/msbuild.py +++ b/packaging/MacSDK/msbuild.py @@ -3,7 +3,7 @@ import fileinput class MSBuild (GitHubPackage): def __init__ (self): GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.3', - revision = '483c14cc7ae36b2314f87591f2806be53ab7322b', + revision = 'f7dcc3900c808775adad970f047202b4de34e986', git_branch = 'xplat-master') def build (self): diff --git a/support/stdlib.c b/support/stdlib.c index 077a85e58f5..5c4c57638c9 100644 --- a/support/stdlib.c +++ b/support/stdlib.c @@ -18,7 +18,7 @@ G_BEGIN_DECLS void* Mono_Unix_VersionString () { - return "MonoProject-2015-12-1"; + return (void *) "MonoProject-2015-12-1"; } gint32