class.c (make_class_data): Always emit JV_STATE_PRELOADING for class' initial state.
authorTom Tromey <tromey@redhat.com>
Wed, 17 Aug 2005 20:44:10 +0000 (20:44 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 17 Aug 2005 20:44:10 +0000 (20:44 +0000)
gcc/java:
* class.c (make_class_data): Always emit JV_STATE_PRELOADING for
class' initial state.
libjava:
* java/lang/Class.h (_Jv_IsBinaryCompatibilityABI): Declare as
friend.
* include/jvm.h (_Jv_IsBinaryCompatibilityABI): New function.
* testsuite/libjava.lang/bclink.java: New file.
* testsuite/libjava.lang/bclink.out: New file.
* link.cc (print_class_loaded): Changed ABI test to look at
various _syms fields.

From-SVN: r103225

gcc/java/ChangeLog
gcc/java/class.c
libjava/ChangeLog
libjava/include/jvm.h
libjava/java/lang/Class.h
libjava/link.cc
libjava/testsuite/libjava.lang/bclink.java [new file with mode: 0644]
libjava/testsuite/libjava.lang/bclink.out [new file with mode: 0644]

index 07dfc5b54dc516149d382b17d613fcd575ca2ff7..0ecfd8f8098e0c25d53477f68d1ed023803462fa 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-16  Tom Tromey  <tromey@redhat.com>
+
+       * class.c (make_class_data): Always emit JV_STATE_PRELOADING for
+       class' initial state.
+
 2005-08-16  Ranjit Mathew  <rmathew@hotmail.com>
 
        PR java/22113
index 21945eb7fe3008939c3a88d2299806853a03ae3b..a089112276e339a0cd24e31e1bdfbd0cfcaa0216 100644 (file)
@@ -1860,13 +1860,9 @@ make_class_data (tree type)
   PUSH_FIELD_VALUE (cons, "loader", null_pointer_node);
   PUSH_FIELD_VALUE (cons, "interface_count",
                    build_int_cst (NULL_TREE, interface_len));
-  PUSH_FIELD_VALUE 
-    (cons, "state",
-     convert (byte_type_node,
-             build_int_cst (NULL_TREE,
-                            flag_indirect_dispatch
-                            ? JV_STATE_PRELOADING
-                            : JV_STATE_COMPILED)));
+  PUSH_FIELD_VALUE (cons, "state",
+                   convert (byte_type_node,
+                            build_int_cst (NULL_TREE, JV_STATE_PRELOADING)));
 
   PUSH_FIELD_VALUE (cons, "thread", null_pointer_node);
   PUSH_FIELD_VALUE (cons, "depth", integer_zero_node);
index 47e37183074a890f1bbc0e89420cf680cf86cb36..915c2ff895858535312f3807c5d174e4dc2666d9 100644 (file)
@@ -1,3 +1,13 @@
+2005-08-17  Tom Tromey  <tromey@redhat.com>
+
+       * java/lang/Class.h (_Jv_IsBinaryCompatibilityABI): Declare as
+       friend.
+       * include/jvm.h (_Jv_IsBinaryCompatibilityABI): New function.
+       * testsuite/libjava.lang/bclink.java: New file.
+       * testsuite/libjava.lang/bclink.out: New file.
+       * link.cc (print_class_loaded): Changed ABI test to look at
+       various _syms fields.
+
 2005-08-17  Andreas Tobler  <a.tobler@schweiz.ch>
 
        * testsuite/libjava.jacks/jacks.xfail: Remove 15.21-assoc-7,
index 606a84ddcbf7dceade1eabe5789a624c51b40000..459d4594278c9db37f61246da8aa7eae71522da2 100644 (file)
@@ -621,4 +621,13 @@ _Jv_IsInterpretedClass (jclass c)
   return (c->accflags & java::lang::reflect::Modifier::INTERPRETED) != 0;
 }
 
+// Return true if the class was compiled with the BC ABI.
+extern inline jboolean
+_Jv_IsBinaryCompatibilityABI (jclass c)
+{
+  // There isn't really a better test for the ABI type at this point,
+  // that will work once the class has been registered.
+  return c->otable_syms || c->atable_syms || c->itable_syms;
+}
+
 #endif /* __JAVA_JVM_H__ */
index 01a653e5c9f32ca3a5da67aeaa95184be5b3bac3..a2ec357f770bb0c9693739cf134407529d0bdfcb 100644 (file)
@@ -235,6 +235,7 @@ jboolean _Jv_CheckAccess (jclass self_klass, jclass other_klass,
 jclass _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader);
 
 jboolean _Jv_IsInterpretedClass (jclass);
+jboolean _Jv_IsBinaryCompatibilityABI (jclass);
 
 void _Jv_CopyClassesToSystemLoader (java::lang::ClassLoader *);
 
@@ -470,6 +471,7 @@ private:
                                       java::lang::ClassLoader *loader);
 
   friend jboolean (::_Jv_IsInterpretedClass) (jclass);
+  friend jboolean (::_Jv_IsBinaryCompatibilityABI) (jclass);
 
 #ifdef INTERPRETER
   friend void ::_Jv_InitField (jobject, jclass, int);
index e97b31bb78ec4d11419baa63c742218e3ce5be65..5411f4aacca1b21328647a807d229cd4df4f3135 100644 (file)
@@ -1659,11 +1659,10 @@ _Jv_Linker::print_class_loaded (jclass klass)
   if (codesource == NULL)
     codesource = "<no code source>";
 
-  // We use a somewhat bogus test for the ABI here.
   char *abi;
   if (_Jv_IsInterpretedClass (klass))
     abi = "bytecode";
-  else if (klass->state == JV_STATE_PRELOADING)
+  else if (_Jv_IsBinaryCompatibilityABI (klass))
     abi = "BC-compiled";
   else
     abi = "pre-compiled";
diff --git a/libjava/testsuite/libjava.lang/bclink.java b/libjava/testsuite/libjava.lang/bclink.java
new file mode 100644 (file)
index 0000000..b10c678
--- /dev/null
@@ -0,0 +1,12 @@
+// This tests that a C++ ABI class can derive from a BC ABI class.
+// This can't always work, but if the base class does not change then
+// it will work fine.
+
+import org.xml.sax.*;
+
+public class bclink extends SAXParseException {
+  public bclink() { super ("hi", null); }
+
+  public static void main(String[] args) throws Throwable {
+  }
+}
diff --git a/libjava/testsuite/libjava.lang/bclink.out b/libjava/testsuite/libjava.lang/bclink.out
new file mode 100644 (file)
index 0000000..e69de29