OSDN Git Service

gcc/java:
[pf3gnuchains/gcc-fork.git] / gcc / java / lang.c
index 4856e5f..b89bdf9 100644 (file)
@@ -17,7 +17,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. 
+Boston, MA 02111-1307, USA.
 
 Java and all Java-based marks are trademarks or registered trademarks
 of Sun Microsystems, Inc. in the United States and other countries.
@@ -58,17 +58,15 @@ static void put_decl_string (const char *, int);
 static void put_decl_node (tree);
 static void java_print_error_function (diagnostic_context *, const char *);
 static tree java_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
-                                             void *, void *);
-static int java_unsafe_for_reeval (tree);
+                                             void *, struct pointer_set_t *);
 static int merge_init_test_initialization (void * *, void *);
 static int inline_init_test_initialization (void * *, void *);
 static bool java_can_use_bit_fields_p (void);
 static bool java_dump_tree (void *, tree);
 static void dump_compound_expr (dump_info_p, tree);
 static bool java_decl_ok_for_sibcall (tree);
-static int java_estimate_num_insns (tree);
-static int java_start_inlining (tree);
 static tree java_get_callee_fndecl (tree);
+static void java_clear_binding_stack (void);
 
 #ifndef TARGET_OBJECT_SUFFIX
 # define TARGET_OBJECT_SUFFIX ".o"
@@ -80,9 +78,9 @@ static tree java_get_callee_fndecl (tree);
 
 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
 
