CLI 2.0 독서 노트
1. 런타임에 DLL을 로드합니다.
2. dll을 로드하려면
3. GAC 로드 명명 dll.
4. GAC를 관리하려면 gacutil을 사용합니다.
5. 구성 가능한 단계를 로드합니다.
9/15
1. redirect bind
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="echo"
publicKeyToken="fcd14a8abe06f0d2"
culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0"
newVersion="1.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
2. Validating Assemblies for Consistency. PE validation, metadata validation 포함
3. AppDomain, SystemDomain, SharedDomain. C++로 구현, 부류BaseDomain
SystemDomain에는 ExecuteMainMethod 방법이 있습니다.
4. Agile Components. 객체 상태가 도메인 경계 간에 전달될 수 있는 객체입니다.Agile components는strings,generics,type hanles,security objects,localization tables,components that are part of the remoting infrastructure를 포함한다.
5. Agile Components는 SystemDomain에 있습니다.
6. Assembly를 실행하려면 해석되어 CLI에 로드되어야 하지만 CLI 자체도 로드해야 하는 코드입니다.이것이 바로 고전적인 Bootstrapping 문제다.C실현. clix.exe 코드는 다음과 같습니다.
4
DWORD Launch(WCHAR* pFileName, WCHAR* pCmdLine)
{
WCHAR exeFileName[MAX_PATH + 1];
DWORD dwAttrs;
DWORD dwError;
DWORD nExitCode;
dwAttrs = ::GetFileAttributesW(pFileName);
if (dwAttrs == INVALID_FILE_ATTRIBUTES)
{
dwError = ::GetLastError();
}
else if ((dwAttrs & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
dwError = ERROR_FILE_NOT_FOUND;
}
else
{
dwError = ERROR_SUCCESS;
}
if (dwError == ERROR_FILE_NOT_FOUND)
{
// If the file doesn't exist, append a '.exe' extension and
// try again.
const WCHAR *exeExtension = L".exe";
if (wcslen(pFileName) + wcslen(exeExtension) <
sizeof(exeFileName) / sizeof(WCHAR))
{
wcscpy(exeFileName, pFileName);
wcscat(exeFileName, exeExtension);
dwAttrs = ::GetFileAttributesW(exeFileName);
if (dwAttrs == INVALID_FILE_ATTRIBUTES)
{
dwError = ::GetLastError();
}
else if ((dwAttrs & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
dwError = ERROR_FILE_NOT_FOUND;
}
else
{
pFileName = exeFileName;
dwError = ERROR_SUCCESS;
}
}
}
if (dwError != ERROR_SUCCESS)
{
// We can't find the file, or there's some other problem. Exit with an
error.
fwprintf(stderr, L"%s: ", pFileName);
DisplayMessageFromSystem(dwError);
return 1; // error
}
nExitCode = _CorExeMain2(NULL, 0, pFileName, NULL, pCmdLine);
// _CorExeMain2 never returns with success
_ASSERTE(nExitCode != 0);
DisplayMessageFromSystem(::GetLastError());
return nExitCode;
}
이 코드를 통해assembly를 CLI에 불러오고 되돌아오는 코드를 운영체제에 불러옵니다. 11/19
Interface IFoo is a simple interface consisting of one method, Bar. Upon load time, the Interface will be assigned a unique Interface ID. Once a method (such as InvokeMethod) is JIT compiled, the JIT will ask the runtime for a token to call the method. The runtime hands the JIT an indirect cell pointer, and creates a Lookup Stub for that callsite, which will inevitably pass through a Dispatch Token unique to that callsite to the Generic Resolver. The Lookup Stub is then shared for other instances of this callsite type. When the JIT compiled code is executed, the Lookup Stub is called via the Indirect Cell, and passes through the hardcoded Dispatch Token to the Generic Resolver. The Generic Resolver looks inside the Dispatch Token and pulls out the Interface ID and the Interface¡¦s Slot Map index. It then looks up the objects Slot Map through the DispatchMap pointer, and matches the Interface ID and Slot Map index number to the object¡¦s vtable index. The Generic Resolver then creates both the Dispatch and Resolver stubs unique to that callsite. The Dispatch Stub contains a check for type equivocation and a jump if true to the pointer that exists in the objects vtable, and a jump if false to the Resolver stub. If the type equivocation test in the Dispatch Stub fails, the Resolver Stub is called. The Resolver checks its local cache to see if it has seen this failed case before, and invokes the cached callsite receiver if found, otherwise it calls the Generic Resolver to resolve the mapping, and generate a new Resolver Stub cache entry.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms721625(v=vs.85).aspx#_security_security_descriptor_gly
http://www.codeproject.com/Articles/30648/Demo-on-CLR-Profiling
https://msdn.microsoft.com/en-us/library/windows/hardware/ff551063(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/hardware/mt219729(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/hardware/dn553412(v=vs.85).aspx
https://blogs.msdn.microsoft.com/salvapatuel/2007/10/12/design-memory-working-set-explored/
http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/solving-memory-problems/index
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.