From 5d698b0def2de7648b47bcf86ec2ea3e7a237f09 Mon Sep 17 00:00:00 2001
From: tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 26 Nov 2002 06:51:14 +0000
Subject: [PATCH] 	* verify.cc (type::compatible): Check initialization
 status 	first. 	* interpret.cc (run) [insn_invokespecial,
 invokespecial_resolved]: 	Don't use NULLCHECK.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59494 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libjava/ChangeLog    |  7 +++++++
 libjava/interpret.cc | 10 ++++++++--
 libjava/verify.cc    | 11 +++++------
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index c2b65f4306fb..df1c794e3ac1 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+2002-11-25  Tom Tromey  <tromey@redhat.com>
+
+	* verify.cc (type::compatible): Check initialization status
+	first.
+	* interpret.cc (run) [insn_invokespecial, invokespecial_resolved]:
+	Don't use NULLCHECK.
+
 2002-11-23  Mark Wielaard  <mark@klomp.org>
 
 	* javax/naming/AuthenticationException.java: Update copyright header.
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index d3f919bac133..bc324b13ba97 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -2795,7 +2795,10 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
 
 	sp -= rmeth->stack_item_count;
 
-	NULLCHECK (sp[0].o);
+	// We don't use NULLCHECK here because we can't rely on that
+	// working for <init>.  So instead we do an explicit test.
+	if (! sp[0].o)
+	  throw new java::lang::NullPointerException;
 
 	fun = (void (*)()) rmeth->method->ncode;
 
@@ -2813,7 +2816,10 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
       {
 	rmeth = (_Jv_ResolvedMethod *) AVAL ();
 	sp -= rmeth->stack_item_count;
-	NULLCHECK (sp[0].o);
+	// We don't use NULLCHECK here because we can't rely on that
+	// working for <init>.  So instead we do an explicit test.
+	if (! sp[0].o)
+	  throw new java::lang::NullPointerException;
 	fun = (void (*)()) rmeth->method->ncode;
       }
       goto perform_invoke;
diff --git a/libjava/verify.cc b/libjava/verify.cc
index 29f0f321a7f8..5917ce09c770 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -458,8 +458,12 @@ private:
       if (key < reference_type || k.key < reference_type)
 	return key == k.key;
 
+      // An initialized type and an uninitialized type are not
+      // compatible.
+      if (isinitialized () != k.isinitialized ())
+	return false;
+
       // The `null' type is convertible to any reference type.
-      // FIXME: is this correct for THIS?
       if (key == null_type || k.key == null_type)
 	return true;
 
@@ -469,11 +473,6 @@ private:
 	  && data.klass == &java::lang::Object::class$)
 	return true;
 
-      // An initialized type and an uninitialized type are not
-      // compatible.
-      if (isinitialized () != k.isinitialized ())
-	return false;
-
       // Two uninitialized objects are compatible if either:
       // * The PCs are identical, or
       // * One PC is UNINIT.
-- 
GitLab