From: Zoltan Varga Date: Mon, 5 Aug 2019 15:13:40 +0000 (-0400) Subject: [netcore] ifdef out unused icalls/files. (mono/mono#16009) X-Git-Tag: submit/tizen/20210909.063632~10331^2~5^2~859 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2f0d615ef67f6ff0e1300506b3b2dab8b1bff0b;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [netcore] ifdef out unused icalls/files. (mono/mono#16009) * [netcore] ifdef out unused icalls/files. * Add MONO_EMPTY_SOURCE_FILE. Commit migrated from https://github.com/mono/mono/commit/93a6bc31511decdf93357e78fb2a1a14bf7c76c1 --- diff --git a/src/mono/configure.ac b/src/mono/configure.ac index 3fcc4f0..7edcd4b 100644 --- a/src/mono/configure.ac +++ b/src/mono/configure.ac @@ -1350,6 +1350,8 @@ elif test x$with_runtime_preset = xnetcore; then mono_feature_disable_mdb='yes' mono_feature_disable_com='yes' mono_feature_disable_gac='yes' + mono_feature_disable_perfcounters='yes' + mono_feature_disable_sockets='yes' disable_mono_native=yes support_boehm=no elif test x$with_runtime_preset = xnet_4_x; then diff --git a/src/mono/mono/metadata/appdomain.c b/src/mono/mono/metadata/appdomain.c index c41c1a4..699f647 100644 --- a/src/mono/mono/metadata/appdomain.c +++ b/src/mono/mono/metadata/appdomain.c @@ -88,8 +88,10 @@ typedef struct gchar *filename; } RuntimeConfig; +#ifndef ENABLE_NETCORE static gunichar2 process_guid [36]; static gboolean process_guid_set = FALSE; +#endif static gboolean no_exec = FALSE; @@ -998,6 +1000,7 @@ mono_domain_set_fast (MonoDomain *domain, gboolean force) return TRUE; } +#ifndef ENABLE_NETCORE MonoObjectHandle ves_icall_System_AppDomain_GetData (MonoAppDomainHandle ad, MonoStringHandle name, MonoError *error) { @@ -1114,6 +1117,7 @@ ves_icall_System_CLRConfig_CheckThrowUnobservedTaskExceptions (MonoError *error) return domain->throw_unobserved_task_exceptions; } +#endif static char* get_attribute_value (const gchar **attribute_names, @@ -1254,6 +1258,7 @@ mono_domain_set_options_from_config (MonoDomain *domain) g_free (config_file_path); } +#ifndef ENABLE_NETCORE MonoAppDomainHandle ves_icall_System_AppDomain_createDomain (MonoStringHandle friendly_name, MonoAppDomainSetupHandle setup, MonoError *error) { @@ -1272,6 +1277,7 @@ ves_icall_System_AppDomain_createDomain (MonoStringHandle friendly_name, MonoApp #endif return ad; } +#endif static gboolean add_assembly_to_array (MonoDomain *domain, MonoArrayHandle dest, int dest_idx, MonoAssembly* assm, MonoError *error) @@ -2462,9 +2468,9 @@ ves_icall_System_Reflection_Assembly_InternalLoad (MonoStringHandle name_handle, fail: return MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE); } - #endif +#ifndef ENABLE_NETCORE MonoReflectionAssemblyHandle ves_icall_System_Reflection_Assembly_LoadFrom (MonoStringHandle fname, MonoBoolean refOnly, MonoStackCrawlMark *stack_mark, MonoError *error) { @@ -2509,6 +2515,7 @@ leave: g_free (name); return result; } +#endif static MonoAssembly * @@ -2694,6 +2701,7 @@ mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, gu return ass; } +#ifndef ENABLE_NETCORE MonoReflectionAssemblyHandle ves_icall_System_AppDomain_LoadAssembly (MonoAppDomainHandle ad, MonoStringHandle assRef, MonoObjectHandle evidence, MonoBoolean refOnly, MonoStackCrawlMark *stack_mark, MonoError *error) { @@ -2948,6 +2956,7 @@ ves_icall_System_AppDomain_InternalGetProcessGuid (MonoStringHandle newguid, Mon mono_domain_unlock (mono_root_domain); return newguid; } +#endif /** * mono_domain_is_unloading: diff --git a/src/mono/mono/metadata/console-unix.c b/src/mono/mono/metadata/console-unix.c index 9e3bbdb..cc9e543 100644 --- a/src/mono/mono/metadata/console-unix.c +++ b/src/mono/mono/metadata/console-unix.c @@ -36,6 +36,11 @@ #include #include #include +#include +#include +#include "icall-decl.h" + +#ifndef ENABLE_NETCORE /* On solaris, curses.h must come before both termios.h and term.h */ #ifdef HAVE_CURSES_H @@ -56,10 +61,6 @@ # include #endif -#include -#include -#include "icall-decl.h" - static gboolean setup_finished; static gboolean atexit_called; @@ -77,10 +78,8 @@ static struct termios mono_attr; /* static void console_restore_signal_handlers (void); */ static void console_set_signal_handlers (void); - static GENERATE_TRY_GET_CLASS_WITH_CACHE (console, "System", "Console"); - void mono_console_init (void) { @@ -511,3 +510,17 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoStringHandle keypad, MonoStringHand return TRUE; } + +#else /* ENABLE_NETCORE */ + +void +mono_console_init (void) +{ +} + +void +mono_console_handle_async_ops (void) +{ +} + +#endif diff --git a/src/mono/mono/metadata/environment.c b/src/mono/mono/metadata/environment.c index 7b6ec01..f0a5ae8 100644 --- a/src/mono/mono/metadata/environment.c +++ b/src/mono/mono/metadata/environment.c @@ -45,6 +45,7 @@ mono_environment_exitcode_set (gint32 value) exitcode=value; } +#ifndef ENABLE_NETCORE /* note: we better manipulate the string in managed code (easier and safer) */ MonoStringHandle ves_icall_System_Environment_GetOSVersionString (MonoError *error) @@ -89,4 +90,4 @@ ves_icall_System_Environment_GetOSVersionString (MonoError *error) #endif return mono_string_new_handle (mono_domain_get (), "0.0.0.0", error); } - +#endif diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index 73e412f..67cb79d 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -3400,6 +3400,7 @@ leave: return ret; } +#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_RuntimeType_IsTypeExportedToWindowsRuntime (MonoError *error) { @@ -3415,6 +3416,7 @@ ves_icall_System_RuntimeType_IsWindowsRuntimeObjectType (MonoError *error) mono_error_set_not_implemented (error, "%s", "System.RuntimeType.IsWindowsRuntimeObjectType"); return FALSE; } +#endif /* ENABLE_NETCORE */ void ves_icall_RuntimeMethodInfo_GetPInvoke (MonoReflectionMethodHandle ref_method, int* flags, MonoStringHandleOut entry_point, MonoStringHandleOut dll_name, MonoError *error) @@ -7730,10 +7732,12 @@ ves_icall_System_Environment_get_HasShutdownStarted (void) #ifndef HOST_WIN32 +#ifndef ENABLE_NETCORE void ves_icall_System_Environment_BroadcastSettingChange (MonoError *error) { } +#endif #endif @@ -7752,11 +7756,13 @@ ves_icall_System_Environment_get_TickCount64 (void) } #endif +#ifndef ENABLE_NETCORE gint32 ves_icall_System_Runtime_Versioning_VersioningHelper_GetRuntimeId (MonoError *error) { return 9; } +#endif #ifndef DISABLE_REMOTING MonoBoolean @@ -7841,14 +7847,17 @@ ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (Mo #else /* DISABLE_REMOTING */ +#ifndef ENABLE_NETCORE void ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (MonoReflectionTypeHandle type, MonoBoolean enable, MonoError *error) { g_assert_not_reached (); } +#endif #endif +#ifndef ENABLE_NETCORE MonoObjectHandle ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance (MonoReflectionTypeHandle type, MonoError *error) { @@ -7874,15 +7883,13 @@ ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClas } } -#if !ENABLE_NETCORE - MonoStringHandle ves_icall_System_IO_get_temp_path (MonoError *error) { return mono_string_new_handle (mono_domain_get (), g_get_tmp_dir (), error); } -#endif +#endif /* ENABLE_NETCORE */ #if defined(ENABLE_MONODROID) || defined(ENABLE_MONOTOUCH) || defined(TARGET_WASM) @@ -7977,6 +7984,8 @@ ves_icall_RuntimeMethodHandle_GetFunctionPointer (MonoMethod *method, MonoError return mono_compile_method_checked (method, error); } +#ifndef ENABLE_NETCORE + MonoStringHandle ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (MonoError *error) { @@ -8064,7 +8073,6 @@ ves_icall_System_Environment_get_bundled_machine_config (MonoError *error) return get_bundled_machine_config (error); } - MonoStringHandle ves_icall_System_Configuration_DefaultConfig_get_bundled_machine_config (MonoError *error) { @@ -8077,7 +8085,6 @@ ves_icall_System_Configuration_InternalConfigurationHost_get_bundled_machine_con return get_bundled_machine_config (error); } - MonoStringHandle ves_icall_System_Web_Util_ICalls_get_machine_install_dir (MonoError *error) { @@ -8122,6 +8129,8 @@ ves_icall_get_resources_ptr (MonoReflectionAssemblyHandle assembly, gpointer *re return TRUE; } +#endif /* ENABLE_NETCORE */ + MonoBoolean ves_icall_System_Diagnostics_Debugger_IsAttached_internal (MonoError *error) { @@ -8150,11 +8159,13 @@ mono_icall_write_windows_debug_string (const gunichar2 *message) } #endif /* !HOST_WIN32 */ +#ifndef ENABLE_NETCORE void ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (const gunichar2 *message, MonoError *error) { mono_icall_write_windows_debug_string (message); } +#endif /* Only used for value types */ MonoObjectHandle @@ -8376,6 +8387,7 @@ ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionTypeH } } +#ifndef ENABLE_NETCORE /* * used by System.Runtime.InteropServices.RuntimeInformation.(OS|Process)Architecture; * which use them in different ways for filling in an enum @@ -8396,6 +8408,7 @@ ves_icall_System_Runtime_InteropServices_RuntimeInformation_GetOSName (MonoError error_init (error); return mono_string_new_handle (mono_domain_get (), mono_config_get_os (), error); } +#endif /* ENABLE_NETCORE */ int ves_icall_Interop_Sys_DoubleToString(double value, char *format, char *buffer, int bufferLength) @@ -8680,6 +8693,7 @@ mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds) } #endif /* !HOST_WIN32 */ +#ifndef ENABLE_NETCORE gint32 ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle (gpointer handle, gint32 milliseconds, MonoError *error) { @@ -8701,6 +8715,7 @@ ves_icall_Mono_TlsProviderFactory_IsBtlsSupported (MonoError *error) return FALSE; #endif } +#endif /* ENABLE_NETCORE */ #ifndef DISABLE_COM diff --git a/src/mono/mono/metadata/marshal.c b/src/mono/mono/metadata/marshal.c index 97f090b..ea0ebdb 100644 --- a/src/mono/mono/metadata/marshal.c +++ b/src/mono/mono/metadata/marshal.c @@ -5548,12 +5548,14 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, return res; } +#ifndef ENABLE_NETCORE gpointer ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement (MonoArrayHandle arrayobj, int index, MonoError *error) { int esize = mono_array_element_size (mono_handle_class (arrayobj)); return mono_array_addr_with_size_fast (MONO_HANDLE_RAW (arrayobj), esize, index); } +#endif MonoDelegateHandle ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal (void *ftn, MonoReflectionTypeHandle type, MonoError *error) diff --git a/src/mono/mono/metadata/mono-perfcounters.c b/src/mono/mono/metadata/mono-perfcounters.c index 2970e08..c366df7 100644 --- a/src/mono/mono/metadata/mono-perfcounters.c +++ b/src/mono/mono/metadata/mono-perfcounters.c @@ -1946,6 +1946,8 @@ mono_perfcounter_foreach (PerfCounterEnumCallback cb, gpointer data) #else +#ifndef ENABLE_NETCORE + void* mono_perfcounter_get_impl (const gunichar2 *category, gint32 category_length, const gunichar2 *counter, gint32 counter_length, @@ -2025,4 +2027,6 @@ mono_perfcounter_instance_names (const gunichar2 *category, gint32 category_leng g_assert_not_reached (); } +#endif /* ENABLE_NETCORE */ + #endif diff --git a/src/mono/mono/metadata/mono-security.c b/src/mono/mono/metadata/mono-security.c index 9d187a0..f73f30b 100644 --- a/src/mono/mono/metadata/mono-security.c +++ b/src/mono/mono/metadata/mono-security.c @@ -22,6 +22,9 @@ #include #include "reflection-internals.h" #include "icall-decl.h" + +#ifndef ENABLE_NETCORE + #ifndef HOST_WIN32 #ifdef HAVE_GRP_H #include @@ -640,3 +643,9 @@ ves_icall_System_Security_SecureString_EncryptInternal (MonoArrayHandle data, Mo { mono_invoke_protected_memory_method (data, scope, "Protect", &mono_method_securestring_encrypt, error); } + +#else + +MONO_EMPTY_SOURCE_FILE (mono_security); + +#endif /* ENABLE_NETCORE */ diff --git a/src/mono/mono/metadata/rand.c b/src/mono/mono/metadata/rand.c index a041a99..8ce627e 100644 --- a/src/mono/mono/metadata/rand.c +++ b/src/mono/mono/metadata/rand.c @@ -21,6 +21,8 @@ #include "utils/mono-rand.h" #include "icall-decl.h" +#ifndef ENABLE_NETCORE + MonoBoolean ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (MonoError *error) { @@ -46,3 +48,9 @@ ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpoint { mono_rand_close (handle); } + +#else + +MONO_EMPTY_SOURCE_FILE (rand); + +#endif /* ENABLE_NETCORE */ diff --git a/src/mono/mono/metadata/threads.c b/src/mono/mono/metadata/threads.c index 00a9f27..9d9f741 100644 --- a/src/mono/mono/metadata/threads.c +++ b/src/mono/mono/metadata/threads.c @@ -3210,11 +3210,13 @@ mono_threads_register_app_context (MonoAppContextHandle ctx, MonoError *error) MONO_PROFILER_RAISE (context_loaded, (MONO_HANDLE_RAW (ctx))); } +#ifndef ENABLE_NETCORE void ves_icall_System_Runtime_Remoting_Contexts_Context_RegisterContext (MonoAppContextHandle ctx, MonoError *error) { mono_threads_register_app_context (ctx, error); } +#endif void mono_threads_release_app_context (MonoAppContext* ctx, MonoError *error) @@ -3230,11 +3232,13 @@ mono_threads_release_app_context (MonoAppContext* ctx, MonoError *error) MONO_PROFILER_RAISE (context_unloaded, (ctx)); } +#ifndef ENABLE_NETCORE void ves_icall_System_Runtime_Remoting_Contexts_Context_ReleaseContext (MonoAppContextHandle ctx, MonoError *error) { mono_threads_release_app_context (MONO_HANDLE_RAW (ctx), error); /* FIXME use handles in mono_threads_release_app_context */ } +#endif void mono_thread_init (MonoThreadStartCB start_cb, MonoThreadAttachCB attach_cb) @@ -3953,8 +3957,6 @@ static void dump_thread (MonoInternalThread *thread, ThreadDumpUserData *ud, FILE* output_file) { GString* text = g_string_new (0); - char *name; - GError *gerror = NULL; int i; ud->thread = thread; diff --git a/src/mono/mono/metadata/w32event-unix.c b/src/mono/mono/metadata/w32event-unix.c index 4d38307..abc9bf9 100644 --- a/src/mono/mono/metadata/w32event-unix.c +++ b/src/mono/mono/metadata/w32event-unix.c @@ -378,6 +378,7 @@ ves_icall_System_Threading_Events_CloseEvent_internal (gpointer handle) mono_w32handle_close (handle); } +#ifndef ENABLE_NETCORE gpointer ves_icall_System_Threading_Events_OpenEvent_icall (const gunichar2 *name, gint32 name_length, gint32 rights, gint32 *win32error, MonoError *error) @@ -389,6 +390,7 @@ ves_icall_System_Threading_Events_OpenEvent_icall (const gunichar2 *name, gint32 g_free (utf8_name); return handle; } +#endif gpointer mono_w32event_open (const gchar *utf8_name, gint32 rights G_GNUC_UNUSED, gint32 *win32error) diff --git a/src/mono/mono/metadata/w32file-unix.c b/src/mono/mono/metadata/w32file-unix.c index 99d3924..1e4a37c 100644 --- a/src/mono/mono/metadata/w32file-unix.c +++ b/src/mono/mono/metadata/w32file-unix.c @@ -4745,6 +4745,7 @@ GetDriveTypeFromPath (const gchar *utf8_root_path_name) } #endif +#ifndef ENABLE_NETCORE guint32 ves_icall_System_IO_DriveInfo_GetDriveType (const gunichar2 *root_path_name, gint32 root_path_name_length, MonoError *error) { @@ -4776,6 +4777,7 @@ ves_icall_System_IO_DriveInfo_GetDriveType (const gunichar2 *root_path_name, gin return (drive_type); } +#endif #if defined (HOST_DARWIN) || defined (__linux__) || defined(HOST_BSD) || defined(__FreeBSD_kernel__) || defined(__HAIKU__) || defined(_AIX) static gchar* diff --git a/src/mono/mono/metadata/w32process-unix.c b/src/mono/mono/metadata/w32process-unix.c index f5456d3..fcb8935 100644 --- a/src/mono/mono/metadata/w32process-unix.c +++ b/src/mono/mono/metadata/w32process-unix.c @@ -90,6 +90,8 @@ #include "object-internals.h" #include "icall-decl.h" +#ifndef ENABLE_NETCORE + #ifndef MAXPATHLEN #define MAXPATHLEN 242 #endif @@ -4284,3 +4286,27 @@ mono_w32process_ver_language_name (guint32 lang, gunichar2 *lang_out, guint32 la return copy_lang (lang_out, lang_len, name); } + +#else /* ENABLE_NETCORE */ + +void +mono_w32process_init (void) +{ +} + +void +mono_w32process_cleanup (void) +{ +} + +void +mono_w32process_set_cli_launcher (gchar *path) +{ +} + +void +mono_w32process_signal_finished (void) +{ +} + +#endif /* ENABLE_NETCORE */ diff --git a/src/mono/mono/metadata/w32process.c b/src/mono/mono/metadata/w32process.c index b386cd6..83a1fb4 100644 --- a/src/mono/mono/metadata/w32process.c +++ b/src/mono/mono/metadata/w32process.c @@ -391,6 +391,7 @@ cleanup: #endif // G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#ifndef ENABLE_NETCORE void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObjectHandle this_obj, const gunichar2 *filename, int filename_length, MonoError *error) @@ -404,6 +405,7 @@ ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject process_set_field_utf16 (this_obj, str, "filename", filename, filename_length, error); } +#endif #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) @@ -519,6 +521,7 @@ exit: HANDLE_FUNCTION_RETURN (); } +#ifndef ENABLE_NETCORE /* Returns an array of System.Diagnostics.ProcessModule */ MonoArrayHandle ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObjectHandle this_obj, HANDLE process, MonoError *error) @@ -606,6 +609,7 @@ ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process, MonoE return len ? mono_string_new_utf16_handle (mono_domain_get (), name, len, error) : NULL_HANDLE_STRING; } +#endif /* ENABLE_NETCORE */ #endif // G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) && defined(HOST_WIN32) diff --git a/src/mono/mono/metadata/w32socket-unix.c b/src/mono/mono/metadata/w32socket-unix.c index 6afe958..607c0a3 100644 --- a/src/mono/mono/metadata/w32socket-unix.c +++ b/src/mono/mono/metadata/w32socket-unix.c @@ -1554,6 +1554,7 @@ mono_w32socket_convert_error (gint error) } } +#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, MonoError *error) { @@ -1569,6 +1570,7 @@ ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, Mo return FALSE; #endif } +#endif gboolean mono_w32socket_duplicate (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle)