summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2005-04-16 09:19:53 +0000
committerMichael Koch <konqueror@gmx.de>2005-04-16 09:19:53 +0000
commit24a0a06dd7f5d813bc029023aec049de53d9f45b (patch)
treebfc174380ac1fb845fa372cc68f56a98d3dec038 /vm
parentfac6a094be0f8e14dcc947d1eb81abcea19d9c92 (diff)
downloadclasspath-24a0a06dd7f5d813bc029023aec049de53d9f45b.tar.gz
2005-04-16 Michael Koch <konqueror@gmx.de>
* include/java_lang_Double.h, include/java_lang_Object.h, native/jni/java-lang/java_lang_Double.c, native/jni/java-lang/java_lang_Object.c: Removed. * include/java_lang_VMDouble.h: Regenerated. * java/lang/Double.java (static): Removed. (toString): Call native method from VMDouble. (parseDouble): Make non-native and call native method from VMDouble. (toString): Removed. * java/lang/Float.java (toString): Call native method from VMDouble. * java/lang/Object.java (getClass): Refactored to call the native in java.lang.VMObject. * include/Makefile.am: Don't generate java_lang_Double.h and java_lang_Object.h. * native/jni/java-lang/Makefile.am: Removed java_lang_Double.c and java_lang_Object.c. * native/jni/java-lang/java_lang_VMDouble.c (initIDs): New method. (toString): Likewise. (parseDouble): Likewise. * vm/reference/java/lang/VMDouble.java (initIDs): Likewise. (toString): Likewise. (parseDouble): Likewise. * vm/reference/java/lang/VMObject.java (getClass): Likewise.
Diffstat (limited to 'vm')
-rw-r--r--vm/reference/java/lang/VMDouble.java23
-rw-r--r--vm/reference/java/lang/VMObject.java13
2 files changed, 31 insertions, 5 deletions
diff --git a/vm/reference/java/lang/VMDouble.java b/vm/reference/java/lang/VMDouble.java
index 29d74beb0..0b7a35a5c 100644
--- a/vm/reference/java/lang/VMDouble.java
+++ b/vm/reference/java/lang/VMDouble.java
@@ -1,5 +1,5 @@
/* VMDouble.java -- VM Specific Double methods
- Copyright (C) 2003 Free Software Foundation
+ Copyright (C) 2003, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ import gnu.classpath.Configuration;
/**
* Code relocated from java.lang.Double by
- * @author Dave Grove <groved@us.ibm.com>
+ * @author Dave Grove (groved@us.ibm.com)
*/
final class VMDouble
{
@@ -61,6 +61,8 @@ final class VMDouble
{
System.loadLibrary("javalang");
}
+
+ initIDs();
}
/**
@@ -110,5 +112,20 @@ final class VMDouble
*/
public static native double longBitsToDouble(long bits);
+ /**
+ * Helper method to convert to string.
+ *
+ * @param d the double to convert
+ * @param isFloat true if the conversion is requested by Float (results in
+ * fewer digits)
+ */
+ public static native String toString(double d, boolean isFloat);
+
+ /**
+ * Initialize JNI cache. This method is called only by the
+ * static initializer when using JNI.
+ */
+ public static native void initIDs();
-} // class VMDouble
+ public static native double parseDouble(String str);
+}
diff --git a/vm/reference/java/lang/VMObject.java b/vm/reference/java/lang/VMObject.java
index 2f7cfa4ff..9e33c4250 100644
--- a/vm/reference/java/lang/VMObject.java
+++ b/vm/reference/java/lang/VMObject.java
@@ -1,5 +1,5 @@
/* VMObject.java -- Reference implementation for VM hooks used by Object
- Copyright (C) 1998, 2002 Free Software Foundation
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -42,11 +42,20 @@ package java.lang;
* As such, it needs help from the VM.
*
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
final class VMObject
{
/**
+ * Returns the runtime {@link Class} of a given Object.
+ *
+ * @param obj the object to return the class for.
+ *
+ * @return the class of the Object.
+ */
+ static native Class getClass(Object obj);
+
+ /**
* The VM is expected to make a field-for-field shallow copy of the
* argument. Thus, the copy has the same runtime type as the argument.
* Note, however, that the cloned object must still be finalizable, even