diff options
author | Mark Wielaard <mark@klomp.org> | 2001-11-11 16:07:09 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2001-11-11 16:07:09 +0000 |
commit | 89d4b110502e3062d19d0dc20ef75de3e785c681 (patch) | |
tree | a6fa8a493c449587fe3920452a9de51651e3422a | |
parent | e6700c0a09b9f65bcf2a0cfebe270809d98a8f2b (diff) | |
download | classpath-89d4b110502e3062d19d0dc20ef75de3e785c681.tar.gz |
* doc/vmintegration.texinfo: Add gcj, kissme and small explanation of
VMObject, VMClassLoader, VMSystem and VMSecurityManager
* java/lang/Boolean.java (TYPE): VMClassLoader.getPrimitiveClass(char)
* java/lang/Byte.java (TYPE): Likewise
* java/lang/Character.java (TYPE): Likewise
* java/lang/Double.java (TYPE): Likewise
* java/lang/Float.java (TYPE): Likewise
* java/lang/Integer.java (TYPE): Likewise
* java/lang/Long.java (TYPE): Likewise
* java/lang/Short.java (TYPE): Likewise
* java/lang/Void.java (TYPE): Likewise
* vm/reference/java/lang/VMClassLoader.java (getPrimitiveClass(char)):
new method
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | doc/vmintegration.texinfo | 35 | ||||
-rw-r--r-- | java/lang/Boolean.java | 2 | ||||
-rw-r--r-- | java/lang/Byte.java | 2 | ||||
-rw-r--r-- | java/lang/Character.java | 2 | ||||
-rw-r--r-- | java/lang/Double.java | 2 | ||||
-rw-r--r-- | java/lang/Float.java | 2 | ||||
-rw-r--r-- | java/lang/Integer.java | 2 | ||||
-rw-r--r-- | java/lang/Long.java | 2 | ||||
-rw-r--r-- | java/lang/Short.java | 2 | ||||
-rw-r--r-- | java/lang/Void.java | 2 | ||||
-rw-r--r-- | vm/reference/java/lang/VMClassLoader.java | 81 |
12 files changed, 130 insertions, 20 deletions
@@ -1,3 +1,19 @@ +2001-11-11 Mark Wielaard <mark@klomp.org> + + * doc/vmintegration.texinfo: Add gcj, kissme and small explanation of + VMObject, VMClassLoader, VMSystem and VMSecurityManager + * java/lang/Boolean.java (TYPE): VMClassLoader.getPrimitiveClass(char) + * java/lang/Byte.java (TYPE): Likewise + * java/lang/Character.java (TYPE): Likewise + * java/lang/Double.java (TYPE): Likewise + * java/lang/Float.java (TYPE): Likewise + * java/lang/Integer.java (TYPE): Likewise + * java/lang/Long.java (TYPE): Likewise + * java/lang/Short.java (TYPE): Likewise + * java/lang/Void.java (TYPE): Likewise + * vm/reference/java/lang/VMClassLoader.java (getPrimitiveClass(char)): + new method + 2001-11-06 Joseph S. Myers <jsm28@cam.ac.uk> * java/io/ByteArrayOutputStream.java, diff --git a/doc/vmintegration.texinfo b/doc/vmintegration.texinfo index 3535ae2f4..f4b670a10 100644 --- a/doc/vmintegration.texinfo +++ b/doc/vmintegration.texinfo @@ -20,6 +20,7 @@ Copyright (C) 1998-2001 Free Software Foundation, Inc. @title GNU Classpath VM Integration Guide @author John Keiser @author C. Brian Jones +@author Mark Wielaard @page @vskip 0pt plus 1filll @@ -106,11 +107,31 @@ This VM project so far supports only Sun UltraSparc processors using the proprietary Solaris 2.5.1 or higher operating system. LaTTe was derived from Kaffe but claims a number of improvements. +@item @uref{http://gcc.gnu.org/java/,GNU Compiler for Java (GCJ)} +This is a portable, optimizing, ahead-of-time compiler for the Java +Programming Language. It can compile Java source code directly to native +machine code, Java source code to Java bytecode (class files), and Java +bytecode to native machine code. Compiled applications are linked with the +GCJ runtime, libgcj which is based on the GNU Classpath code, which provides +the core class libraries, a garbage collector, and a bytecode interpreter. +libgcj can dynamically load and interpret class files, resulting in mixed +compiled/interpreted applications. +GCJ is part of the GNU Compiler Collection (@uref{http://gcc.gnu.org/,GCC}). +On march 6 2000 the libgcj and GNU Classpath projects were officially merged +and there is active work on merging all the classes between the projects. + +@item @uref{http://kissme.sourceforge.net/,Kissme} +This is a free Java Virtual Machine that is being developed on GNU/Linux +and can run console java applications. kissme also provides support for +orthogonally persistent java. + @end itemize -Current integration efforts are focused mainly on Japhar with an eye -towards getting Electrical Fire to work. All information contained in -this document is gleaned from these efforts. +In the past integration efforts were focused mainly on Japhar with an eye +towards getting Electrical Fire to work. Most information contained in +this document is gleaned from these efforts. Recently more work has been +done on getting gcj, orp and kissme to work out of the box with GNU Classpath +but there is much to do before that becomes a reality. @node Initialization, Classpath Hooks, Introduction, Top @@ -143,9 +164,17 @@ from Classpath call out to to get certain VM-specific dirty work done: @itemize @bullet @item java.lang.VMObject +is the bridge between the low level Object facilities such +as makeing a clone, getting the class of the object and the wait/notify +semantics. @item java.lang.VMClassLoader +provides methods for defining and resolving core and primitive classes. @item java.lang.VMSystem +is used to initialize the System properties, the System.arraycopy +method and the identityHashCode of an Object. @item java.lang.VMSecurityManager +provides the class context (stack trace) of the currently +executing thread and a way to get the currently active ClassLoader. @end itemize Some of the classes you implement for the VM will need to call back to diff --git a/java/lang/Boolean.java b/java/lang/Boolean.java index 91edeb92d..cb7e14159 100644 --- a/java/lang/Boolean.java +++ b/java/lang/Boolean.java @@ -60,7 +60,7 @@ public final class Boolean implements Serializable * The primitive type <code>boolean</code> is represented by this * <code>Class</code> object. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass("boolean"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass('Z'); /** * The immutable value of this Boolean. diff --git a/java/lang/Byte.java b/java/lang/Byte.java index 964e073b7..b264a9952 100644 --- a/java/lang/Byte.java +++ b/java/lang/Byte.java @@ -57,7 +57,7 @@ public final class Byte extends Number implements Comparable * The primitive type <code>byte</code> is represented by this * <code>Class</code> object. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass("byte"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass('B'); /** * The immutable value of this Byte. diff --git a/java/lang/Character.java b/java/lang/Character.java index 6298a5b2f..3c3c3d45d 100644 --- a/java/lang/Character.java +++ b/java/lang/Character.java @@ -460,7 +460,7 @@ public final class Character implements Serializable, Comparable /** * Class object representing the primitive char data type. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass("char"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass('C'); /** * Cn = Other, Not Assigned (Normative) diff --git a/java/lang/Double.java b/java/lang/Double.java index 471a51e0e..139c66b43 100644 --- a/java/lang/Double.java +++ b/java/lang/Double.java @@ -80,7 +80,7 @@ public final class Double extends Number implements Comparable * The primitive type <code>double</code> is represented by this * <code>Class</code> object. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass ("double"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass('D'); /** * The immutable value of this Double. diff --git a/java/lang/Float.java b/java/lang/Float.java index 9e26143f7..e44503fbc 100644 --- a/java/lang/Float.java +++ b/java/lang/Float.java @@ -79,7 +79,7 @@ public final class Float extends Number implements Comparable * The primitive type <code>float</code> is represented by this * <code>Class</code> object. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass ("float"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass('F'); /** * The immutable value of this Float. diff --git a/java/lang/Integer.java b/java/lang/Integer.java index 8e417e95b..afa42a439 100644 --- a/java/lang/Integer.java +++ b/java/lang/Integer.java @@ -58,7 +58,7 @@ public final class Integer extends Number implements Comparable * The primitive type <code>int</code> is represented by this * <code>Class</code> object. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass ("int"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass ('I'); /** * The immutable value of this Integer. diff --git a/java/lang/Long.java b/java/lang/Long.java index addb7e9d8..948f7b907 100644 --- a/java/lang/Long.java +++ b/java/lang/Long.java @@ -60,7 +60,7 @@ public final class Long extends Number implements Comparable * The primitive type <code>long</code> is represented by this * <code>Class</code> object. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass ("long"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass ('J'); /** * The immutable value of this Long. diff --git a/java/lang/Short.java b/java/lang/Short.java index db3cac0f0..a0ba024c9 100644 --- a/java/lang/Short.java +++ b/java/lang/Short.java @@ -56,7 +56,7 @@ public final class Short extends Number implements Comparable * The primitive type <code>short</code> is represented by this * <code>Class</code> object. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass("short"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass('S'); /** * The immutable value of this Short. diff --git a/java/lang/Void.java b/java/lang/Void.java index 453e5fcb6..820a1bbfa 100644 --- a/java/lang/Void.java +++ b/java/lang/Void.java @@ -47,7 +47,7 @@ public final class Void * The return type <code>void</code> is represented by this * <code>Class</code> object. */ - public static final Class TYPE = VMClassLoader.getPrimitiveClass("void"); + public static final Class TYPE = VMClassLoader.getPrimitiveClass('V'); /** * Don't allow Void objects to be made. diff --git a/vm/reference/java/lang/VMClassLoader.java b/vm/reference/java/lang/VMClassLoader.java index 144e15980..8bac0456f 100644 --- a/vm/reference/java/lang/VMClassLoader.java +++ b/vm/reference/java/lang/VMClassLoader.java @@ -1,6 +1,6 @@ /* * java.lang.ClassLoader: part of the Java Class Libraries project. - * Copyright (C) 1998 Free Software Foundation + * Copyright (C) 1998, 2001 Free Software Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -25,7 +25,7 @@ package java.lang; * on behalf of java.lang.ClassLoader. * * @author John Keiser - * @version 1.1.0, Sep 22 1998 + * @author Mark Wielaard (mark@klomp.org) * @since CP1.1 */ @@ -39,7 +39,8 @@ class VMClassLoader { * @param offset the offset into the data where the classfile starts. * @param len the length of the classfile data in the array. * @return the class that was defined. - * @exception ClassFormatError if the byte array is not in proper classfile format. + * @exception ClassFormatError if the byte array is not in proper + * classfile format. */ final static native Class defineClass(ClassLoader cl, String name, byte[] data, int offset, int len) throws ClassFormatError; @@ -51,13 +52,77 @@ class VMClassLoader { final static native void resolveClass(Class c); /** - * Helper for java.lang.Integer, Byte, etc. to get the TYPE class - * at initialization time. If there are multiple classloaders, this - * method may be called once per ClassLoader per type. + * Helper for java.lang.Integer, Byte, etc to get the TYPE class + * at initialization time. The type code is one of the chars that + * represents the primitive type as in JNI. * - * @param type name of the primitive type; i.e. "int", "byte", etc. + * <ul> + * <li>'Z' - boolean</li> + * <li>'B' - byte</li> + * <li>'C' - char</li> + * <li>'D' - double</li> + * <li>'F' - float</li> + * <li>'I' - int</li> + * <li>'J' - long</li> + * <li>'S' - short</li> + * <li>'V' - void</li> + * </ul> + * + * Note that this is currently a java version that converts the type code + * to a string and calls the native <code>getPrimitiveClass(String)</code> + * method for backwards compatibility with VMs that used old versions of + * GNU Classpath. Please replace this method with a native method + * <code>final static native Class getPrimitiveClass(char type);</code> + * if your VM supports it. <strong>The java version of this method and + * the String version of this method will disappear in a future version + * of GNU Classpath</strong>. + * + * @param type the primitive type * @return a "bogus" class representing the primitive type. */ - final static native Class getPrimitiveClass(String type); + final static Class getPrimitiveClass(char type) + { + String t; + switch (type) { + case 'Z': + t = "boolean"; + break; + case 'B': + t = "byte"; + break; + case 'C': + t = "char"; + break; + case 'D': + t = "double"; + break; + case 'F': + t = "float"; + break; + case 'I': + t = "int"; + break; + case 'J': + t = "long"; + break; + case 'S': + t = "short"; + break; + case 'V': + t = "void"; + break; + default: + throw new NoClassDefFoundError("Invalid type specifier: " + type); + } + return getPrimitiveClass(t); + } + /** + * Old version of the interface, added here for backwards compatibility. + * Called by the java version of getPrimitiveClass(char) when no native + * version of that method is available. + * <strong>This method will be removed in a future version of GNU + * Classpath</strong>. + */ + final static native Class getPrimitiveClass(String type); } |