OSDN Git Service

Merged gcj-eclipse branch to trunk.
[pf3gnuchains/gcc-fork.git] / gcc / java / constants.c
index 2f4c053..70e5321 100644 (file)
@@ -34,11 +34,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 
 static void set_constant_entry (CPool *, int, int, jword);
 static int find_tree_constant (CPool *, int, tree);
-static int find_class_or_string_constant (CPool *, int, tree);
 static int find_name_and_type_constant (CPool *, tree, tree);
 static tree get_tag_node (int);
 static tree build_constant_data_ref (void);
-static CPool *cpool_for_class (tree);
 
 /* Set the INDEX'th constant in CPOOL to have the given TAG and VALUE. */
 
@@ -134,7 +132,7 @@ find_utf8_constant (CPool *cpool, tree name)
   return find_tree_constant (cpool, CONSTANT_Utf8, name);
 }
 
-static int
+int
 find_class_or_string_constant (CPool *cpool, int tag, tree name)
 {
   jword j = find_utf8_constant (cpool, name);
@@ -322,6 +320,9 @@ get_tag_node (int tag)
 {
   /* A Cache for build_int_cst (CONSTANT_XXX, 0). */
 
+  if (tag >= 13)
+    return build_int_cst (NULL_TREE, tag);
+
   if (tag_nodes[tag] == NULL_TREE)
     tag_nodes[tag] = build_int_cst (NULL_TREE, tag);
   return tag_nodes[tag];
@@ -329,7 +330,7 @@ get_tag_node (int tag)
 
 /* Given a class, return its constant pool, creating one if necessary.  */
 
-static CPool *
+CPool *
 cpool_for_class (tree class)
 {
   CPool *cpool = TYPE_CPOOL (class);
@@ -495,11 +496,20 @@ build_constants_constructor (void)
   tree tags_list = NULL_TREE;
   tree data_list = NULL_TREE;
   int i;
+
   for (i = outgoing_cpool->count;  --i > 0; )
-    switch (outgoing_cpool->tags[i])
+    switch (outgoing_cpool->tags[i] & ~CONSTANT_LazyFlag)
       {
+      case CONSTANT_None:  /* The second half of a Double or Long on a
+                             32-bit target.  */
       case CONSTANT_Fieldref:
       case CONSTANT_NameAndType:
+      case CONSTANT_Float:
+      case CONSTANT_Integer:
+      case CONSTANT_Double:
+      case CONSTANT_Long:
+      case CONSTANT_Methodref:
+      case CONSTANT_InterfaceMethodref:
        {
          unsigned HOST_WIDE_INT temp = outgoing_cpool->data[i].w;
 
@@ -512,8 +522,7 @@ build_constants_constructor (void)
            temp <<= BITS_PER_WORD - 32;
 
          tags_list
-           = tree_cons (NULL_TREE, 
-                        build_int_cst (NULL_TREE, outgoing_cpool->tags[i]),
+           = tree_cons (NULL_TREE, get_tag_node (outgoing_cpool->tags[i]),
                         tags_list);
          data_list
            = tree_cons (NULL_TREE, 
@@ -522,7 +531,11 @@ build_constants_constructor (void)
                         data_list);
        }
        break;
-      default:
+
+      case CONSTANT_Class:
+      case CONSTANT_String:
+      case CONSTANT_Unicode:
+      case CONSTANT_Utf8:
        tags_list
          = tree_cons (NULL_TREE, get_tag_node (outgoing_cpool->tags[i]),
                       tags_list);
@@ -530,6 +543,9 @@ build_constants_constructor (void)
          = tree_cons (NULL_TREE, build_utf8_ref (outgoing_cpool->data[i].t),
                       data_list);
        break;
+
+      default:
+       gcc_assert (false);
       }
   if (outgoing_cpool->count > 0)
     {