From fa0fad6c48c0e253ac21af3a2d01abb5aa2f4775 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 16 Feb 2024 20:38:15 +0100 Subject: [PATCH 1/3] Enable new exception handling by default This change just flips the config knob to enable the new exception handling by default. --- src/coreclr/inc/clrconfigvalues.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index 30956bf4a67418..5816793ec46c3d 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -259,7 +259,7 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_legacyCorruptedStateExceptionsPolicy, W("le CONFIG_DWORD_INFO(INTERNAL_SuppressLostExceptionTypeAssert, W("SuppressLostExceptionTypeAssert"), 0, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_UseEntryPointFilter, W("UseEntryPointFilter"), 0, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_Corhost_Swallow_Uncaught_Exceptions, W("Corhost_Swallow_Uncaught_Exceptions"), 0, "") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableNewExceptionHandling, W("EnableNewExceptionHandling"), 0, "Enable new exception handling."); +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableNewExceptionHandling, W("EnableNewExceptionHandling"), 1, "Enable new exception handling."); /// From f189ccd95d72e83053db4f69fc49ba5fedd86eca Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 16 Feb 2024 23:06:50 +0100 Subject: [PATCH 2/3] Add runtime.config setting for enabling the new EH --- src/coreclr/vm/exceptionhandling.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index 937fe61f4e1342..5d5e8c78929544 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -19,6 +19,7 @@ #include "corinfo.h" #include "exceptionhandlingqcalls.h" #include "exinfo.h" +#include "configuration.h" #if defined(TARGET_X86) #define USE_CURRENT_CONTEXT_IN_FILTER @@ -236,7 +237,7 @@ void InitializeExceptionHandling() // Initialize the lock used for synchronizing access to the stacktrace in the exception object g_StackTraceArrayLock.Init(LOCK_TYPE_DEFAULT, TRUE); - g_isNewExceptionHandlingEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableNewExceptionHandling) != 0; + g_isNewExceptionHandlingEnabled = Configuration::GetKnobBooleanValue(W("System.Runtime.EnableNewExceptionHandling"), CLRConfig::EXTERNAL_EnableNewExceptionHandling) != 0; #ifdef TARGET_UNIX // Register handler of hardware exceptions like null reference in PAL From 918ff7cc8e894893fe25698731bc7dc32536b2fa Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Sun, 18 Feb 2024 20:22:04 +0100 Subject: [PATCH 3/3] Reflect PR - switch the config name From the EnableNewExceptionHandling to LegacyExceptionHandling --- src/coreclr/inc/clrconfigvalues.h | 2 +- src/coreclr/vm/exceptionhandling.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index 5816793ec46c3d..45674a77c35396 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -259,7 +259,7 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_legacyCorruptedStateExceptionsPolicy, W("le CONFIG_DWORD_INFO(INTERNAL_SuppressLostExceptionTypeAssert, W("SuppressLostExceptionTypeAssert"), 0, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_UseEntryPointFilter, W("UseEntryPointFilter"), 0, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_Corhost_Swallow_Uncaught_Exceptions, W("Corhost_Swallow_Uncaught_Exceptions"), 0, "") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableNewExceptionHandling, W("EnableNewExceptionHandling"), 1, "Enable new exception handling."); +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_LegacyExceptionHandling, W("LegacyExceptionHandling"), 0, "Enable legacy exception handling."); /// diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index 5d5e8c78929544..84ed4f2ee06fa9 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -237,7 +237,7 @@ void InitializeExceptionHandling() // Initialize the lock used for synchronizing access to the stacktrace in the exception object g_StackTraceArrayLock.Init(LOCK_TYPE_DEFAULT, TRUE); - g_isNewExceptionHandlingEnabled = Configuration::GetKnobBooleanValue(W("System.Runtime.EnableNewExceptionHandling"), CLRConfig::EXTERNAL_EnableNewExceptionHandling) != 0; + g_isNewExceptionHandlingEnabled = Configuration::GetKnobBooleanValue(W("System.Runtime.LegacyExceptionHandling"), CLRConfig::EXTERNAL_LegacyExceptionHandling ) == 0; #ifdef TARGET_UNIX // Register handler of hardware exceptions like null reference in PAL