-const char tree_code_type[] = {
+const enum tree_code_class tree_code_type[] = {
 #include "tree.def"
-  'x',
+  tcc_exceptional,
 #include "java-tree.def"
 };
 #undef DEFTREECODE
@@ -119,12 +117,6 @@ int compiling_from_source;
 
 const char *resource_name;
 
-int flag_emit_class_files = 0;
-
-/* Nonzero if input file is a file with a list of filenames to compile. */
-
-int flag_filelist_file = 0;
-
 /* When nonzero, we emit xref strings. Values of the flag for xref
    backends are defined in xref_flag_table, xref.c.  */
 
@@ -133,63 +125,26 @@ int flag_emit_xref = 0;
 /* When nonzero, -Wall was turned on.  */
 int flag_wall = 0;
 
-/* When nonzero, check for redundant modifier uses.  */
-int flag_redundant = 0;
-
-/* When nonzero, call a library routine to do integer divisions. */
-int flag_use_divide_subroutine = 1;
-
-/* When nonzero, generate code for the Boehm GC.  */
-int flag_use_boehm_gc = 0;
-
-/* When nonzero, assume the runtime uses a hash table to map an
-   object to its synchronization structure.  */
-int flag_hash_synchronization;
-
-/* When nonzero, permit the use of the assert keyword.  */
-int flag_assert = 1;
-
-/* When nonzero, assume all native functions are implemented with
-   JNI, not CNI.  */
-int flag_jni = 0;
-
-/* When nonzero, warn when source file is newer than matching class
-   file.  */
-int flag_newer = 1;
-
-/* When nonzero, generate checks for references to NULL.  */
-int flag_check_references = 0;
-
 /* The encoding of the source file.  */
 const char *current_encoding = NULL;
 
-/* When nonzero, report the now deprecated empty statements.  */
-int flag_extraneous_semicolon;
-
 /* When nonzero, report use of deprecated classes, methods, or fields.  */
 int flag_deprecated = 1;
 
-/* When nonzero, always check for a non gcj generated classes archive.  */
-int flag_force_classes_archive_check;
-
 /* When zero, don't optimize static class initialization. This flag shouldn't
    be tested alone, use STATIC_CLASS_INITIALIZATION_OPTIMIZATION_P instead.  */
-int flag_optimize_sci = 1;
+/* FIXME: Make this work with gimplify.  */
+/* int flag_optimize_sci = 0;  */
 
-/* When nonzero, use offset tables for virtual method calls
-   in order to improve binary compatibility. */
-int flag_indirect_dispatch = 0;
+/* Don't attempt to verify invocations.  */
+int flag_verify_invocations = 0; 
 
-/* When zero, don't generate runtime array store checks. */
-int flag_store_check = 1;
+/* True if the new bytecode verifier should be used.  */
+int flag_new_verifier = 0;
 
 /* When nonzero, print extra version information.  */
 static int v_flag = 0;
 
-/* Set nonzero if the user specified -finline-functions on the command
-   line.  */
-int flag_really_inline = 0;
-
 JCF *current_jcf;
 
 /* Variable controlling how dependency tracking is enabled in
@@ -221,12 +176,8 @@ struct language_function GTY(())
 #define LANG_HOOKS_POST_OPTIONS java_post_options
 #undef LANG_HOOKS_PARSE_FILE
 #define LANG_HOOKS_PARSE_FILE java_parse_file
-#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
-#define LANG_HOOKS_UNSAFE_FOR_REEVAL java_unsafe_for_reeval
 #undef LANG_HOOKS_MARK_ADDRESSABLE
 #define LANG_HOOKS_MARK_ADDRESSABLE java_mark_addressable
-#undef LANG_HOOKS_EXPAND_EXPR
-#define LANG_HOOKS_EXPAND_EXPR java_expand_expr
 #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
 #define LANG_HOOKS_TRUTHVALUE_CONVERSION java_truthvalue_conversion
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
@@ -249,18 +200,15 @@ struct language_function GTY(())
 #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
 #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE java_signed_or_unsigned_type
 
-#undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
-#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES java_tree_inlining_walk_subtrees
-
-#undef LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS
-#define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS java_estimate_num_insns
-
-#undef LANG_HOOKS_TREE_INLINING_START_INLINING
-#define LANG_HOOKS_TREE_INLINING_START_INLINING java_start_inlining
-
 #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
 #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree
 
+#undef LANG_HOOKS_GIMPLIFY_EXPR
+#define LANG_HOOKS_GIMPLIFY_EXPR java_gimplify_expr
+
+#undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
+#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES java_tree_inlining_walk_subtrees
+
 #undef LANG_HOOKS_DECL_OK_FOR_SIBCALL
 #define LANG_HOOKS_DECL_OK_FOR_SIBCALL java_decl_ok_for_sibcall
 
@@ -270,6 +218,9 @@ struct language_function GTY(())
 #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
 #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION java_expand_body
 
+#undef LANG_HOOKS_CLEAR_BINDING_STACK
+#define LANG_HOOKS_CLEAR_BINDING_STACK java_clear_binding_stack
+
 /* Each front end provides its own.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
@@ -284,9 +235,6 @@ java_handle_option (size_t scode, const char *arg, int value)
 
   switch (code)
     {
-    default:
-      abort();
-
     case OPT_I:
       jcf_path_include_arg (arg);
       break;
@@ -334,26 +282,6 @@ java_handle_option (size_t scode, const char *arg, int value)
       set_Wunused (value);
       break;
 
-    case OPT_Wdeprecated:
-      flag_deprecated = value;
-      break;
-
-    case OPT_Wextraneous_semicolon:
-      flag_extraneous_semicolon = value;
-      break;
-
-    case OPT_Wout_of_date:
-      flag_newer = value;
-      break;
-
-    case OPT_Wredundant_modifiers:
-      flag_redundant = value;
-      break;
-
-    case OPT_fassert:
-      flag_assert = value;
-      break;
-
     case OPT_fenable_assertions_:
       add_enable_assert (arg, value);
       break;
@@ -382,10 +310,6 @@ java_handle_option (size_t scode, const char *arg, int value)
       jcf_path_bootclasspath_arg (arg);
       break;
 
-    case OPT_fcheck_references:
-      flag_check_references = value;
-      break;
-
     case OPT_fclasspath_:
     case OPT_fCLASSPATH_:
       jcf_path_classpath_arg (arg);
@@ -400,11 +324,6 @@ java_handle_option (size_t scode, const char *arg, int value)
        return 0;
       break;
 
-    case OPT_femit_class_file:
-    case OPT_femit_class_files:
-      flag_emit_class_files = value;
-      break;
-
     case OPT_fencoding_:
       current_encoding = arg;
       break;
@@ -413,54 +332,18 @@ java_handle_option (size_t scode, const char *arg, int value)
       jcf_path_extdirs_arg (arg);
       break;
 
-    case OPT_ffilelist_file:
-      flag_filelist_file = value;
-      break;
-
-    case OPT_fforce_classes_archive_check:
-      flag_force_classes_archive_check = value;
-      break;
-
-    case OPT_fhash_synchronization:
-      flag_hash_synchronization = value;
-      break;
-
-    case OPT_findirect_dispatch:
-      flag_indirect_dispatch = value;
-      break;
-
-    case OPT_finline_functions:
-      flag_inline_functions = value;
-      flag_really_inline = value;
-      break;
-
-    case OPT_fjni:
-      flag_jni = value;
-      break;
-
-    case OPT_foptimize_static_class_initialization:
-      flag_optimize_sci = value;
-      break;
-
     case OPT_foutput_class_dir_:
       jcf_write_base_directory = arg;
       break;
 
-    case OPT_fstore_check:
-      flag_store_check = value;
-      break;
-
-    case OPT_fuse_boehm_gc:
-      flag_use_boehm_gc = value;
-      break;
-
-    case OPT_fuse_divide_subroutine:
-      flag_use_divide_subroutine = value;
-      break;
-
     case OPT_version:
       v_flag = 1;
       break;
+      
+    default:
+      if (cl_options[code].flags & CL_Java)
+       break;
+      abort();
     }
 
   return 1;
@@ -477,9 +360,6 @@ java_init (void)
   flag_minimal_debug = 0;
 #endif
 
-  if (flag_inline_functions)
-    flag_inline_trees = 1;
-
   /* FIXME: Indirect dispatch isn't yet compatible with static class
      init optimization.  */
   if (flag_indirect_dispatch)
@@ -552,8 +432,7 @@ put_decl_node (tree node)
       node = TREE_TYPE (node);
       was_pointer = 1;
     }
