summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-08 19:13:30 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-08 19:13:30 +0000
commit10320e23afd6fc7f4ddca62b603000a33b12f48f (patch)
tree0bf8d5318f0fbf36f3291b621e882cf69a6cd8bb
parentd7eb56defdea58124864988b36586d58936dfe5f (diff)
downloadlinaro-gcc-10320e23afd6fc7f4ddca62b603000a33b12f48f.tar.gz
linaro-gcc-10320e23afd6fc7f4ddca62b603000a33b12f48f.tar.bz2
linaro-gcc-10320e23afd6fc7f4ddca62b603000a33b12f48f.zip
2005-07-06 Colin Walters <walters@verbum.org>
* verify.cc (class _Jv_BytecodeVerifier) <op_new>: Don't check for abstract classes or interfaces here; JVM spec says it should throw an exception, so we'll do so later. * interpret.cc (run): Throw an InstantiationException for abstract classes and interfaces. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101788 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/ChangeLog8
-rw-r--r--libjava/interpret.cc5
-rw-r--r--libjava/verify.cc4
3 files changed, 15 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index cf84f1a9d00..8183d0c9fd1 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-06 Colin Walters <walters@verbum.org>
+
+ * verify.cc (class _Jv_BytecodeVerifier) <op_new>: Don't
+ check for abstract classes or interfaces here; JVM spec
+ says it should throw an exception, so we'll do so later.
+ * interpret.cc (run): Throw an InstantiationException for
+ abstract classes and interfaces.
+
2005-07-08 Andrew Haley <aph@redhat.com>
* posix-threads.cc (_Jv_ThreadSetPriority): Use SCHED_OTHER
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index 8b46dc6fa4a..dcda95e64de 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -30,6 +30,7 @@ details. */
#include <java/lang/NullPointerException.h>
#include <java/lang/ArithmeticException.h>
#include <java/lang/IncompatibleClassChangeError.h>
+#include <java/lang/InstantiationException.h>
#include <java/lang/Thread.h>
#include <java-insns.h>
#include <java-signal.h>
@@ -2942,6 +2943,10 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
int index = GET2U ();
jclass klass = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
index)).clazz;
+ /* VM spec, section 3.11.5 */
+ if ((klass->getModifiers() & Modifier::ABSTRACT)
+ || klass->isInterface())
+ throw new java::lang::InstantiationException;
jobject res = _Jv_AllocObject (klass);
PUSHA (res);
diff --git a/libjava/verify.cc b/libjava/verify.cc
index 167d74cf8f6..3869bffd502 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -2926,8 +2926,8 @@ private:
case op_new:
{
type t = check_class_constant (get_ushort ());
- if (t.isarray () || t.isinterface (this) || t.isabstract (this))
- verify_fail ("type is array, interface, or abstract");
+ if (t.isarray ())
+ verify_fail ("type is array");
t.set_uninitialized (start_PC, this);
push_type (t);
}