]> gcc.gnu.org Git - gcc.git/commitdiff
[multiple changes]
authorBryce McKinlay <bryce@gcc.gnu.org>
Mon, 7 Mar 2005 21:10:49 +0000 (21:10 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Mon, 7 Mar 2005 21:10:49 +0000 (21:10 +0000)
2005-03-04  Bryce McKinlay  <mckinlay@redhat.com>

* verify-glue.c (vfy_is_assignable_from): Perform static check using
can_widen_reference_to if the C++ ABI is in use.
(vfy_get_interface_count, vfy_get_interface): Remove unused functions.
* verify-impl.c (debug_print, make_utf8_const, init_type, copy_type,
type_isresolved, init_state, set_pc, state_get_pc,
_Jv_BytecodeVerifier): Clean up unused and disabled functions.
(verify_fail): Report the current PC from the verifier context.
(free_state): Remove #if 0 block to enable this function.
(free_verifier_context): Call free_state on state_list iterator
values before freeing them.
* expr.c (pop_type_0): Pop correct type for error message when stack
contains a multi-word type.

2005-03-04  Ranjit Mathew  <rmathew@hotmail.com>

* expr.c (build_java_array_length_access): Remove !flag_new_verifier
for known NULL array length access.

From-SVN: r96044

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

index a03c6605091adae3f71ec747d97732baa8b4a59a..298bd725b85843cd0ff091fdaba3ece0ddf985dd 100644 (file)
@@ -1,3 +1,23 @@
+2005-03-07  Bryce McKinlay  <mckinlay@redhat.com>
+
+       * verify-glue.c (vfy_is_assignable_from): Perform static check using
+       can_widen_reference_to if the C++ ABI is in use.
+       (vfy_get_interface_count, vfy_get_interface): Remove unused functions.
+       * verify-impl.c (debug_print, make_utf8_const, init_type, copy_type,
+       type_isresolved, init_state, set_pc, state_get_pc,
+       _Jv_BytecodeVerifier): Clean up unused and disabled functions.
+       (verify_fail): Report the current PC from the verifier context.
+       (free_state): Remove #if 0 block to enable this function.
+       (free_verifier_context): Call free_state on state_list iterator
+       values before freeing them.
+       * expr.c (pop_type_0): Pop correct type for error message when stack
+       contains a multi-word type.
+
+2005-03-07  Ranjit Mathew  <rmathew@hotmail.com>
+
+       * expr.c (build_java_array_length_access): Remove !flag_new_verifier
+       for known NULL array length access.
+
 2005-03-07  Tom Tromey  <tromey@redhat.com>
 
        * gcj.texi (Invoking gcj-dbtool): Document '-f'.
index 2c517a16f2d5c6a93aaa680f55edda982318a594..eaf5fd04292e4e9f9cd8615ec6c40f343bb08f21 100644 (file)
@@ -383,6 +383,10 @@ pop_type_0 (tree type, char **messagep)
  fail:
   {
     char *temp = xstrdup (lang_printable_name (type, 0));
+    /* If the stack contains a multi-word type, keep popping the stack until 
+       the real type is found.  */
+    while (t == void_type_node)
+      t = stack_type_map[--stack_pointer];
     *messagep = concat ("expected type '", temp,
                        "' but stack contains '", lang_printable_name (t, 0),
                        "'", NULL);
@@ -818,7 +822,7 @@ build_java_array_length_access (tree node)
      throws a NullPointerException.  The only way we could get a node
      of type ptr_type_node at this point is `aconst_null; arraylength'
      or something equivalent.  */
-  if (!flag_new_verifier && type == ptr_type_node)
+  if (type == ptr_type_node)
     return build3 (CALL_EXPR, int_type_node, 
                   build_address_of (soft_nullpointer_node),
                   NULL_TREE, NULL_TREE);
index d36aa1bc4f3280d7d1abc512824c2b986aeec7a9..67bc0e48e1ee9f74466a8f53167a479a9d57d01b 100644 (file)
@@ -134,7 +134,7 @@ int flag_deprecated = 1;
 int flag_verify_invocations = 0; 
 
 /* True if the new bytecode verifier should be used.  */
-int flag_new_verifier = 0;
+int flag_new_verifier = 1;
 
 /* When nonzero, print extra version information.  */
 static int v_flag = 0;
index 5d480e88d6820fdbd45a252461713ee840ad930b..b1664ba991a3342e38d62dd9450602aaed5e5aca 100644 (file)
@@ -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)
 {
index ae585c8d7dbc4382a8c7a7c705f71927839eb657..30d12209449c8cfe656d2aa1de724881dea705bc 100644 (file)
@@ -42,22 +42,6 @@ debug_print (const char *fmt ATTRIBUTE_UNUSED, ...)
 }    
 #endif /* VERIFY_DEBUG */
 
-#if 0
-static void debug_print (const char *fmt, ...)
-  __attribute__ ((format (printf, 1, 2)));
-
-static void
-debug_print (const char *fmt, ...)
-{
-#ifdef VERIFY_DEBUG
-  va_list ap;
-  va_start (ap, fmt);
-  vfprintf (stderr, fmt, ap);
-  va_end (ap);
-#endif /* VERIFY_DEBUG */
-}
-#endif
-
 /* This started as a fairly ordinary verifier, and for the most part
    it remains so.  It works in the obvious way, by modeling the effect
    of each opcode as it is encountered.  For most opcodes, this is a
@@ -224,22 +208,6 @@ static GTY(()) verifier_context *vfr;
 bool type_initialized (type *t);
 int ref_count_dimensions (ref_intersection *ref);
 
-#if 0
-  /* Create a new Utf-8 constant and return it.  We do this to avoid
-     having our Utf-8 constants prematurely collected.  */
-  static vfy_string
-  make_utf8_const (const char *s, int len)
-  {
-    vfy_string val = vfy_make_string (s, len);
-    vfy_string_list *lu = vfy_alloc (sizeof (vfy_string_list));
-    lu->val = val;
-    lu->next = vfr->utf8_list;
-    vfr->utf8_list = lu;
-
-    return val;
-  }
-#endif
-
 static void
 verify_fail_pc (const char *s, int pc)
 {
@@ -249,7 +217,7 @@ verify_fail_pc (const char *s, int pc)
 static void
 verify_fail (const char *s)
 {
-  verify_fail_pc (s, -1);
+  verify_fail_pc (s, vfr->PC);
 }
 
 /* This enum holds a list of tags for all the different types we
@@ -554,17 +522,6 @@ struct type
 #define EITHER -3
 };
 
-#if 0
-/* Basic constructor.  */
-static void
-init_type (type *t)
-{
-  t->key = unsuitable_type;
-  t->klass = NULL;
-  t->pc = UNINIT;
-}
-#endif
-
 /* Make a new instance given the type tag.  We assume a generic
    `reference_type' means Object.  */
 static void
@@ -626,26 +583,6 @@ make_type_from_string (vfy_string n)
   return t;
 }
 
-#if 0
-    /* Make a new instance given the name of a class.  */
-    type (vfy_string n)
-    {
-      key = reference_type;
-      klass = new ref_intersection (n, verifier);
-      pc = UNINIT;
-    }
-
-    /* Copy constructor.  */
-    static type copy_type (type *t)
-    {
-      type copy;
-      copy.key = t->key;
-      copy.klass = t->klass;
-      copy.pc = t->pc;
-      return copy;
-    }
-#endif
-
 /* Promote a numeric type.  */
 static void
 vfy_promote_type (type *t)
@@ -874,16 +811,6 @@ type_initialized (type *t)
   return t->key == reference_type || t->key == null_type;
 }
 