-  if (TREE_CODE_CLASS (TREE_CODE (node)) == 'd'
-      && DECL_NAME (node) != NULL_TREE)
+  if (DECL_P (node) && DECL_NAME (node) != NULL_TREE)
     {
       if (TREE_CODE (node) == FUNCTION_DECL)
        {
@@ -586,8 +465,7 @@ put_decl_node (tree node)
       else
        put_decl_node (DECL_NAME (node));
     }
-  else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't'
-      && TYPE_NAME (node) != NULL_TREE)
+  else if (TYPE_P (node) && TYPE_NAME (node) != NULL_TREE)
     {
       if (TREE_CODE (node) == RECORD_TYPE && TYPE_ARRAY_P (node))
        {
@@ -619,24 +497,14 @@ put_decl_node (tree node)
    which is also called directly by java_print_error_function. */
 
 const char *
-lang_printable_name (tree decl, int v  __attribute__ ((__unused__)))
+lang_printable_name (tree decl, int v)
 {
   decl_bufpos = 0;
-  put_decl_node (decl);
-  put_decl_string ("", 1);
-  return decl_buf;
-}
-
-/* Does the same thing that lang_printable_name, but add a leading
-   space to the DECL name string -- With Leading Space.  */
-
-const char *
-lang_printable_name_wls (tree decl, int v  __attribute__ ((__unused__)))
-{
-  decl_bufpos = 1;
-  put_decl_node (decl);
+  if (v == 0 && TREE_CODE (decl) == FUNCTION_DECL)
+    put_decl_node (DECL_NAME (decl));
+  else
+    put_decl_node (decl);
   put_decl_string ("", 1);
-  decl_buf [0] = ' ';
   return decl_buf;
 }
 
@@ -660,7 +528,7 @@ java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED,
        fprintf (stderr, "%s: ", file);
 
       last_error_function_context = DECL_CONTEXT (current_function_decl);
-      fprintf (stderr, "In class `%s':\n",
+      fprintf (stderr, "In class '%s':\n",
               lang_printable_name (last_error_function_context, 0));
     }
   if (last_error_function != current_function_decl)
@@ -673,8 +541,8 @@ java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED,
       else
        {
          const char *name = lang_printable_name (current_function_decl, 2);
-         fprintf (stderr, "In %s `%s':\n",
-                  (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor" 
+         fprintf (stderr, "In %s '%s':\n",
+                  (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor"
                    : "method"),
                   name);
        }
@@ -691,7 +559,8 @@ java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED,
    2, function prototypes are fully resolved and can be printed when
    reporting errors.  */
 
-void lang_init_source (int level)
+void
+lang_init_source (int level)
 {
   inhibit_error_function_printing = (level == 1);
 }
@@ -732,17 +601,21 @@ java_post_options (const char **pfilename)
 {
   const char *filename = *pfilename;
 
- /* Use tree inlining if possible.  Function instrumentation is only
-     done in the RTL level, so we disable tree inlining.  */
-  if (! flag_instrument_function_entry_exit)
+  /* Use tree inlining.  */
+  if (!flag_no_inline)
+    flag_no_inline = 1;
+  if (flag_inline_functions)
+    flag_inline_trees = 2;
+
+  /* An absolute requirement: if we're not using indirect dispatch, we
+     must always verify everything.  */
+  if (! flag_indirect_dispatch)
+    flag_verify_invocations = true;
+  else
     {
-      if (!flag_no_inline)
-       flag_no_inline = 1;
-      if (flag_inline_functions)
-       {
-         flag_inline_trees = 2;
-         flag_inline_functions = 0;
-       }
+      /* If we are using indirect dispatch, then we want the new
+        verifier as well.  */
+      flag_new_verifier = 1;
     }
 
   /* Open input file.  */
@@ -805,6 +678,10 @@ java_post_options (const char **pfilename)
            }
        }
     }
+#ifdef USE_MAPPED_LOCATION
+  linemap_add (&line_table, LC_ENTER, false, filename, 0);
+  linemap_add (&line_table, LC_RENAME, false, "<built-in>", 0);
+#endif
 
   /* Initialize the compiler back end.  */
   return false;
@@ -839,7 +716,7 @@ java_tree_inlining_walk_subtrees (tree *tp ATTRIBUTE_UNUSED,
                                  int *subtrees ATTRIBUTE_UNUSED,
                                  walk_tree_fn func ATTRIBUTE_UNUSED,
                                  void *data ATTRIBUTE_UNUSED,
-                                 void *htab ATTRIBUTE_UNUSED)
+                                 struct pointer_set_t *pset ATTRIBUTE_UNUSED)
 {
   enum tree_code code;
   tree result;
@@ -847,7 +724,7 @@ java_tree_inlining_walk_subtrees (tree *tp ATTRIBUTE_UNUSED,
 #define WALK_SUBTREE(NODE)                             \
   do                                                   \
     {                                                  \
-      result = walk_tree (&(NODE), func, data, htab);  \
+      result = walk_tree (&(NODE), func, data, pset);  \
       if (result)                                      \
        return result;                                  \
     }                                                  \
@@ -864,45 +741,30 @@ java_tree_inlining_walk_subtrees (tree *tp ATTRIBUTE_UNUSED,
       WALK_SUBTREE (BLOCK_EXPR_BODY (t));
       return NULL_TREE;
 
-    default:
+    case EXIT_BLOCK_EXPR:
+      *subtrees = 0;
       return NULL_TREE;
-    }
-
-  #undef WALK_SUBTREE
-}
-
-/* Called from unsafe_for_reeval.  */
-static int
-java_unsafe_for_reeval (tree t)
-{
-  switch (TREE_CODE (t))
-    {
-    case BLOCK:
-      /* Our expander tries to expand the variables twice.  Boom.  */
-      if (BLOCK_EXPR_DECLS (t) != NULL)
-       return 2;
-      return unsafe_for_reeval (BLOCK_EXPR_BODY (t));
 
     default:
-      break;
+      return NULL_TREE;
     }
 
-  return -1;
+  #undef WALK_SUBTREE
 }
 
 /* Every call to a static constructor has an associated boolean
    variable which is in the outermost scope of the calling method.
    This variable is used to avoid multiple calls to the static
-   constructor for each class.  
+   constructor for each class.
 
    It looks something like this:
 
    foo ()
    {
       boolean dummy = OtherClass.is_initialized;
-  
+
      ...
-  
+
      if (! dummy)
        OtherClass.initialize();
 
@@ -925,7 +787,7 @@ merge_init_test_initialization (void **entry, void *x)
   splay_tree decl_map = (splay_tree)x;
   splay_tree_node n;
   tree *init_test_decl;
-  
+
   /* See if we have remapped this declaration.  If we haven't there's
      a bug in the inliner.  */
   n = splay_tree_lookup (decl_map, (splay_tree_key) ite->value);
@@ -940,18 +802,18 @@ merge_init_test_initialization (void **entry, void *x)
   if (!*init_test_decl)
     *init_test_decl = (tree)n->value;
 
-  /* This fixes a weird case.  
+  /* This fixes a weird case.
 
   The front end assumes that once we have called a method that
   initializes some class, we can assume the class is initialized.  It
   does this by setting the DECL_INITIAL of the init_test_decl for that
   class, and no initializations are emitted for that class.
-  
+
   However, what if the method that is suppoed to do the initialization
   is itself inlined in the caller?  When expanding the called method
   we'll assume that the class initialization has already been done,
   because the DECL_INITIAL of the init_test_decl is set.
-  
+
   To fix this we remove the DECL_INITIAL (in the caller scope) of all
   the init_test_decls corresponding to classes initialized by the
   inlined method.  This makes the caller no longer assume that the
@@ -967,7 +829,7 @@ merge_init_test_initialization (void **entry, void *x)
 void
 java_inlining_merge_static_initializers (tree fn, void *decl_map)
 {
-  htab_traverse 
+  htab_traverse
     (DECL_FUNCTION_INIT_TEST_TABLE (fn),
      merge_init_test_initialization, decl_map);
 }
@@ -983,8 +845,8 @@ inline_init_test_initialization (void **entry, void *x)
 {
   struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
   splay_tree decl_map = (splay_tree)x;
-  
-  tree h = java_treetreehash_find 
+
+  tree h = java_treetreehash_find
     (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), ite->key);
   if (! h)
     return true;
@@ -1002,7 +864,7 @@ inline_init_test_initialization (void **entry, void *x)
 void
 java_inlining_map_static_initializers (tree fn, void *decl_map)
 {
-  htab_traverse 
+  htab_traverse
     (DECL_FUNCTION_INIT_TEST_TABLE (fn),
      inline_init_test_initialization, decl_map);
 }
@@ -1034,7 +896,7 @@ dump_compound_expr (dump_info_p di, tree t)
        }
     }
 }
-  
+
 static bool
 java_dump_tree (void *dump_info, tree t)
 {
@@ -1073,13 +935,12 @@ java_dump_tree (void *dump_info, tree t)
       return true;
 
     case LABELED_BLOCK_EXPR:
-      dump_child ("label", TREE_OPERAND (t, 0));
-      dump_child ("block", TREE_OPERAND (t, 1));
+      dump_child ("label", LABELED_BLOCK_LABEL (t));
+      dump_child ("block", LABELED_BLOCK_BODY (t));
       return true;
 
     case EXIT_BLOCK_EXPR:
-      dump_child ("block", TREE_OPERAND (t, 0));
-      dump_child ("val", TREE_OPERAND (t, 1));
+      dump_child ("block", EXIT_BLOCK_LABELED_BLOCK (t));
       return true;
 
     case BLOCK:
@@ -1092,7 +953,7 @@ java_dump_tree (void *dump_info, tree t)
              dump_child ("var", local);
              local = next;
            }
-         
+
          {
            tree block = BLOCK_EXPR_BODY (t);
            dump_child ("body", block);
@@ -1100,7 +961,7 @@ java_dump_tree (void *dump_info, tree t)
          }
        }
       return true;
-      
+
     case COMPOUND_EXPR:
       if (!dump_flag (di, TDF_SLIM, t))
        return false;
@@ -1124,122 +985,6 @@ java_decl_ok_for_sibcall (tree decl)
   return decl != NULL && DECL_CONTEXT (decl) == output_class;
 }
 
-/* Used by estimate_num_insns.  Estimate number of instructions seen
-   by given statement.  */
-static tree
-java_estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
-{
-  int *count = data;
-  tree x = *tp;
-
-  if (TYPE_P (x) || DECL_P (x))
-    {
-      *walk_subtrees = 0;
-      return NULL;
-    }
-  /* Assume that constants and references counts nothing.  These should
-     be majorized by amount of operations among them we count later
-     and are common target of CSE and similar optimizations.  */
-  if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c'
-      || TREE_CODE_CLASS (TREE_CODE (x)) == 'r')
-    return NULL;
-  switch (TREE_CODE (x))
-    { 
-    /* Recognize assignments of large structures and constructors of
-       big arrays.  */
-    case MODIFY_EXPR:
-    case CONSTRUCTOR:
-      {
-       HOST_WIDE_INT size;
-
-       size = int_size_in_bytes (TREE_TYPE (x));
-
-       if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO)
-         *count += 10;
-       else
-         *count += ((size + MOVE_MAX_PIECES - 1) / MOVE_MAX_PIECES);
-      }
-      break;
-    /* Few special cases of expensive operations.  This is usefull
-       to avoid inlining on functions having too many of these.  */
-    case TRUNC_DIV_EXPR:
-    case CEIL_DIV_EXPR:
-    case FLOOR_DIV_EXPR:
-    case ROUND_DIV_EXPR:
-    case TRUNC_MOD_EXPR:
-    case CEIL_MOD_EXPR:
-    case FLOOR_MOD_EXPR:
-    case ROUND_MOD_EXPR:
-    case RDIV_EXPR:
-    case CALL_EXPR:
-
-    case NEW_ARRAY_EXPR:
-    case NEW_ANONYMOUS_ARRAY_EXPR:
-    case NEW_CLASS_EXPR:
-      *count += 10;
-      break;
-    /* Various containers that will produce no code themselves.  */
-    case INIT_EXPR:
-    case TARGET_EXPR:
-    case BIND_EXPR:
-    case BLOCK:
-    case TREE_LIST:
-    case TREE_VEC:
-    case IDENTIFIER_NODE:
-    case PLACEHOLDER_EXPR:
-    case WITH_CLEANUP_EXPR:
-    case CLEANUP_POINT_EXPR:
-    case NOP_EXPR:
-    case VIEW_CONVERT_EXPR:
-    case SAVE_EXPR:
-    case UNSAVE_EXPR:
-    case COMPLEX_EXPR:
-    case REALPART_EXPR:
-    case IMAGPART_EXPR:
-    case TRY_CATCH_EXPR:
-    case TRY_FINALLY_EXPR:
-    case LABEL_EXPR:
-    case EXIT_EXPR:
-    case LABELED_BLOCK_EXPR:
-    case EXIT_BLOCK_EXPR:
-    case EXPR_WITH_FILE_LOCATION:
-    case UNARY_PLUS_EXPR:
-    case THIS_EXPR:
-    case DEFAULT_EXPR:
-    case TRY_EXPR:
-
-      break;
-    case CLASS_LITERAL:
-      *walk_subtrees = 0;
-      break;
-    default:
-      (*count)++;
-    }
-  return NULL;
-}
-
-/*  Estimate number of instructions that will be created by expanding the body.  */
-static int
-java_estimate_num_insns (tree decl)
-{
-  int num = 0;
-  walk_tree_without_duplicates (&DECL_SAVED_TREE (decl),
-                               java_estimate_num_insns_1, &num);
-  return num;
-}
-
-/* Start inlining fn.  Called by the tree inliner via
-   lang_hooks.tree_inlining.cannot_inline_tree_fn.  */
-
-static int
-java_start_inlining (tree fn)
-{
-  /* A java function's body doesn't have a BLOCK structure suitable
-     for debug output until it is expanded.  Prevent inlining functions
-     that are not yet expanded.  */
-  return TREE_ASM_WRITTEN (fn) ? 1 : 0;
-}
-
 /* Given a call_expr, try to figure out what its target might be.  In
    the case of an indirection via the atable, search for the decl.  If
    the decl is external, we return NULL.  If we don't, the optimizer
@@ -1252,6 +997,10 @@ java_get_callee_fndecl (tree call_expr)
 
   HOST_WIDE_INT index;
 
+  /* FIXME: This is disabled because we end up passing calls through
+     the PLT, and we do NOT want to do that.  */
+  return NULL;
+
   if (TREE_CODE (call_expr) != CALL_EXPR)
     return NULL;
   method = TREE_OPERAND (call_expr, 0);
@@ -1260,13 +1009,13 @@ java_get_callee_fndecl (tree call_expr)
     return NULL;
   table = TREE_OPERAND (method, 0);
   if (! DECL_LANG_SPECIFIC(table)
-      || !DECL_OWNER (table) 
+      || !DECL_OWNER (table)
       || TYPE_ATABLE_DECL (DECL_OWNER (table)) != table)
     return NULL;
 
   atable_methods = TYPE_ATABLE_METHODS (DECL_OWNER (table));
   index = TREE_INT_CST_LOW (TREE_OPERAND (method, 1));
-  
+
   /* FIXME: Replace this for loop with a hash table lookup.  */
   for (element = atable_methods; element; element = TREE_CHAIN (element))
     {
@@ -1285,4 +1034,13 @@ java_get_callee_fndecl (tree call_expr)
   return NULL;
 }
 
+
+/* Clear the binding stack.  */
+static void
+java_clear_binding_stack (void)
+{
+  while (!global_bindings_p ())
+    poplevel (0, 0, 0);
+}
+
 #include "gt-java-lang.h"