Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
SwapnilGaikwad committed Jul 9, 2024
2 parents a640ab1 + dd4b757 commit 6b29a57
Show file tree
Hide file tree
Showing 157 changed files with 2,823 additions and 3,059 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>

<NativeBuildPartitionPropertiesToRemove>ClrFullNativeBuild;ClrRuntimeSubset;ClrJitSubset;ClrPalTestsSubset;ClrAllJitsSubset;ClrILToolsSubset;ClrNativeAotSubset;ClrSpmiSubset;ClrCrossComponentsSubset;ClrDebugSubset;HostArchitecture;PgoInstrument;NativeOptimizationDataSupported;CMakeArgs;CxxStandardLibrary;CxxStandardLibraryStatic;CxxAbiLibrary</NativeBuildPartitionPropertiesToRemove>
<UseSystemZlib Condition="'$(TargetsAppleMobile)' == 'true' or '$(TargetOS)' == 'android' or '$(TargetArchitecture)' == 'armv6'">true</UseSystemZlib>
</PropertyGroup>

<!-- RepositoryEngineeringDir isn't set when Installer tests import this file. -->
Expand Down
2 changes: 1 addition & 1 deletion docs/area-owners.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Note: Editing this file doesn't update the mapping used by `@msftbot` for area-s
| area-UWP | @tommcdon | @dotnet/area-uwp | UWP-specific issues including Microsoft.NETCore.UniversalWindowsPlatform and Microsoft.Net.UWPCoreRuntimeSdk |
| area-VM-coreclr | @mangod9 | @mangod9 | |
| area-VM-meta-mono | @steveisok | @lambdageek | |
| area-VM-reflection-mono | @mangod9 | @lambdageek | MonoVM-specific reflection and reflection-emit issues |
| area-VM-reflection-mono | @steveisok | @lambdageek | MonoVM-specific reflection and reflection-emit issues |
| area-VM-threading-mono | @mangod9 | @lambdageek | |
| area-Workloads | @lewing | @dotnet/net-sdk-workload-contributors | |

Expand Down
1 change: 1 addition & 0 deletions docs/workflow/ci/pr-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Anyone with write access can merge a pull request manually when the following co
* The PR has been approved by at least one reviewer and any other objections are addressed.
* You can request another review from the original reviewer.
* The PR successfully builds and passes all tests in the Continuous Integration (CI) system. In case of failures, refer to the [analyzing build failures](failure-analysis.md) doc.
* The CI results are no more than 1 week old.

Typically, PRs are merged as one commit (squash merges). It creates a simpler history than a Merge Commit. "Special circumstances" are rare, and typically mean that there are a series of cleanly separated changes that will be too hard to understand if squashed together, or for some reason we want to preserve the ability to disect them.

