mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-08 08:16:46 +08:00
VMClassLoader.java (getPrimitiveClass): Now native.
* java/lang/VMClassLoader.java (getPrimitiveClass): Now native. Now takes a jchar type-code argument, not a string. * java/lang/natClassLoader.cc (VMClassLoader::getPrimitiveClass): New method. Just call _Jv_FindClassFromSignature. * java/lang/Boolean.java (TYPE): Initialize from VMClassLoader.getPrimitiveClass using type-code. * 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. From-SVN: r46521
This commit is contained in:
parent
f3a8e4f58d
commit
839f820424
@ -1,3 +1,19 @@
|
||||
2001-10-25 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
|
||||
|
||||
* java/lang/VMClassLoader.java (getPrimitiveClass): Now native. Now
|
||||
takes a jchar type-code argument, not a string.
|
||||
* java/lang/natClassLoader.cc (VMClassLoader::getPrimitiveClass):
|
||||
New method. Just call _Jv_FindClassFromSignature.
|
||||
* java/lang/Boolean.java (TYPE): Initialize from
|
||||
VMClassLoader.getPrimitiveClass using type-code.
|
||||
* 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.
|
||||
|
||||
2001-10-25 Hans Boehm <Hans_Boehm@hp.com>
|
||||
|
||||
* include/boehm-gc.h: Call thread local allocation functions
|
||||
|
@ -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.
|
||||
|
@ -33,9 +33,7 @@ public final class Character implements Serializable, Comparable
|
||||
public static final int MIN_RADIX = 2;
|
||||
public static final int MAX_RADIX = 36;
|
||||
|
||||
// This initialization is seemingly circular, but it is accepted
|
||||
// by javac, and is handled specially by gcc.
|
||||
public static final Class TYPE = char.class;
|
||||
public static final Class TYPE = VMClassLoader.getPrimitiveClass('C');
|
||||
|
||||
// Space.
|
||||
public static final byte SPACE_SEPARATOR = 12;
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -54,32 +54,9 @@ class VMClassLoader {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* at initialization time.
|
||||
*
|
||||
* @param type name of the primitive type; i.e. "int", "byte", etc.
|
||||
* @return a "bogus" class representing the primitive type.
|
||||
* @param type code for the primitive type.
|
||||
*/
|
||||
static final Class getPrimitiveClass(String type)
|
||||
{
|
||||
if ("int".equals (type))
|
||||
return int.class;
|
||||
else if ("long".equals (type))
|
||||
return long.class;
|
||||
else if ("boolean".equals (type))
|
||||
return boolean.class;
|
||||
else if ("short".equals (type))
|
||||
return short.class;
|
||||
else if ("char".equals (type))
|
||||
return char.class;
|
||||
else if ("byte".equals (type))
|
||||
return byte.class;
|
||||
else if ("float".equals (type))
|
||||
return float.class;
|
||||
else if ("double".equals (type))
|
||||
return double.class;
|
||||
else if ("void".equals (type))
|
||||
return void.class;
|
||||
return null;
|
||||
}
|
||||
static native Class getPrimitiveClass(char type);
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -35,6 +35,7 @@ details. */
|
||||
#include <java/lang/ClassCircularityError.h>
|
||||
#include <java/lang/IncompatibleClassChangeError.h>
|
||||
#include <java/lang/VirtualMachineError.h>
|
||||
#include <java/lang/VMClassLoader.h>
|
||||
#include <java/lang/reflect/Modifier.h>
|
||||
#include <java/lang/Runtime.h>
|
||||
#include <java/lang/StringBuffer.h>
|
||||
@ -176,6 +177,15 @@ java::lang::ClassLoader::markClassErrorState0 (java::lang::Class *klass)
|
||||
klass->notifyAll ();
|
||||
}
|
||||
|
||||
jclass
|
||||
java::lang::VMClassLoader::getPrimitiveClass (jchar type)
|
||||
{
|
||||
char sig[2];
|
||||
sig[0] = (char) type;
|
||||
sig[1] = '\0';
|
||||
return _Jv_FindClassFromSignature (sig, NULL);
|
||||
}
|
||||
|
||||
// This is the findClass() implementation for the System classloader. It is
|
||||
// the only native method in VMClassLoader, so we define it here.
|
||||
jclass
|
||||
|
Loading…
Reference in New Issue
Block a user