diff options
author | Tom Tromey <tromey@redhat.com> | 2001-11-19 07:08:36 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-11-19 07:08:36 +0000 |
commit | d68e5f555d11826aab75b63d0dbcff85a2b425f1 (patch) | |
tree | ffae3bbbb68e0f88dec21fdae51b13c8b1584b17 /libjava/verify.cc | |
parent | 755407600fec4e6ec6aefbc5e9192fa278e92035 (diff) | |
download | gcc-d68e5f555d11826aab75b63d0dbcff85a2b425f1.zip gcc-d68e5f555d11826aab75b63d0dbcff85a2b425f1.tar.gz gcc-d68e5f555d11826aab75b63d0dbcff85a2b425f1.tar.bz2 |
verify.cc (type::to_array): New method.
* verify.cc (type::to_array): New method.
(_Jv_BytecodeVerifier::verify_instructions_0) [op_anewarray]:
Construct new array type.
From-SVN: r47165
Diffstat (limited to 'libjava/verify.cc')
-rw-r--r-- | libjava/verify.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libjava/verify.cc b/libjava/verify.cc index 423edaa..8c290a3 100644 --- a/libjava/verify.cc +++ b/libjava/verify.cc @@ -491,6 +491,23 @@ private: return type (k); } + // Return the array type corresponding to an initialized + // reference. We could expand this to work for other kinds of + // types, but currently we don't need to. + type to_array () + { + // Resolving isn't ideal, because it might force us to load + // another class, but it's easy. FIXME? + if (key == unresolved_reference_type) + resolve (); + + if (key == reference_type) + return type (_Jv_GetArrayClass (data.klass, + data.klass->getClassLoader ())); + else + verify_fail ("internal error in type::to_array()"); + } + bool isreference () const { return key >= reference_type; @@ -2426,7 +2443,7 @@ private: break; case op_anewarray: pop_type (int_type); - push_type (check_class_constant (get_ushort ())); + push_type (check_class_constant (get_ushort ()).to_array ()); break; case op_arraylength: { |