Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[monodroid] remove monodroid_get_log_categories() #9625

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Mono.Android/Android.Runtime/JNIEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ internal static void LogTypemapTrace (StackTrace st)
}

if (ret == IntPtr.Zero) {
if (JNIEnvInit.LogAssemblyCategory) {
if (Logger.LogAssembly) {
RuntimeNativeMethods.monodroid_log (LogLevel.Warn, LogCategories.Default, $"typemap: failed to map managed type to Java type: {type.AssemblyQualifiedName} (Module ID: {type.Module.ModuleVersionId}; Type token: {type.MetadataToken})");
LogTypemapTrace (new StackTrace (true));
}
Expand Down
3 changes: 1 addition & 2 deletions src/Mono.Android/Android.Runtime/JNIEnvInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ internal struct JnienvInitializeArgs {
internal static AndroidValueManager? AndroidValueManager;
internal static bool IsRunningOnDesktop;
internal static bool jniRemappingInUse;
internal static bool LogAssemblyCategory;
internal static bool MarshalMethodsEnabled;
internal static bool PropagateExceptions;
internal static BoundExceptionType BoundExceptionType;
Expand Down Expand Up @@ -83,7 +82,7 @@ internal static unsafe void Initialize (JnienvInitializeArgs* args)
IntPtr total_timing_sequence = IntPtr.Zero;
IntPtr partial_timing_sequence = IntPtr.Zero;

LogAssemblyCategory = (args->logCategories & (uint)LogCategories.Assembly) != 0;
Logger.SetLogCategories ((LogCategories)args->logCategories);

gref_gc_threshold = args->grefGcThreshold;

Expand Down
2 changes: 1 addition & 1 deletion src/Mono.Android/Android.Runtime/JNINativeWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static Delegate CreateDelegate (Delegate dlg)
if (result != null)
return result;

if (JNIEnvInit.LogAssemblyCategory) {
if (Logger.LogAssembly) {
RuntimeNativeMethods.monodroid_log (LogLevel.Debug, LogCategories.Assembly, $"Falling back to System.Reflection.Emit for delegate type '{delegateType}': {dlg.Method}");
}

Expand Down
9 changes: 2 additions & 7 deletions src/Mono.Android/Android.Runtime/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ public static void Log (LogLevel level, string appname, string? log) {
}
}

[DllImport (RuntimeConstants.InternalDllName, CallingConvention = CallingConvention.Cdecl)]
extern static uint monodroid_get_log_categories ();

static Logger ()
{
Categories = (LogCategories) monodroid_get_log_categories ();
}
internal static void SetLogCategories (LogCategories categories) =>
Categories = categories;
}
}
2 changes: 1 addition & 1 deletion src/Mono.Android/Java.Interop/TypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static Exception CreateJavaLocationException ()

if (!JNIEnvInit.IsRunningOnDesktop) {
// Miss message is logged in the native runtime
if (JNIEnvInit.LogAssemblyCategory)
if (Logger.LogAssembly)
JNIEnv.LogTypemapTrace (new System.Diagnostics.StackTrace (true));
return null;
}
Expand Down
6 changes: 0 additions & 6 deletions src/native/monodroid/internal-pinvokes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
using namespace xamarin::android;
using namespace xamarin::android::internal;

unsigned int
monodroid_get_log_categories ()
{
return log_categories;
}

int
monodroid_get_system_property (const char *name, char **value)
{
Expand Down
1 change: 0 additions & 1 deletion src/native/pinvoke-override/generate-pinvoke-tables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const std::vector<std::string> internal_pinvoke_names = {
"_monodroid_get_dns_servers",
"monodroid_get_dylib",
"_monodroid_getifaddrs",
"monodroid_get_log_categories",
"monodroid_get_namespaced_system_property",
"_monodroid_get_network_interface_supports_multicast",
"_monodroid_get_network_interface_up_state",
Expand Down
8 changes: 3 additions & 5 deletions src/native/pinvoke-override/pinvoke-tables.include
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
namespace {
#if INTPTR_MAX == INT64_MAX
//64-bit internal p/invoke table
std::array<PinvokeEntry, 46> internal_pinvokes {{
{0x452e23128e42f0a, "monodroid_get_log_categories", reinterpret_cast<void*>(&monodroid_get_log_categories)},
std::array<PinvokeEntry, 45> internal_pinvokes {{
{0xa50ce5de13bf8b5, "_monodroid_timezone_get_default_id", reinterpret_cast<void*>(&_monodroid_timezone_get_default_id)},
{0x19055d65edfd668e, "_monodroid_get_network_interface_up_state", reinterpret_cast<void*>(&_monodroid_get_network_interface_up_state)},
{0x2b3b0ca1d14076da, "monodroid_get_dylib", reinterpret_cast<void*>(&monodroid_get_dylib)},
Expand Down Expand Up @@ -550,7 +549,7 @@ constexpr hash_t system_security_cryptography_native_android_library_hash = 0x18
constexpr hash_t system_globalization_native_library_hash = 0x28b5c8fca080abd5;
#else
//32-bit internal p/invoke table
std::array<PinvokeEntry, 46> internal_pinvokes {{
std::array<PinvokeEntry, 45> internal_pinvokes {{
{0xb7a486a, "monodroid_TypeManager_get_java_class_name", reinterpret_cast<void*>(&monodroid_TypeManager_get_java_class_name)},
{0xf562bd9, "monodroid_embedded_assemblies_set_assemblies_prefix", reinterpret_cast<void*>(&monodroid_embedded_assemblies_set_assemblies_prefix)},
{0x227a2636, "monodroid_get_namespaced_system_property", reinterpret_cast<void*>(&monodroid_get_namespaced_system_property)},
Expand Down Expand Up @@ -584,7 +583,6 @@ constexpr hash_t system_globalization_native_library_hash = 0x28b5c8fca080abd5;
{0xc5146c54, "_monodroid_gref_log_delete", reinterpret_cast<void*>(&_monodroid_gref_log_delete)},
{0xc58eafa5, "java_interop_free", reinterpret_cast<void*>(&java_interop_free)},
{0xd3b5d2c1, "_monodroid_freeifaddrs", reinterpret_cast<void*>(&_monodroid_freeifaddrs)},
{0xd78c749d, "monodroid_get_log_categories", reinterpret_cast<void*>(&monodroid_get_log_categories)},
{0xd91f3619, "create_public_directory", reinterpret_cast<void*>(&create_public_directory)},
{0xe215a17c, "_monodroid_weak_gref_delete", reinterpret_cast<void*>(&_monodroid_weak_gref_delete)},
{0xe4c3ee19, "monodroid_log_traces", reinterpret_cast<void*>(&monodroid_log_traces)},
Expand Down Expand Up @@ -1089,6 +1087,6 @@ constexpr hash_t system_security_cryptography_native_android_library_hash = 0x93
constexpr hash_t system_globalization_native_library_hash = 0xa66f1e5a;
#endif

constexpr size_t internal_pinvokes_count = 46;
constexpr size_t internal_pinvokes_count = 45;
constexpr size_t dotnet_pinvokes_count = 477;
} // end of anonymous namespace
1 change: 0 additions & 1 deletion src/native/runtime-base/internal-pinvokes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mono_bool _monodroid_get_network_interface_up_state (const char *ifname, mono_bo
mono_bool _monodroid_get_network_interface_supports_multicast (const char *ifname, mono_bool *supports_multicast);
int _monodroid_get_dns_servers (void **dns_servers_array);

unsigned int monodroid_get_log_categories ();
int monodroid_get_system_property (const char *name, char **value);
int monodroid_embedded_assemblies_set_assemblies_prefix (const char *prefix);
void monodroid_log (xamarin::android::LogLevel level, LogCategories category, const char *message);
Expand Down
Loading