Skip to content

Commit

Permalink
Remove some instances of %S and %ls (#78894)
Browse files Browse the repository at this point in the history
* Remove unused NativeImagePerfMap

* Allocate enough for UTF8 conversion

* Missed VariantAsString API.
Change local `sFlags` to generic `szTempBuf`

* Remove all "entry point" logging for metadata APIs.
  • Loading branch information
AaronRobinsonMSFT committed Jan 3, 2023
1 parent 435bff2 commit ad4bdd1
Show file tree
Hide file tree
Showing 45 changed files with 332 additions and 906 deletions.
14 changes: 7 additions & 7 deletions src/coreclr/debug/ee/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ void DebuggerController::RemovePatchesFromModule(Module *pModule, AppDomain *pAp
}
CONTRACTL_END;

LOG((LF_CORDB, LL_INFO100000, "DPT::CPFM mod:0x%p (%S)\n",
LOG((LF_CORDB, LL_INFO100000, "DPT::CPFM mod:0x%p (%s)\n",
pModule, pModule->GetDebugName()));

// First find all patches of interest
Expand Down Expand Up @@ -7398,14 +7398,14 @@ void DebuggerStepper::TriggerMethodEnter(Thread * thread,
"See http://team/sites/clrdev/Devdocs/StubManagers.rtf for more information on StubManagers.\n"
"Stepper this=0x%p, startMethod='%s::%s'\n"
"---------------------------------\n"
"Stub manager log:\n%S"
"Stub manager log:\n%s"
"\n"
"The thread is now in managed method '%s::%s'.\n"
"---------------------------------\n",
this,
((m_StepInStartMethod == NULL) ? "unknown" : m_StepInStartMethod->m_pszDebugClassName),
((m_StepInStartMethod == NULL) ? "unknown" : m_StepInStartMethod->m_pszDebugMethodName),
sLog.GetUnicode(),
sLog.GetUTF8(),
pDesc->m_pszDebugClassName, pDesc->m_pszDebugMethodName
));
}
Expand Down Expand Up @@ -8707,8 +8707,8 @@ DebuggerEnCBreakpoint::DebuggerEnCBreakpoint(SIZE_T offset,
_ASSERTE( jitInfo != NULL );
// Add and activate the specified patch
AddBindAndActivateNativeManagedPatch(jitInfo->m_nativeCodeVersion.GetMethodDesc(), jitInfo, offset, LEAF_MOST_FRAME, pAppDomain);
LOG((LF_ENC,LL_INFO1000, "DEnCBPDEnCBP::adding %S patch!\n",
fTriggerType == REMAP_PENDING ? W("remap pending") : W("remap complete")));
LOG((LF_ENC,LL_INFO1000, "DEnCBPDEnCBP::adding %s patch!\n",
fTriggerType == REMAP_PENDING ? "remap pending" : "remap complete"));
}


Expand Down Expand Up @@ -8749,9 +8749,9 @@ TP_RESULT DebuggerEnCBreakpoint::TriggerPatch(DebuggerControllerPatch *patch,
_ASSERTE(map == MAPPING_EXACT);

LOG((LF_ENC, LL_ALWAYS,
"DEnCBP::TP: triggered E&C %S breakpoint: tid=0x%x, module=0x%08x, "
"DEnCBP::TP: triggered E&C %s breakpoint: tid=0x%x, module=0x%08x, "
"method def=0x%08x, version=%d, native offset=0x%x, IL offset=0x%x\n this=0x%x\n",
m_fTriggerType == REMAP_PENDING ? W("ResumePending") : W("ResumeComplete"),
m_fTriggerType == REMAP_PENDING ? "ResumePending" : "ResumeComplete",
thread, module, md, m_jitInfo->m_encVersion, offset, currentIP, this));

// If this is a REMAP_COMPLETE patch, then dispatch the RemapComplete callback
Expand Down
18 changes: 7 additions & 11 deletions src/coreclr/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9335,7 +9335,7 @@ void Debugger::LoadAssembly(DomainAssembly * pDomainAssembly)
if (CORDBUnrecoverableError(this))
return;

LOG((LF_CORDB, LL_INFO100, "D::LA: Load Assembly Asy:0x%p AD:0x%p which:%ls\n",
LOG((LF_CORDB, LL_INFO100, "D::LA: Load Assembly Asy:0x%p AD:0x%p which:%s\n",
pDomainAssembly, pDomainAssembly->GetAppDomain(), pDomainAssembly->GetAssembly()->GetDebugName() ));

if (!CORDebuggerAttached())
Expand Down Expand Up @@ -9391,7 +9391,7 @@ void Debugger::UnloadAssembly(DomainAssembly * pDomainAssembly)
if (CORDBUnrecoverableError(this))
return;

LOG((LF_CORDB, LL_INFO100, "D::UA: Unload Assembly Asy:0x%p AD:0x%p which:%ls\n",
LOG((LF_CORDB, LL_INFO100, "D::UA: Unload Assembly Asy:0x%p AD:0x%p which:%s\n",
pDomainAssembly, pDomainAssembly->GetAppDomain(), pDomainAssembly->GetAssembly()->GetDebugName() ));

Thread *thread = g_pEEInterface->GetThread();
Expand Down Expand Up @@ -9676,7 +9676,7 @@ void Debugger::UnloadModule(Module* pRuntimeModule,



LOG((LF_CORDB, LL_INFO100, "D::UM: unload module Mod:%#08x AD:%#08x runtimeMod:%#08x modName:%ls\n",
LOG((LF_CORDB, LL_INFO100, "D::UM: unload module Mod:%#08x AD:%#08x runtimeMod:%#08x modName:%s\n",
LookupOrCreateModule(pRuntimeModule, pAppDomain), pAppDomain, pRuntimeModule, pRuntimeModule->GetDebugName()));


Expand All @@ -9689,7 +9689,7 @@ void Debugger::UnloadModule(Module* pRuntimeModule,
DebuggerModule* module = LookupOrCreateModule(pRuntimeModule, pAppDomain);
if (module == NULL)
{
LOG((LF_CORDB, LL_INFO100, "D::UM: module already unloaded AD:%#08x runtimeMod:%#08x modName:%ls\n",
LOG((LF_CORDB, LL_INFO100, "D::UM: module already unloaded AD:%#08x runtimeMod:%#08x modName:%s\n",
pAppDomain, pRuntimeModule, pRuntimeModule->GetDebugName()));
goto LExit;
}
Expand Down Expand Up @@ -9776,7 +9776,7 @@ void Debugger::DestructModule(Module *pModule)
}
CONTRACTL_END;

LOG((LF_CORDB, LL_INFO100, "D::DM: destruct module runtimeMod:%#08x modName:%ls\n",
LOG((LF_CORDB, LL_INFO100, "D::DM: destruct module runtimeMod:%#08x modName:%s\n",
pModule, pModule->GetDebugName()));

// @@@
Expand Down Expand Up @@ -10002,7 +10002,7 @@ BOOL Debugger::LoadClass(TypeHandle th,
// handle this in SendSystemClassLoadUnloadEvent below by looping through all AppDomains and dispatching
// events for each that contain this assembly.

LOG((LF_CORDB, LL_INFO10000, "D::LC: load class Tok:%#08x Mod:%#08x AD:%#08x classMod:%#08x modName:%ls\n",
LOG((LF_CORDB, LL_INFO10000, "D::LC: load class Tok:%#08x Mod:%#08x AD:%#08x classMod:%#08x modName:%s\n",
classMetadataToken, (pAppDomain == NULL) ? NULL : LookupOrCreateModule(classModule, pAppDomain),
pAppDomain, classModule, classModule->GetDebugName()));

Expand Down Expand Up @@ -10057,7 +10057,7 @@ void Debugger::UnloadClass(mdTypeDef classMetadataToken,
return;
}

LOG((LF_CORDB, LL_INFO10000, "D::UC: unload class Tok:0x%08x Mod:%#08x AD:%#08x runtimeMod:%#08x modName:%ls\n",
LOG((LF_CORDB, LL_INFO10000, "D::UC: unload class Tok:0x%08x Mod:%#08x AD:%#08x runtimeMod:%#08x modName:%s\n",
classMetadataToken, LookupOrCreateModule(classModule, pAppDomain), pAppDomain, classModule, classModule->GetDebugName()));

Assembly *pAssembly = classModule->GetClassLoader()->GetAssembly();
Expand Down Expand Up @@ -14653,10 +14653,6 @@ HRESULT Debugger::UpdateAppDomainEntryInIPC(AppDomain *pAppDomain)
szName = pADInfo->m_pAppDomain->GetFriendlyNameForDebugger();
pADInfo->SetName(szName);

LOG((LF_CORDB, LL_INFO100,
"D::UADEIIPC: New name:%ls (AD:0x%x)\n", pADInfo->m_szAppDomainName,
pAppDomain));

ErrExit:
// UnLock the list
m_pAppDomainCB->Unlock();
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/ee/functioninfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,7 @@ void DebuggerMethodInfoTable::ClearMethodsOfModule(Module *pModule)

_ASSERTE(g_pDebugger->HasDebuggerDataLock());

LOG((LF_CORDB, LL_INFO1000000, "CMOM:mod:0x%x (%S)\n", pModule
LOG((LF_CORDB, LL_INFO1000000, "CMOM:mod:0x%x (%s)\n", pModule
,pModule->GetDebugName()));

HASHFIND info;
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/inc/ceesectionstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ class CeeSectionString : public CeeSection {
StringTableEntry *findStringInsert(
StringTableEntry *&entry, _In_z_ LPWSTR targetValue, ULONG hashId);
void deleteEntries(StringTableEntry *e);
#ifdef RDATA_STATS
int dumpEntries(StringTableEntry *e);
void dumpTable();
#endif

public:
~CeeSectionString();
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapEnabled, W("PerfMapEnabled"), 0, "This
RETAIL_CONFIG_STRING_INFO(EXTERNAL_PerfMapJitDumpPath, W("PerfMapJitDumpPath"), "Specifies a path to write the perf jitdump file. Defaults to GetTempPathA()")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapIgnoreSignal, W("PerfMapIgnoreSignal"), 0, "When perf map is enabled, this option will configure the specified signal to be accepted and ignored as a marker in the perf logs. It is disabled by default")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapShowOptimizationTiers, W("PerfMapShowOptimizationTiers"), 1, "Shows optimization tiers in the perf map for methods, as part of the symbol name. Useful for seeing separate stack frames for different optimization tiers of each method.")
RETAIL_CONFIG_STRING_INFO(EXTERNAL_NativeImagePerfMapFormat, W("NativeImagePerfMapFormat"), "Specifies the format of native image perfmap files generated by crossgen. Valid options are RVA or OFFSET.")
#endif

RETAIL_CONFIG_STRING_INFO(EXTERNAL_StartupDelayMS, W("StartupDelayMS"), "")
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/importervectorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ GenTree* Compiler::impSpanEqualsOrStartsWith(bool startsWith, CORINFO_SIG_INFO*
{
// check for fake "" first
cnsLength = 0;
JITDUMP("Trying to unroll MemoryExtensions.Equals|SequenceEqual|StartsWith(op1, \"\")...\n", str)
JITDUMP("Trying to unroll MemoryExtensions.Equals|SequenceEqual|StartsWith(op1, \"\")...\n")
}
else
{
Expand Down
29 changes: 0 additions & 29 deletions src/coreclr/md/ceefilegen/ceesectionstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,8 @@ void CeeSectionString::deleteEntries(StringTableEntry *e)
delete e;
}

#ifdef RDATA_STATS
int CeeSectionString::dumpEntries(StringTableEntry *e)
{
if (!e)
return 0;
else {
printf(" HashId: %d, value: %S\n", e->m_hashId, computOffset(e->m_offset));
return dumpEntries(e->m_next) + 1;
}
}

void CeeSectionString::dumpTable()
{
int sum = 0, count = 0;
for (int i=0; i < MaxRealEntries; i++) {
if (stringTable[i]) {
printf("Bucket %d\n", i);
printf("Total size: %d\n\n",
count = dumpEntries(stringTable[i]));
sum += count;
}
}
printf("Total number strings: %d\n\n", sum);
}
#endif

CeeSectionString::~CeeSectionString()
{
#ifdef RDATA_STATS
dumpTable();
#endif
for (int i=0; i < MaxRealEntries; i++)
deleteEntries(stringTable[i]);
}
Expand Down
46 changes: 0 additions & 46 deletions src/coreclr/md/compiler/assemblymd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ STDMETHODIMP RegMeta::GetAssemblyProps( // S_OK or error.
AssemblyRec *pRecord;
CMiniMdRW *pMiniMd = &(m_pStgdb->m_MiniMd);

LOG((LOGMD, "RegMeta::GetAssemblyProps(0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)\n",
mda, ppbPublicKey, pcbPublicKey, pulHashAlgId, szName, cchName, pchName, pMetaData,
pdwAssemblyFlags));

LOCKREAD();

_ASSERTE(TypeFromToken(mda) == mdtAssembly && RidFromToken(mda));
Expand Down Expand Up @@ -102,10 +98,6 @@ STDMETHODIMP RegMeta::GetAssemblyRefProps( // S_OK or error.
AssemblyRefRec *pRecord;
CMiniMdRW *pMiniMd = &(m_pStgdb->m_MiniMd);

LOG((LOGMD, "RegMeta::GetAssemblyRefProps(0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)\n",
mdar, ppbPublicKeyOrToken, pcbPublicKeyOrToken, szName, cchName,
pchName, pMetaData, ppbHashValue, pdwAssemblyRefFlags));

LOCKREAD();

_ASSERTE(TypeFromToken(mdar) == mdtAssemblyRef && RidFromToken(mdar));
Expand Down Expand Up @@ -156,9 +148,6 @@ STDMETHODIMP RegMeta::GetFileProps( // S_OK or error.
FileRec *pRecord;
CMiniMdRW *pMiniMd = &(m_pStgdb->m_MiniMd);

LOG((LOGMD, "RegMeta::GetFileProps(%#08x, %#08x, %#08x, %#08x, %#08x, %#08x, %#08x)\n",
mdf, szName, cchName, pchName, ppbHashValue, pcbHashValue, pdwFileFlags));

LOCKREAD();

_ASSERTE(TypeFromToken(mdf) == mdtFile && RidFromToken(mdf));
Expand Down Expand Up @@ -198,10 +187,6 @@ STDMETHODIMP RegMeta::GetExportedTypeProps( // S_OK or error.
CMiniMdRW *pMiniMd = &(m_pStgdb->m_MiniMd);
int bTruncation=0; // Was there name truncation?

LOG((LOGMD, "RegMeta::GetExportedTypeProps(%#08x, %#08x, %#08x, %#08x, %#08x, %#08x, %#08x)\n",
mdct, szName, cchName, pchName,
ptkImplementation, ptkTypeDef, pdwExportedTypeFlags));

LOCKREAD();

_ASSERTE(TypeFromToken(mdct) == mdtExportedType && RidFromToken(mdct));
Expand Down Expand Up @@ -269,12 +254,6 @@ STDMETHODIMP RegMeta::GetManifestResourceProps( // S_OK or error.
ManifestResourceRec *pRecord;
CMiniMdRW *pMiniMd = &(m_pStgdb->m_MiniMd);

LOG((LOGMD, "RegMeta::GetManifestResourceProps("
"%#08x, %#08x, %#08x, %#08x, %#08x, %#08x, %#08x)\n",
mdmr, szName, cchName, pchName,
ptkImplementation, pdwOffset,
pdwResourceFlags));

LOCKREAD();

_ASSERTE(TypeFromToken(mdmr) == mdtManifestResource && RidFromToken(mdmr));
Expand Down Expand Up @@ -308,9 +287,6 @@ STDMETHODIMP RegMeta::EnumAssemblyRefs( // S_OK or error
HENUMInternal **ppmdEnum = reinterpret_cast<HENUMInternal **> (phEnum);
HENUMInternal *pEnum;

LOG((LOGMD, "MD RegMeta::EnumAssemblyRefs(%#08x, %#08x, %#08x, %#08x)\n",
phEnum, rAssemblyRefs, cMax, pcTokens));

LOCKREAD();

if (*ppmdEnum == 0)
Expand Down Expand Up @@ -353,8 +329,6 @@ STDMETHODIMP RegMeta::EnumFiles( // S_OK or error
HENUMInternal **ppmdEnum = reinterpret_cast<HENUMInternal **> (phEnum);
HENUMInternal *pEnum;

LOG((LOGMD, "MD RegMeta::EnumFiles(%#08x, %#08x, %#08x, %#08x)\n",
phEnum, rFiles, cMax, pcTokens));
LOCKREAD();

if (*ppmdEnum == 0)
Expand Down Expand Up @@ -397,9 +371,6 @@ STDMETHODIMP RegMeta::EnumExportedTypes( // S_OK or error
HENUMInternal **ppmdEnum = reinterpret_cast<HENUMInternal **> (phEnum);
HENUMInternal *pEnum = NULL;

LOG((LOGMD, "MD RegMeta::EnumExportedTypes(%#08x, %#08x, %#08x, %#08x)\n",
phEnum, rExportedTypes, cMax, pcTokens));

LOCKREAD();

if (*ppmdEnum == 0)
Expand Down Expand Up @@ -464,9 +435,6 @@ STDMETHODIMP RegMeta::EnumManifestResources( // S_OK or error
HENUMInternal **ppmdEnum = reinterpret_cast<HENUMInternal **> (phEnum);
HENUMInternal *pEnum;

LOG((LOGMD, "MD RegMeta::EnumManifestResources(%#08x, %#08x, %#08x, %#08x)\n",
phEnum, rManifestResources, cMax, pcTokens));

LOCKREAD();

if (*ppmdEnum == 0)
Expand Down Expand Up @@ -504,7 +472,6 @@ STDMETHODIMP RegMeta::GetAssemblyFromScope( // S_OK or error
HRESULT hr = NOERROR;
CMiniMdRW *pMiniMd = NULL;

LOG((LOGMD, "MD RegMeta::GetAssemblyFromScope(%#08x)\n", ptkAssembly));
LOCKREAD();
_ASSERTE(ptkAssembly);

Expand Down Expand Up @@ -534,12 +501,8 @@ STDMETHODIMP RegMeta::FindExportedTypeByName( // S_OK or error
CMiniMdRW *pMiniMd = NULL;
LPSTR szNameUTF8 = NULL;

LOG((LOGMD, "MD RegMeta::FindExportedTypeByName(%S, %#08x, %#08x)\n",
MDSTR(szName), tkEnclosingType, ptkExportedType));

LOCKREAD();


// Validate name for prefix.
if (!szName)
IfFailGo(E_INVALIDARG);
Expand Down Expand Up @@ -574,12 +537,8 @@ STDMETHODIMP RegMeta::FindManifestResourceByName( // S_OK or error
LPCUTF8 szNameTmp = NULL;
CMiniMdRW *pMiniMd = NULL;

LOG((LOGMD, "MD RegMeta::FindManifestResourceByName(%S, %#08x)\n",
MDSTR(szName), ptkManifestResource));

LOCKREAD();


// Validate name for prefix.
if (!szName)
IfFailGo(E_INVALIDARG);
Expand Down Expand Up @@ -624,11 +583,6 @@ STDMETHODIMP RegMeta::FindAssembliesByName( // S_OK or error
ULONG *pcAssemblies) // [OUT] The number of assemblies returned.
{
#ifdef FEATURE_METADATA_IN_VM
LOG((LOGMD, "RegMeta::FindAssembliesByName(0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)\n",
szAppBase, szPrivateBin, szAssemblyName, ppIUnk, cMax, pcAssemblies));

// No need to lock this function. It is going through fusion to find the matching Assemblies by name

return COR_E_NOTSUPPORTED;
#else //!FEATURE_METADATA_IN_VM
// Calls to fusion are not supported outside VM
Expand Down
Loading

0 comments on commit ad4bdd1

Please sign in to comment.