Commit 199ecb18 by Tom Tromey Committed by Tom Tromey

verify.cc (type::isnull): New method.

	* verify.cc (type::isnull): New method.
	(require_array_type): Handle case where array is null.
	(verify_instructions_0) [op_arraylength]: Likewise.

From-SVN: r49555
parent 5e3f4df7
2002-02-06 Tom Tromey <tromey@redhat.com>
* verify.cc (type::isnull): New method.
(require_array_type): Handle case where array is null.
(verify_instructions_0) [op_arraylength]: Likewise.
2002-02-05 Bryce McKinlay <bryce@waitaki.otago.ac.nz> 2002-02-05 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* configure.in: Set up PLATFORMOBJS not PLATFORM_SPECIFIC_SOURCES. * configure.in: Set up PLATFORMOBJS not PLATFORM_SPECIFIC_SOURCES.
......
...@@ -522,6 +522,11 @@ private: ...@@ -522,6 +522,11 @@ private:
return false; return false;
} }
bool isnull () const
{
return key == null_type;
}
bool isinterface (_Jv_BytecodeVerifier *verifier) bool isinterface (_Jv_BytecodeVerifier *verifier)
{ {
resolve (verifier); resolve (verifier);
...@@ -1161,6 +1166,10 @@ private: ...@@ -1161,6 +1166,10 @@ private:
// compatible with type ELEMENT. Returns the actual element type. // compatible with type ELEMENT. Returns the actual element type.
type require_array_type (type array, type element) type require_array_type (type array, type element)
{ {
// An odd case. Here we just pretend that everything went ok.
if (array.isnull ())
return element;
if (! array.isarray ()) if (! array.isarray ())
verify_fail ("array required"); verify_fail ("array required");
...@@ -2796,7 +2805,7 @@ private: ...@@ -2796,7 +2805,7 @@ private:
case op_arraylength: case op_arraylength:
{ {
type t = pop_type (reference_type); type t = pop_type (reference_type);
if (! t.isarray ()) if (! t.isarray () && ! t.isnull ())
verify_fail ("array type expected"); verify_fail ("array type expected");
push_type (int_type); push_type (int_type);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment