JIT compiler vs offline compilers

Yes, there certainly are such scenarios. JIT compilation can use runtime profiling to optimize specific cases based on measurement of the characteristics of what the code is actually doing at the moment, and can recompile “hot” code as necessary. That’s not theoretical; Java’s HotSpot actually does this. JITters can optimize for the specific CPU and … Read more

RyuJit producing incorrect results

Thank you for the isolated repro program and I can confirm that this is indeed a RyuJIT bug in the optimizer which got exposed due to inlining. I’ve made a fix to the compiler and figuring the roll out details. Not to turn SO into a bug tracker, and for a quicker turnaround: ryujit@microsoft.com.

Preventing JIT inlining on a method

You could use MethodImplAttribute and specify MethodImplOptions.NoInlining. [MethodImpl(MethodImplOptions.NoInlining)] void YourMethod() { // do something } Note that this still doesn’t guarantee that you can get at the actual calling method as seen in the source code. Your method won’t be inlined, but your method’s caller could be inlined into its own caller, etc etc.

How to generate and run native code dynamically?

Not sure about linux, but this works on x86/windows. Update: http://codepad.org/sQoF6kR8 #include <stdio.h> #include <windows.h> typedef unsigned char byte; int arg1; int arg2; int res1; typedef void (*pfunc)(void); union funcptr { pfunc x; byte* y; }; int main( void ) { byte* buf = (byte*)VirtualAllocEx( GetCurrentProcess(), 0, 1<<16, MEM_COMMIT, PAGE_EXECUTE_READWRITE ); if( buf==0 ) return … Read more

How does the JVM decided to JIT-compile a method (categorize a method as “hot”)?

HotSpot compilation policy is rather complex, especially for Tiered Compilation, which is on by default in Java 8. It’s neither a number of executions, nor a matter of CompileThreshold parameter. The best explanation (apparently, the only reasonable explanation) can be found in HotSpot sources, see advancedThresholdPolicy.hpp. I’ll summarize the main points of this advanced compilation … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)