title: Native stack and Cache code in JVM
body: <blockquote>
    <p>Java byte code is interpreted however this is not as fast as directly executing native code on the JVM’s host CPU. To improve performance the Oracle Hotspot VM looks for “hot” areas of byte code that are executed regularly and compiles these to native code. The native code is then stored in the code cache in non-heap memory. In this way the Hotspot VM tries to choose the most appropriate way to trade-off the extra time it takes to compile code verses the extra time it take to execute interpreted code.</p>
    
    <p>Not all JVMs support native methods, however, those that do typically create a per thread native method stack. If a JVM has been implemented using a C-linkage model for Java Native Invocation (JNI) then the native stack will be a C stack. In this case the order of arguments and return value will be identical in the native stack to typical C program. A native method can typically (depending on the JVM implementation) call back into the JVM and invoke a Java method. Such a native to Java invocation will occur on the stack (normal Java stack); the thread will leave the native stack and create a new frame on the stack (normal Java stack).</p>
  </blockquote>
  
  <p>What does it mean native as for Code cache and native stack? When I write a program on Ubuntu and run it on Eclipse, and the program runs endlesly a loop in which there is some code, will this code go to code cache? Will it be recompiled to some native language and which, when I am using Ubuntu, Oracle Java 1.7, I have Intel i5 processor.
  The same question about Oracle JVM7 - is it written in C? When native stack would be used and what exactly mean native in this case, when I have Ubuntu and Oracle Java 1.7 ?</p>