-#if 0
-static bool
-type_isresolved (type *t)
-{
-  return (t->key == reference_type
-         || t->key == null_type
-         || t->key == uninitialized_reference_type);
-}
-#endif
-
 static void
 type_verify_dimensions (type *t, int ndims)
 {
@@ -1018,16 +945,6 @@ struct state
    acquired from the verification list.  */
 #define NO_NEXT -1
 
-#if 0
-static void
-init_state (state *s)
-{
-  s->stack = NULL;
-  s->locals = NULL;
-  s->next = INVALID_STATE;  
-}
-#endif
-
 static void
 init_state_with_stack (state *s, int max_stack, int max_locals)
 {
@@ -1084,7 +1001,6 @@ make_state (int max_stack, int max_locals)
   return s;
 }
 
-#if 0
 static void
 free_state (state *s)
 {
@@ -1093,29 +1009,6 @@ free_state (state *s)
   if (s->locals != NULL)
     vfy_free (s->locals);
 }
-#endif
-
-#if 0
-    void *operator new[] (size_t bytes)
-    {
-      return vfy_alloc (bytes);
-    }
-
-    void operator delete[] (void *mem)
-    {
-      vfy_free (mem);
-    }
-
-    void *operator new (size_t bytes)
-    {
-      return vfy_alloc (bytes);
-    }
-
-    void operator delete (void *mem)
-    {
-      vfy_free (mem);
-    }
-#endif
 
 /* Modify this state to reflect entry to an exception handler.  */
 static void
@@ -1129,20 +1022,6 @@ state_set_exception (state *s, type *t, int max_stack)
     init_type_from_tag (&s->stack[i], unsuitable_type);
 }
 
