Civil Rights
Movements, leaders, victories and the continuing fight for equality.
Explore the people, places, events, achievements, struggles and stories that shaped our journey.
Movements, leaders, victories and the continuing fight for equality.
Innovation, patents, science, technology and world-changing contributions.
Pioneers, champions, Negro Leagues, records, activism and excellence.
Meet the people whose lives, choices and achievements shaped the journey.
Black towns, communities, institutions and places where history happened.
Moments that changed communities, movements, institutions and the nation.
Wilmington, North Carolina once had a thriving Black middle class and an elected interracial government. In 1898 white supremacists used violence to overthrow that government, kill Black residents and drive many others from the city.
MORE →Reflects the personal views, recollections, and perspective of the author, Mike Davis.
This is a personal recollection on the Move fire on May 13, 1985
| GNU Compiler for Java | |
|---|---|
| Developer | The GNU Project |
| Release | September 6, 1998[1] |
| Written in | C, C++, Java |
| Operating system | Unix-like |
| Platform | GNU and many others |
| Type | Compiler |
| License | GNU GPL |
| Website | gcc |
The GNU Compiler for Java (GCJ) is a discontinued free compiler for the Java programming language. It was part of the GNU Compiler Collection.[2][3]
GCJ compiles Java source code to Java virtual machine (JVM) bytecode or to machine code for a number of CPU architectures. It could also compile class files and whole JARs that contain bytecode into machine code.[4][5]
The GCJ runtime-libraries original source is from GNU Classpath project, but there is a code difference between the libgcj libraries. GCJ 4.3 uses the Eclipse Compiler for Java as a front-end.[6]
In 2007, a lot of work was done to implement support for Java's two graphical APIs in GNU Classpath: AWT and Swing. Software support for AWT was incomplete. "Once AWT support is working then Swing support can be considered. There is at least one free-software partial implementations of Swing that may be usable.".[7] By the time of its removal, GCC had support for up to version 1.4 of Java (and thus lacked support for most of the later features, such as generics, annotations, or JPMS modules; despite this, portions of the java.nio library were implemented).[8]
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.[9] GCJ was removed from the GCC trunk on September 30, 2016.[10][11] Announcement of its removal was made with the release of the GCC 7.1, which does not contain it.[12] GCJ remains part of GCC 6.
In 2023, an developer named Max Downey Twiss began independent work on a revival for GCJ, with GNU Classpath replaced with OpenJDK, with the goal of restoring GCJ as a native machine-code compiler for Java.[13][14][15]
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.[16]
The Compiled Native Interface (CNI), previously named "Cygnus Native Interface", is a software framework for the GCJ that allows Java code to call, and be called by, native applications (programs specific to a hardware and operating-system platform) and libraries written in C++.[17][18] It could work with C++ up to C++17 (the latest version of C++ supported by GCC 6.5, the final version of GCJ).
CNI closely resembles the Java Native Interface (JNI) framework which comes as a standard with various Java virtual machines.
GCJ additionally supports a "Java linkage" with extern "Java", which is used when referencing Java code compiled by GCJ and used in C++ code to indicate that a symbol that is consumed originates from Java.[19]
For example, consider the following Java code:
package org.wikipedia.examples;
public class Foo {
public int add(int a, int b) {
return a + b;
}
}
Then, from C++ it can be consumed as so:
#include <gcj/cni.h>
#include <java/lang/Object.h>
// Automatically generated header
#include <org/wikipedia/examples/Foo.h>
using namespace java::lang;
using org::wikipedia::examples::Foo;
extern "Java" {
int addThroughJava(int a, int b) {
Foo* foo = new Foo();
return foo->add(a, b);
// Note: foo should not be deleted, as it is garbage collected
}
namespace org::wikipedia::examples {
// Inheriting a Java object
// Only single inheritance supported
class Bar: public Object {
// ...
};
}
}
An implementation of libjava (which contains the C++ headers for the Java Class Library) may be found here (in a GCC 6 release). Java classes are exposed to C++ as (auto-generated) header files by one class per header[20], preserving namespace structure per Java package.[21]
All Java reference types X are translated to a pointer X* in C++. For example, java.lang.String becomes java::lang::String*.[22] Because Java classes are managed by the Java garbage collector, they should not be deleted using the delete operator from C++, even though they are both instantiated using new[23]; the Java objects are automatically deleted by the garbage collector.[24] Java classes, when used in C++, maintain the same field order and alignment, and will not widen 8-bit and 16-bit native types to 32 bits.[25]
Java reflection on Java objects in C++ possible using CNI, featuring the jfieldID and jmethodID (as seen in JNI).[26] (Java already offers java.lang.reflect.Field/java.lang.reflect.Method, but these are not used by GCJ.) While Java generics were never implemented by the time GCJ was removed, some discussions regarding how they would operate with C++ (for example, directly translating generics to templates or omitting them entirely, which the JVM does at runtime) had taken place.
Java primitives may map exactly to the corresponding C/C++ primitive. However, in the case where they do not (as C/C++ do not specify the exact width of integer types), typedefs are provided as the following:[27]
| Java type | C/C++ alias | Description | Closest C/C++ type |
|---|---|---|---|
char |
jchar |
16-bit Unicode character | char16_t
|
boolean |
jboolean |
Boolean (logical true/false value) | bool
|
byte |
jbyte |
8-bit signed integer | char or int8_t
|
short |
jshort |
16-bit signed integer | short or int16_t
|
int |
jint |
32-bit signed integer | int or int32_t
|
long |
jlong |
64-bit signed integer | long or int64_t
|
float |
jfloat |
32-bit IEEE floating-point number | float or float32_t
|
double |
jdouble |
64-bit IEEE floating-point number | double or float64_t
|
void maps exactly the same between languages, as it does not refer to any value. It was recommended to use these Java typedefs over the native C++ types, to avoid possible errors.[27]
Java arrays are implemented with the class template JArray<T>, and inherit java::lang::Object (and implement operator[]). Additional typedefs for each pointer to array of Java primitives are provided.[28]
Variadic functions in Java are internally represented as arrays; thus, in GCJ a signature with variadic parameter like void f(T... args); is generated as void f(JArray<T> args);.
Additionally, common classes receive the following typedefs:[22]
| Java type | C/C++ alias | Description |
|---|---|---|
java.lang.Object |
jobject (for java::lang::Object*) |
Universal supertype of all reference types, representing an object |
java.lang.String |
jstring (for java::lang::String*) |
String type |
java.lang.Class |
jclass (for java::lang::Class*)[a] |
Runtime state and metadata of any reference type in Java |
Note that in JNI, jobject, jstring and jclass were opaque handles without any data[29][30]; in CNI, the Java classes they point to have data.
Additionally, all Java classes X expose a static field X::class$ in C++, which behaves equivalently to X.class in Java. However, the class$ field is of type java::lang::Class (not java::lang::Class*). The Java null was originally translated to the older C++ NULL (however the null pointer constant nullptr may be substituted due to implicit conversions).[31] Additional classes, gnu::gcj::RawData and gnu::gcj::RawDataManaged respectively denote non-scanned reference types (which will not be checked by the compiler and can store any C/C++ data structure), and data which may be marked by the memory manager and be garbage-collected.[32]
In C++, java::lang::String* (or jstring) must be created manually using CNI utility functions (analogous to those of JNI); they cannot be implicitly converted from const char* or C++ std::string.[33]
The Java synchronized blocks are implemented in C++ using the ::JvSynchronize class (which lives in the global namespace).[34] For example, the following is equivalent to Java synchronized (obj) { /* code... */ }
{
JvSynchronize _(obj); // create dummy lock, destroyed upon scope end
// code...
}
In C++, any class which enforces the Java inheritance model must inherit the java::lang::Object base class, and may inherit at most one base class. Although it was planned, interface inheritance awareness was never implemented in GCJ by the time of its removal.[35] Despite this, an attribute [[gnu::java_interface]] existed to mark a class as a Java interface, along with a pragma #pragma interface.[19] Methods of interfaces, however, could be implemented, but calling a method of a superinterface required casting the class back to the superinterface.[35] Additionally, Java access specifiers were never enforced strictly in C++; only private fields and methods from Java were properly mapped to private in C++, but everything else was mapped to public.[25]
Methods map directly between Java and C++ with the same names and corresponding types, and preserved static methods (still called using :: for resolution). Name mangling for overloaded methods use the same encoding scheme between Java and C++. While Java does not allow a constructor to be a native method itself, a constructor may call a native method.[36]
Failed allocation of a Java class will throw a java::lang::OutOfMemoryError.[37]
libgcj use POSIX signals internally, and using the same signal may interfere with libgcj or even cause it to fail. For example, SIGSEGV generates a java::lang::NullPointerException, java::lang::Runtime::exec() makes use of SIGCHLD, while other signals (potentially platform-dependent) may be used by the memory manager or java::lang::Thread::interrupt().[32]
The authors of CNI claim for various advantages over JNI:[38]
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,[39] given a Java class,
package org.wikipedia.examples;
public class MyInteger {
private int i;
public MyInteger(int i) {
this.i = i;
}
public int get() {
return i;
}
public void set(int j) {
i = j;
}
public static final MyInteger ZERO = new MyInteger(0);
}
one can use the class thus:
#include <gcj/cni.h>
#include <org/wikipedia/examples/MyInteger.h>
using org::wikipedia::examples::MyInteger;
MyInteger* mult(MyInteger& p, jint k) {
if (k == 0) {
return MyInteger::ZERO; // Static member access.
}
return new MyInteger(p.get() * k);
}
GCJ allows the usage of Java exceptions in C++, but they cannot be used in the same translation unit with C++ exceptions.[40] The pragma #pragma GCC java_exceptions must be used to ensure destructors are called upon propagating a Java exception through C++.[41] Despite this, no support for finally blocks were ever included. Java exceptions are caught by pointer rather than by reference, because Java references are represented in CNI through pointers. Additionally, they are not const-qualified because Java objects are inherently mutable references.[42]
For example, the following catches a Java exception, while using the Invocation API: [31]
#pragma GCC java_exceptions
#include <gcj/cni.h>
#include <java/lang/Integer.h>
#include <java/lang/Math.h>
#include <java/lang/NumberFormatException.h>
#include <java/lang/String.h>
#include <java/lang/System.h>
#include <java/io/File.h>
#include <java/io/IOException.h>
#include <java/net/URI.h>
using namespace java::lang;
using java::io::File;
using java::io::IOException;
using java::net::URI;
// Helper literal to create java::lang::String*
String* operator""_js(const char* s, size_t len) {
return ::JvNewStringLatin1(s, len);
}
int main(int argc, char* argv[]) {
try {
::JvCreateJavaVM(nullptr);
::JvAttachCurrentThread(nullptr, nullptr);
::JvInitClass(&System::class$);
::JvInitClass(&Math::class$);
JArray<String*>* args = ::JvConvertArgv(argc, argv); // String[] args
jdouble one = Math::sin(Math::PI / 2);
URI* location = new URI("file:///C:/temp/example.txt"_js);
File* file = new File(location);
System::out->println(file->getAbsolutePath());
String* invalid = "not a number"_js;
jint result = Integer::parseInt(invalid);
} catch (NumberFormatException* e) {
System::err->println("Failed to format number: "_js->concat(e->getMessage()));
e->printStackTrace();
} catch (IOException* e) {
System::err->println("Failed I/O operation: "_js->concat(e->getMessage()));
e->printStackTrace();
}
return 0;
}
Note that Java classes with static fields, such as java::lang::System and java::lang::Math, must first be initialized using a ::JvInitClass() function call.
Source: Wikipedia. Article content is retrieved live through the MediaWiki API.
The GNU Compiler for Java (GCJ) is a discontinued free compiler for the Java programming language. It was part of the GNU Compiler Collection. GCJ compiles Java source code to Java virtual machine (JVM) bytecode or to machine code for a number of CPU architectures. It could also compile class files and whole JARs that contain bytecode into machine code.
A Java compiler is a compiler for the Java programming language. Some Java compilers output optimized machine code for a particular hardware/operating system combination, called a domain specific computer system. An example would be the now discontinued GNU Compiler for Java. The most common form of output from a Java compiler is Java class files containing cross-platform intermediate representation (IR), called Java bytecode. The Java virtual machine (JVM) loads the class files and either interprets the bytecode or just-in-time compiles it to machine code and then possibly optimizes it using dynamic compilation. A standard on how to interact with Java compilers was specified in JSR 199. It is provided by module jdk.compiler, and requires the full Java Development Kit (as opposed to just the Java Runtime Environment), and reside in the javax.tools.* namespace.
GNU Multiple Precision Arithmetic Library (GMP) is a free library for arbitrary-precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers. There are no practical limits to the precision except the ones implied by the available memory (operands may be of up to 232−1 bits on 32-bit machines and 237 bits on 64-bit machines). GMP has a rich set of functions, and the functions have a regular interface. The basic interface is for C, but wrappers exist for other languages, including Ada, C++, C#, Julia, .NET, OCaml, Perl, PHP, Python, R, Ruby, and Rust. Before 2008, Kaffe, a Java virtual machine, used GMP to support Java built-in arbitrary precision arithmetic. Shortly after, GMP support was added to GNU Classpath, as the backends to java.math.BigInteger and java.math.BigDecimal. The main target applications of GMP are cryptography applications and research, Internet security applications, and computer algebra systems. GMP aims to be faster than any other arbitrary-precision arithmetic (big number) library for all operand sizes. Some important factors in doing this are: Full words are the basic type for all arithmetic. Different algorithms are used for different operand sizes; algorithms which are more efficient with large numbers are not used when dealing with small numbers. Assembly language (specialized for different processors) is used in the most common inner loops to optimize them as much as possible. The first GMP release was made in 1991. It is constantly developed and maintained. GMP is part of the GNU project (although its website being off gnu.org may cause confusion), and is distributed under the GNU Lesser General Public License (LGPL). GMP is used for integer arithmetic in many computer algebra systems such as Mathematica and Maple. It is also used in the Computational Geometry Algorithms Library (CGAL). GMP is needed to build the GNU Compiler Collection (GCC).
The GNU Compiler Collection (GCC; formerly GNU C Compiler) is a collection of compilers from the GNU Project that support various programming languages, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes GCC as free software under the GNU General Public License (GNU GPL). GCC is a key component of the GNU toolchain which is used for most projects related to GNU and the Linux kernel. With roughly 15 million lines of code in 2019, GCC is one of the largest free programs in existence. It has played an important role in the growth of free software, as both a tool and an example. When it was first released in 1987 by Richard Stallman, GCC 1.0 was named the GNU C Compiler since it only handled the C programming language. It was extended to compile C++ in December of that year. Front ends were later developed for Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, Rust, COBOL, and ALGOL 68 among others. The OpenMP and OpenACC specifications are also supported in the C and C++ compilers. As well as being the official compiler of the GNU operating system, GCC has been adopted as the standard compiler by many other modern Unix-like computer operating systems, including most Linux distributions. Most BSD family operating systems also switched to GCC shortly after its release, although since then, FreeBSD and Apple macOS have moved to the Clang compiler, largely due to licensing reasons. GCC can also compile code for Windows, Android, iOS, Solaris, HP-UX, AIX, and MS-DOS compatible operating systems. GCC has been ported to more platforms and instruction set architectures than any other compiler, and is widely deployed as a tool in the development of both free and proprietary software. GCC is also available for many embedded systems, including ARM-based and Power ISA-based chips.
Before the 1921 destruction of Tulsa’s Greenwood District, Black residents had created a remarkable center of business and community life. The district included stores, professional offices, entertainment venues and homes owned by Black citizens. Understanding Greenwood means learning what was built—not only what was burned.
MORE →Brown v. Board of Education in 1954.