Java bytecode: Difference between revisions

Content deleted Content added
m Relation to Java: what is "an integer 5"? (int) 5? An int[5]?
WP:LINKs: updates, adds, fix-cut: WP:NOPIPEs, WP:REDs. Nonlead-word nonproper noun MOS:CAPS > low-case. Full terms define before WP:ABBReviations. Small WP:EoS WP:COPYEDITs.
Line 90:
 
== Generation ==
{{MainFurther information|List of JVM languages}}
 
The most common language targeting [[Java Virtualvirtual Machinemachine]] by producing Java bytecode is Java. Originally only one compiler existed, the [[javac]] compiler from [[Sun Microsystems]], which compiles [[Java source code]] to Java bytecode; but because all the specifications for Java bytecode are now available, other parties have supplied compilers that produce Java bytecode. Examples of other compilers include:
*[[Jikes]], compiles from Java to Java bytecode (developed by [[IBM]], implemented in [[C++]])
*Espresso, compiles from Java to Java bytecode (Java 1.0 only)
*[[GNU Compiler for Java|GCJ]], the GNU Compiler for Java(GCJ), compiles from Java to Java bytecode; it iscan also able to compile to native [[machine code]] and is available as part of the [[GNU Compiler Collection]] (GCC).
 
Some projects provide Java assemblers to enable writing Java bytecode by hand. Assembly code may be also generated by machine, for example by a compiler targeting a [[Java virtual machine]]. Notable Java assemblers include:
*[[Jasmin (Java assembler)|Jasmin]], takes textualtext descriptions for Java classes, written in a simple assembly-like syntax using Java Virtualvirtual Machinemachine instruction set and generates a Java class file<ref>[http://jasmin.sourceforge.net Jasmin Homehome Pagepage<!-- Bot generated title -->]</ref>
*[[Jamaica (Java assembler)|Jamaica]], a [[Macro (computer science)|macro]] [[assembly language]] for the [[Java virtual machine]]. Java syntax is used for class or interface definition. Method bodies are specified using bytecode instructions.<ref>[http://www.judoscript.org/jamaica.html Jamaica: The Java Virtualvirtual Machinemachine (JVM) Macromacro Assemblerassembler<!-- Bot generated title -->]</ref>
*[[Krakatau Bytecode Tools|Krakatau]], currently contains three tools: a decompiler and disassembler for Java classfiles and an assembler to create classfiles.<ref>[https://github.com/Storyyeller/Krakatau Krakatau Homehome Pagepage]</ref>
*[[Lilac (Java assembler)|Lilac]], an assembler and disassembler for the [[Java virtual machine]].<ref>[http://lilac.sourceforge.net Lilac Homehome Pagepage]</ref>
 
Others have developed compilers, for different programming languages, in order to target the Java virtual machine, such as:
*[[ColdFusion]]
*[[JRuby]] and [[Jython]], two [[scripting language]]s based on [[Ruby (programming language)|Ruby]] and [[Python (programming language)|Python]]
*[[Groovy (programming language)|Groovy]], a [[scripting language]] based on Java
*[[Scala (programming language)|Scala]], a type-safe general-purpose programming language supporting object-oriented and functional programming
*[[JGNAT]] and [[AdaMagic|AppletMagic]], compile from the language [[Ada (programming language)|Ada]] to Java bytecode
*[[Java Virtualvirtual Machinemachine#C to bytecode compilers|C to Java byte-code compiler]]s
*[[Clojure]], a functional, immutable, general-purpose programming language in the LISP[[Lisp (programming language)|Lisp]] family with a strong emphasis on concurrency
*[[MIDletPascal]]
*[[JavaFX Script]] code is also compiled to Java bytecode
*[[Kotlin (programming language)|Kotlin]]
 
Line 121:
{{Further|Java virtual machine}}
 
If executing Java bytecode in a Java virtual machine is not desirableundesirable, a developer can also compile Java source code or Java bytecode directly to native machine code with tools such as the [[GCJ|GNU Compiler for Java]] (GCJ). Some processors can execute Java bytecode natively. Such processors are known astermed ''[[Java processor]]s''.
 
== Support for dynamic languages ==
{{MainFurther information|List of JVM languages}}
 
The [[Java Virtualvirtual Machinemachine]] provides some support for [[Type system#Dynamic typing|dynamically typed languages]]. Most of the existingextant JVM instruction set is [[Type system#Static typing|statically typed]] - in the sense that method calls have their signatures type-checked at [[compile time]], without a mechanism to defer this decision to [[Run time (program lifecycle phase)|run time]], or to choose the method dispatch by an alternative approach.<ref>{{cite web
| url=http://headius.blogspot.com/2007/01/invokedynamic-actually-useful.html
| title=InvokeDynamic: Actually Useful?
Line 133:
| accessdate=2008-01-25}}</ref>
 
[[Java Community Process|JSR]] 292 (''Supporting Dynamically Typed Languages on the Java&trade; Platform'')<ref>[http://www.jcp.org/en/jsr/detail?id=292 see JSR 292]</ref> added a new <code>invokedynamic</code> instruction at the JVM level, to allow method invocation relying on dynamic [[Type system#Type checking|type checking]] (instead of the existingextant statically type-checked <code>invokevirtual</code> instruction). The [[Da Vinci Machine]] is a prototype virtual machine implementation that hosts JVM extensions aimed at supporting dynamic languages. All JVMs supporting [[Java Platform, Standard Edition|JSE]] 7 also include the <code>invokedynamic</code> opcode.
 
== See also ==