Expand Down
16 changes: 8 additions & 8 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -360,17 +360,17 @@
<Uri>https://github.com/dotnet/runtime-assets</Uri>
<Sha>ec2da34cd7e31a605d6f30f02021a8d76947c99d</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.11.0-3.24329.1">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.12.0-1.24355.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>92051d4c24bc13ff58232104a647910bf22cd105</Sha>
<Sha>19b5e961ecb97b008106f1b646c077e0bffde4a7</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis" Version="4.11.0-3.24329.1">
<Dependency Name="Microsoft.CodeAnalysis" Version="4.12.0-1.24355.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>92051d4c24bc13ff58232104a647910bf22cd105</Sha>
<Sha>19b5e961ecb97b008106f1b646c077e0bffde4a7</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.11.0-3.24329.1">
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.12.0-1.24355.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>92051d4c24bc13ff58232104a647910bf22cd105</Sha>
<Sha>19b5e961ecb97b008106f1b646c077e0bffde4a7</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0-beta1.24324.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
Expand All @@ -381,9 +381,9 @@
<Sha>43709af7570da7140fb3e9a5237f55ffb24677e7</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.11.0-3.24329.1">
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.12.0-1.24355.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>92051d4c24bc13ff58232104a647910bf22cd105</Sha>
<Sha>19b5e961ecb97b008106f1b646c077e0bffde4a7</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="9.0.100-preview.7.24323.5">
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure
they do not break the local dev experience.
-->
<MicrosoftCodeAnalysisCSharpVersion>4.11.0-3.24329.1</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisVersion>4.11.0-3.24329.1</MicrosoftCodeAnalysisVersion>
<MicrosoftNetCompilersToolsetVersion>4.11.0-3.24329.1</MicrosoftNetCompilersToolsetVersion>
<MicrosoftCodeAnalysisCSharpVersion>4.12.0-1.24355.3</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisVersion>4.12.0-1.24355.3</MicrosoftCodeAnalysisVersion>
<MicrosoftNetCompilersToolsetVersion>4.12.0-1.24355.3</MicrosoftNetCompilersToolsetVersion>
</PropertyGroup>
<!--
For source generator support we need to target multiple versions of Roslyn in order to be able to run on older versions of Roslyn.
Expand Down
9 changes: 8 additions & 1 deletion eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# We need to set this to Release as there's no way to intercept configuration-specific linker flags
# for try_compile-style tests (like check_c_source_compiles) and some of the default Debug flags
# (ie. /INCREMENTAL) conflict with our own flags.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
Expand Down Expand Up @@ -58,6 +63,7 @@ if (MSVC)
define_property(TARGET PROPERTY CLR_CONTROL_FLOW_GUARD INHERITED BRIEF_DOCS "Controls the /guard:cf flag presence" FULL_DOCS "Set this property to ON or OFF to indicate if the /guard:cf compiler and linker flag should be present")
define_property(TARGET PROPERTY CLR_EH_CONTINUATION INHERITED BRIEF_DOCS "Controls the /guard:ehcont flag presence" FULL_DOCS "Set this property to ON or OFF to indicate if the /guard:ehcont compiler flag should be present")
define_property(TARGET PROPERTY CLR_EH_OPTION INHERITED BRIEF_DOCS "Defines the value of the /EH option" FULL_DOCS "Set this property to one of the valid /EHxx options (/EHa, /EHsc, /EHa-, ...)")
define_property(TARGET PROPERTY MSVC_WARNING_LEVEL INHERITED BRIEF_DOCS "Define the warning level for the /Wn option" FULL_DOCS "Set this property to one of the valid /Wn options (/W0, /W1, /W2, /W3, /W4)")

set_property(GLOBAL PROPERTY CLR_CONTROL_FLOW_GUARD ON)

Expand Down Expand Up @@ -779,7 +785,8 @@ if (MSVC)

