jit

Runtime optimization of static languages: JIT for C++?

人走茶凉 提交于 2019-12-03 02:27:36
问题 Is anyone using JIT tricks to improve the runtime performance of statically compiled languages such as C++? It seems like hotspot analysis and branch prediction based on observations made during runtime could improve the performance of any code, but maybe there's some fundamental strategic reason why making such observations and implementing changes during runtime are only possible in virtual machines. I distinctly recall overhearing C++ compiler writers mutter "you can do that for programs

java PrintCompilation output: what's the meaning of “made not entrant” and “made zombie”

旧巷老猫 提交于 2019-12-03 01:38:06
问题 When running a Java 1.6 (1.6.0_03-b05) app I've added the -XX:+PrintCompilation flag. On the output for some methods, in particular some of those that I know are getting called a lot, I see the text made not entrant and made zombie . What do these mean? Best guess is that it's a decompilation step before recompiling either that method or a dependency with greater optimisation. Is that true? Why "zombie" and "entrant"? Example, with quite a bit of time between some of these lines: [... near

JIT code generation techniques

蓝咒 提交于 2019-12-03 01:37:16
How does a virtual machine generate native machine code on the fly and execute it? Assuming you can figure out what are the native machine op-codes you want to emit, how do you go about actually running it? Is it something as hacky as mapping the mnemonic instructions to binary codes, stuffing it into an char* pointer and casting it as a function and executing? Or would you generate a temporary shared library (.dll or .so or whatever) and load it into memory using standard functions like LoadLibrary ? You can just make the program counter point to the code you want to execute. Remember that

.NET JIT potential error?

て烟熏妆下的殇ゞ 提交于 2019-12-03 01:30:39
问题 The following code gives different output when running the release inside Visual Studio, and running the release outside Visual Studio. I'm using Visual Studio 2008 and targeting .NET 3.5. I've also tried .NET 3.5 SP1. When running outside Visual Studio, the JIT should kick in. Either (a) there's something subtle going on with C# that I'm missing or (b) the JIT is actually in error. I'm doubtful that the JIT can go wrong, but I'm running out of other possiblities... Output when running inside

Useless test instruction?

谁都会走 提交于 2019-12-03 01:03:56
I got the below assembly list as result for JIT compilation for my java program. mov 0x14(%rsp),%r10d inc %r10d mov 0x1c(%rsp),%r8d inc %r8d test %eax,(%r11) ; <--- this instruction mov (%rsp),%r9 mov 0x40(%rsp),%r14d mov 0x18(%rsp),%r11d mov %ebp,%r13d mov 0x8(%rsp),%rbx mov 0x20(%rsp),%rbp mov 0x10(%rsp),%ecx mov 0x28(%rsp),%rax movzbl 0x18(%r9),%edi movslq %r8d,%rsi cmp 0x30(%rsp),%rsi jge 0x00007fd3d27c4f17 My understanding the test instruction is useless here because the main idea of the test is The flags SF, ZF, PF are modified while the result of the AND is discarded. and here we don't

RyuJit producing incorrect results

萝らか妹 提交于 2019-12-03 01:02:38
After recently upgrading to .net 4.6 we discovered a bug where RyuJit produces incorrect results, we were able to work around the issue for now by adding useLegacyJit enabled="true" to the app.config. How can I debug the machine code generated by the following? I created a new console project in VS 2015 RTM, set to Release, Any CPU, unchecked Prefer 32 bit, running with and without debugger attached produces the same result. using System; using System.Runtime.CompilerServices; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Console.WriteLine(Calculate());

Java 8 JIT thread seems like falling into infinite loop

情到浓时终转凉″ 提交于 2019-12-02 23:09:56
I wrote a server application in Java 8, and running it with java 1.8.0u25. It works fine for the first several hours, but after it gets about 5k~10k requests, a thread of the VM process uses 100% of one of the CPUs. So I tried jstack for the VM process to check what the problematic thread was, and it showed that the thread(thread id was 14303=0x37df) was "C2 CompilerThread0": "C2 CompilerThread0" #6 daemon prio=9 os_prio=0 tid=0x00002aaabc12a000 nid=0x37df runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE And with jstack -m , the stack trace of the thread was as the following: ---

How to get Java stacks when JVM can't reach a safepoint

痞子三分冷 提交于 2019-12-02 23:00:24
We recently had a situation where one of our production JVMs would randomly freeze. The Java process was burning CPU, but all visible activity would cease: no log output, nothing written to the GC log, no response to any network request, etc. The process would persist in this state until restarted. It turned out that the org.mozilla.javascript.DToA class, when invoked on certain inputs, will get confused and call BigInteger.pow with enormous values (e.g. 5^2147483647), which triggers the JVM freeze. My guess is that some large loop, perhaps in java.math.BigInteger.multiplyToLen, was JIT'ed

How do I make gmpy array operations faster?

依然范特西╮ 提交于 2019-12-02 20:24:31
问题 I've been having trouble with speed while trying to utilise the gmpy module. import numpy as np import gmpy2 as gm N = 1000 a = range(N) %timeit [gm.sin(x) for x in a] # 100 loops, best of 3: 7.39 ms per loop %timeit np.sin(a) # 10000 loops, best of 3: 198 us per loop I was wondering if I could somehow speed this computation. I was thinking JIT or multiprocessing might help but I haven't figured out how to do it. Any help would be greatly appreciated. If you want me to post more information

Performance of behaviorally identical conditional checks [duplicate]

房东的猫 提交于 2019-12-02 19:45:57
问题 This question already has answers here : How do I write a correct micro-benchmark in Java? (11 answers) Closed 4 years ago . I answered this question and noticed something that intrigued me while running the code for it. Part of the question was about the performance of various styles of identical conditional checks, for example: if (x > 0) { if (y > 0) { if (z > 0) { if (complexCondition()) { noOp(); } } } } versus if (x > 0 && y > 0 && z > 0 && complexCondition()) { noOp(); } I wrote a