]> gcc.gnu.org Git - gcc.git/commitdiff
VMClassLoader.java (getPrimitiveClass): Now native.
authorBryce McKinlay <bryce@waitaki.otago.ac.nz>
Fri, 26 Oct 2001 01:51:04 +0000 (01:51 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Fri, 26 Oct 2001 01:51:04 +0000 (02:51 +0100)
* 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

libjava/ChangeLog
libjava/java/lang/Boolean.java
libjava/java/lang/Character.java
libjava/java/lang/Double.java
libjava/java/lang/Float.java
libjava/java/lang/Integer.java
libjava/java/lang/Long.java
libjava/java/lang/Short.java
libjava/java/lang/VMClassLoader.java
libjava/java/lang/Void.java
libjava/java/lang/natClassLoader.cc

index 939f044f4e5bda2c85ef9397d557d57c24bd28c3..f7badb7e3efdd5e5b0d64b0ddf92053dd5c2c629 100644 (file)
@@ -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
index 91edeb92d7c05656f40fbd875190a12bf7b7b9ce..cb7e1415985f030b9cd33ffb678476482a0819d3 100644 (file)
@@ -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.
index 56284521efa129b87e841e9f0f484a2139e41186..87682b2b764f8fdaa4680d392029b4f5888ed718 100644 (file)
@@ -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;
index 63ee265924edad9130caf542c737dbde09490b8b..cf139a8d51e3434fa1f881b3f0d530d1adb1d1d7 100644 (file)
@@ -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.
index 9e26143f77374100240434abe95d341cbe55c2be..e44503fbcd4a257bad1bea50ac8092fc4a332b49 100644 (file)
@@ -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.
index 8e417e95bbe3a191fe73ef221b3367ed831d9dbb..afa42a439f6f466ea72305e626cc5750e07453fe 100644 (file)
@@ -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.
index addb7e9d83c457ff9979b7fedd23503799ca87df..948f7b907b62a4fd21beabe5e00829175694bd3e 100644 (file)
@@ -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.
index db3cac0f095ba9d29f717dbba7cd622b04ab1a6c..a0ba024c990eeb3c4a6c6842c85b067e14e8250e 100644 (file)
@@ -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.
index dcfec0558f3d46d59b97b700e1f60a81be58c63f..5ff7ae86b211904fe61f9d15dc225d19cbd1f0fa 100644 (file)
@@ -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);
 }
index 453e5fcb6cbe3c5ad3f0c5e7a03c8b3f4d341a75..820a1bbfab436aa18bb3eb877315a37b99aa0e50 100644 (file)
@@ -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.
index b6dd8ce26ea58898f04ea6074a17fb20ddad3a56..7d366078dc2c188688939720c588e13c868bd32a 100644 (file)
@@ -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
This page took 0.081446 seconds and 5 git commands to generate.