# [[! Microsoft.Security.SystemsADM.10086 !]] - SDL required warnings
# set default warning level to 4 but allow targets to override it.
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W$<GENEX_EVAL:$<IF:$<BOOL:$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>>,$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>,4>>>)
set_property(GLOBAL PROPERTY MSVC_WARNING_LEVEL 4)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>>)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/WX>) # treat warnings as errors
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oi>) # enable intrinsics
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oy->) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls
Expand Down
7 changes: 7 additions & 0 deletions eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,10 @@ if(LOWERCASE_CMAKE_BUILD_TYPE STREQUAL debug)
string(REPLACE "-D_FORTIFY_SOURCE=2 " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "-D_FORTIFY_SOURCE=2 " "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
endif()

if (CLR_CMAKE_TARGET_ANDROID OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_HOST_ARCH_ARMV6)
# Some platforms are opted-out from using the in-tree zlib-ng by default:
# - Android and iOS-like platforms: concerns about extra binary size
# - Armv6: zlib-ng has build breaks
set(CLR_CMAKE_USE_SYSTEM_ZLIB 1)
endif()
4 changes: 2 additions & 2 deletions eng/native/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function(preprocess_file inputFilename outputFilename)
get_compile_definitions(PREPROCESS_DEFINITIONS)
get_include_directories(PREPROCESS_INCLUDE_DIRECTORIES)
get_source_file_property(SOURCE_FILE_DEFINITIONS ${inputFilename} COMPILE_DEFINITIONS)

foreach(DEFINITION IN LISTS SOURCE_FILE_DEFINITIONS)
list(APPEND PREPROCESS_DEFINITIONS -D${DEFINITION})
endforeach()
Expand Down Expand Up @@ -508,7 +508,7 @@ function(install_static_library targetName destination component)
if (WIN32)
set_target_properties(${targetName} PROPERTIES
COMPILE_PDB_NAME "${targetName}"
COMPILE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
COMPILE_PDB_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:${targetName}>"
)
install (FILES "$<TARGET_FILE_DIR:${targetName}>/${targetName}.pdb" DESTINATION ${destination} COMPONENT ${component})
endif()
Expand Down
26 changes: 7 additions & 19 deletions src/coreclr/System.Private.CoreLib/src/System/Exception.CoreCLR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ internal void InternalPreserveStackTrace()
private static extern void PrepareForForeignExceptionRaise();

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void GetStackTracesDeepCopy(Exception exception, out byte[]? currentStackTrace, out object[]? dynamicMethodArray);

[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void SaveStackTracesFromDeepCopy(Exception exception, byte[]? currentStackTrace, object[]? dynamicMethodArray);
private static extern object? GetFrozenStackTrace(Exception exception);

[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern uint GetExceptionCount();
Expand All @@ -147,18 +144,13 @@ internal void RestoreDispatchState(in DispatchState dispatchState)
// in the exception object. This will ensure that when this exception is thrown and these
// fields are modified, then EDI's references remain intact.
//
byte[]? stackTraceCopy = (byte[]?)dispatchState.StackTrace?.Clone();
object[]? dynamicMethodsCopy = (object[]?)dispatchState.DynamicMethods?.Clone();

// Watson buckets and remoteStackTraceString fields are captured and restored without any locks. It is possible for them to
// get out of sync without violating overall integrity of the system.
_watsonBuckets = dispatchState.WatsonBuckets;
_ipForWatsonBuckets = dispatchState.IpForWatsonBuckets;
_remoteStackTraceString = dispatchState.RemoteStackTrace;

// The binary stack trace and references to dynamic methods have to be restored under a lock to guarantee integrity of the system.
SaveStackTracesFromDeepCopy(this, stackTraceCopy, dynamicMethodsCopy);

_stackTrace = dispatchState.StackTrace;
_stackTraceString = null;

// Marks the TES state to indicate we have restored foreign exception
Expand All @@ -172,7 +164,7 @@ internal void RestoreDispatchState(in DispatchState dispatchState)
private IDictionary? _data;
private readonly Exception? _innerException;
private string? _helpURL;
private byte[]? _stackTrace;
private object? _stackTrace;
private byte[]? _watsonBuckets;
private string? _stackTraceString; // Needed for serialization.
private string? _remoteStackTraceString;
Expand All @@ -181,7 +173,6 @@ internal void RestoreDispatchState(in DispatchState dispatchState)
// DynamicMethodDescs alive for the lifetime of the exception. We do this because
// the _stackTrace field holds MethodDescs, and a DynamicMethodDesc can be destroyed
// unless a System.Resolver object roots it.
private readonly object[]? _dynamicMethods;
private string? _source; // Mainly used by VB.
private UIntPtr _ipForWatsonBuckets; // Used to persist the IP for Watson Bucketing
private readonly IntPtr _xptrs; // Internal EE stuff
Expand Down Expand Up @@ -227,21 +218,18 @@ internal static string GetMessageFromNativeResources(ExceptionMessageKind kind)

internal readonly struct DispatchState
{
public readonly byte[]? StackTrace;
public readonly object[]? DynamicMethods;
public readonly object? StackTrace;
public readonly string? RemoteStackTrace;
public readonly UIntPtr IpForWatsonBuckets;
public readonly byte[]? WatsonBuckets;

public DispatchState(
byte[]? stackTrace,
object[]? dynamicMethods,
object? stackTrace,
string? remoteStackTrace,
UIntPtr ipForWatsonBuckets,
byte[]? watsonBuckets)
{
StackTrace = stackTrace;
DynamicMethods = dynamicMethods;
RemoteStackTrace = remoteStackTrace;
IpForWatsonBuckets = ipForWatsonBuckets;
WatsonBuckets = watsonBuckets;
Expand All @@ -250,9 +238,9 @@ public DispatchState(

internal DispatchState CaptureDispatchState()
{
GetStackTracesDeepCopy(this, out byte[]? stackTrace, out object[]? dynamicMethods);
object? stackTrace = GetFrozenStackTrace(this);

return new DispatchState(stackTrace, dynamicMethods,
return new DispatchState(stackTrace,
_remoteStackTraceString, _ipForWatsonBuckets, _watsonBuckets);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,23 @@ class AsmOffsets
public const int SIZEOF__EHEnum = 0x20;
public const int OFFSETOF__StackFrameIterator__m_pRegDisplay = 0x228;
public const int OFFSETOF__ExInfo__m_pPrevExInfo = 0;
public const int OFFSETOF__ExInfo__m_pExContext = 0xc0;
public const int OFFSETOF__ExInfo__m_exception = 0xc8;
public const int OFFSETOF__ExInfo__m_kind = 0xd0;
public const int OFFSETOF__ExInfo__m_passNumber = 0xd1;
public const int OFFSETOF__ExInfo__m_idxCurClause = 0xd4;
public const int OFFSETOF__ExInfo__m_frameIter = 0xd8;
public const int OFFSETOF__ExInfo__m_pExContext = 0xa8;
public const int OFFSETOF__ExInfo__m_exception = 0xb0;
public const int OFFSETOF__ExInfo__m_kind = 0xb8;
public const int OFFSETOF__ExInfo__m_passNumber = 0xb9;
public const int OFFSETOF__ExInfo__m_idxCurClause = 0xbc;
public const int OFFSETOF__ExInfo__m_frameIter = 0xc0;
public const int OFFSETOF__ExInfo__m_notifyDebuggerSP = OFFSETOF__ExInfo__m_frameIter + SIZEOF__StackFrameIterator;
#else // TARGET_64BIT
public const int SIZEOF__EHEnum = 0x10;
public const int OFFSETOF__StackFrameIterator__m_pRegDisplay = 0x218;
public const int OFFSETOF__ExInfo__m_pPrevExInfo = 0;
public const int OFFSETOF__ExInfo__m_pExContext = 0x70;
public const int OFFSETOF__ExInfo__m_exception = 0x74;
public const int OFFSETOF__ExInfo__m_kind = 0x78;
public const int OFFSETOF__ExInfo__m_passNumber = 0x79;
public const int OFFSETOF__ExInfo__m_idxCurClause = 0x7C;
public const int OFFSETOF__ExInfo__m_frameIter = 0x80;
public const int OFFSETOF__ExInfo__m_pExContext = 0x5c;
public const int OFFSETOF__ExInfo__m_exception = 0x60;
public const int OFFSETOF__ExInfo__m_kind = 0x64;
public const int OFFSETOF__ExInfo__m_passNumber = 0x65;
public const int OFFSETOF__ExInfo__m_idxCurClause = 0x68;
public const int OFFSETOF__ExInfo__m_frameIter = 0x6c;
public const int OFFSETOF__ExInfo__m_notifyDebuggerSP = OFFSETOF__ExInfo__m_frameIter + SIZEOF__StackFrameIterator;
#endif // TARGET_64BIT

Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/classlibnative/bcltype/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ FCIMPL1(ReflectMethodObject*, SystemNative::GetMethodFromStackTrace, ArrayBase*
{
FCALL_CONTRACT;

// The pStackTraceUNSAFE can be either I1Array or Object[]. In the latter case, the first entry is the actual stack trace I1Array,
// the rest are pointers to the method info objects. We only care about the first entry here.
if (pStackTraceUNSAFE->GetArrayElementType() != ELEMENT_TYPE_I1)
{
PtrArray *combinedArray = (PtrArray*)pStackTraceUNSAFE;
pStackTraceUNSAFE = (ArrayBase*)OBJECTREFToObject(combinedArray->GetAt(0));
}
I1ARRAYREF pArray(static_cast<I1Array *>(pStackTraceUNSAFE));
StackTraceArray stackArray(pArray);

Expand Down
Loading

0 comments on commit 6b29a57

Please sign in to comment.