aboutsummaryrefslogtreecommitdiff
path: root/libjava/verify.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2003-05-01 21:36:18 +0000
committerTom Tromey <tromey@gcc.gnu.org>2003-05-01 21:36:18 +0000
commit06b021af7b30d4aa8793f2f638b701462788d814 (patch)
tree440306528a8f43570c476adff8f6b799ce240878 /libjava/verify.cc
parentc93139b8267b5bf6debc9f697eb49b0d6dfe43d4 (diff)
downloadgcc-06b021af7b30d4aa8793f2f638b701462788d814.zip
gcc-06b021af7b30d4aa8793f2f638b701462788d814.tar.gz
gcc-06b021af7b30d4aa8793f2f638b701462788d814.tar.bz2
re PR libgcj/10582 (array assignment fails in some situations)
PR libgcj/10582: * verify.cc (_Jv_BytecodeVerifier::is_assignable_from_slow): Removed. (type::compatible): Use _Jv_IsAssignableFrom. * java/lang/natClass.cc (iindex_mutex_initialized): Now static. (_Jv_IsAssignableFrom): Work even when source or target class is not prepared. From-SVN: r66348
Diffstat (limited to 'libjava/verify.cc')
-rw-r--r--libjava/verify.cc62
1 files changed, 2 insertions, 60 deletions
diff --git a/libjava/verify.cc b/libjava/verify.cc
index 4a6ca45..3aacc27 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -240,64 +240,6 @@ private:
return get_type_val_for_signature ((jchar) k->method_count);
}
- // This is like _Jv_IsAssignableFrom, but it works even if SOURCE or
- // TARGET haven't been prepared.
- static bool is_assignable_from_slow (jclass target, jclass source)
- {
- // This will terminate when SOURCE==Object.
- while (true)
- {
- if (source == target)
- return true;
-
- if (target->isPrimitive () || source->isPrimitive ())
- return false;
-
- if (target->isArray ())
- {
- if (! source->isArray ())
- return false;
- target = target->getComponentType ();
- source = source->getComponentType ();
- }
- else if (target->isInterface ())
- {
- for (int i = 0; i < source->interface_count; ++i)
- {
- // We use a recursive call because we also need to
- // check superinterfaces.
- if (is_assignable_from_slow (target, source->interfaces[i]))
- return true;
- }
- source = source->getSuperclass ();
- if (source == NULL)
- return false;
- }
- // We must do this check before we check to see if SOURCE is
- // an interface. This way we know that any interface is
- // assignable to an Object.
- else if (target == &java::lang::Object::class$)
- return true;
- else if (source->isInterface ())
- {
- for (int i = 0; i < target->interface_count; ++i)
- {
- // We use a recursive call because we also need to
- // check superinterfaces.
- if (is_assignable_from_slow (target->interfaces[i], source))
- return true;
- }
- target = target->getSuperclass ();
- if (target == NULL)
- return false;
- }
- else if (source == &java::lang::Object::class$)
- return false;
- else
- source = source->getSuperclass ();
- }
- }
-
// This is used to keep track of which `jsr's correspond to a given
// jsr target.
struct subr_info
@@ -520,7 +462,7 @@ private:
// We must resolve both types and check assignability.
resolve (verifier);
k.resolve (verifier);
- return is_assignable_from_slow (data.klass, k.data.klass);
+ return _Jv_IsAssignableFrom (data.klass, k.data.klass);
}
bool isvoid () const
@@ -707,7 +649,7 @@ private:
// Ordinarily this terminates when we hit Object...
while (k != NULL)
{
- if (is_assignable_from_slow (k, oldk))
+ if (_Jv_IsAssignableFrom (k, oldk))
break;
k = k->getSuperclass ();
changed = true;