The Motley Fool Discussion Boards

Previous Page

Computers, Phones & Internet / Help with this STUPID computer!

URL:  http://boards.fool.com/hey-steven-you-said-wrong-on-both-counts-a-30298088.aspx

Subject:  Re: Yet another Java flaw Date:  10/3/2012  4:32 PM
Author:  tketola Number:  182048 of 190785

Hey Steven,,, you said:

Wrong on both counts.

A Java VM is a virtual machine, and it's ancestor in spirit is the Pascal p-machine and p-code. Programmers write apps in Java (or Pascal), compile that code to Java bytecode (or P-code), and execute that code on a Java VM (or P-machine).
Java uses a two step compilation process. Java source code is compiled down to "bytecode" by the Java compiler. The bytecode is executed by Java Virtual Machine (JVM). The current version of Sun HotSpot JVM uses a technique called Just-in-time (JIT) compilation to compile the bytecode to the native instructions understood by the CPU on the fly at run time.


Yes you are!!!

Regardless of how the Execution takes place, by Compilation or Interpretation, depends on the particular Machine and Implementation, the Tools Supported, etc. It can be and is done both ways, by Compilation or Interpretation, read below!!!

So, in my mind anyway, any initial Source-Code-Compilation that does NOT directly result in Executable/Loadable-Machine-Code, is still being Interpreted, one way or another.

Using JIT, JVM, Bytecode, etc., in any combination is still Interpretation, on the Fly or NOT.!!!

Just my opinion...

TK...
____________________________________________________

http://stackoverflow.com/questions/1326071/is-java-a-compile...

Java uses a two step compilation process. Java source code is compiled down to "bytecode" by the Java compiler. The bytecode is executed by Java Virtual Machine (JVM). The current version of Sun HotSpot JVM uses a technique called Just-in-time (JIT) compilation to compile the bytecode to the native instructions understood by the CPU on the fly at run time.

Some implementations of JVM might interpret the bytecode instead of JIT compiling it to machine code and running it directly. While this is still considered an "interpreter." It's significantly different from interpreters that read and execute the high level source code (i.e. in this case, Java source code is not interpreted directly, the bytecode, output of Java compiler, is.)

To summarize, depending on the execution environment, bytecode can be:

compiled ahead of time and executed as native code (similar to C++)
compiled just-in-time and executed
interpreted
directly executed by a supported processor (bytecode is the native instruction set of some CPUs)



And...

The terms "interpreted language" or "compiled language" don't make sense, because any programming language can be interpreted and/or compiled.

As for the existing implementations of Java, most involve a compilation step to bytecode, so they involve compilation. The runtime also can load bytecode dynamically, so some form of a bytecode interpreter is always needed. That interpreter may or may not in turn use compilation to native code internally.

These days partial just-in-time compilation is used for many languages which were once considered "interpreted", for example Javascript.


____________________________________________________
Copyright 1996-2014 trademark and the "Fool" logo is a trademark of The Motley Fool, Inc. Contact Us