Skip to content

Commit 7b92525

Browse files
Fix comments in zapimage.cpp (#1629)
I noticed that base addresses in the comments were not correct (constants in the switches.h file had been updated without updating the comments in this file), and while at it, fixed spelling and grammar in other comments.
1 parent 8cdefc1 commit 7b92525

File tree

1 file changed

+40
-43
lines changed

1 file changed

+40
-43
lines changed

src/coreclr/src/zap/zapimage.cpp

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ZapImage::ZapImage(Zapper *zapper)
4747
ZapImage::~ZapImage()
4848
{
4949
#ifdef ZAP_HASHTABLE_TUNING
50-
// If ZAP_HASHTABLE_TUNING is defined, preallocate is overloaded to print the tunning constants
50+
// If ZAP_HASHTABLE_TUNING is defined, preallocate is overloaded to print the tuning constants
5151
Preallocate();
5252
#endif
5353

@@ -339,10 +339,10 @@ void ZapImage::AllocateVirtualSections()
339339

340340
m_pExternalMethodCellSection = NewVirtualSection(pDataSection, IBCProfiledSection | HotColdSortedRange | ExternalMethodThunkSection, TARGET_POINTER_SIZE);
341341

342-
// m_pStubDispatchCellSection is deliberately placed directly after
342+
// m_pStubDispatchCellSection is deliberately placed directly after
343343
// the last m_pDelayLoadInfoTableSection (all .data sections go together in the order indicated).
344344
// We do this to place it as the last "hot, written" section. Why? Because
345-
// we don't split the dispatch cells into hot/cold sections (We probably should),
345+
// we don't split the dispatch cells into hot/cold sections (we probably should),
346346
// and so the section is actually half hot and half cold.
347347
// But it turns out that the hot dispatch cells always come
348348
// first (because the code that uses them is hot and gets compiled first).
@@ -363,14 +363,14 @@ void ZapImage::AllocateVirtualSections()
363363
// Virtual sections that are moved to .cdata when we have profile data.
364364
//
365365

366-
// This is everyhing that is assumed to be warm in the first strata
366+
// This is everything that is assumed to be warm in the first strata
367367
// of non-profiled scenarios. MethodTables related to objects etc.
368368
m_pPreloadSections[CORCOMPILE_SECTION_WARM] = NewVirtualSection(pDataSection, IBCProfiledSection | WarmRange | EEDataSection, TARGET_POINTER_SIZE);
369369

370370
m_pPreloadSections[CORCOMPILE_SECTION_RVA_STATICS_COLD] = NewVirtualSection(pDataSection, IBCProfiledSection | ColdRange | RVAStaticsSection);
371371

372372
// In an ideal world these are cold in both profiled and the first strata
373-
// of non-profiled scenarios (i.e. no reflection, etc. ) The sections at the
373+
// of non-profiled scenarios (i.e. no reflection, etc.) The sections at the
374374
// bottom correspond to further strata of non-profiled scenarios.
375375
m_pPreloadSections[CORCOMPILE_SECTION_CLASS_COLD] = NewVirtualSection(pDataSection, IBCProfiledSection | ColdRange | ClassSection, TARGET_POINTER_SIZE);
376376
m_pPreloadSections[CORCOMPILE_SECTION_CROSS_DOMAIN_INFO] = NewVirtualSection(pDataSection, IBCUnProfiledSection | ColdRange | CrossDomainInfoSection, TARGET_POINTER_SIZE);
@@ -517,7 +517,7 @@ void ZapImage::AllocateVirtualSections()
517517
m_pHotGCSection = NewVirtualSection(pTextSection, IBCProfiledSection | WarmRange | GCInfoSection, sizeof(DWORD));
518518

519519
#if !defined(_TARGET_ARM_)
520-
// For ARM, put these sections more towards the end because bl/b instructions have limited diplacement
520+
// For ARM, put these sections more towards the end because bl/b instructions have limited displacement
521521

522522
// IL
523523
m_pILSection = NewVirtualSection(pTextSection, IBCProfiledSection | HotColdSortedRange | ILSection, sizeof(DWORD));
@@ -579,7 +579,7 @@ void ZapImage::AllocateVirtualSections()
579579
m_pColdCodeSection->SetDefaultFill(DEFAULT_CODE_BUFFER_INIT);
580580

581581
#if defined(_TARGET_ARM_)
582-
// For ARM, put these sections more towards the end because bl/b instructions have limited diplacement
582+
// For ARM, put these sections more towards the end because bl/b instructions have limited displacement
583583

584584
// IL
585585
m_pILSection = NewVirtualSection(pTextSection, IBCProfiledSection | HotColdSortedRange | ILSection, sizeof(DWORD));
@@ -639,7 +639,7 @@ void ZapImage::Preallocate()
639639
{
640640
COUNT_T cbILImage = m_ModuleDecoder.GetSize();
641641

642-
// Curb the estimate to handle corner cases gracefuly
642+
// Curb the estimate to handle corner cases gracefully
643643
cbILImage = min(cbILImage, 50000000);
644644

645645
PREALLOCATE_HASHTABLE(ZapImage::m_CompiledMethods, 0.0050, cbILImage);
@@ -1019,7 +1019,7 @@ HANDLE ZapImage::GenerateFile(LPCWSTR wszOutputFileName, CORCOMPILE_NGEN_SIGNATU
10191019
rsds.magic = VAL32(0x53445352); // "SDSR";
10201020
rsds.age = 1;
10211021
// our PDB signature will be the same as our NGEN signature.
1022-
// However we want the printed version of the GUID to be be the same as the
1022+
// However we want the printed version of the GUID to be the same as the
10231023
// byte dump of the signature so we swap bytes to make this work.
10241024
//
10251025
// * See code:CCorSvcMgr::CreatePdb for where this is used.
@@ -1079,10 +1079,10 @@ HANDLE ZapImage::SaveImage(LPCWSTR wszOutputFileName, LPCWSTR wszDllPath, CORCOM
10791079

10801080
OutputTables();
10811081

1082-
// Create a empty export table. This makes tools like symchk not think
1083-
// that native images are resoure-only DLLs. It is important to NOT
1082+
// Create an empty export table. This makes tools like symchk not think
1083+
// that native images are resource-only DLLs. It is important to NOT
10841084
// be a resource-only DLL because those DLL's PDBS are not put up on the
1085-
// symbol server and we want NEN PDBS to be placed there.
1085+
// symbol server and we want NGEN PDBS to be placed there.
10861086
ZapPEExports* exports = new(GetHeap()) ZapPEExports(wszDllPath);
10871087
m_pDebugSection->Place(exports);
10881088
SetDirectoryEntry(IMAGE_DIRECTORY_ENTRY_EXPORT, exports);
@@ -1232,7 +1232,7 @@ void ZapImage::CalculateZapBaseAddress()
12321232
baseAddress = 0x30000000;
12331233
#elif defined(_TARGET_64BIT_)
12341234
// We use 04000000 for an exe
1235-
// which is remapped to 0x642`88000000 on x64
1235+
// which is remapped to 0x644`88000000 on x64
12361236
baseAddress = 0x04000000;
12371237
#endif
12381238
}
@@ -1243,14 +1243,14 @@ void ZapImage::CalculateZapBaseAddress()
12431243
baseAddress = 0x31000000;
12441244
#elif defined(_TARGET_64BIT_)
12451245
// We start a 05000000 for the main assembly with the manifest
1246-
// which is remapped to 0x642`8A000000 on x64
1246+
// which is remapped to 0x644`8A000000 on x64
12471247
baseAddress = 0x05000000;
12481248
#endif
12491249
}
12501250
}
12511251
else // is dependent assembly of a multi-module assembly
12521252
{
1253-
// Set the base address for a dependant multi module assembly
1253+
// Set the base address for a dependent multi-module assembly
12541254

12551255
// We should have already set the nextBaseAddressForMultiModule
12561256
// when we compiled the manifest module
@@ -1295,24 +1295,21 @@ void ZapImage::CalculateZapBaseAddress()
12951295
nextBaseAddressForMultiModule = tempBaseAddress;
12961296

12971297
//
1298-
// Now we remap the 32-bit address range used for x86 and PE32 images into thre
1298+
// Now we remap the 32-bit address range used for x86 and PE32 images into the
12991299
// upper address range used on 64-bit platforms
13001300
//
1301-
#if USE_UPPER_ADDRESS
1302-
#if defined(_TARGET_64BIT_)
1301+
#if USE_UPPER_ADDRESS // Implies _TARGET_64BIT_
13031302
if (baseAddress < 0x80000000)
13041303
{
13051304
if (baseAddress < 0x40000000)
1306-
baseAddress += 0x40000000; // We map [00000000..3fffffff] to [642'80000000..642'ffffffff]
1305+
baseAddress += 0x40000000; // We map [00000000..3fffffff] to [644'80000000..644'ffffffff]
13071306
else
1308-
baseAddress -= 0x40000000; // We map [40000000..7fffffff] to [642'00000000..642'7fffffff]
1307+
baseAddress -= 0x40000000; // We map [40000000..7fffffff] to [644'00000000..644'7fffffff]
13091308

13101309
baseAddress *= UPPER_ADDRESS_MAPPING_FACTOR;
13111310
baseAddress += CLR_UPPER_ADDRESS_MIN;
13121311
}
13131312
#endif
1314-
#endif
1315-
13161313

13171314
// Apply the calculated base address.
13181315
SetBaseAddress(baseAddress);
@@ -1548,7 +1545,7 @@ void ZapImage::OutputTables()
15481545
}
15491546

15501547
#if defined(FEATURE_PAL) && !defined(_TARGET_64BIT_)
1551-
// To minimize wasted VA space on 32 bit systems align file to page bounaries (presumed to be 4K).
1548+
// To minimize wasted VA space on 32-bit systems, align file to page boundaries (presumed to be 4K).
15521549
SetFileAlignment(0x1000);
15531550
#elif defined(_TARGET_ARM_) && defined(FEATURE_CORESYSTEM)
15541551
if (!IsReadyToRunCompilation())
@@ -1623,7 +1620,7 @@ void ZapImage::ProfileDisableInlining()
16231620
}
16241621

16251622
// CompileHotRegion
1626-
// Performs the compilation and placement for all methods in the the "Hot" code region
1623+
// Performs the compilation and placement for all methods in the "Hot" code region
16271624
// Methods placed in this region typically correspond to all of the methods that were
16281625
// executed during any of the profiling scenarios.
16291626
//
@@ -1663,7 +1660,7 @@ void ZapImage::CompileHotRegion()
16631660
else if (TypeFromToken(token) == ibcMethodSpec)
16641661
{
16651662
//
1666-
// compile a generic/parameterized method
1663+
// Compile a generic/parameterized method
16671664
//
16681665
CORBBTPROF_BLOB_PARAM_SIG_ENTRY *pBlobSigEntry = pProfileData->GetBlobSigEntry(token);
16691666

@@ -1687,7 +1684,7 @@ void ZapImage::CompileHotRegion()
16871684
else
16881685
{
16891686
// This generic/parameterized method is not part of the native image
1690-
// Either the IBC type specified no longer exists or it is a SIMD types
1687+
// Either the IBC type specified no longer exists or it is a SIMD types
16911688
// or the type can't be loaded in a ReadyToRun native image because of
16921689
// a cross-module type dependencies.
16931690
//
@@ -1711,7 +1708,7 @@ void ZapImage::CompileHotRegion()
17111708
}
17121709

17131710
// CompileColdRegion
1714-
// Performs the compilation and placement for all methods in the the "Cold" code region
1711+
// Performs the compilation and placement for all methods in the "Cold" code region
17151712
// Methods placed in this region typically correspond to all of the methods that were
17161713
// NOT executed during any of the profiling scenarios.
17171714
//
@@ -1906,7 +1903,7 @@ BOOL ZapImage::IsVTableGapMethod(mdMethodDef md)
19061903
DWORD dwAttributes;
19071904

19081905
// Get method attributes and check that RTSpecialName was set for the method (this means the name has
1909-
// semantic import to the runtime and must be formatted rigorously with one of a few well known rules).
1906+
// semantic import to the runtime and must be formatted rigorously with one of a few well-known rules).
19101907
// Note that we just return false on any failure path since this will just lead to our caller continuing
19111908
// to throw the exception they were about to anyway.
19121909
hr = m_pMDImport->GetMethodDefProps(md, &dwAttributes);
@@ -1995,7 +1992,7 @@ ZapImage::CompileStatus ZapImage::TryCompileInstantiatedMethod(CORINFO_METHOD_HA
19951992
return COMPILE_EXCLUDED;
19961993

19971994
// If we compiling this method because it was specified by the IBC profile data
1998-
// then issue an warning if this method is not on our uncompiled method list
1995+
// then issue a warning if this method is not on our uncompiled method list.
19991996
//
20001997
if (methodProfilingDataFlags != 0)
20011998
{
@@ -2061,7 +2058,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h
20612058
//
20622059
if (methodProfilingDataFlags != 0)
20632060
{
2064-
// Report the profiling data flags for layout of the EE datastructures
2061+
// Report the profiling data flags for layout of the EE data structures
20652062
m_pPreloader->SetMethodProfilingFlags(handle, methodProfilingDataFlags);
20662063

20672064
// Hot methods can be marked to be excluded from the AOT native image.
@@ -2074,7 +2071,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h
20742071
}
20752072

20762073
// Cold methods can be marked to be excluded from the AOT native image.
2077-
// We can reduced the size of the AOT native image by selectively
2074+
// We can reduce the size of the AOT native image by selectively
20782075
// excluding the code for some of the cold methods.
20792076
//
20802077
if ((methodProfilingDataFlags & (1 << ExcludeColdMethodCode)) != 0)
@@ -2084,7 +2081,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h
20842081
}
20852082

20862083
// If the code was never executed based on the profile data
2087-
// then don't compile this method now. Wait until until later
2084+
// then don't compile this method now. Wait until later
20882085
// when we are compiling the methods in the cold section.
20892086
//
20902087
if ((methodProfilingDataFlags & (1 << ReadMethodCode)) == 0)
@@ -2167,9 +2164,9 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h
21672164
// messages to the console
21682165
if (IsReadyToRunCompilation())
21692166
{
2170-
// When compiling the method we may receive an exeception when the
2167+
// When compiling the method, we may receive an exception when the
21712168
// method uses a feature that is Not Implemented for ReadyToRun
2172-
// or a Type Load exception if the method uses for a SIMD type.
2169+
// or a Type Load exception if the method uses a SIMD type.
21732170
//
21742171
// We skip the compilation of such methods and we don't want to
21752172
// issue a warning or error
@@ -2186,7 +2183,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h
21862183
ex->GetMessage(message);
21872184

21882185
// FileNotFound errors here can be converted into a single error string per ngen compile,
2189-
// and the detailed error is available with verbose logging
2186+
// and the detailed error is available with verbose logging
21902187
if (hrException == COR_E_FILENOTFOUND)
21912188
{
21922189
StackSString logMessage(W("System.IO.FileNotFoundException: "));
@@ -2575,7 +2572,7 @@ HRESULT ZapImage::parseProfileData()
25752572
return S_FALSE;
25762573
}
25772574

2578-
// This module has profile data (this ends up controling the layout of physical and virtual
2575+
// This module has profile data (this ends up controlling the layout of physical and virtual
25792576
// sections within the image, see ZapImage::AllocateVirtualSections.
25802577
m_fHaveProfileData = true;
25812578
m_zapper->m_pOpt->m_fHasAnyProfileData = true;
@@ -2929,7 +2926,7 @@ HRESULT ZapImage::convertProfileDataFromV1()
29292926
sizeWrite += blobEntry->cBuffer;
29302927
if (blobEntry->blobType == ParamMethodSpec)
29312928
{
2932-
sizeWrite -= 1; // Adjust for
2929+
sizeWrite -= 1; // Adjust for ENCODE_METHOD_SIG prefix removal
29332930
}
29342931
sizeRead += sizeof(CORBBTPROF_BLOB_ENTRY_V1);
29352932
sizeRead += blobEntry->cBuffer;
@@ -3325,7 +3322,7 @@ void ZapImage::hashBBUpdateFlagsAndCompileResult(mdToken token, unsigned methodP
33253322
assert(pEntry->md == newEntry.md);
33263323
assert(pEntry->flags == 0); // the flags should not be set at this point.
33273324

3328-
// Copy and keep the two fleids that were previously set
3325+
// Copy and keep the two fields that were previously set
33293326
newEntry.size = pEntry->size;
33303327
newEntry.pos = pEntry->pos;
33313328
}
@@ -3447,15 +3444,15 @@ bool ZapImage::canIntraModuleDirectCall(
34473444
goto CALL_VIA_ENTRY_POINT;
34483445
}
34493446

3450-
// Does the methods's class have a cctor, etc?
3447+
// Does the method's class have a cctor, etc?
34513448

34523449
if (!m_pPreloader->CanSkipMethodPreparation(callerFtn, targetFtn, pReason, accessFlags))
34533450
goto CALL_VIA_ENTRY_POINT;
34543451

34553452
ZapMethodHeader * pMethod;
34563453
pMethod = GetCompiledMethod(targetFtn);
34573454

3458-
// If we have not compiled the method then we can't call direct
3455+
// If we have not compiled the method, then we can't call directly
34593456

34603457
if (pMethod == NULL)
34613458
{
@@ -3556,13 +3553,13 @@ void ZapImage::Error(mdToken token, HRESULT hr, UINT resID, LPCWSTR message)
35563553
// Some warnings are demoted to informational level
35573554
if (resID == IDS_EE_SIMD_NGEN_DISALLOWED)
35583555
{
3559-
// Supress printing of "Target-dependent SIMD vector types may not be used with ngen."
3556+
// Suppress printing of "Target-dependent SIMD vector types may not be used with ngen."
35603557
level = CORZAP_LOGLEVEL_INFO;
35613558
}
35623559

35633560
if (resID == IDS_EE_HWINTRINSIC_NGEN_DISALLOWED)
35643561
{
3565-
// Supress printing of "Hardware intrinsics may not be used with ngen."
3562+
// Suppress printing of "Hardware intrinsics may not be used with ngen."
35663563
level = CORZAP_LOGLEVEL_INFO;
35673564
}
35683565

@@ -3574,7 +3571,7 @@ void ZapImage::Error(mdToken token, HRESULT hr, UINT resID, LPCWSTR message)
35743571
if (m_zapper->m_pOpt->m_ignoreErrors && !m_zapper->m_pOpt->m_verbose)
35753572
return;
35763573

3577-
// Supress printing of "The generic type/method specified by the IBC data is not available to this assembly"
3574+
// Suppress printing of "The generic type/method specified by the IBC data is not available to this assembly"
35783575
level = CORZAP_LOGLEVEL_INFO;
35793576
}
35803577
#endif

0 commit comments

Comments
 (0)