summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2002-10-23 23:19:55 +0000
committerTom Tromey <tromey@gcc.gnu.org>2002-10-23 23:19:55 +0000
commitb0af98d793adb3ff2dfd1a754209fd290e7ca491 (patch)
tree7202a1525195aa15d68a9c5550674a2dbc3c7ee2
parent6ddbb7ebbafbc655ce923bb675c890fc6d582c3b (diff)
downloadgcc-b0af98d793adb3ff2dfd1a754209fd290e7ca491.tar.gz
jni.cc (_Jv_JNI_AllocObject): Removed old FIXME comment.
* jni.cc (_Jv_JNI_AllocObject): Removed old FIXME comment. (array_from_valist): Correctly handle promotion for jint, jlong, jfloat, and jdouble. From-SVN: r58476
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/jni.cc16
2 files changed, 14 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 1f871dcfac2..faa6c68c322 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,9 @@
+2002-10-23 Tom Tromey <tromey@redhat.com>
+
+ * jni.cc (_Jv_JNI_AllocObject): Removed old FIXME comment.
+ (array_from_valist): Correctly handle promotion for jint, jlong,
+ jfloat, and jdouble.
+
2002-10-23 Ranjit Mathew <rmathew@hotmail.com>
* java/io/natFileWin32.cc (attr): Use FindFirstFile( ) instead of
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 8c404296b5c..2985d47930d 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -600,10 +600,7 @@ _Jv_JNI_AllocObject (JNIEnv *env, jclass clazz)
if (clazz->isInterface() || Modifier::isAbstract(clazz->getModifiers()))
env->ex = new java::lang::InstantiationException ();
else
- {
- // FIXME: will this work for String?
- obj = JvAllocObject (clazz);
- }
+ obj = JvAllocObject (clazz);
}
catch (jthrowable t)
{
@@ -694,18 +691,21 @@ array_from_valist (jvalue *values, JArray<jclass> *arg_types, va_list vargs)
jclass *arg_elts = elements (arg_types);
for (int i = 0; i < arg_types->length; ++i)
{
+ // Here we assume that sizeof(int) >= sizeof(jint), because we
+ // use `int' when decoding the varargs. Likewise for
+ // long/jlong, float, and double.
if (arg_elts[i] == JvPrimClass (byte))
values[i].b = (jbyte) va_arg (vargs, int);
else if (arg_elts[i] == JvPrimClass (short))
values[i].s = (jshort) va_arg (vargs, int);
else if (arg_elts[i] == JvPrimClass (int))
- values[i].i = va_arg (vargs, jint);
+ values[i].i = (jint) va_arg (vargs, int);
else if (arg_elts[i] == JvPrimClass (long))
- values[i].j = va_arg (vargs, jlong);
+ values[i].j = (jlong) va_arg (vargs, long);
else if (arg_elts[i] == JvPrimClass (float))
- values[i].f = va_arg (vargs, jfloat);
+ values[i].f = (jfloat) va_arg (vargs, double);
else if (arg_elts[i] == JvPrimClass (double))
- values[i].d = va_arg (vargs, jdouble);
+ values[i].d = (jdouble) va_arg (vargs, double);
else if (arg_elts[i] == JvPrimClass (boolean))
values[i].z = (jboolean) va_arg (vargs, int);
else if (arg_elts[i] == JvPrimClass (char))