aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/verify-glue.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java/verify-glue.c')
-rw-r--r--gcc/java/verify-glue.c54
1 files changed, 24 insertions, 30 deletions
diff --git a/gcc/java/verify-glue.c b/gcc/java/verify-glue.c
index b2cd9156cd0..b1664ba991a 100644
--- a/gcc/java/verify-glue.c
+++ b/gcc/java/verify-glue.c
@@ -1,5 +1,5 @@
/* Glue to interface gcj with bytecode verifier.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
@@ -231,17 +231,18 @@ vfy_get_class_name (vfy_jclass klass)
bool
vfy_is_assignable_from (vfy_jclass target, vfy_jclass source)
{
- /* At compile time, for the BC-ABI we assume that reference types are always
- compatible. However, a type assertion table entry is emitted so that the
- runtime can detect binary-incompatible changes. */
-
- /* FIXME: implement real test for old ABI. */
-
/* Any class is always assignable to itself, or java.lang.Object. */
if (source == target || target == object_type_node)
return true;
- /* Otherwise, a type assertion is required. */
+ /* For the C++ ABI, perform this test statically. */
+ if (! flag_indirect_dispatch)
+ return can_widen_reference_to (source, target);
+
+ /* For the BC-ABI, we assume at compile time that reference types are always
+ compatible. However, a type assertion table entry is emitted so that the
+ runtime can detect binary-incompatible changes. */
+
add_type_assertion (current_class, JV_ASSERT_TYPES_COMPATIBLE, source,
target);
return true;
@@ -257,28 +258,6 @@ vfy_get_primitive_char (vfy_jclass klass)
return (IDENTIFIER_POINTER (sig))[0];
}
-int
-vfy_get_interface_count (vfy_jclass klass ATTRIBUTE_UNUSED)
-{
- /* FIXME: Need to merge from mainline to get this. */
- #if 0
- return BINFO_N_BASE_BINFOS (klass);
- #endif
- return -1;
-}
-
-vfy_jclass
-vfy_get_interface (vfy_jclass klass ATTRIBUTE_UNUSED, int index ATTRIBUTE_UNUSED)
-{
- /* FIXME: Need to merge from mainline to get this. */
- #if 0
- vfy_jclass k;
- k = BINFO_BASE_BINFO (klass, index);
- return k;
- #endif
- return NULL;
-}
-
bool
vfy_is_array (vfy_jclass klass)
{
@@ -385,6 +364,21 @@ vfy_null_type (void)
return TYPE_NULL;
}
+bool
+vfy_class_has_field (vfy_jclass klass, vfy_string name,
+ vfy_string signature)
+{
+ tree field = TYPE_FIELDS (klass);
+ while (field != NULL_TREE)
+ {
+ if (DECL_NAME (field) == name
+ && build_java_signature (TREE_TYPE (field)) == signature)
+ return true;
+ field = TREE_CHAIN (field);
+ }
+ return false;
+}
+
int
vfy_fail (const char *message, int pc, vfy_jclass ignore1 ATTRIBUTE_UNUSED,
vfy_method *ignore2 ATTRIBUTE_UNUSED)