Content deleted Content added
→CNI (Compiled Native Interface): remove link to redirect to self |
|||
(79 intermediate revisions by 55 users not shown) | |||
Line 1:
{{Short description|Java compiler}}
{{Infobox software
| name = GNU Compiler for Java
| logo =
| logo size = 70px
| screenshot =
| caption =
| developer = [[GNU|The GNU Project]]
| 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 = {{wikidata|qualifier|preferred|single|Q1007042|P348|P548=Q2804309|P577}}
| 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 =
| genre = [[Compiler]]
| license = [[GNU General Public License|GNU GPL]]
| website = {{URL|https://gcc.gnu.org
}}
The '''GNU Compiler for Java''' ('''GCJ''') is a discontinued [[
GCJ
==History==
The GCJ runtime-libraries original source is from [[GNU Classpath]] project, but there is a code difference between the <code>
{{cite web | title = gcj to use Eclipse compiler as a front end | url =
▲cite web | title = gcj to use Eclipse compiler as a front end | url = http://gcc.gnu.org/java/ | date= 2007-01-08 | accessdate = 2007-05-20
</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"?)-->
==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>
==
The
CNI closely resembles the [[Java Native Interface|JNI]] (Java Native Interface) framework which comes as a standard with various [[Java virtual machine]]s.
===Comparison of language use===
The authors of CNI claim for various advantages over JNI:<ref>[
{{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 78 ⟶ 94:
* [[Apache Harmony]]
* [[Jikes]]
* [[GraalVM]] - GraalVM's Native Image functionality is an ahead-of-time compilation technology that produces executable binaries of class files.
* [[Java virtual machine]]
* [[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.
==References==
Line 87 ⟶ 103:
==External links==
* {{cite web |url= http://gcc.gnu.org/java/ |title= Official website |publisher= GNU |work= GCC |date= Mar 30, 2007 |url-status= dead |archive-date= May 9, 2007 |archive-url= https://web.archive.org/web/20070509055923/http://gcc.gnu.org/java/ }}
*
*
*
{{Java Virtual Machine}}
{{Java (
{{DEFAULTSORT:Gnu Compiler For Java}}
[[Category:Free and open source compilers]]
[[Category:GNU Project software|Java]]
[[Category:Java
[[Category:
|