clr

Does JIT convert the binary code of IL into binary machine code?

孤者浪人 提交于 2019-12-13 02:26:56
问题 This is regarding .NET. Code (high-level: c#,vb.net - human understandable) is compiled in VS and dll/exe is generated This is called IL (this is also more or less human understandable). When we run this dll/exe for the first time on the machine, the CLR/JIT converts the IL to machine code (binary format: 0's and 1's - this is not human understandable). This machine code is saved in memory so next time the conversion is not required unless the system is restarted. ILASM.exe can be used to

When Is MethodBase.GetCurrentMethod Reliable / Predictable?

吃可爱长大的小学妹 提交于 2019-12-12 20:04:12
问题 A method could get inlined; there is an attribute to prevent that ("there's an att for that"). However, apparently a method may also not get its own stack frame on x64 due to tail-call optimization by the JITter (http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx). Would this affect the behavior of MethodBase.GetCurrentMethod ? The discussions that I can find are mostly about inlining (When is a method eligible to be inlined by the

WeakReference behaving differently in Debug and Release (no debugger attached). Even when using a factory method

情到浓时终转凉″ 提交于 2019-12-12 16:46:48
问题 [Doh! I am an idiot.. I am rooting the object right there in the code..] I have code that works as expected in Release, but fails in Debug. I have a Dictionary that contains WeakReference instances to other objects. In Release, the dictionary “loses” its values as expected, once they are not referenced and collection occurs. However, in Debug, it doesn’t seem to happen… Even in debug, I do see other WeakReference getting collected in Debug, but the ones in the dictionary are not… The code

Using CLR UDTs as SQL Server stored procedure parameters

不羁岁月 提交于 2019-12-12 15:50:24
问题 I've been doing some reading about CLR integration in SQL Server (I'm using 2008 R2, but I believe this is of little relevance to the question), and bumped into the subject of CLR UDTs. After some reading, I found that most people find them to be evil, advice against using them, and even go as far as suggesting they have no practical application whatsoever. However, every discussion I found about CLR UDTs revolved around using them as column types to store objects in a database, but I couldn

Java and .NET heap overhead

£可爱£侵袭症+ 提交于 2019-12-12 14:01:07
问题 I have understanding how heap and garbage collector works: garbage collection happens in generations, memory allocation happens sequentially, during garbage collection free/unused space compacted by shifting data and forming continues block, etc. Is there any headers for allocated memory chunks are present and how big are they (I heard it’s 8-16 bytes for .NET CLR) and if byte, word or quad-word alignment present? I’m interested in any information for JIT (Java) and CLR (.NET Framework or

Documenting CLR JIT Strategy

天涯浪子 提交于 2019-12-12 13:57:58
问题 I'd like to know what scope and sequence the CLR applies to JIT compilation. For example, if my application calls only a single method of a given class, do the unused methods of that class get JIT compiled needlessly? And if yes, are they all JIT compiled before executing the one method I needed, or are they lazily compiled after the fact? And what about branches in a method? Does the CLR allow half of the code in a method to be compiled, while allowing a separate branch in the same method to

Threading in CLR in SQL Server 2008

拥有回忆 提交于 2019-12-12 13:18:58
问题 I have a CLR process which runs under SQL Server2008 . It builds a cache of several tables data to hold in a static class for use later by other calls. My question is could I improve the process of loading this cache by spawning threads to load each data set/ table in my cache? I've steared clear of this in the past as various posts have suggested leave the thread management to SQL Server . However I could really do with speeding up this process. Currently its a sequential process to load

On which CPU architectures are writes to an int “implicitly volatile” using the CLR (and variants)?

对着背影说爱祢 提交于 2019-12-12 12:35:10
问题 I recently learnt here the following is thread-safe on x86 CPU with the x86 CLR (not necessarily ECMA standard CLR) public class SometimesThreadSafe { private int value; public int Value { get { return value; } } public void Update() { Interlocked.Add(ref value, 47); } } This is because writing to an int on such architectures ensures any other CPU caches of value are synched. On ARM CPUs however this is not thread safe! As reading value from a different thread could read an old copy from a

C++/CLI: #pragma managed / unmanaged scope

喜欢而已 提交于 2019-12-12 12:17:26
问题 I have a mixed-mode DLL, and a .cpp file in it with both managed and unmanaged code. A simplified repro example looks like this: #include "stdafx.h" #pragma managed // Just for explicitness (doesn't influence results) #include <msclr\marshal.h> void Test() { System::String^ sName = ""; msclr::interop::marshal_context context; context.marshal_as<const TCHAR*>(sName); } //#pragma unmanaged // uncomment this line to get errors This code compiles successfully, however if I uncomment the last line

Reference .NET Assembly from a SQL Server Stored procedure or function

纵饮孤独 提交于 2019-12-12 12:17:18
问题 Is it possible to reference a .NET Assembly from a SQL Server Stored procedure or function, or otherwise access the clr code from SQL Server? EDIT Whilst this solution will require to be somewhat generic, I am fairly confident expecting SQL 2005+ 回答1: It depends on your version of SQL Server. SQL Server 2005 and higher supports CLR Stored Procedures. If you have an older version, you need to register the Assembly as a COM class (using attributes on the objects/methods/assembly), and then