Patch: interpreter bug fix

Tom Tromey tromey@redhat.com
Mon Feb 12 09:29:00 GMT 2001


I'm checking this in.
Thanks Jeff.

2001-02-12  Jeff Sturm  <jeff.sturm@commerceone.com>
            Tom Tromey  <tromey@redhat.com>

	* interpret.cc (continue1): [insn_invokevirtual] Do an explicit
	null pointer check.

Tom

Index: interpret.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/interpret.cc,v
retrieving revision 1.22
diff -u -r1.22 interpret.cc
--- interpret.cc	2000/10/20 23:25:57	1.22
+++ interpret.cc	2001/02/12 16:59:22
@@ -1,6 +1,6 @@
 // interpret.cc - Code for the interpreter
 
-/* Copyright (C) 1999, 2000  Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -678,7 +678,11 @@
 	rmeth = (_Jv_ResolvePoolEntry (defining_class, index)).rmethod;
 
 	sp -= rmeth->stack_item_count;
-	NULLCHECK (sp[0].o);
+	// We don't use NULLCHECK here because we can't rely on that
+	// working if the method is final.  So instead we do an
+	// explicit test.
+	if (! sp[0].o)
+	  throw new java::lang::NullPointerException ();
 
 	if (rmeth->vtable_index == -1)
 	  {



More information about the Java-patches mailing list