Content deleted Content added
DanShearer (talk | contribs) See also GraalVM's compilation feature |
|||
(25 intermediate revisions by 20 users not shown) | |||
Line 1:
{{Short description|Java compiler}}
{{Infobox software
| name = GNU Compiler for Java
Line 8 ⟶ 9:
| released = {{Start date and age|1998|09|06}}<ref>{{cite web|url=https://gcc.gnu.org/news/gcj-announce.txt|author=Anthony Green, Cygnus Solutions|title=GCJ announcement}}</ref>
| discontinued = yes
| latest release version = {{wikidata|property|preferred|references|edit|Q1007042|P348|P548=Q2804309}}
| latest release date = {{
| latest preview version = {{wikidata|property|preferred|references|edit|Q1007042|P348|P548=Q51930650}}
| latest preview date = {{wikidata|qualifier|preferred|single|Q1007042|P348|P548=Q51930650|P577}}
| operating system = [[Unix-like]]
| programming language =
Line 16 ⟶ 19:
| website = {{URL|https://gcc.gnu.org}}
}}
The '''GNU Compiler for Java''' ('''GCJ''') is a discontinued [[Free software|free]] [[compiler]] for the [[Java (programming language)|Java programming language]]. It was part of the [[GNU Compiler Collection]]
GCJ compiles Java [[source code]] to [[Java
==History==
The GCJ runtime-libraries original source is from [[GNU Classpath]] project, but there is a code difference between the <code>libgcj</code> libraries. GCJ 4.3 uses the [[Eclipse (software)|Eclipse]] Compiler for Java as a front-end.<ref>
{{cite web | title = gcj to use Eclipse compiler as a front end | url = https://gcc.gnu.org/java/ | date = 2007-01-08 |
</ref>
In 2007, a lot of work was done to implement support for Java's two graphical [[
<!--Not sure if this non-development for years contradicts above "AWT is still in development" as that is not a compiler (but would appear in "News"?)-->As of 2015, there were no new developments announced from GCJ and the product was in [[maintenance mode]], with open-source Java toolchain development mostly happening within [[OpenJDK]].<ref>[https://www.phoronix.com/scan.php?page=news_item&px=MTUwOTA GCC Looks To Turn Off Java, Replace With Go Or ADA]</ref> GCJ was removed from the GCC [[Trunk (software)|trunk]] on September 30, 2016.<ref>{{cite web|url=https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=240661|title=[gcc] Revision 240661|date=September 30, 2016|author=Andrew Haley}}</ref><ref>{{Cite web|url=https://tromey.com/blog/?p=911|title=The Deletion of gcj|last=Tromey|first=Tom|date=October 2, 2016|website=The Cliffs of Inanity
==Performance==
The compilation function in GCJ should have a faster start-up time than the equivalent bytecode launched in a JVM when compiling Java code into machine code.<ref>
==Compiled Native Interface (CNI)==
Line 38 ⟶ 41:
===Comparison of language use===
The authors of CNI claim for various advantages over JNI:<ref>[https://gcc.gnu.org/java/faq.html#2_3 The GCJ FAQ
{{cquote|We use CNI because we think it is a better solution, especially for a Java implementation that is based on the idea that Java is just another programming language that can be implemented using standard compilation techniques. Given that, and the idea that languages implemented using Gcc should be compatible where it makes sense, it follows that the Java calling convention should be as similar as practical to that used for other languages, especially C++, since we can think of Java as a subset of C++. CNI is just a set of helper functions and conventions built on the idea that C++ and Java have the *same* calling convention and object layout; they are binary compatible. (This is a simplification, but close enough.)
}}
CNI depends on Java classes appearing as C++ classes. For example,<ref>The example comes from: https://gcc.gnu.org/onlinedocs/gcj/Objects-and-Classes.html#Objects-and-Classes {{Webarchive|url=https://web.archive.org/web/20161020222612/https://gcc.gnu.org/onlinedocs/gcj/Objects-and-Classes.html#Objects-and-Classes |date=2016-10-20 }}</ref>
given a Java class,
<
public class
▲ public int i;
public Int(int i) {
this.i = i; }
public static Int zero = new Int(0);▼
public int get() {
return i;
}
public void set(int j) {
i = j;
}
}
</syntaxhighlight>
one can use the class thus:
<
#include <gcj/cni.h>
#include <
MyInteger* mult(MyInteger& p, int k) {
if (k == 0) {▼
}
▲ if (k == 0)
▲ return Int::zero; // Static member access.
▲ return new Int(p->i * k);
}
</syntaxhighlight>
==See also==
{{Portal|Free and open-source software|
* [[Excelsior JET]] (Excelsior Java native code compiler)
* [[IcedTea]]
Line 82 ⟶ 95:
* [[Jikes]]
* [[GraalVM]] - GraalVM's Native Image functionality is an ahead-of-time compilation technology that produces executable binaries of class files.
* [[
* [[Free Java implementations]]
* [[Kotlin (programming language)|Kotlin]] - Kotlin/Native is a technology for compiling Kotlin to native binaries that run without any JVM. It comprises a [[LLVM]]-based backend for the Kotlin compiler and a native implementation of the Kotlin runtime library.
Line 90 ⟶ 103:
==External links==
*
*
*
*
{{Java Virtual Machine}}
{{Java (
{{DEFAULTSORT:Gnu Compiler For Java}}
[[Category:Free
[[Category:GNU Project software|Java]]
[[Category:Java compilers]]
[[Category:Discontinued Java virtual machines]]
|