在启动CLR依赖大会决议 [英] CLR dependent assembly resolution at startup

查看:105
本文介绍了在启动CLR依赖大会决议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CLR是否尝试解决[不一定加载]所有相关组件,当程序启动? 也就是说,对需求做了相关的决议? 请注意,我不是在谈论的Assembly.Load * [反思]种类的负载。

Does CLR try to resolve [not necessarily load] all the dependent assemblies when the program starts up? That is, is the dependent assembly resolution done on demand? Please note that I am not talking about Assembly.Load* [reflective] kind of load.

推荐答案

这是JIT编译器,指示组件的负荷,以应对IL转换为机器code。类型的方法调用在第一个翻译叫存根功能。当被调用时,该存根激活JIT编译器加载IL(其中加载程序集如果需要的话),并把它翻译。很点播。

It is the JIT compiler that directs the loading of assemblies, in response to translating IL to machine code. Type method calls are at first translated to call a stub function. When called, this stub activates the JIT compiler to load the IL (which loads the assembly if necessary) and translate it. Very much on-demand.

在这个过程中的一个除皱是通过Ngen.exe中运行的程序集,当他们被安装在计算机上的所有.NET框架组件是。这是第一次加载的程序集时检测。 JIT编译器然后跳过转换步骤,并使用pre-翻译机code原样。虽然这将装入所有的由组装产生的机器code,它仍然是点播。术语负荷是相对的位置​​,Windows使用内存映射文件到原始图像映射到虚拟内存空间。没有实际的字节从文件中读取到code执行到达尚未映射到内存但内存页面。该技术术语是缺页,它是可见的TaskMgr.exe。

One wrinkle in this process are assemblies that were run through Ngen.exe, all the .NET framework assemblies were when they were installed on the machine. This is detected when an assembly is first loaded. The JIT compiler then skips the translation step and uses the pre-translated machine code as-is. While this will load all of the machine code produced by an assembly, it is still on-demand. The term "load" is relative here, Windows uses a memory mapped file to map the native image into the virtual memory space. No actual bytes are read from the file until code execution arrives at a memory page that hasn't been mapped into RAM yet. The technical term for this is "page fault", it is visible in Taskmgr.exe.

这篇关于在启动CLR依赖大会决议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