expr.c (java_push_constant_from_pool): Handle 'ldc class'.
authorTom Tromey <tromey@redhat.com>
Fri, 26 May 2006 15:41:46 +0000 (15:41 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Fri, 26 May 2006 15:41:46 +0000 (15:41 +0000)
* expr.c (java_push_constant_from_pool): Handle 'ldc class'.
* verify-glue.c (vfy_class_type): New function.
* verify-impl.c (check_constant): Allow 'ldc class'.
* verify.h (vfy_class_type): Declare.

From-SVN: r114135

gcc/java/ChangeLog
gcc/java/expr.c
gcc/java/verify-glue.c
gcc/java/verify-impl.c
gcc/java/verify.h

index fa2580fc4e4286da4f8357c00069e6cca9a8affd..edcde22c8e1e713f4ae0a7c328ea95e027c0ce6d 100644 (file)
@@ -1,3 +1,10 @@
+2006-05-26  Tom Tromey  <tromey@redhat.com>
+
+       * expr.c (java_push_constant_from_pool): Handle 'ldc class'.
+       * verify-glue.c (vfy_class_type): New function.
+       * verify-impl.c (check_constant): Allow 'ldc class'.
+       * verify.h (vfy_class_type): Declare.
+
 2006-05-25  Andrew Haley  <aph@redhat.com>
 
        PR java/27756
index b2e03fc862ecae209aa05047b4d7000364c73c96..94f76fdd8c1dead3def9c14d6af058320fb0b7c4 100644 (file)
@@ -3117,6 +3117,12 @@ java_push_constant_from_pool (JCF *jcf, int index)
       c = build_ref_from_constant_pool (index);
       c = convert (promote_type (string_type_node), c);
     }
+  else if (JPOOL_TAG (jcf, index) == CONSTANT_Class
+          || JPOOL_TAG (jcf, index) == CONSTANT_ResolvedClass)
+    {
+      tree record = get_class_constant (jcf, index);
+      c = build_class_ref (record);
+    }
   else
     c = get_constant (jcf, index);
   push_value (c);
index 737a19bd77003749a3151559b4b93d637451b2a6..23fcaba3d4045965d96da8783d54d07cc2afc51d 100644 (file)
@@ -1,5 +1,5 @@
 /* Glue to interface gcj with bytecode verifier.
-   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -328,6 +328,12 @@ vfy_object_type (void)
   return k;
 }
 
+vfy_jclass
+vfy_class_type (void)
+{
+  return class_type_node;
+}
+
 vfy_jclass
 vfy_string_type (void)
 {
index f672fcf78818218fb450fa47e03cc51f9b662009..886dfe7d66c257b8224b84a1147f318fc28e197b 100644 (file)
@@ -1975,6 +1975,10 @@ check_constant (int index)
     init_type_from_tag (&t, int_type);
   else if (vfy_tag (pool, index) == JV_CONSTANT_Float)
     init_type_from_tag (&t, float_type);
+  else if (vfy_tag (pool, index) == JV_CONSTANT_Class
+          || vfy_tag (pool, index) == JV_CONSTANT_ResolvedClass)
+    /* FIXME: should only allow this for 1.5 bytecode.  */
+    init_type_from_class (&t, vfy_class_type ());
   else
     verify_fail_pc ("String, int, or float constant expected", vfr->start_PC);
   return t;
index d63519379aec8b711e76a42497f211cfc13007e9..b85176ea85dbf2471d80c3c204d89de52fdef1cc 100644 (file)
@@ -1,5 +1,5 @@
 /* Declarations to interface gcj with bytecode verifier.
-   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -112,6 +112,7 @@ vfy_jclass vfy_get_component_type (vfy_jclass klass);
 bool vfy_is_abstract (vfy_jclass klass);
 vfy_jclass vfy_find_class (vfy_jclass klass, vfy_string name);
 vfy_jclass vfy_object_type (void);
+vfy_jclass vfy_class_type (void);
 vfy_jclass vfy_string_type (void);
 vfy_jclass vfy_throwable_type (void);
 vfy_jclass vfy_unsuitable_type (void);