summaryrefslogtreecommitdiff
path: root/src/vm/domainfile.cpp
diff options
context:
space:
mode:
authordanmosemsft <danmose@microsoft.com>2017-02-11 07:20:12 -0800
committerdanmosemsft <danmose@microsoft.com>2017-02-11 07:20:12 -0800
commit56d4ba8a9338c3ff7378d18378f38ad847f130f2 (patch)
tree40b9463880286b1bc0b4c3f858680f1ff210c933 /src/vm/domainfile.cpp
parent8be2f9bb0039e2c49f59c4fb66cebf5467485ba2 (diff)
downloadcoreclr-56d4ba8a9338c3ff7378d18378f38ad847f130f2.tar.gz
coreclr-56d4ba8a9338c3ff7378d18378f38ad847f130f2.tar.bz2
coreclr-56d4ba8a9338c3ff7378d18378f38ad847f130f2.zip
Revert "Remove always defined FEATURE_CORESYSTEM"
This reverts commit 751771a8976f909af772e35c167bd7e3ffbe44c8.
Diffstat (limited to 'src/vm/domainfile.cpp')
-rw-r--r--src/vm/domainfile.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp
index e66ebaef8b..bf7fc57774 100644
--- a/src/vm/domainfile.cpp
+++ b/src/vm/domainfile.cpp
@@ -3373,7 +3373,113 @@ bool DomainAssembly::GetDebuggingOverrides(DWORD *pdwFlags)
}
CONTRACTL_END;
+#if defined(DEBUGGING_SUPPORTED) && !defined(FEATURE_CORESYSTEM)
+ // TODO FIX in V5.0
+ // Any touch of the file system is relatively expensive even in the warm case.
+ //
+ // Ideally we remove the .INI feature completely (if we need something put it in the .exe.config file)
+ //
+ // However because of compatibility concerns, we won't do this until the next side-by-side release
+ // In the mean time don't check in the case where we have already loaded the NGEN image, as the
+ // JIT overrides don't mean anything in that case as we won't be jitting anyway.
+ // This avoids doing these probes for framework DLLs right away.
+ if (GetFile()->HasNativeImage())
+ return false;
+
+ _ASSERTE(pdwFlags);
+
+ bool fHasBits = false;
+ WCHAR *pFileName = NULL;
+ HRESULT hr = S_OK;
+ UINT cbExtOrValue = 4;
+ WCHAR *pTail = NULL;
+ size_t len = 0;
+ WCHAR *lpFileName = NULL;
+
+ const WCHAR *wszFileName = GetFile()->GetPath();
+
+ if (wszFileName == NULL)
+ {
+ return false;
+ }
+
+ // lpFileName is a copy of the original, and will be edited.
+ CQuickBytes qb;
+ len = wcslen(wszFileName);
+ size_t cchlpFileName = (len + 1);
+ lpFileName = (WCHAR*)qb.AllocThrows(cchlpFileName * sizeof(WCHAR));
+ wcscpy_s(lpFileName, cchlpFileName, wszFileName);
+
+ pFileName = wcsrchr(lpFileName, W('\\'));
+
+ if (pFileName == NULL)
+ {
+ pFileName = lpFileName;
+ }
+
+ if (*pFileName == W('\\'))
+ {
+ pFileName++; //move the pointer past the last '\'
+ }
+
+ _ASSERTE(wcslen(W(".INI")) == cbExtOrValue);
+
+ if (pFileName == NULL || (pTail=wcsrchr(pFileName, W('.'))) == NULL || (wcslen(pTail)<cbExtOrValue))
+ {
+ return false;
+ }
+
+ wcscpy_s(pTail, cchlpFileName - (pTail - lpFileName), W(".INI"));
+
+ // Win2K has a problem if multiple processes call GetPrivateProfile* on the same
+ // non-existent .INI file simultaneously. The OS livelocks in the kernel (i.e.
+ // outside of user space) and remains there at full CPU for several minutes. Then
+ // it breaks out. Here is our work-around, while we pursue a fix in a future
+ // version of the OS.
+ if (WszGetFileAttributes(lpFileName) == INVALID_FILE_ATTRIBUTES)
+ return false;
+
+ // Having modified the filename, we use the full path
+ // to actually get the file.
+ if ((cbExtOrValue=WszGetPrivateProfileInt(DE_INI_FILE_SECTION_NAME,
+ DE_INI_FILE_KEY_TRACK_INFO,
+ INVALID_INI_INT,
+ lpFileName)) != INVALID_INI_INT)
+ {
+ if (cbExtOrValue != 0)
+ {
+ *pdwFlags |= DACF_OBSOLETE_TRACK_JIT_INFO;
+ }
+ else
+ {
+ *pdwFlags &= (~DACF_OBSOLETE_TRACK_JIT_INFO);
+ }
+
+ fHasBits = true;
+ }
+
+ if ((cbExtOrValue=WszGetPrivateProfileInt(DE_INI_FILE_SECTION_NAME,
+ DE_INI_FILE_KEY_ALLOW_JIT_OPTS,
+ INVALID_INI_INT,
+ lpFileName)) != INVALID_INI_INT)
+ {
+ if (cbExtOrValue != 0)
+ {
+ *pdwFlags |= DACF_ALLOW_JIT_OPTS;
+ }
+ else
+ {
+ *pdwFlags &= (~DACF_ALLOW_JIT_OPTS);
+ }
+
+ fHasBits = true;
+ }
+
+ return fHasBits;
+
+#else // DEBUGGING_SUPPORTED && !FEATURE_CORESYSTEM
return false;
+#endif // DEBUGGING_SUPPORTED && !FEATURE_CORESYSTEM
}