Skip to content

Commit 085732c

Browse files
authored
Misc cleanup (fixing comments, deleting dead code) (#117908)
* Left-over feedback from #114246 * Delete unused macros * Delete dead ifdef * Delete obsolete comment * Delete dead code * Fix formatting * Delete dead code * Delete mentions of Windows Arm32 * Delete unrecognized attribute * Fix comment and log message
1 parent 082123b commit 085732c

File tree

16 files changed

+21
-88
lines changed

16 files changed

+21
-88
lines changed

docs/workflow/requirements/windows-requirements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ It is highly recommended to use the *Workloads* approach, as that installs the f
4646
- .NET desktop development
4747
- Desktop development with C++
4848

49-
To build the tests and do ARM32/ARM64 development, you'll need some additional components. You can find them by clicking on the *Individual components* tab in the *Visual Studio Installer*:
49+
To build the tests and do ARM64 development, you'll need some additional components. You can find them by clicking on the *Individual components* tab in the *Visual Studio Installer*:
5050

51-
- For ARM stuff: *MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)* for Arm64, and *MSVC v143 - VS 2022 C++ ARM build tools (Latest)* for Arm32.
51+
- For Arm64: *MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)*
5252
- For building tests: *C++/CLI support for v143 build tools (Latest)*
5353

5454
Alternatively, there is also a `.vsconfig` file included at the root of the runtime repo. It includes all the necessary components required, outlined in a JSON format that Visual Studio can read and parse. You can boot up Visual Studio directly and [import this `.vsconfig` file](https://learn.microsoft.com/visualstudio/install/import-export-installation-configurations?view=vs-2022#import-a-configuration) instead of installing the workloads yourself. It is worth mentioning however, that while we are very careful in maintaining this file up-to-date, sometimes it might get a tad obsolete and miss important components. So, it is always a good idea to double check that the full workloads are installed.

src/coreclr/inc/loaderheap.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ struct InterleavedLoaderHeapConfig
466466
void InitializeLoaderHeapConfig(InterleavedLoaderHeapConfig *pConfig, size_t stubSize, void* templateInImage, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size), void (*dataPageGenerator)(uint8_t* pageBase, size_t size));
467467

468468
//===============================================================================
469-
// This is the base class for InterleavedLoaderHeap It's used as a simple
469+
// This is the base class for InterleavedLoaderHeap. It's used as a simple
470470
// allocator for stubs in a scheme where each stub is a small fixed size, and is paired
471471
// with memory which is GetStubCodePageSize() bytes away. In addition there is an
472472
// ability to free is via a "backout" mechanism that is not considered to have good performance.
@@ -574,7 +574,7 @@ class UnlockedInterleavedLoaderHeap : public UnlockedLoaderHeapBase
574574
);
575575

576576
protected:
577-
// This frees memory allocated by UnlockAllocMem. It's given this horrible name to emphasize
577+
// This frees memory allocated by UnlockedAllocStub. It's given this horrible name to emphasize
578578
// that it's purpose is for error path leak prevention purposes. You shouldn't
579579
// use LoaderHeap's as general-purpose alloc-free heaps.
580580
void UnlockedBackoutStub(void *pMem
@@ -702,8 +702,7 @@ inline CRITSEC_COOKIE CreateLoaderHeapLock()
702702
}
703703

704704
//===============================================================================
705-
// The LoaderHeap is the black-box heap and has a Backout() method but none
706-
// of the advanced features that let you control address ranges.
705+
// Thread-safe variant of UnlockedLoaderHeap.
707706
//===============================================================================
708707
typedef DPTR(class LoaderHeap) PTR_LoaderHeap;
709708
class LoaderHeap : public UnlockedLoaderHeap
@@ -972,7 +971,7 @@ class LoaderHeap : public UnlockedLoaderHeap
972971

973972

