|
From: <ls...@us...> - 2007-05-13 16:52:36
|
Revision: 3190
http://jnode.svn.sourceforge.net/jnode/?rev=3190&view=rev
Author: lsantha
Date: 2007-05-13 09:52:35 -0700 (Sun, 13 May 2007)
Log Message:
-----------
First portions of OpenJDK.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/Class.java
Added Paths:
-----------
trunk/core/src/classpath/vm/java/lang/NativeDouble.java
Modified: trunk/core/src/classpath/vm/java/lang/Class.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/Class.java 2007-05-13 16:51:36 UTC (rev 3189)
+++ trunk/core/src/classpath/vm/java/lang/Class.java 2007-05-13 16:52:35 UTC (rev 3190)
@@ -1039,6 +1039,36 @@
}
/**
+ * Gets a primitive class of a given type.
+ *
+ * @param type
+ * @return
+ * @see VmType#getPrimitiveClass(char)
+ */
+ static Class getPrimitiveClass(String type) {
+ if(type.equals("double"))
+ return getPrimitiveClass('D');
+ else if(type.equals("float"))
+ return getPrimitiveClass('F');
+ else if(type.equals("boolean"))
+ return getPrimitiveClass('Z');
+ else if(type.equals("byte"))
+ return getPrimitiveClass('B');
+ else if(type.equals("char"))
+ return getPrimitiveClass('C');
+ else if(type.equals("short"))
+ return getPrimitiveClass('S');
+ else if(type.equals("int"))
+ return getPrimitiveClass('I');
+ else if(type.equals("long"))
+ return getPrimitiveClass('J');
+ else if(type.equals("void"))
+ return getPrimitiveClass('V');
+ else
+ throw new IllegalArgumentException("Unknown type " + type);
+ }
+
+ /**
* Returns the enumeration constants of this class, or null if this class is
* not an <code>Enum</code>.
*
Added: trunk/core/src/classpath/vm/java/lang/NativeDouble.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/NativeDouble.java (rev 0)
+++ trunk/core/src/classpath/vm/java/lang/NativeDouble.java 2007-05-13 16:52:35 UTC (rev 3190)
@@ -0,0 +1,47 @@
+/*
+ * $Id$
+ */
+package java.lang;
+
+import org.jnode.vm.VmMagic;
+
+/**
+ * @author Levente S\xE1ntha
+ */
+public class NativeDouble {
+ /**
+ * Convert the double to the IEEE 754 floating-point "double format" bit
+ * layout. Bit 63 (the most significant) is the sign bit, bits 62-52 (masked
+ * by 0x7ff0000000000000L) represent the exponent, and bits 51-0 (masked by
+ * 0x000fffffffffffffL) are the mantissa. This function leaves NaN alone,
+ * rather than collapsing to a canonical value. The result of this function
+ * can be used as the argument to <code>Double.longBitsToDouble(long)</code>
+ * to obtain the original <code>double</code> value.
+ *
+ * @param value
+ * the <code>double</code> to convert
+ * @return the bits of the <code>double</code>
+ * @see java.lang.Double#longBitsToDouble(long)
+ */
+ public static long doubleToRawLongBits(double value) {
+ return VmMagic.doubleToRawLongBits(value);
+ }
+
+ /**
+ * Convert the argument in IEEE 754 floating-point "double format" bit
+ * layout to the corresponding float. Bit 63 (the most significant) is the
+ * sign bit, bits 62-52 (masked by 0x7ff0000000000000L) represent the
+ * exponent, and bits 51-0 (masked by 0x000fffffffffffffL) are the mantissa.
+ * This function leaves NaN alone, so that you can recover the bit pattern
+ * with <code>Double.doubleToRawLongBits(double)</code>.
+ *
+ * @param bits
+ * the bits to convert
+ * @return the <code>double</code> represented by the bits
+ * @see java.lang.Double#doubleToLongBits(double)
+ * @see #doubleToRawLongBits(double)
+ */
+ public static double longBitsToDouble(long bits) {
+ return VmMagic.longBitsToDouble(bits);
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-16 20:03:45
|
Revision: 3205
http://jnode.svn.sourceforge.net/jnode/?rev=3205&view=rev
Author: lsantha
Date: 2007-05-16 13:03:44 -0700 (Wed, 16 May 2007)
Log Message:
-----------
Openjdk patches.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/NativeDouble.java
Added Paths:
-----------
trunk/core/src/classpath/vm/java/lang/NativeFloat.java
Modified: trunk/core/src/classpath/vm/java/lang/NativeDouble.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/NativeDouble.java 2007-05-16 20:02:30 UTC (rev 3204)
+++ trunk/core/src/classpath/vm/java/lang/NativeDouble.java 2007-05-16 20:03:44 UTC (rev 3205)
@@ -8,7 +8,7 @@
/**
* @author Levente S\xE1ntha
*/
-public class NativeDouble {
+class NativeDouble {
/**
* Convert the double to the IEEE 754 floating-point "double format" bit
* layout. Bit 63 (the most significant) is the sign bit, bits 62-52 (masked
@@ -23,7 +23,7 @@
* @return the bits of the <code>double</code>
* @see java.lang.Double#longBitsToDouble(long)
*/
- public static long doubleToRawLongBits(double value) {
+ static long doubleToRawLongBits(double value) {
return VmMagic.doubleToRawLongBits(value);
}
@@ -41,7 +41,7 @@
* @see java.lang.Double#doubleToLongBits(double)
* @see #doubleToRawLongBits(double)
*/
- public static double longBitsToDouble(long bits) {
+ static double longBitsToDouble(long bits) {
return VmMagic.longBitsToDouble(bits);
}
}
Added: trunk/core/src/classpath/vm/java/lang/NativeFloat.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/NativeFloat.java (rev 0)
+++ trunk/core/src/classpath/vm/java/lang/NativeFloat.java 2007-05-16 20:03:44 UTC (rev 3205)
@@ -0,0 +1,47 @@
+/*
+ * $Id$
+ */
+package java.lang;
+
+import org.jnode.vm.VmMagic;
+
+/**
+ * @author Levente S\xE1ntha
+ */
+class NativeFloat {
+ /**
+ * Convert the float to the IEEE 754 floating-point "single format" bit
+ * layout. Bit 31 (the most significant) is the sign bit, bits 30-23 (masked
+ * by 0x7f800000) represent the exponent, and bits 22-0 (masked by
+ * 0x007fffff) are the mantissa. This function leaves NaN alone, rather than
+ * collapsing to a canonical value. The result of this function can be used
+ * as the argument to <code>Float.intBitsToFloat(int)</code> to obtain the
+ * original <code>float</code> value.
+ *
+ * @param value
+ * the <code>float</code> to convert
+ * @return the bits of the <code>float</code>
+ * @see #intBitsToFloat(int)
+ */
+ static int floatToRawIntBits(float value) {
+ return VmMagic.floatToRawIntBits(value);
+ }
+
+ /**
+ * Convert the argument in IEEE 754 floating-point "single format" bit
+ * layout to the corresponding float. Bit 31 (the most significant) is the
+ * sign bit, bits 30-23 (masked by 0x7f800000) represent the exponent, and
+ * bits 22-0 (masked by 0x007fffff) are the mantissa. This function leaves
+ * NaN alone, so that you can recover the bit pattern with
+ * <code>Float.floatToRawIntBits(float)</code>.
+ *
+ * @param bits
+ * the bits to convert
+ * @return the <code>float</code> represented by the bits
+ * @see java.lang.Float#floatToIntBits(float)
+ * @see #floatToRawIntBits(float)
+ */
+ static float intBitsToFloat(int bits) {
+ return VmMagic.intBitsToFloat(bits);
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-17 17:12:28
|
Revision: 3212
http://jnode.svn.sourceforge.net/jnode/?rev=3212&view=rev
Author: lsantha
Date: 2007-05-17 10:12:27 -0700 (Thu, 17 May 2007)
Log Message:
-----------
Created openjdk speciffic vm source tree.
Removed Paths:
-------------
trunk/core/src/classpath/vm/java/lang/NativeDouble.java
trunk/core/src/classpath/vm/java/lang/NativeFloat.java
Deleted: trunk/core/src/classpath/vm/java/lang/NativeDouble.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/NativeDouble.java 2007-05-17 17:03:05 UTC (rev 3211)
+++ trunk/core/src/classpath/vm/java/lang/NativeDouble.java 2007-05-17 17:12:27 UTC (rev 3212)
@@ -1,47 +0,0 @@
-/*
- * $Id$
- */
-package java.lang;
-
-import org.jnode.vm.VmMagic;
-
-/**
- * @author Levente S\xE1ntha
- */
-class NativeDouble {
- /**
- * Convert the double to the IEEE 754 floating-point "double format" bit
- * layout. Bit 63 (the most significant) is the sign bit, bits 62-52 (masked
- * by 0x7ff0000000000000L) represent the exponent, and bits 51-0 (masked by
- * 0x000fffffffffffffL) are the mantissa. This function leaves NaN alone,
- * rather than collapsing to a canonical value. The result of this function
- * can be used as the argument to <code>Double.longBitsToDouble(long)</code>
- * to obtain the original <code>double</code> value.
- *
- * @param value
- * the <code>double</code> to convert
- * @return the bits of the <code>double</code>
- * @see java.lang.Double#longBitsToDouble(long)
- */
- static long doubleToRawLongBits(double value) {
- return VmMagic.doubleToRawLongBits(value);
- }
-
- /**
- * Convert the argument in IEEE 754 floating-point "double format" bit
- * layout to the corresponding float. Bit 63 (the most significant) is the
- * sign bit, bits 62-52 (masked by 0x7ff0000000000000L) represent the
- * exponent, and bits 51-0 (masked by 0x000fffffffffffffL) are the mantissa.
- * This function leaves NaN alone, so that you can recover the bit pattern
- * with <code>Double.doubleToRawLongBits(double)</code>.
- *
- * @param bits
- * the bits to convert
- * @return the <code>double</code> represented by the bits
- * @see java.lang.Double#doubleToLongBits(double)
- * @see #doubleToRawLongBits(double)
- */
- static double longBitsToDouble(long bits) {
- return VmMagic.longBitsToDouble(bits);
- }
-}
Deleted: trunk/core/src/classpath/vm/java/lang/NativeFloat.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/NativeFloat.java 2007-05-17 17:03:05 UTC (rev 3211)
+++ trunk/core/src/classpath/vm/java/lang/NativeFloat.java 2007-05-17 17:12:27 UTC (rev 3212)
@@ -1,47 +0,0 @@
-/*
- * $Id$
- */
-package java.lang;
-
-import org.jnode.vm.VmMagic;
-
-/**
- * @author Levente S\xE1ntha
- */
-class NativeFloat {
- /**
- * Convert the float to the IEEE 754 floating-point "single format" bit
- * layout. Bit 31 (the most significant) is the sign bit, bits 30-23 (masked
- * by 0x7f800000) represent the exponent, and bits 22-0 (masked by
- * 0x007fffff) are the mantissa. This function leaves NaN alone, rather than
- * collapsing to a canonical value. The result of this function can be used
- * as the argument to <code>Float.intBitsToFloat(int)</code> to obtain the
- * original <code>float</code> value.
- *
- * @param value
- * the <code>float</code> to convert
- * @return the bits of the <code>float</code>
- * @see #intBitsToFloat(int)
- */
- static int floatToRawIntBits(float value) {
- return VmMagic.floatToRawIntBits(value);
- }
-
- /**
- * Convert the argument in IEEE 754 floating-point "single format" bit
- * layout to the corresponding float. Bit 31 (the most significant) is the
- * sign bit, bits 30-23 (masked by 0x7f800000) represent the exponent, and
- * bits 22-0 (masked by 0x007fffff) are the mantissa. This function leaves
- * NaN alone, so that you can recover the bit pattern with
- * <code>Float.floatToRawIntBits(float)</code>.
- *
- * @param bits
- * the bits to convert
- * @return the <code>float</code> represented by the bits
- * @see java.lang.Float#floatToIntBits(float)
- * @see #floatToRawIntBits(float)
- */
- static float intBitsToFloat(int bits) {
- return VmMagic.intBitsToFloat(bits);
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|