• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JIT compiler

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it true that JIT compilers produce native machine code rather than byte code? I read in a book that since JIT compilers produce native machine code the program runs faster. If it produce native machine code then how can it be platform independent?
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sanyev Babu:
Is it true that JIT compilers produce native machine code rather than byte code? I read in a book that since JIT compilers produce native machine code the program runs faster. If it produce native machine code then how can it be platform independent?


I was just reading about this in "Head First Java".


Your java code will run on any JVM. However, each JVM is not platform-independent. Each JVM is written for a particular operating system and uses native code to translate your crossplatform bytecode into something the underlying system platform understands."

 
Sanyev Babu
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was asking if the output of a JIT compiler is a native machine code then how can the program be platform independent. if you are compiling a java source file the compiler generates a class file which will be used by the JVM at runtime. but if you are using a JIT compiler then what is the output? is it a class file in byte code or an executable in machine code or does the JIT compiler also performs the functions of the JVM. I don't have any idea about JIT compilers. any explanations could be helpful.
 
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My understanding is that the compiler output is always in standard java byte codes able to be interpreted by any jre. The jre will assemble the byte code when it runs it for the first time. I do notice that running a button for the first time is slower than the second and further times.
 
reply
    Bookmark Topic Watch Topic
  • New Topic