-static int
-state_get_pc (state *s)
-{
-  return s->pc;
-}
-
-#if 0
-static void
-set_pc (state *s, int npc)
-{
-  s->pc = npc;
-}
-#endif
-
 /* Merge STATE_OLD into this state.  Destructively modifies this
    state.  Returns true if the new state was in fact changed.
    Will throw an exception if the states are not mergeable.  */
@@ -2368,7 +2247,7 @@ verify_instructions_0 (void)
          if (new_state == NULL)
            break;
 
-         vfr->PC = state_get_pc (new_state);
+         vfr->PC = new_state->pc;
          debug_print ("== State pop from pending list\n");
          /* Set up the current state.  */
          copy_state (vfr->current_state, new_state, 
@@ -3259,32 +3138,6 @@ verify_instructions_0 (void)
          handle_jsr_insn (get_int ());
          break;
 
-#if 0
-       /* These are unused here, but we call them out explicitly
-          so that -Wswitch-enum doesn't complain.  */
-       case op_putfield_1:
-       case op_putfield_2:
-       case op_putfield_4:
-       case op_putfield_8:
-       case op_putfield_a:
-       case op_putstatic_1:
-       case op_putstatic_2:
-       case op_putstatic_4:
-       case op_putstatic_8:
-       case op_putstatic_a:
-       case op_getfield_1:
-       case op_getfield_2s:
-       case op_getfield_2u:
-       case op_getfield_4:
-       case op_getfield_8:
-       case op_getfield_a:
-       case op_getstatic_1:
-       case op_getstatic_2s:
-       case op_getstatic_2u:
-       case op_getstatic_4:
-       case op_getstatic_8:
-       case op_getstatic_a:
-#endif
        default:
          /* Unrecognized opcode.  */
          verify_fail_pc ("unrecognized instruction in verify_instructions_0",
@@ -3375,17 +3228,6 @@ verify_instructions (void)
     }
 }
 
-#if 0
-_Jv_BytecodeVerifier (_Jv_InterpMethod *m)
-{
-  /* We just print the text as utf-8.  This is just for debugging
-     anyway.  */
-  debug_print ("--------------------------------\n");
-  debug_print ("-- Verifying method `%s'\n", m->self->name->chars());
-
-}
-#endif
-
 static void
 make_verifier_context (vfy_method *m)
 {
@@ -3436,6 +3278,7 @@ free_verifier_context (void)
          while (iter != NULL)
            {
              state_list *next = iter->next;
+             free_state (iter->val);
              vfy_free (iter->val);
              vfy_free (iter);
              iter = next;
This page took 0.092613 seconds and 5 git commands to generate.