974973
public:
975-
// This frees memory allocated by AllocMem. It's given this horrible name to emphasize
974+
// This frees memory allocated by RealAllocMem. It's given this horrible name to emphasize
976975
// that it's purpose is for error path leak prevention purposes. You shouldn't
977976
// use LoaderHeap's as general-purpose alloc-free heaps.
978977
void RealBackoutMem(void *pMem
@@ -1033,8 +1032,7 @@ class LoaderHeap : public UnlockedLoaderHeap
10331032
#endif
10341033

10351034
//===============================================================================
1036-
// The LoaderHeap is the black-box heap and has a Backout() method but none
1037-
// of the advanced features that let you control address ranges.
1035+
// Thread-safe variant of UnlockedInterleavedLoaderHeap.
10381036
//===============================================================================
10391037
typedef DPTR(class InterleavedLoaderHeap) PTR_InterleavedLoaderHeap;
10401038
class InterleavedLoaderHeap : public UnlockedInterleavedLoaderHeap
@@ -1107,7 +1105,7 @@ class InterleavedLoaderHeap : public UnlockedInterleavedLoaderHeap
11071105

11081106

11091107
public:
1110-
// This frees memory allocated by AllocMem. It's given this horrible name to emphasize
1108+
// This frees memory allocated by RealAllocStub. It's given this horrible name to emphasize
11111109
// that it's purpose is for error path leak prevention purposes. You shouldn't
11121110
// use LoaderHeap's as general-purpose alloc-free heaps.
11131111
void RealBackoutMem(void *pMem

src/coreclr/inc/palclr.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -362,30 +362,6 @@
362362
{ \
363363
PAL_TRY_HANDLER_DBG_BEGIN
364364

365-
// PAL_TRY implementation that abstracts usage of COMPILER_INSTANCE*, which is used by
366-
// JIT64. On Windows, we dont need to do anything special as we dont have nested classes/methods
367-
// as on PAL.
368-
#define PAL_TRY_CI(__ParamType, __paramDef, __paramRef) \
369-
{ \
370-
struct __HandlerData { \
371-
__ParamType __param; \
372-
COMPILER_INSTANCE *__ciPtr; \
373-
}; \
374-
__HandlerData handlerData; \
375-
handlerData.__param = __paramRef; \
376-
handlerData.__ciPtr = ciPtr; \
377-
__HandlerData* __param = &handlerData; \
378-
__ParamType __paramToPassToFilter = __paramRef; \
379-
class __Body \
380-
{ \
381-
public: \
382-
static void Run(__HandlerData* __pHandlerData) \
383-
{ \
384-
PAL_TRY_HANDLER_DBG_BEGIN \
385-
COMPILER_INSTANCE *ciPtr = __pHandlerData->__ciPtr; \
386-
__ParamType __paramDef = __pHandlerData->__param;
387-
388-
389365
#define PAL_TRY_FOR_DLLMAIN(__ParamType, __paramDef, __paramRef, __reason) \
390366
{ \
391367
__ParamType __param = __paramRef; \
@@ -434,11 +410,6 @@
434410
PAL_TRY_NAKED \
435411
PAL_TRY_HANDLER_DBG_BEGIN
436412

437-
// PAL_TRY implementation that abstracts usage of COMPILER_INSTANCE*, which is used by
438-
// JIT64. On Windows, we dont need to do anything special as we dont have nested classes/methods
439-
// as on PAL.
440-
#define PAL_TRY_CI(__ParamType, __paramDef, __paramRef) PAL_TRY(__ParamType, __paramDef, __paramRef)
441-
442413
#define PAL_TRY_FOR_DLLMAIN(__ParamType, __paramDef, __paramRef, __reason) \
443414
{ \
444415
__ParamType __param = __paramRef; \
@@ -464,10 +435,6 @@
464435

465436
#endif // _DEBUG
466437

467-
// Executes the handler if the specified exception code matches
468-
// the one in the exception. Otherwise, returns EXCEPTION_CONTINUE_SEARCH.
469-
#define PAL_EXCEPT_IF_EXCEPTION_CODE(dwExceptionCode) PAL_EXCEPT((GetExceptionCode() == (dwExceptionCode))?EXCEPTION_EXECUTE_HANDLER:EXCEPTION_CONTINUE_SEARCH)
470-
471438
#define PAL_CPP_TRY try
472439
#define PAL_CPP_ENDTRY
473440
#define PAL_CPP_THROW(type, obj) do { throw obj; } while (false)

src/coreclr/jit/importercalls.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6808,7 +6808,7 @@ void Compiler::impCheckForPInvokeCall(
68086808
}
68096809
}
68106810

6811-
JITLOG((LL_INFO1000000, "\nInline a CALLI PINVOKE call from method %s\n", info.compFullName));
6811+
JITLOG((LL_INFO1000000, "\nInline a PINVOKE call from method %s\n", info.compFullName));
68126812

68136813
call->gtFlags |= GTF_CALL_UNMANAGED;
68146814
call->unmgdCallConv = unmanagedCallConv;
@@ -6817,7 +6817,6 @@ void Compiler::impCheckForPInvokeCall(
68176817
info.compUnmanagedCallCountWithGCTransition++;
68186818
}
68196819

6820-
// AMD64 convention is same for native and managed
68216820
if (unmanagedCallConv == CorInfoCallConvExtension::C ||
68226821
unmanagedCallConv == CorInfoCallConvExtension::CMemberFunction)
68236822
{

src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeMetadataReader.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,6 @@ internal ReadOnlySpan<byte> ReadStringAsBytes(ConstantStringValueHandle handle)
234234

235235
internal sealed partial class MetadataHeader
236236
{
237-
/// <todo>
238-
/// Signature should be updated every time the metadata schema changes.
239-
/// </todo>
240237
public const uint Signature = 0xDEADDFFD;
241238

242239
/// <summary>

src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.String.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,7 @@ public unsafe uint DecodeString(uint offset, out string value)
7373
if (endOffset < numBytes || endOffset > _size)
7474
ThrowBadImageFormatException();
7575

76-
#if NETFX_45
77-
byte[] bytes = new byte[numBytes];
78-
for (int i = 0; i < bytes.Length; i++)
79-
bytes[i] = *(_base + offset + i);
80-
81-
value = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
82-
#else
8376
value = Encoding.UTF8.GetString(_base + offset, (int)numBytes);
84-
#endif
8577

8678
return endOffset;
8779
}

src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AssemblyName>ILCompiler.MetadataTransform</AssemblyName>
55
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
7-
<DefineConstants>$(DefineConstants);NATIVEFORMAT_PUBLICWRITER;NETFX_45</DefineConstants>
7+
<DefineConstants>$(DefineConstants);NATIVEFORMAT_PUBLICWRITER</DefineConstants>
88
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
99
<Platforms>x64;x86</Platforms>
1010
<PlatformTarget>AnyCPU</PlatformTarget>

src/coreclr/utilcode/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ set(UTILCODE_COMMON_SOURCES
3030
interleavedloaderheap.cpp
3131
loaderheap_shared.cpp
3232
explicitcontrolloaderheap.cpp
33-
allocmemtracker.cpp
3433
rangelist.cpp
3534
outstring.cpp
3635
ilformatter.cpp
@@ -69,6 +68,7 @@ endif(CLR_CMAKE_TARGET_WIN32)
6968

7069
set(UTILCODE_SOURCES
7170
${UTILCODE_COMMON_SOURCES}
71+
allocmemtracker.cpp
7272
executableallocator.cpp
7373
)
7474

src/coreclr/utilcode/allocmemtracker.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#define DONOT_DEFINE_ETW_CALLBACK
99
#include "eventtracebase.h"
1010

11-
#ifndef DACCESS_COMPILE
12-
1311
AllocMemTracker::AllocMemTracker()
1412
{
1513
CONTRACTL
@@ -169,5 +167,3 @@ void AllocMemTracker::SuppressRelease()
169167

170168
m_fReleased = TRUE;
171169
}
172-
173-
#endif //#ifndef DACCESS_COMPILE

src/coreclr/utilcode/explicitcontrolloaderheap.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ ExplicitControlLoaderHeap::ExplicitControlLoaderHeap(bool fMakeExecutable) :
7272
#endif
7373
}
7474

75-
// ~LoaderHeap is not synchronised (obviously)
7675
ExplicitControlLoaderHeap::~ExplicitControlLoaderHeap()
7776
{
7877
CONTRACTL

0 commit comments

Comments
 (0)