public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ecj] Patch: remove old .java parser
@ 2006-12-20 19:18 Tom Tromey
  2006-12-23  2:46 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2006-12-20 19:18 UTC (permalink / raw)
  To: Gcc Patch List; +Cc: Java Patch List

I'm going to check this in on the gcj-eclipse-merge-branch.
Andrew, if you could give it a look over first, that would be helpful.

This is the first step at removing the old .java parser and other
now-unused code from gcj.  There is still some unused code remaining,
and a few bits which I simply commented out.  I'll have more cleanups
in future patches.

Bootstrapped and tested on x86 FC5.

I've omitted deleted files from the patch for brevity.

Tom

"And I cross out, and I correct, with the joy one can have at cutting
a gangrenous limb from one's body." -- Rene Daumal

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java-tree.h (compiling_from_source, current_encoding,
	JTI_FINIT_IDENTIFIER_NODE, JTI_INSTINIT_IDENTIFIER_NODE,
	JTI_LENGTH_IDENTIFIER_NODE, JTI_SUPER_IDENTIFIER_NODE,
	JTI_CONTINUE_IDENTIFIER_NODE, JTI_ACCESS0_IDENTIFIER_NODE,
	JTI_WFL_OPERATOR): Removed
	(finit_identifier_node, instinit_identifier_node,
	length_identifier_node, super_identifier_node,
	continue_identifier_node, access0_identifier_node, wfl_operator):
	Removed.
	(cyclic_inheritance_report,
	DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND,
	DECL_FUNCTION_NAP, DECL_FUNCTION_SYNTHETIC_CTOR,
	DECL_FIXED_CONSTRUCTOR_P): Removed.
	(struct lang_decl_func) <smic, nap, synthetic_ctor, fixed_ctor>:
	Removed.
	(TYPE_FINIT_STMT_LIST, TYPE_CLINIT_STMT_LIST, TYPE_II_STMT_LIST,
	TYPE_IMPORT_LIST, TYPE_IMPORT_DEMAND_LIST): Removed.
	(struct lang_type) <finit_stmt_list, clinit_stmt_list, ii_block,
	import_list, import_demand_list>: Removed.
	(java_layout_seen_class_methods, init_jcf_parse, init_src_parse,
	cxx_keyword_p): Removed.
	(DECL_FINIT_P, DECL_INSTINIT_P, ID_FINIT_P, ID_INSTINIT_P,
	TYPE_UNUSED, TYPE_UNDERFLOW, TYPE_UNEXPECTED,
	CLASS_ACCESS0_GENERATED_P, CLASS_HAS_FINIT_P,
	IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P, IS_A_CLASSFILE_NAME,
	IS_AN_IMPORT_ON_DEMAND_P, COMPOUND_ASSIGN_P, SWITCH_HAS_DEFAULT,
	PRIMARY_P, MODIFY_EXPR_FROM_INITIALIZATION_P,
	CLASS_METHOD_CHECKED_P, FOR_LOOP_P, ANONYMOUS_CLASS_P,
	LOCAL_CLASS_P, ARG_FINAL_P, SUPPRESS_UNREACHABLE_ERROR,
	RESOLVE_PACKAGE_NAME_P, RESOLVE_TYPE_NAME_P, IS_BREAK_STMT_P,
	IS_CRAFTED_STRING_BUFFER_P, IS_INIT_CHECKED, CALL_USING_SUPER,
	NESTED_FIELD_ACCESS_IDENTIFIER_P, TOPLEVEL_CLASS_DECL_P,
	PURE_INNER_CLASS_TYPE_P, TOPLEVEL_CLASS_TYPE_P,
	CALL_CONSTRUCTOR_P, CALL_EXPLICIT_CONSTRUCTOR_P,
	CALL_THIS_CONSTRUCTOR_P, CALL_SUPER_CONSTRUCTOR_P,
	FINALLY_EXPR_LABEL, FINALLY_EXPR_BLOCK, BLOCK_IS_IMPLICIT,
	BLOCK_EMPTY_P, IS_UNCHECKED_EXCEPTION_P, java_error_count,
	java_parse_abort_on_error, extract_field_decl): Removed.
	(finput): Declare.
	* lang.c: (compiling_from_source, current_encoding): Removed.
	(java_handle_option): Ignore -fencoding.
	* parse.h: Don't include lex.h.
	(java_error_count, int_fits_type_p, stabilize_reference, RULE,
	RECOVERED, DRECOVERED, RECOVER, DRECOVER, YYERROR_NOW,
	YYNOT_TWICE, CLASS_MODIFIERS, FIELD_MODIFIERS, METHOD_MODIFIERS,
	INTERFACE_MODIFIERS, INTERFACE_INNER_MODIFIERS,
	INTERFACE_METHOD_MODIFIERS, INTERFACE_FIELD_MODIFIERS,
	MODIFIER_WFL, THIS_MODIFIER_ONLY, parse_error_context,
	ABSTRACT_CHECK, JCONSTRUCTOR_CHECK, exit_java_complete_class,
	CLASS_OR_INTERFACE, GET_REAL_TYPE, GET_TYPE_NAME,
	OBSOLETE_MODIFIER_WARNING, OBSOLETE_MODIFIER_WARNING2,
	BUILD_PTR_FROM_NAME, INCOMPLETE_TYPE_P,
	JAVA_MAYBE_GENERATE_DEBUG_INFO, JBSC_TYPE_P, JSTRING_P,
	JNULLP_TYPE_P, JDECL_P, TYPE_INTERFACE_P, TYPE_CLASS_P,
	IDENTIFIER_INNER_CLASS_OUTER_FIELD_ACCESS,
	MANGLE_OUTER_LOCAL_VARIABLE_NAME,
	MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID,
	MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STRING,
	SKIP_THIS_AND_ARTIFICIAL_PARMS, MARK_FINAL_PARMS,
	UNMARK_FINAL_PARMS, CRAFTED_PARAM_LIST_FIXUP,
	AIPL_FUNCTION_CREATION, AIPL_FUNCTION_DECLARATION,
	AIPL_FUNCTION_CTOR_INVOCATION, AIPL_FUNCTION_FINIT_INVOCATION,
	ERROR_CANT_CONVERT_TO_BOOLEAN, ERROR_CANT_CONVERT_TO_NUMERIC,
	ERROR_CAST_NEEDED_TO_INTEGRAL, ERROR_VARIABLE_NOT_INITIALIZED,
	LOOP_EXPR_BODY_MAIN_BLOCK, LOOP_EXPR_BODY_UPDATE_BLOCK,
	LOOP_EXPR_BODY_CONDITION_EXPR, LOOP_EXPR_BODY_LABELED_BODY,
	LOOP_EXPR_BODY_BODY_EXPR, PUSH_LABELED_BLOCK, POP_LABELED_BLOCK,
	PUSH_LOOP, POP_LOOP, PUSH_EXCEPTIONS, POP_EXCEPTIONS,
	IN_TRY_BLOCK_P, EXCEPTIONS_P, ANONYMOUS_ARRAY_BASE_TYPE,
	ANONYMOUS_ARRAY_DIMS_SIG, ANONYMOUS_ARRAY_INITIALIZER,
	INVOKE_STATIC, INVOKE_NONVIRTUAL, INVOKE_SUPER, INVOKE_INTERFACE,
	INVOKE_VIRTUAL, jdep_code, struct _jdep, JDEP_DECL, JDEP_DECL_WFL,
	JDEP_KIND, JDEP_WFL, JDEP_MISC, JDEP_ENCLOSING, JDEP_CLASS,
	JDEP_APPLY_PATCH, JDEP_GET_PATCH, JDEP_CHAIN, JDEP_TO_RESOLVE,
	JDEP_RESOLVED_DECL, JDEP_RESOLVED, JDEP_RESOLVED_P, struct
	jdeplist_s, jdeplists, CLASSD_FIRST, CLASSD_LAST, CLASSD_CHAIN,
	JDEP_INSERT, SET_TYPE_FOR_RESOLUTION, WFL_STRIP_BRACKET,
	STRING_STRIP_BRACKETS, PROMOTE_RECORD_IF_COMPLETE,
	BLOCK_CHAIN_DECL, GET_CURRENT_BLOCK, EXPR_WFL_GET_LINECOL,
	EXPR_WFL_QUALIFICATION, QUAL_WFL, QUAL_RESOLUTION, QUAL_DECL_TYPE,
	GET_SKIP_TYPE, COMPLETE_CHECK_OP, COMPLETE_CHECK_OP_0,
	COMPLETE_CHECK_OP_1, COMPLETE_CHECK_OP_2, BUILD_APPEND,
	BUILD_STRING_BUFFER, BUILD_THROW, SET_WFL_OPERATOR,
	PATCH_METHOD_RETURN_ERROR, CHECK_METHODS, CLEAR_DEPRECATED,
	CHECK_DEPRECATED_NO_RESET, CHECK_DEPRECATED, REGISTER_IMPORT,
	CURRENT_OSB, struct parser_ctxt, GET_CPC_LIST, CPC_INNER_P,
	GET_CPC, GET_CPC_UN, GET_CPC_UN_MODE, GET_CPC_DECL_NODE,
	GET_ENCLOSING_CPC, GET_NEXT_ENCLOSING_CPC,
	GET_ENCLOSING_CPC_CONTEXT, INNER_ENCLOSING_SCOPE_CHECK, PUSH_CPC,
	PUSH_ERROR, POP_CPC, DEBUG_CPC, CPC_INITIALIZER_LIST,
	CPC_STATIC_INITIALIZER_LIST, CPC_INSTANCE_INITIALIZER_LIST,
	CPC_INITIALIZER_STMT, CPC_STATIC_INITIALIZER_STMT,
	CPC_INSTANCE_INITIALIZER_STMT, SET_CPC_INITIALIZER_STMT,
	SET_CPC_STATIC_INITIALIZER_STMT,
	SET_CPC_INSTANCE_INITIALIZER_STMT, JAVA_NOT_RADIX10_FLAG,
	java_complete_class, java_check_circular_reference,
	java_fix_constructors, java_layout_classes, java_reorder_fields,
	java_method_add_stmt, java_get_line_col, reset_report,
	java_init_lex, yyparse, java_parse, yyerror, java_expand_classes,
	java_finish_classes, ctxp, ctxp_for_generation,
	ctxp_for_generation_last): Removed.
	* expr.c (force_evaluation_order): Don't mention NEW_CLASS_EXPR.
	* mangle.c (utf8_cmp): New function.
	(cxx_keywords): New global.
	(cxx_keyword_p): New function.
	* jvspec.c (JAVA_START_CHAR): Removed obsolete comment.
	* java-tree.def (UNARY_PLUS_EXPR, NEW_ARRAY_EXPR,
	NEW_ANONYMOUS_ARRAY_EXPR, NEW_CLASS_EXPR, THIS_EXPR,
	CASE_EXPR, DEFAULT_EXPR, JAVA_CATCH_EXPR, SYNCHRONIZED_EXPR,
	THROW_EXPR, CONDITIONAL_EXPR, INSTANCEOF_EXPR, NEW_ARRAY_INIT,
	CLASS_LITERAL, JAVA_EXC_OBJ_EXPR): Removed.
	* Make-lang.in (java.srcextra): Do nothing.
	(parse.c, keyword.h, gt-java-parse.h): Removed targets.
	(JAVA_OBJS): Don't mention deleted files.
	(java.mostlyclean): Likewise.
	(java.clean): Likewise.
	(JAVA_LEX_C): Removed.
	(buffer.o, check-init.o, parse.o): Remove unused targets.
	(typeck.o): Updated.
	* jcf-parse.c (read_class): Comment out unused code.
	(java_layout_seen_class_methods): New function.
	(parse_source_file_1, parse_source_file_2, parse_source_file_3):
	Removed.
	(java_parse_file): Comment out unused code.  Don't use 'ctxp'.
	(init_jcf_parse): Removed.
	* config-lang.in (gtfiles): Remove deleted files.
	* decl.c (java_init_decl_processing): Don't initialize
	finit_identifier_node, instinit_identifier_node,
	length_identifier_node, super_identifier_node,
	continue_identifier_node, access0_identifier_node.  Don't call
	init_jcf_parse.
	* class.c (cyclic_inheritance_report): New global.
	(add_method_1): Don't use
	DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND.
	(maybe_layout_super_class): Comment out code.
	(safe_layout_class): New function.
	* java-gimplify.c (java_gimplify_expr): Removed CASE_EXPR,
	DEFAULT_EXPR, NEW_ARRAY_INIT, JAVA_CATCH_EXPR, JAVA_EXC_OBJ_EXPR,
	UNARY_PLUS_EXPR, NEW_ARRAY_EXPR, NEW_ANONYMOUS_ARRAY_EXPR,
	NEW_CLASS_EXPR, SYNCHRONIZED_EXPR, CONDITIONAL_EXPR,
	INSTANCEOF_EXPR, CLASS_LITERAL, THIS_EXPR.
	(java_gimplify_case_expr): Removed.
	(java_gimplify_default_expr): Likewise.
	(java_gimplify_new_array_init): Likewise.
	* parse.y: Removed.
	* keyword.gperf, keyword.h: Removed.
	* chartables.h: Removed.
	* check-init.c: Removed.
	* buffer.c, buffer.h: Removed.
	* convert.h: Removed.
	* gen-table.pl: Removed.
	* lex.c, lex.h: Removed.

Index: java-gimplify.c
===================================================================
--- java-gimplify.c	(revision 120056)
+++ java-gimplify.c	(working copy)
@@ -1,5 +1,5 @@
 /* Java(TM) language-specific gimplification routines.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -34,10 +34,7 @@
 
 static tree java_gimplify_labeled_block_expr (tree);
 static tree java_gimplify_exit_block_expr (tree);
-static tree java_gimplify_case_expr (tree);
-static tree java_gimplify_default_expr (tree);
 static tree java_gimplify_block (tree);
-static tree java_gimplify_new_array_init (tree);
 static tree java_gimplify_try_expr (tree);
 static enum gimplify_status java_gimplify_modify_expr (tree*, tree*, tree *);
 static enum gimplify_status java_gimplify_component_ref (tree*, tree*, tree *);
@@ -92,30 +89,10 @@
       *expr_p = java_gimplify_exit_block_expr (*expr_p);
       break;
 
-    case CASE_EXPR:
-      *expr_p = java_gimplify_case_expr (*expr_p);
-      break;
-
-    case DEFAULT_EXPR:
-      *expr_p = java_gimplify_default_expr (*expr_p);
-      break;
-
-    case NEW_ARRAY_INIT:
-      *expr_p = java_gimplify_new_array_init (*expr_p);
-      break;
-
     case TRY_EXPR:
       *expr_p = java_gimplify_try_expr (*expr_p);
       break;
 
-    case JAVA_CATCH_EXPR:
-      *expr_p = TREE_OPERAND (*expr_p, 0);
-      break;
-
-    case JAVA_EXC_OBJ_EXPR:
-      *expr_p = build_exception_object_ref (TREE_TYPE (*expr_p));
-      break;
-
     case VAR_DECL:
       *expr_p = java_replace_reference (*expr_p, /* want_lvalue */ false);
       return GS_UNHANDLED;
@@ -144,15 +121,6 @@
     case COMPARE_EXPR:
     case COMPARE_L_EXPR:
     case COMPARE_G_EXPR:
-    case UNARY_PLUS_EXPR:
-    case NEW_ARRAY_EXPR:
-    case NEW_ANONYMOUS_ARRAY_EXPR:
-    case NEW_CLASS_EXPR:
-    case THIS_EXPR:
-    case SYNCHRONIZED_EXPR:
-    case CONDITIONAL_EXPR:
-    case INSTANCEOF_EXPR:
-    case CLASS_LITERAL:
       gcc_unreachable ();
 
     case COMPONENT_REF:
@@ -357,21 +325,6 @@
 }
 
     
-static tree
-java_gimplify_case_expr (tree expr)
-{
-  tree label = create_artificial_label ();
-  return build3 (CASE_LABEL_EXPR, void_type_node,
-		 TREE_OPERAND (expr, 0), NULL_TREE, label);
-}
-
-static tree
-java_gimplify_default_expr (tree expr ATTRIBUTE_UNUSED)
-{
-  tree label = create_artificial_label ();
-  return build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, label);
-}
-
 /* Gimplify BLOCK into a BIND_EXPR.  */
 
 static tree
@@ -408,47 +361,7 @@
   return build3 (BIND_EXPR, TREE_TYPE (java_block), decls, body, block);
 }
 
-/* Gimplify a NEW_ARRAY_INIT node into array/element assignments.  */
-
 static tree
-java_gimplify_new_array_init (tree exp)
-{
-  tree array_type = TREE_TYPE (TREE_TYPE (exp));
-  tree data_field = lookup_field (&array_type, get_identifier ("data"));
-  tree element_type = TYPE_ARRAY_ELEMENT (array_type);
-  HOST_WIDE_INT ilength = java_array_type_length (array_type);
-  tree length = build_int_cst (NULL_TREE, ilength);
-  tree init = TREE_OPERAND (exp, 0);
-  tree value;
-  unsigned HOST_WIDE_INT cnt;
-
-  tree array_ptr_type = build_pointer_type (array_type);
-  tree tmp = create_tmp_var (array_ptr_type, "array");
-  tree body = build2 (MODIFY_EXPR, array_ptr_type, tmp,
-		      build_new_array (element_type, length));
-
-  int index = 0;
-
-  /* FIXME: try to allocate array statically?  */
-  FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (init), cnt, value)
-    {
-      /* FIXME: Should use build_java_arrayaccess here, but avoid
-	 bounds checking.  */
-      tree lhs = build3 (COMPONENT_REF, TREE_TYPE (data_field),    
-			 build_java_indirect_ref (array_type, tmp, 0),
-			 data_field, NULL_TREE);
-      tree assignment = build2 (MODIFY_EXPR, element_type,
-				build4 (ARRAY_REF, element_type, lhs,
-					build_int_cst (NULL_TREE, index++),
-					NULL_TREE, NULL_TREE),
-				value);
-      body = build2 (COMPOUND_EXPR, element_type, body, assignment);
-    }
-
-  return build2 (COMPOUND_EXPR, array_ptr_type, body, tmp);
-}
-
-static tree
 java_gimplify_try_expr (tree try_expr)
 {
   tree body = TREE_OPERAND (try_expr, 0);
Index: class.c
===================================================================
--- class.c	(revision 120056)
+++ class.c	(working copy)
@@ -69,6 +69,8 @@
 
 struct obstack temporary_obstack;
 
+static const char *cyclic_inheritance_report;
+
 /* The compiler generates different code depending on whether or not
    it can assume certain classes have been compiled down to native
    code or not.  The compiler options -fassume-compiled= and
@@ -723,9 +725,6 @@
     DECL_FUNCTION_INITIALIZED_CLASS_TABLE (fndecl) =
       htab_create_ggc (50, htab_hash_pointer, htab_eq_pointer, NULL);
 
-  /* Initialize the static method invocation compound list */
-  DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl) = NULL_TREE;
-
   TREE_CHAIN (fndecl) = TYPE_METHODS (this_class);
   TYPE_METHODS (this_class) = fndecl;
 
@@ -2314,7 +2313,7 @@
 /* Handle the different manners we may have to lay out a super class.  */
 
 static tree
-maybe_layout_super_class (tree super_class, tree this_class)
+maybe_layout_super_class (tree super_class, tree this_class ATTRIBUTE_UNUSED)
 {
   if (!super_class)
     return NULL_TREE;
@@ -2333,6 +2332,7 @@
 	super_class = TREE_TYPE (super_class);
       else
 	{
+#if 0
 	  /* do_resolve_class expects an EXPR_WITH_FILE_LOCATION, so
 	     we give it one.  */
 	  tree this_wrap = NULL_TREE;
@@ -2358,6 +2358,8 @@
 	  if (!super_class)
 	    return NULL_TREE;	/* FIXME, NULL_TREE not checked by caller. */
 	  super_class = TREE_TYPE (super_class);
+#endif
+	  gcc_unreachable ();
 	}
     }
   if (!TYPE_SIZE (super_class))
@@ -2366,7 +2368,23 @@
   return super_class;
 }
 
+/* safe_layout_class just makes sure that we can load a class without
+   disrupting the current_class, input_file, input_line, etc, information
+   about the class processed currently.  */
+
 void
+safe_layout_class (tree class)
+{
+  tree save_current_class = current_class;
+  location_t save_location = input_location;
+
+  layout_class (class);
+
+  current_class = save_current_class;
+  input_location = save_location;
+}
+
+void
 layout_class (tree this_class)
 {
   tree super_class = CLASSTYPE_SUPER (this_class);
Index: decl.c
===================================================================
--- decl.c	(revision 120056)
+++ decl.c	(working copy)
@@ -755,15 +755,9 @@
   TYPE_identifier_node = get_identifier ("TYPE");
   init_identifier_node = get_identifier ("<init>");
   clinit_identifier_node = get_identifier ("<clinit>");
-  finit_identifier_node = get_identifier ("finit$");
-  instinit_identifier_node = get_identifier ("instinit$");
   void_signature_node = get_identifier ("()V");
-  length_identifier_node = get_identifier ("length");
   finalize_identifier_node = get_identifier ("finalize");
   this_identifier_node = get_identifier ("this");
-  super_identifier_node = get_identifier ("super");
-  continue_identifier_node = get_identifier ("continue");
-  access0_identifier_node = get_identifier ("access$0");
   classdollar_identifier_node = get_identifier ("class$");
 
   java_lang_cloneable_identifier_node = get_identifier ("java.lang.Cloneable");
@@ -1110,8 +1104,6 @@
 
   lang_eh_runtime_type = do_nothing;
 
-  init_jcf_parse ();
-    
   initialize_builtins ();
   soft_fmod_node = built_in_decls[BUILT_IN_FMOD];
 #if 0
Index: config-lang.in
===================================================================
--- config-lang.in	(revision 120056)
+++ config-lang.in	(working copy)
@@ -36,7 +36,7 @@
 
 stagestuff="jc1\$(exeext) gcj\$(exeext) jvgenmain\$(exeext) jcf-dump\$(exeext)"
 
-gtfiles="\$(srcdir)/java/java-tree.h \$(srcdir)/java/jcf.h \$(srcdir)/java/lex.h \$(srcdir)/java/parse.h \$(srcdir)/java/builtins.c \$(srcdir)/java/class.c \$(srcdir)/java/constants.c \$(srcdir)/java/decl.c \$(srcdir)/java/expr.c \$(srcdir)/java/jcf-parse.c \$(srcdir)/java/lang.c \$(srcdir)/java/mangle.c \$(srcdir)/java/parse.y \$(srcdir)/java/resource.c"
+gtfiles="\$(srcdir)/java/java-tree.h \$(srcdir)/java/jcf.h \$(srcdir)/java/parse.h \$(srcdir)/java/builtins.c \$(srcdir)/java/class.c \$(srcdir)/java/constants.c \$(srcdir)/java/decl.c \$(srcdir)/java/expr.c \$(srcdir)/java/jcf-parse.c \$(srcdir)/java/lang.c \$(srcdir)/java/mangle.c \$(srcdir)/java/resource.c"
 
 target_libs=${libgcj_saved}
 lang_dirs="zlib fastjar"
Index: jcf-parse.c
===================================================================
--- jcf-parse.c	(revision 120056)
+++ jcf-parse.c	(working copy)
@@ -110,15 +110,13 @@
 static int classify_zip_file (struct ZipDirectory *zdir);
 static void parse_zip_file_entries (void);
 static void process_zip_dir (FILE *);
-static void parse_source_file_1 (tree, const char *, FILE *);
-static void parse_source_file_2 (void);
-static void parse_source_file_3 (void);
 static void parse_class_file (void);
 static void handle_deprecated (void);
 static void set_source_filename (JCF *, int);
 static void jcf_parse (struct JCF*);
 static void load_inner_classes (tree);
 static void handle_annotation (JCF *jcf, int level);
+static void java_layout_seen_class_methods (void);
 
 /* Handle "Deprecated" attribute.  */
 static void
@@ -1309,6 +1307,8 @@
 
   if (current_jcf->java_source)
     {
+      gcc_unreachable ();
+#if 0
       const char *filename = current_jcf->filename;
       char *real_path;
       tree given_file, real_file;
@@ -1346,15 +1346,16 @@
       JCF_FINISH (current_jcf);
       java_pop_parser_context (generate);
       java_parser_context_restore_global ();
+#endif
     }
   else
     {
       if (class == NULL_TREE || ! CLASS_PARSED_P (class))
 	{
-	  java_parser_context_save_global ();
-	  java_push_parser_context ();
+/* 	  java_parser_context_save_global (); */
+/* 	  java_push_parser_context (); */
 	  output_class = current_class = class;
-	  ctxp->save_location = input_location;
+/* 	  ctxp->save_location = input_location; */
 	  if (JCF_SEEN_IN_ZIP (current_jcf))
 	    read_zip_member(current_jcf,
 			    current_jcf->zipd, current_jcf->zipd->zipf);
@@ -1364,8 +1365,8 @@
 	  if (current_class != class && icv != NULL_TREE)
 	    TREE_TYPE (icv) = current_class;
 	  class = current_class;
-	  java_pop_parser_context (0);
-	  java_parser_context_restore_global ();
+/* 	  java_pop_parser_context (0); */
+/* 	  java_parser_context_restore_global (); */
 	}
       layout_class (class);
       load_inner_classes (class);
@@ -1606,6 +1607,42 @@
 }
 
 static void
+java_layout_seen_class_methods (void)
+{
+  tree previous_list = all_class_list;
+  tree end = NULL_TREE;
+  tree current;
+
+  while (1)
+    {
+      for (current = previous_list;
+	   current != end; current = TREE_CHAIN (current))
+        {
+	  tree decl = TREE_VALUE (current);
+          tree cls = TREE_TYPE (decl);
+
+	  input_location = DECL_SOURCE_LOCATION (decl);
+
+          if (! CLASS_LOADED_P (cls))
+            load_class (cls, 0);
+
+          layout_class_methods (cls);
+        }
+
+      /* Note that new classes might have been added while laying out
+         methods, changing the value of all_class_list.  */
+
+      if (previous_list != all_class_list)
+	{
+	  end = previous_list;
+	  previous_list = all_class_list;
+	}
+      else
+	break;
+    }
+}
+
+static void
 parse_class_file (void)
 {
   tree method;
@@ -1723,71 +1760,6 @@
   input_location = save_location;
 }
 
-/* Parse a source file, as pointed by the current value of INPUT_FILENAME. */
-
-static void
-parse_source_file_1 (tree real_file, const char *filename, FILE *finput)
-{
-  int save_error_count = java_error_count;
-
-  /* Mark the file as parsed.  */
-  HAS_BEEN_ALREADY_PARSED_P (real_file) = 1;
-
-  lang_init_source (1);		    /* Error msgs have no method prototypes */
-
-  /* There's no point in trying to find the current encoding unless we
-     are going to do something intelligent with it -- hence the test
-     for iconv.  */
-#if defined (HAVE_LOCALE_H) && defined (HAVE_ICONV) && defined (HAVE_LANGINFO_CODESET)
-  setlocale (LC_CTYPE, "");
-  if (current_encoding == NULL)
-    current_encoding = nl_langinfo (CODESET);
-#endif 
-  if (current_encoding == NULL || *current_encoding == '\0')
-    current_encoding = DEFAULT_ENCODING;
-
-#ifdef USE_MAPPED_LOCATION
-  linemap_add (&line_table, LC_ENTER, false, filename, 0);
-  input_location = linemap_line_start (&line_table, 0, 125);
-#else
-  input_filename = filename;
-  input_line = 0;
-#endif
-  ctxp->file_start_location = input_location;
-  ctxp->filename = filename;
-
-  jcf_dependency_add_file (input_filename, 0);
-
-  /* Initialize the parser */
-  java_init_lex (finput, current_encoding);
-  java_parse_abort_on_error ();
-
-  java_parse ();		    /* Parse and build partial tree nodes. */
-  java_parse_abort_on_error ();
-}
-
-/* Process a parsed source file, resolving names etc. */
-
-static void
-parse_source_file_2 (void)
-{
-  int save_error_count = java_error_count;
-  flag_verify_invocations = true;
-  java_complete_class ();	    /* Parse unsatisfied class decl. */
-  java_parse_abort_on_error ();
-}
-
-static void
-parse_source_file_3 (void)
-{
-  int save_error_count = java_error_count;
-  java_check_circular_reference (); /* Check on circular references */
-  java_parse_abort_on_error ();
-  java_fix_constructors ();	    /* Fix the constructors */
-  java_parse_abort_on_error ();
-  java_reorder_fields ();	    /* Reorder the fields */
-}
-
 void
 add_predefined_file (tree name)
 {
@@ -2034,6 +2006,8 @@
 	}
       else
 	{
+	  gcc_unreachable ();
+#if 0
 	  java_push_parser_context ();
 	  java_parser_context_save_global ();
 
@@ -2043,21 +2017,10 @@
 #ifdef USE_MAPPED_LOCATION
 	  linemap_add (&line_table, LC_LEAVE, false, NULL, 0);
 #endif
+#endif
 	}
     }
 
-  for (ctxp = ctxp_for_generation;  ctxp;  ctxp = ctxp->next)
-    {
-      input_location = ctxp->file_start_location;
-      parse_source_file_2 ();
-    }
-
-  for (ctxp = ctxp_for_generation; ctxp; ctxp = ctxp->next)
-    {
-      input_location = ctxp->file_start_location;
-      parse_source_file_3 ();
-    }
-
   /* Do this before lowering any code.  */
   for (node = current_file_list; node; node = TREE_CHAIN (node))
     {
@@ -2087,12 +2050,12 @@
 
   bitmap_obstack_release (&bit_obstack);
 
-  java_expand_classes ();
-  if (java_report_errors () || flag_syntax_only)
-    return;
+/*   java_expand_classes (); */
+/*   if (java_report_errors () || flag_syntax_only) */
+/*     return; */
     
   /* Expand all classes compiled from source.  */
-  java_finish_classes ();
+/*   java_finish_classes (); */
 
  finish:
   /* Arrange for any necessary initialization to happen.  */
@@ -2318,12 +2281,5 @@
     }
 }
 
-/* Initialization.  */
-
-void
-init_jcf_parse (void)
-{
-  init_src_parse ();
-}
-
 #include "gt-java-jcf-parse.h"
+#include "gtype-java.h"
Index: Make-lang.in
===================================================================
--- Make-lang.in	(revision 120056)
+++ Make-lang.in	(working copy)
@@ -75,30 +75,15 @@
 	-rm -f $(GCJ)-cross$(exeext)
 	cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)
 
-java.srcextra: java/parse.c
-	-cp -p $^ $(srcdir)/java
+java.srcextra:
 
-java/parse.c: java/parse.y
-	-$(BISON) -t --name-prefix=java_ $(BISONFLAGS) -o $@ $<
-
-$(srcdir)/java/keyword.h: $(srcdir)/java/keyword.gperf
-	(cd $(srcdir)/java || exit 1; \
-	gperf -L ANSI-C -C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,4,$$ \
-		keyword.gperf > k$$$$.h || { \
-	echo "Please update gperf from ftp://ftp.gnu.org/pub/gnu/gperf/" >&2; \
-	rm -f k$$$$.h; \
-	exit 1; } ; \
-	mv -f k$$$$.h keyword.h)
-
-gt-java-parse.h : s-gtype ; @true
-
 # Executables built by this Makefile:
-JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \
+JAVA_OBJS = java/class.o java/decl.o java/expr.o \
   java/constants.o java/lang.o java/typeck.o java/except.o \
   java/verify-glue.o java/verify-impl.o \
   java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \
   java/mangle_name.o java/builtins.o java/resource.o \
-  java/buffer.o java/check-init.o java/jcf-depend.o \
+  java/jcf-depend.o \
   java/jcf-path.o java/boehm.o java/java-gimplify.o
 
 JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
@@ -207,7 +192,6 @@
 # We just have to delete files specific to us.
 
 java.mostlyclean:
-	-rm -f java/parse.c
 	-rm -f java/*$(objext) $(DEMANGLER_PROG)
 	-rm -f java/*$(coverageexts)
 	-rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) \
@@ -215,7 +199,6 @@
 java.clean:
 java.distclean:
 	-rm -f java/config.status java/Makefile
-	-rm -f java/parse.output java/y.tab.c
 java.maintainer-clean:
 	-rm -f $(docobjdir)/gcj.1
 	-rm -f $(docobjdir)/jcf-dump.1
@@ -244,19 +227,14 @@
 #\f
 # .o:.h dependencies.
 JAVA_TREE_H = $(TREE_H) $(HASHTAB_H) java/java-tree.h java/java-tree.def
-JAVA_LEX_C = java/lex.c java/keyword.h java/chartables.h
 
 java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \
   java/jcf-dump.c java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def \
   version.h $(GGC_H) intl.h
 java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   $(TREE_H) $(JAVA_TREE_H) java/parse.h toplev.h
-java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h $(SYSTEM_H) coretypes.h \
-  $(TM_H) toplev.h
 java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   $(JAVA_TREE_H) $(GGC_H) $(FLAGS_H) langhooks.h gt-java-builtins.h
-java/check-init.o: java/check-init.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
-  coretypes.h $(TM_H) toplev.h
 java/class.o: java/class.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   $(JAVA_TREE_H) $(RTL_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
   $(TARGET_H) $(FUNCTION_H) gt-java-class.h $(CGRAPH_H)
@@ -291,7 +269,7 @@
   $(JAVA_TREE_H) $(RTL_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
   $(TARGET_H) $(FUNCTION_H) gt-java-resource.h $(EXPR_H)
 java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
-  java/convert.h toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) $(REAL_H)
+  toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) $(REAL_H)
 java/win32-host.o: java/win32-host.c $(CONFIG_H) $(SYSTEM_H) coretypes.h java/jcf.h
 java/verify-glue.o: java/verify-glue.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
   coretypes.h $(TM_H) java/verify.h toplev.h
@@ -302,11 +280,6 @@
 java/java-gimplify.o: java/java-gimplify.c $(CONFIG_H) $(SYSTEM_H) \
   coretypes.h $(TM_H) $(JAVA_TREE_H) $(TREE_GIMPLE_H) toplev.h
 
-java/parse.o: java/parse.c java/jcf-reader.c $(CONFIG_H) $(SYSTEM_H) \
-  coretypes.h $(TM_H) $(FUNCTION_H) $(JAVA_TREE_H) $(JAVA_LEX_C) java/parse.h \
-  java/lex.h input.h $(GGC_H) debug.h gt-java-parse.h gtype-java.h $(TARGET_H) \
-  $(TREE_DUMP_H)
-
 # jcf-io.o needs $(ZLIBINC) added to cflags.
 java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   $(JAVA_TREE_H)
Index: java-tree.def
===================================================================
--- java-tree.def	(revision 120056)
+++ java-tree.def	(working copy)
@@ -11,36 +11,6 @@
 /* Same as COMPARE_EXPR, but if either value is NaN, the result is 1. */
 DEFTREECODE (COMPARE_G_EXPR, "compare_g_expr", tcc_binary, 2)
 
-/* Unary plus. Operand 0 is the expression the unary plus is applied
-   to */
-DEFTREECODE (UNARY_PLUS_EXPR, "unary_plus_expr", tcc_unary, 1)
-
-/* New array creation expression.
-   Operand 0 is the array base type.
-   Operand 1 is the list of dimension expressions. 
-   Operand 2 is the number of other dimensions of unspecified range.
-   Once patched, the node will bear the type of the created array.  */
-DEFTREECODE (NEW_ARRAY_EXPR, "new_array_expr", tcc_expression, 3)
-
-/* New anonymous array creation expression.
-   Operand 0 is the base type of the anonymous array.
-   Operand 1 is the signature of the dimensions this array contains.
-   Operand 2 is the anonymous array initializer.
-   Once patched, the node will bear the type of the created array.  */
-DEFTREECODE (NEW_ANONYMOUS_ARRAY_EXPR, "new_anonymous_array",
-	     tcc_expression, 3)
-
-/* New class creation expression.
-   Operand 0 is the name of the class to be created
-   Operand 1 is the argument list used to select a constructor.
-   There is no operand 2.  That slot is used for the
-   CALL_EXPR_RTL macro (see preexpand_calls).
-   The type should be the one of the created class.  */
-DEFTREECODE (NEW_CLASS_EXPR, "new_class_expr", tcc_expression, 3)
-
-/* Defines `this' as an expression.  */
-DEFTREECODE (THIS_EXPR, "this", tcc_expression, 0)
-
 /* A labeled block. Operand 0 is the label that will be generated to
    mark the end of the block.  Operand 1 is the labeled block body.  */
 DEFTREECODE (LABELED_BLOCK_EXPR, "labeled_block_expr", tcc_expression, 2)
@@ -49,57 +19,11 @@
    LABELED_BLOCK_EXPR to exit.  */
 DEFTREECODE (EXIT_BLOCK_EXPR, "exit_block_expr", tcc_statement, 1)
 
-/* Case statement expression.
-   Operand 1 is the case value.  */
-DEFTREECODE (CASE_EXPR, "case", tcc_expression, 1)
-
-/* Default statement expression. */
-DEFTREECODE (DEFAULT_EXPR, "default", tcc_expression, 0)
-
 /* Try expression
    Operand 0 is the tried block,
    Operand 1 contains chained catch nodes. */
 DEFTREECODE (TRY_EXPR, "try-catch", tcc_expression, 2)
 
-/* Catch clause.
-   Operand 0 is the catch clause block, which contains the declaration of
-   the catch clause parameter.  */
-DEFTREECODE (JAVA_CATCH_EXPR, "catch", tcc_unary, 1)
-
-/* Synchronized statement.
-   Operand 0 is the expression on which we wish to synchronize,
-   Operand 1 is the synchronized expression block.  */
-DEFTREECODE (SYNCHRONIZED_EXPR, "synchronized", tcc_expression, 2)
-
-/* Throw statement.
-   Operand 0 is the throw expression.  */
-DEFTREECODE (THROW_EXPR, "throw", tcc_unary, 1)
-
-/* Conditional operator.
-   Operand 0 is the condition expression
-   Operand 1 is the then-value
-   Operand 2 is the else-value.  */
-DEFTREECODE (CONDITIONAL_EXPR, "?:", tcc_expression, 3)
-
-/* instanceof operator.
-   Operand 0 is the expression that is getting tested
-   Operand 1 is the class used for the test.  */
-DEFTREECODE (INSTANCEOF_EXPR, "instanceof", tcc_expression, 2)
-
-/* Array initializers.
-   Operand 0 is the (sub) array target to initialize, left to NULL_TREE
-   when the node is created.
-   Operand 1 is a CONSTRUCTOR node.  */
-DEFTREECODE (NEW_ARRAY_INIT, "new_array_init", tcc_unary, 1)
-
-/* Class literal.
-   Operand 0 is the name of the class we're trying to build a
-   reference from.  */
-DEFTREECODE (CLASS_LITERAL, "class_literal", tcc_unary, 1)
-
-/* The Java object within the exception object from the runtime.  */
-DEFTREECODE (JAVA_EXC_OBJ_EXPR, "java_exc_obj_expr", tcc_expression, 0)
-
 /* Annotates a tree node (usually an expression) with source location
    information: a file name (EXPR_WFL_FILENAME);  a line number
    (EXPR_WFL_LINENO); and column number (EXPR_WFL_COLNO).  It is
Index: jvspec.c
===================================================================
--- jvspec.c	(revision 120056)
+++ jvspec.c	(working copy)
@@ -104,7 +104,6 @@
   return NULL;
 }
 
-/* FIXME: these should come from lex.h.  */
 #define JAVA_START_CHAR_P(c) (c < 128 && (ISIDST (c) || c == '$'))
 #define JAVA_PART_CHAR_P(c) (c < 128					      \
 			     && (ISIDNUM (c)				      \
Index: mangle.c
===================================================================
--- mangle.c	(revision 120056)
+++ mangle.c	(working copy)
@@ -1,6 +1,6 @@
 /* Functions related to mangling class names for the GNU compiler
    for the Java(TM) language.
-   Copyright (C) 1998, 1999, 2001, 2002, 2003
+   Copyright (C) 1998, 1999, 2001, 2002, 2003, 2006
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -73,6 +73,167 @@
 /* atms: array template mangled string. */
 static GTY(()) tree atms;
 
+static int
+utf8_cmp (const unsigned char *str, int length, const char *name)
+{
+  const unsigned char *limit = str + length;
+  int i;
+
+  for (i = 0; name[i]; ++i)
+    {
+      int ch = UTF8_GET (str, limit);
+      if (ch != name[i])
+	return ch - name[i];
+    }
+
+  return str == limit ? 0 : 1;
+}
+
+/* A sorted list of all C++ keywords.  */
+static const char *const cxx_keywords[] =
+{
+  "_Complex",
+  "__alignof",
+  "__alignof__",
+  "__asm",
+  "__asm__",
+  "__attribute",
+  "__attribute__",
+  "__builtin_va_arg",
+  "__complex",
+  "__complex__",
+  "__const",
+  "__const__",
+  "__extension__",
+  "__imag",
+  "__imag__",
+  "__inline",
+  "__inline__",
+  "__label__",
+  "__null",
+  "__real",
+  "__real__",
+  "__restrict",
+  "__restrict__",
+  "__signed",
+  "__signed__",
+  "__typeof",
+  "__typeof__",
+  "__volatile",
+  "__volatile__",
+  "and",
+  "and_eq",
+  "asm",
+  "auto",
+  "bitand",
+  "bitor",
+  "bool",
+  "break",
+  "case",
+  "catch",
+  "char",
+  "class",
+  "compl",
+  "const",
+  "const_cast",
+  "continue",
+  "default",
+  "delete",
+  "do",
+  "double",
+  "dynamic_cast",
+  "else",
+  "enum",
+  "explicit",
+  "export",
+  "extern",
+  "false",
+  "float",
+  "for",
+  "friend",
+  "goto",
+  "if",
+  "inline",
+  "int",
+  "long",
+  "mutable",
+  "namespace",
+  "new",
+  "not",
+  "not_eq",
+  "operator",
+  "or",
+  "or_eq",
+  "private",
+  "protected",
+  "public",
+  "register",
+  "reinterpret_cast",
+  "return",
+  "short",
+  "signed",
+  "sizeof",
+  "static",
+  "static_cast",
+  "struct",
+  "switch",
+  "template",
+  "this",      
+  "throw",
+  "true",
+  "try",
+  "typedef",
+  "typeid",
+  "typename",
+  "typeof",
+  "union",
+  "unsigned",
+  "using",
+  "virtual",
+  "void",
+  "volatile",
+  "wchar_t",
+  "while",
+  "xor",
+  "xor_eq"
+};
+
+/* Return true if NAME is a C++ keyword.  */
+static int
+cxx_keyword_p (const char *name, int length)
+{
+  int last = ARRAY_SIZE (cxx_keywords);
+  int first = 0;
+  int mid = (last + first) / 2;
+  int old = -1;
+
+  for (mid = (last + first) / 2;
+       mid != old;
+       old = mid, mid = (last + first) / 2)
+    {
+      int kwl = strlen (cxx_keywords[mid]);
+      int min_length = kwl > length ? length : kwl;
+      int r = utf8_cmp ((const unsigned char *) name, min_length, cxx_keywords[mid]);
+
+      if (r == 0)
+	{
+	  int i;
+	  /* We've found a match if all the remaining characters are `$'.  */
+	  for (i = min_length; i < length && name[i] == '$'; ++i)
+	    ;
+	  if (i == length)
+	    return 1;
+	  r = 1;
+	}
+
+      if (r < 0)
+	last = mid;
+      else
+	first = mid;
+    }
+  return 0;
+}
+
 /* This is the mangling interface: a decl, a class field (.class) and
    the vtable. */
 
Index: expr.c
===================================================================
--- expr.c	(revision 120056)
+++ expr.c	(working copy)
@@ -3672,7 +3672,6 @@
   if (flag_syntax_only)
     return node;
   if (TREE_CODE (node) == CALL_EXPR
-      || TREE_CODE (node) == NEW_CLASS_EXPR
       || (TREE_CODE (node) == COMPOUND_EXPR
 	  && TREE_CODE (TREE_OPERAND (node, 0)) == CALL_EXPR
 	  && TREE_CODE (TREE_OPERAND (node, 1)) == SAVE_EXPR)) 
Index: parse.h
===================================================================
--- parse.h	(revision 120056)
+++ parse.h	(working copy)
@@ -1,5 +1,5 @@
 /* Language parser definitions for the GNU compiler for the Java(TM) language.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
    Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
 
@@ -27,26 +27,10 @@
 #ifndef GCC_JAVA_PARSE_H
 #define GCC_JAVA_PARSE_H
 
-#include "lex.h"
-
 /* Extern global variable declarations */
-extern int java_error_count;
 extern struct obstack temporary_obstack;
 extern int quiet_flag;
 
-#ifndef JC1_LITE
-/* Function extern to java/ */
-extern int int_fits_type_p (tree, tree);
-extern tree stabilize_reference (tree);
-#endif
-
-/* Macros for verbose debug info  */
-#ifdef  VERBOSE_SKELETON
-#define RULE( rule ) printf ( "jv_yacc:%d: rule %s\n", lineno, rule )
-#else
-#define RULE( rule )
-#endif
-
 #ifdef VERBOSE_SKELETON
 #undef SOURCE_FRONTEND_DEBUG
 #define SOURCE_FRONTEND_DEBUG(X)				\
@@ -55,144 +39,6 @@
 #define SOURCE_FRONTEND_DEBUG(X)
 #endif
 
-/* Macro for error recovering  */
-#ifdef YYDEBUG
-#define RECOVERED     					\
-  { if (!quiet_flag) {printf ("** Recovered\n");} }
-#define DRECOVERED(s) 						\
-  { if (!quiet_flag) {printf ("** Recovered (%s)\n", #s);}}
-#else
-#define RECOVERED
-#define DRECOVERED(s)
-#endif
-
-#define DRECOVER(s) {yyerrok; DRECOVERED(s);}
-#define RECOVER     {yyerrok; RECOVERED;}
-
-#define YYERROR_NOW ctxp->java_error_flag = 1
-#define YYNOT_TWICE if (ctxp->prevent_ese != input_line)
-
-/* Accepted modifiers */
-#define CLASS_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_FINAL|ACC_STRICT
-#define FIELD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_FINAL| \
-                        ACC_STATIC|ACC_TRANSIENT|ACC_VOLATILE
-#define METHOD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_ABSTRACT| \
-			 ACC_STATIC|ACC_FINAL|ACC_SYNCHRONIZED|ACC_NATIVE| \
-			 ACC_STRICT
-#define INTERFACE_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_STRICT
-#define INTERFACE_INNER_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_ABSTRACT| \
-				  ACC_STATIC|ACC_PRIVATE
-#define INTERFACE_METHOD_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT
-#define INTERFACE_FIELD_MODIFIERS ACC_PUBLIC|ACC_STATIC|ACC_FINAL
-
-/* Getting a modifier WFL */
-#define MODIFIER_WFL(M)   (ctxp->modifier_ctx [(M) - PUBLIC_TK])
-
-/* Check on modifiers */
-#ifdef USE_MAPPED_LOCATION
-#define THIS_MODIFIER_ONLY(f, m, v, count, l)				\
-  if ((f) & (m))							\
-    {									\
-      tree node = MODIFIER_WFL (v);					\
-      if (!l)								\
-        l = node;							\
-      else								\
-	{								\
-	  expanded_location lloc = expand_location (EXPR_LOCATION (l));	\
-	  expanded_location nloc = expand_location (EXPR_LOCATION (node)); \
-	  if (nloc.column > lloc.column || nloc.line > lloc.line)	\
-	    l = node;							\
-	}								\
-      count++;								\
-    }
-#else
-#define THIS_MODIFIER_ONLY(f, m, v, count, l)				\
-  if ((f) & (m))							\
-    {									\
-      tree node = MODIFIER_WFL (v);					\
-      if ((l)								\
-	  && ((EXPR_WFL_COLNO (node) > EXPR_WFL_COLNO (l))		\
-	      || (EXPR_WFL_LINENO (node) > EXPR_WFL_LINENO (l))))	\
-        l = node;							\
-      else if (!(l))							\
-        l = node;							\
-      count++;								\
-    }
-#endif
-
-#ifdef ATTRIBUTE_GCC_DIAG
-extern void parse_error_context (tree cl, const char *gmsgid, ...) ATTRIBUTE_GCC_DIAG(2,3);
-#endif
-
-#define ABSTRACT_CHECK(FLAG, V, CL, S)				\
-  if ((FLAG) & (V))						\
-    parse_error_context ((CL), "%s method can't be abstract", (S));
-
-#define JCONSTRUCTOR_CHECK(FLAG, V, CL, S)			\
-  if ((FLAG) & (V))						\
-    parse_error_context ((CL), "Constructor can't be %s", (S));	\
-      
-/* Misc. */
-#define exit_java_complete_class()		\
-  {						\
-    return;					\
-  }
-
-#define CLASS_OR_INTERFACE(decl, s1, s2)			\
-   (decl ?							\
-    ((get_access_flags_from_decl (TYPE_NAME (TREE_TYPE (decl)))	\
-      & ACC_INTERFACE) ?					\
-     s2 : s1) : ((s1 [0]=='S'|| s1 [0]=='s') ?			\
-		 (s1 [0]=='S' ? "Supertype" : "supertype") :	\
-		 (s1 [0] > 'A' ? "Type" : "type")))
-
-#define GET_REAL_TYPE(TYPE) 					\
-  (TREE_CODE (TYPE) == TREE_LIST ? TREE_PURPOSE (TYPE) : TYPE)
-
-/* Get TYPE name string, regardless whether TYPE is a class or an
-   array. */
-#define GET_TYPE_NAME(TYPE)				\
-  (TREE_CODE (TYPE_NAME (TYPE)) == IDENTIFIER_NODE ?	\
-   IDENTIFIER_POINTER (TYPE_NAME (TYPE)) :		\
-   IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TYPE))))
-
-/* Pedantic warning on obsolete modifiers. Note: when cl is NULL,
-   flags was set artificially, such as for an interface method.  */
-#define OBSOLETE_MODIFIER_WARNING(cl, flags, __modifier, arg)                \
-  {                                                                          \
-    if (flag_redundant && (cl) && ((flags) & (__modifier)))		     \
-      parse_warning_context (cl,                                             \
-     "Discouraged redundant use of %qs modifier in declaration of %s",      \
-			     java_accstring_lookup (__modifier), arg);       \
-  }
-#define OBSOLETE_MODIFIER_WARNING2(cl, flags, __modifier, arg1, arg2)        \
-  {                                                                          \
-    if (flag_redundant && (cl) && ((flags) & (__modifier)))		     \
-      parse_warning_context (cl,                                             \
-     "Discouraged redundant use of %qs modifier in declaration of %s %qs", \
-			     java_accstring_lookup (__modifier), arg1, arg2);\
-  }
-
-/* Quickly build a temporary pointer on hypothetical type NAME. */
-#define BUILD_PTR_FROM_NAME(ptr, name)		\
-  do {						\
-    ptr = make_node (POINTER_TYPE);		\
-    TYPE_NAME (ptr) = name;			\
-  } while (0)
-
-#define INCOMPLETE_TYPE_P(NODE)				\
-  ((TREE_CODE (NODE) == POINTER_TYPE)			\
-   && !TREE_TYPE (NODE) 				\
-   && TREE_CODE (TYPE_NAME (NODE)) == IDENTIFIER_NODE)
-
-#ifndef USE_MAPPED_LOCATION
-/* Set the EMIT_LINE_NOTE flag of a EXPR_WLF to 1 if debug information
-   are requested. Works in the context of a parser rule. */
-#define JAVA_MAYBE_GENERATE_DEBUG_INFO(node)		\
-  do {if (debug_info_level != DINFO_LEVEL_NONE)	\
-      EXPR_WFL_EMIT_LINE_NOTE (node) = 1; } while (0)
-#endif
-
 /* Types classification, according to the JLS, section 4.2 */
 #define JFLOAT_TYPE_P(TYPE)      (TYPE && TREE_CODE ((TYPE)) == REAL_TYPE)
 #define JINTEGRAL_TYPE_P(TYPE)   ((TYPE) 				   \
@@ -204,765 +50,24 @@
 				  && (JNUMERIC_TYPE_P ((TYPE))		  \
 				  || TREE_CODE ((TYPE)) == BOOLEAN_TYPE))
 
-#define JBSC_TYPE_P(TYPE) ((TYPE) && (((TYPE) == byte_type_node)	\
-				      || ((TYPE) == short_type_node)	\
-				      || ((TYPE) == char_type_node)))
-
 /* Not defined in the LRM */
 #define JSTRING_TYPE_P(TYPE) ((TYPE) 					   \
 			      && ((TYPE) == string_type_node ||		   \
 				  (TREE_CODE (TYPE) == POINTER_TYPE &&	   \
 				   TREE_TYPE (TYPE) == string_type_node)))
-#define JSTRING_P(NODE) ((NODE)						\
-			 && (TREE_CODE (NODE) == STRING_CST		\
-			     || IS_CRAFTED_STRING_BUFFER_P (NODE)	\
-			     || JSTRING_TYPE_P (TREE_TYPE (NODE))))
-
 #define JREFERENCE_TYPE_P(TYPE) ((TYPE)					      \
 				 && (TREE_CODE (TYPE) == RECORD_TYPE 	      \
 				     ||	(TREE_CODE (TYPE) == POINTER_TYPE     \
 					 &&  TREE_CODE (TREE_TYPE (TYPE)) ==  \
 					 RECORD_TYPE)))
-#define JNULLP_TYPE_P(TYPE) ((TYPE) && (TREE_CODE (TYPE) == POINTER_TYPE) \
-			     && (TYPE) == TREE_TYPE (null_pointer_node))
 
-/* Other predicates */
-#define JDECL_P(NODE) (NODE && (TREE_CODE (NODE) == PARM_DECL		\
-				|| TREE_CODE (NODE) == VAR_DECL		\
-				|| TREE_CODE (NODE) == FIELD_DECL))
-
-#define TYPE_INTERFACE_P(TYPE) 					\
-  (CLASS_P (TYPE) && CLASS_INTERFACE (TYPE_NAME (TYPE)))
-
-#define TYPE_CLASS_P(TYPE) (CLASS_P (TYPE) 				\
-			    && !CLASS_INTERFACE (TYPE_NAME (TYPE)))
-
-/* Identifier business related to 1.1 language extensions.  */
-
-#define IDENTIFIER_INNER_CLASS_OUTER_FIELD_ACCESS(NODE)	\
-  (TREE_CODE (NODE) == IDENTIFIER_NODE &&		\
-   IDENTIFIER_LENGTH (NODE) >= 8 &&			\
-   IDENTIFIER_POINTER (NODE)[7] != '0')
-
-/* Build the string val$<O> and store it into N. The is used to
-   construct the name of inner class hidden fields used to alias outer
-   scope local variables.  */
-#define MANGLE_OUTER_LOCAL_VARIABLE_NAME(N, O)				\
-  {									\
-    char *mangled_name;							\
-    obstack_grow (&temporary_obstack, "val$", 4);			\
-    obstack_grow (&temporary_obstack,					\
-		  IDENTIFIER_POINTER ((O)), IDENTIFIER_LENGTH ((O)));	\
-    obstack_1grow (&temporary_obstack, '\0');				\
-    mangled_name = obstack_finish (&temporary_obstack);			\
-    (N) = get_identifier (mangled_name);				\
-    obstack_free (&temporary_obstack, mangled_name);			\
-  }
-
-/* Build the string parm$<O> and store in into the identifier N. This
-   is used to construct the name of hidden parameters used to
-   initialize outer scope aliases.  */
-#define MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID(N, O)		\
-  {									\
-    char *mangled_name;							\
-    obstack_grow (&temporary_obstack, "parm$", 5);			\
-    obstack_grow (&temporary_obstack, 					\
-		  IDENTIFIER_POINTER ((O)), IDENTIFIER_LENGTH ((O)));	\
-    obstack_1grow (&temporary_obstack, '\0');				\
-    mangled_name = obstack_finish (&temporary_obstack);			\
-    (N) = get_identifier (mangled_name);				\
-    obstack_free (&temporary_obstack, mangled_name);			\
-  }
-
-#define MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR(N, S)	\
-  {								\
-    char *mangled_name;							\
-    obstack_grow (&temporary_obstack, "parm$", 5);		\
-    obstack_grow (&temporary_obstack, (S), strlen ((S)));	\
-    obstack_1grow (&temporary_obstack, '\0');			\
-    mangled_name = obstack_finish (&temporary_obstack);			\
-    (N) = get_identifier (mangled_name);				\
-    obstack_free (&temporary_obstack, mangled_name);			\
-  }
-
-/* Skip THIS and artificial parameters found in function decl M and
-   assign the result to C. We don't do that for $finit$, since it's
-   knowingly called with artificial parms.  */
-#define SKIP_THIS_AND_ARTIFICIAL_PARMS(C,M)			\
-  {								\
-    int i;							\
-    (C) = TYPE_ARG_TYPES (TREE_TYPE ((M)));			\
-    if (!METHOD_STATIC ((M)))					\
-      (C) = TREE_CHAIN (C);					\
-    if (DECL_CONSTRUCTOR_P ((M))				\
-        && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT ((M))))	\
-      (C) = TREE_CHAIN (C);					\
-    if (!DECL_FINIT_P ((M)))					\
-      for (i = DECL_FUNCTION_NAP ((M)); i; i--)			\
-       (C) = TREE_CHAIN (C);					\
-  }
-
-/* Mark final parameters in method M, by comparison of the argument
-   list L. This macro is used to set the flag once the method has been
-   build.  */
-#define MARK_FINAL_PARMS(M, L)						\
-  {									\
-    tree current = TYPE_ARG_TYPES (TREE_TYPE ((M)));			\
-    tree list = (L);							\
-    if (!METHOD_STATIC ((M)))						\
-      current = TREE_CHAIN (current);					\
-    for (; current !=  end_params_node;					\
-	 current = TREE_CHAIN (current), list = TREE_CHAIN (list))	\
-      ARG_FINAL_P (current) = ARG_FINAL_P (list);			\
-    if (current != list)						\
-      abort ();								\
-  }
-
-/* Reset the ARG_FINAL_P that might have been set in method M args.  */
-#define UNMARK_FINAL_PARMS(M)						\
-  {									\
-    tree current;							\
-    for (current = TYPE_ARG_TYPES (TREE_TYPE ((M))); 			\
-	 current != end_params_node; current = TREE_CHAIN (current))	\
-      ARG_FINAL_P (current) = 0;					\
-  }
-
-/* Reverse a crafted parameter list as required.  */
-#define CRAFTED_PARAM_LIST_FIXUP(P)		\
-  {						\
-    if ((P))					\
-      {						\
-	tree last = (P);			\
-	(P) = nreverse (P);			\
-	TREE_CHAIN (last) = end_params_node;	\
-      }						\
-    else					\
-      (P) = end_params_node;			\
-  }
-
-/* Modes governing the creation of a alias initializer parameter
-   lists. AIPL stands for Alias Initializer Parameter List.  */
-enum {
-  AIPL_FUNCTION_CREATION,	  /* Suitable for artificial method creation */
-  AIPL_FUNCTION_DECLARATION,	  /* Suitable for declared methods */
-  AIPL_FUNCTION_CTOR_INVOCATION,  /* Invocation of constructors */
-  AIPL_FUNCTION_FINIT_INVOCATION  /* Invocation of $finit$ */
-};
-
-/* Standard error messages */
-#define ERROR_CANT_CONVERT_TO_BOOLEAN(OPERATOR, NODE, TYPE)		\
-  parse_error_context ((OPERATOR),					\
-    "Incompatible type for %qs. Can't convert %qs to boolean",	\
-    operator_string ((NODE)), lang_printable_name ((TYPE),0))
-
-#define ERROR_CANT_CONVERT_TO_NUMERIC(OPERATOR, NODE, TYPE)		\
-  parse_error_context ((OPERATOR),					\
-      "Incompatible type for %qs. Can't convert %qs to numeric type",	\
-      operator_string ((NODE)), lang_printable_name ((TYPE), 0))
-
-#define ERROR_CAST_NEEDED_TO_INTEGRAL(OPERATOR, NODE, TYPE)		\
-do {									\
-  tree _operator = (OPERATOR), _node = (NODE), _type = (TYPE);		\
-  if (JPRIMITIVE_TYPE_P (_type))					\
-    parse_error_context (_operator,					\
-"Incompatible type for %qs. Explicit cast needed to convert %qs to integral",\
-			 operator_string(_node),			\
-			 lang_printable_name (_type, 0));		\
-  else									\
-    parse_error_context (_operator,					\
-      "Incompatible type for %qs. Can't convert %qs to integral",	\
-			 operator_string(_node),			\
-			 lang_printable_name (_type, 0));		\
-} while (0)
-
-#define ERROR_VARIABLE_NOT_INITIALIZED(WFL, V)			\
-  parse_error_context						\
-    ((WFL), "Variable %qs may not have been initialized",	\
-     IDENTIFIER_POINTER (V))
-
-/* Definition for loop handling. This is Java's own definition of a
-   loop body. See parse.y for documentation. It's valid once you hold
-   a loop's body (LOOP_EXPR_BODY) */
-
-/* The loop main block is the one hold the condition and the loop body */
-#define LOOP_EXPR_BODY_MAIN_BLOCK(NODE) TREE_OPERAND (NODE, 0)
-/* And then there is the loop update block */
-#define LOOP_EXPR_BODY_UPDATE_BLOCK(NODE) TREE_OPERAND (NODE, 1)
-
-/* Inside the loop main block, there is the loop condition and the
-   loop body. They may be reversed if the loop being described is a
-   do-while loop. NOTE: if you use a WFL around the EXIT_EXPR so you
-   can issue debug info for it, the EXIT_EXPR will be one operand
-   further. */
-#define LOOP_EXPR_BODY_CONDITION_EXPR(NODE, R) 			\
-  TREE_OPERAND (LOOP_EXPR_BODY_MAIN_BLOCK (NODE), (R ? 1 : 0))
-
-/* Here is the labeled block the loop real body is encapsulated in */
-#define LOOP_EXPR_BODY_LABELED_BODY(NODE, R)			\
-  TREE_OPERAND (LOOP_EXPR_BODY_MAIN_BLOCK (NODE), (R ? 0 : 1))
-/* And here is the loop's real body */
-#define LOOP_EXPR_BODY_BODY_EXPR(NODE, R)			\
-  LABELED_BLOCK_BODY (LOOP_EXPR_BODY_LABELED_BODY(NODE, R))
-
-#define PUSH_LABELED_BLOCK(B)				\
-  {							\
-    TREE_CHAIN (B) = ctxp->current_labeled_block;	\
-    ctxp->current_labeled_block = (B);			\
-  }
-#define POP_LABELED_BLOCK() 						\
-  ctxp->current_labeled_block = TREE_CHAIN (ctxp->current_labeled_block)
-
-#define PUSH_LOOP(L)				\
-  {						\
-    TREE_CHAIN (L) = ctxp->current_loop;	\
-    ctxp->current_loop = (L);			\
-  }
-#define POP_LOOP() ctxp->current_loop = TREE_CHAIN (ctxp->current_loop)
-
-#define PUSH_EXCEPTIONS(E)					\
-  currently_caught_type_list =					\
-    tree_cons (NULL_TREE, (E), currently_caught_type_list);
-
-#define POP_EXCEPTIONS()						\
-  currently_caught_type_list = TREE_CHAIN (currently_caught_type_list)
-
-/* Check that we're inside a try block.  */
-#define IN_TRY_BLOCK_P()				\
-  (currently_caught_type_list 				\
-   && ((TREE_VALUE (currently_caught_type_list) !=	\
-	DECL_FUNCTION_THROWS (current_function_decl))	\
-       || TREE_CHAIN (currently_caught_type_list)))
-
-/* Check that we have exceptions in E.  */
-#define EXCEPTIONS_P(E) ((E) ? TREE_VALUE (E) : NULL_TREE)
-
-/* Anonymous array access */
-#define ANONYMOUS_ARRAY_BASE_TYPE(N)   TREE_OPERAND ((N), 0)
-#define ANONYMOUS_ARRAY_DIMS_SIG(N)    TREE_OPERAND ((N), 1)
-#define ANONYMOUS_ARRAY_INITIALIZER(N) TREE_OPERAND ((N), 2)
-
-/* Invocation modes, as returned by invocation_mode (). */
-enum {
-  INVOKE_STATIC,
-  INVOKE_NONVIRTUAL,
-  INVOKE_SUPER,
-  INVOKE_INTERFACE,
-  INVOKE_VIRTUAL
-};
-
-/* Unresolved type identifiers handling. When we process the source
-   code, we blindly accept an unknown type identifier and try to
-   resolve it later. When an unknown type identifier is encountered
-   and used, we record in a struct jdep element what the incomplete
-   type is and what it should patch. Later, java_complete_class will
-   process all classes known to have unresolved type
-   dependencies. Within each of these classes, this routine will
-   process unresolved type dependencies (JDEP_TO_RESOLVE), patch what
-   needs to be patched in the dependent tree node (JDEP_GET_PATCH,
-   JDEP_APPLY_PATCH) and perform other actions dictated by the context
-   of the patch (JDEP_KIND). The ideas are: we patch only what needs
-   to be patched, and with java_complete_class called at the right
-   time, we will start processing incomplete function bodies tree
-   nodes with everything external to function's bodies already
-   completed, it makes things much simpler. */
-
-enum jdep_code {
-  JDEP_NO_PATCH,		/* Must be first */
-  JDEP_SUPER,			/* Patch the type of one type
-				   supertype. Requires some check
-				   before it's done */
-  JDEP_FIELD,			/* Patch the type of a class field */
-
-  /* JDEP_{METHOD,METHOD_RETURN,METHOD_END} to be kept in order */
-  JDEP_METHOD,			/* Mark the beginning of the patching
-				   of a method declaration, including
-				   it's arguments */
-  JDEP_METHOD_RETURN,		/* Mark the beginning of the patching
-				   of a method declaration. Arguments
-				   aren't patched, only the returned
-				   type is */
-  JDEP_METHOD_END,		/* Mark the end of the patching of a
-				   method declaration. It indicates
-				   that it's time to compute and
-				   install a new signature */
-
-  JDEP_INTERFACE,		/* Patch the type of a Class/interface
-				   extension */
-  JDEP_VARIABLE,		/* Patch the type of a variable declaration */
-  JDEP_PARM,			/* Patch the type of a parm declaration */
-  JDEP_TYPE,			/* Patch a random tree node type,
-                                   without the need for any specific
-                                   actions */
-  JDEP_EXCEPTION,		/* Patch exceptions specified by `throws' */
-  JDEP_ANONYMOUS		/* Patch anonymous classes
-				   (implementation or extension.) */
-
-};
-
-typedef struct _jdep {
-  ENUM_BITFIELD(jdep_code) kind : 8; /* Type of patch */
-
-  unsigned int  flag0 : 1;	/* Some flags */
-  tree decl;			/* Tied decl/or WFL */
-  tree solv;			/* What to solve */
-  tree wfl;			/* Where thing to resolve where found */
-  tree misc;			/* Miscellaneous info (optional). */
-  tree enclosing;		/* The enclosing (current) class */
-  tree *patch;			/* Address of a location to patch */
-  struct _jdep *next;		/* Linked list */
-} jdep;
-
-
-#define JDEP_DECL(J)          ((J)->decl)
-#define JDEP_DECL_WFL(J)      ((J)->decl)
-#define JDEP_KIND(J)          ((J)->kind)
-#define JDEP_WFL(J)           ((J)->wfl)
-#define JDEP_MISC(J)          ((J)->misc)
-#define JDEP_ENCLOSING(J)     ((J)->enclosing)
-#define JDEP_CLASS(J)         ((J)->class)
-#define JDEP_APPLY_PATCH(J,P) (*(J)->patch = (P))
-#define JDEP_GET_PATCH(J)     ((J)->patch)
-#define JDEP_CHAIN(J)         ((J)->next)
-#define JDEP_TO_RESOLVE(J)    ((J)->solv)
-#define JDEP_RESOLVED_DECL(J) ((J)->solv)
-#define JDEP_RESOLVED(J, D)   ((J)->solv = D)
-#define JDEP_RESOLVED_P(J)    \
-	(!(J)->solv || TREE_CODE ((J)->solv) != POINTER_TYPE)
-
-struct jdeplist_s {
-  jdep *first;
-  jdep *last;
-  struct jdeplist_s *next;
-};
-typedef struct jdeplist_s jdeplist;
-
-#define CLASSD_FIRST(CD) ((CD)->first)
-#define CLASSD_LAST(CD)  ((CD)->last)
-#define CLASSD_CHAIN(CD) ((CD)->next)
-
-#define JDEP_INSERT(L,J)			\
-  {						\
-    if (!(L)->first)				\
-      (L)->last = (L)->first = (J);		\
-    else					\
-      {						\
-	JDEP_CHAIN ((L)->last) = (J);		\
-	(L)->last = (J);			\
-      }						\
-  }
-
-/* if TYPE can't be resolved, obtain something suitable for its
-   resolution (TYPE is saved in SAVE before being changed). and set
-   CHAIN to 1. Otherwise, type is set to something usable. CHAIN is
-   usually used to determine that a new DEP must be installed on TYPE.
-   Note that when compiling java.lang.Object, references to Object are
-   java.lang.Object.  */
-#define SET_TYPE_FOR_RESOLUTION(TYPE, SAVE, CHAIN)			\
-  {									\
-    tree _returned_type;						\
-    (CHAIN) = 0;							\
-    if (TREE_TYPE (GET_CPC ()) == object_type_node			\
-	&& TREE_CODE (TYPE) == EXPR_WITH_FILE_LOCATION			\
-	&& EXPR_WFL_NODE (TYPE) == unqualified_object_id_node)		\
-      (TYPE) = object_type_node;					\
-    else								\
-      {									\
-	if (unresolved_type_p (type, &_returned_type))			\
-	  {								\
-	    if (_returned_type)						\
-	      (TYPE) = _returned_type;					\
-	    else							\
-	      {								\
-	        tree _type;						\
-                WFL_STRIP_BRACKET (_type, TYPE);			\
-		(SAVE) = (_type);					\
-		(TYPE) = obtain_incomplete_type (TYPE);			\
-		CHAIN = 1;						\
-	      }								\
-	  }								\
-      }									\
-  }
-
-#define WFL_STRIP_BRACKET(TARGET, TYPE)					  \
-{									  \
-  tree __type = (TYPE);							  \
-  if (TYPE && TREE_CODE (TYPE) == EXPR_WITH_FILE_LOCATION)		  \
-    {									  \
-      tree _node;							  \
-      if (build_type_name_from_array_name (EXPR_WFL_NODE (TYPE), &_node)) \
-        {								  \
-          tree _new = copy_node (TYPE);					  \
-          EXPR_WFL_NODE (_new) = _node;				  	  \
-          __type = _new;						  \
-        }								  \
-    }									  \
-  (TARGET) = __type;							  \
-}
-
-/* If NAME contains one or more trailing []s, NAMELEN will be the
-   adjusted to be the index of the last non bracket character in
-   NAME. ARRAY_DIMS will contain the number of []s found.  */
-
-#define STRING_STRIP_BRACKETS(NAME, NAMELEN, ARRAY_DIMS)                  \
-{									  \
-  ARRAY_DIMS = 0;							  \
-  while (NAMELEN >= 2 && (NAME)[NAMELEN - 1] == ']')			  \
-    {									  \
-      NAMELEN -= 2;							  \
-      (ARRAY_DIMS)++;							  \
-    }									  \
-}
-
-/* Promote a type if it won't be registered as a patch */
-#define PROMOTE_RECORD_IF_COMPLETE(TYPE, IS_INCOMPLETE)		\
-  {								\
-    if (!(IS_INCOMPLETE) && TREE_CODE (TYPE) == RECORD_TYPE)	\
-      (TYPE) = promote_type (TYPE);				\
-  }
-
-/* Insert a DECL in the current block */
-#define BLOCK_CHAIN_DECL(NODE)						    \
-  {		 							    \
-    TREE_CHAIN ((NODE)) = 						    \
-      BLOCK_EXPR_DECLS (GET_CURRENT_BLOCK (current_function_decl));         \
-    BLOCK_EXPR_DECLS (GET_CURRENT_BLOCK (current_function_decl)) = (NODE);  \
-  }
-
-/* Return the current block, either found in the body of the currently
-   declared function or in the current static block being defined. */
-#define GET_CURRENT_BLOCK(F) ((F) ? DECL_FUNCTION_BODY ((F)) :	\
-			     current_static_block)
-
-#ifndef USE_MAPPED_LOCATION
-/* Retrieve line/column from a WFL. */
-#define EXPR_WFL_GET_LINECOL(V,LINE,COL)	\
-  {						\
-     (LINE) = (V) >> 12;			\
-     (COL) = (V) & 0xfff;			\
-   }
-#endif
-
-#define EXPR_WFL_QUALIFICATION(WFL) TREE_OPERAND ((WFL), 1)
-#define QUAL_WFL(NODE) TREE_PURPOSE (NODE)
-#define QUAL_RESOLUTION(NODE) TREE_VALUE (NODE)
-#define QUAL_DECL_TYPE(NODE) GET_SKIP_TYPE (NODE)
-
-#define GET_SKIP_TYPE(NODE)				\
-  (TREE_CODE (TREE_TYPE (NODE)) == POINTER_TYPE ?	\
-   TREE_TYPE (TREE_TYPE (NODE)): TREE_TYPE (NODE))
-
-/* Handy macros for the walk operation */
-#define COMPLETE_CHECK_OP(NODE, N)			\
-{							\
-  TREE_OPERAND ((NODE), (N)) = 				\
-    java_complete_tree (TREE_OPERAND ((NODE), (N)));	\
-  if (TREE_OPERAND ((NODE), (N)) == error_mark_node)	\
-    return error_mark_node;				\
-}
-#define COMPLETE_CHECK_OP_0(NODE) COMPLETE_CHECK_OP(NODE, 0)
-#define COMPLETE_CHECK_OP_1(NODE) COMPLETE_CHECK_OP(NODE, 1)
-#define COMPLETE_CHECK_OP_2(NODE) COMPLETE_CHECK_OP(NODE, 2)
-
-/* Building invocations: append(ARG) and StringBuffer(ARG) */
-#define BUILD_APPEND(ARG)						      \
-  ((JSTRING_TYPE_P (TREE_TYPE (ARG)) || JPRIMITIVE_TYPE_P (TREE_TYPE (ARG)))  \
-   ? build_method_invocation (wfl_append,                                     \
-			      ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE)\
-   : build_method_invocation (wfl_append,                                     \
-			      ARG ? build_tree_list (NULL,                    \
-						     build1 (CONVERT_EXPR,    \
-							     object_type_node,\
-							     (ARG)))          \
-			      : NULL_TREE))
-#define BUILD_STRING_BUFFER(ARG)					      \
-  build_new_invocation (wfl_string_buffer, 				      \
-			(ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE))
-
-#define BUILD_THROW(WHERE, WHAT)				\
-  {								\
-    (WHERE) = 							\
-      build3 (CALL_EXPR, void_type_node,			\
-	      build_address_of (throw_node),			\
-	      build_tree_list (NULL_TREE, (WHAT)), NULL_TREE);	\
-    TREE_SIDE_EFFECTS ((WHERE)) = 1;				\
-  }
-
-/* Set wfl_operator for the most accurate error location */
-#ifdef USE_MAPPED_LOCATION
-#define SET_WFL_OPERATOR(WHICH, NODE, WFL)		\
-  SET_EXPR_LOCATION (WHICH,				\
-    (TREE_CODE (WFL) == EXPR_WITH_FILE_LOCATION ?	\
-     EXPR_LOCATION (WFL) : EXPR_LOCATION (NODE)))
-#else
-#define SET_WFL_OPERATOR(WHICH, NODE, WFL)		\
-  EXPR_WFL_LINECOL (WHICH) =				\
-    (TREE_CODE (WFL) == EXPR_WITH_FILE_LOCATION ?	\
-     EXPR_WFL_LINECOL (WFL) : EXPR_WFL_LINECOL (NODE))
-#endif
-
-#define PATCH_METHOD_RETURN_ERROR()		\
-  {						\
-    if (ret_decl)				\
-      *ret_decl = NULL_TREE;			\
-    return error_mark_node;			\
-  }
-
-/* Convenient macro to check. Assumes that CLASS is a CLASS_DECL.  */
-#define CHECK_METHODS(CLASS)			\
-  {						\
-    if (CLASS_INTERFACE ((CLASS)))		\
-      java_check_abstract_methods ((CLASS));	\
-    else					\
-      java_check_regular_methods ((CLASS));	\
-  }
-
-#define CLEAR_DEPRECATED  ctxp->deprecated = 0
-
-#define CHECK_DEPRECATED_NO_RESET(DECL)		\
-  {						\
-    if (ctxp->deprecated)			\
-      DECL_DEPRECATED (DECL) = 1;		\
-  }
-
-/* Using and reseting the @deprecated tag flag */
-#define CHECK_DEPRECATED(DECL)			\
-  {						\
-    if (ctxp->deprecated)			\
-      DECL_DEPRECATED (DECL) = 1;		\
-    ctxp->deprecated = 0;			\
-  }
-
-/* Register an import */
-#define REGISTER_IMPORT(WHOLE, NAME)					\
-{									\
-  IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P ((NAME)) = 1;			\
-  ctxp->import_list = tree_cons ((WHOLE), (NAME), ctxp->import_list);	\
-}
-
-/* Macro to access the osb (opening square bracket) count */
-#define CURRENT_OSB(C) (C)->osb_number [(C)->osb_depth]
-
-/* Parser context data structure. */
-struct parser_ctxt GTY(()) {
-  const char *filename;		     /* Current filename */
-  location_t file_start_location;
-  location_t save_location;
-  struct parser_ctxt *next;
-
-  java_lexer * GTY((skip)) lexer; /* Current lexer state */
-  char marker_begining;		     /* Marker. Should be a sub-struct */
-  int ccb_indent;		     /* Number of unmatched { seen. */
-  /* The next two fields are only source_location if USE_MAPPED_LOCATION.
-     Otherwise, they are integer line number, but we can't have #ifdefs
-     in GTY structures. */
-  source_location first_ccb_indent1; /* First { at ident level 1 */
-  source_location last_ccb_indent1;  /* Last } at ident level 1 */
-  int parser_ccb_indent;	     /* Keep track of {} indent, parser */
-  int osb_depth;		     /* Current depth of [ in an expression */
-  int osb_limit;		     /* Limit of this depth */
-  int * GTY ((skip)) osb_number; /* Keep track of ['s */
-  char marker_end;		     /* End marker. Should be a sub-struct */
-
-  /* The flags section */
-
-  /* Indicates a context used for saving the parser status. The
-     context must be popped when the status is restored. */
-  unsigned saved_data_ctx:1;	
-  /* Indicates that a context already contains saved data and that the
-     next save operation will require a new context to be created. */
-  unsigned saved_data:1;
-  /* Report error when true */
-  unsigned java_error_flag:1;
-  /* @deprecated tag seen */
-  unsigned deprecated:1;
-  /* Flag to report certain errors (fix this documentation. FIXME) */
-  unsigned class_err:1;
-
-  /* This section is used only if we compile jc1 */
-  tree modifier_ctx [12];	    /* WFL of modifiers */
-  tree class_type;		    /* Current class */
-  tree function_decl;	            /* Current function decl, save/restore */
-
-  int prevent_ese;	            /* Prevent expression statement error */
-
-  int formal_parameter_number;	    /* Number of parameters found */
-  int interface_number;		    /* # itfs declared to extend an itf def */
-
-  tree package;			    /* Defined package ID */
-
-  /* These two lists won't survive file traversal */
-  tree  class_list;		    /* List of classes in a CU */
-  jdeplist * GTY((skip)) classd_list; /* Classe dependencies in a CU */
-  
-  tree  current_parsed_class;	    /* Class currently parsed */
-  tree  current_parsed_class_un;    /* Curr. parsed class unqualified name */
-
-  tree non_static_initialized;	    /* List of non static initialized fields */
-  tree static_initialized;	    /* List of static non final initialized */
-  tree instance_initializers;	    /* List of instance initializers stmts */
-
-  tree import_list;		    /* List of import */
-  tree import_demand_list;	    /* List of import on demand */
-
-  tree current_loop;		    /* List of the currently nested 
-				       loops/switches */
-  tree current_labeled_block;	    /* List of currently nested
-				       labeled blocks. */
-
-  int pending_block;		    /* Pending block to close */
-
-  int explicit_constructor_p;	    /* >0 when processing an explicit
-				       constructor. This flag is used to trap
-				       illegal argument usage during an
-				       explicit constructor invocation. */
-};
-
-/* A set of macros to push/pop/access the currently parsed class.  */
-#define GET_CPC_LIST()     ctxp->current_parsed_class
-
-/* Currently class being parsed is an inner class if an enclosing
-   class has been already pushed. This truth value is only valid prior
-   an inner class is pushed. After, use FIXME. */
-#define CPC_INNER_P() GET_CPC_LIST ()
-
-/* The TYPE_DECL node of the class currently being parsed.  */
-#define GET_CPC() TREE_VALUE (GET_CPC_LIST ())
-
-/* Get the currently parsed class unqualified IDENTIFIER_NODE.  */
-#define GET_CPC_UN() TREE_PURPOSE (GET_CPC_LIST ())
-
-/* Get a parsed class unqualified IDENTIFIER_NODE from its CPC node.  */
-#define GET_CPC_UN_NODE(N) TREE_PURPOSE (N)
-
-/* Get the currently parsed class DECL_TYPE from its CPC node.  */
-#define GET_CPC_DECL_NODE(N) TREE_VALUE (N)
-
-/* The currently parsed enclosing currently parsed TREE_LIST node.  */
-#define GET_ENCLOSING_CPC() TREE_CHAIN (GET_CPC_LIST ())
-
-/* Get the next enclosing context.  */
-#define GET_NEXT_ENCLOSING_CPC(C) TREE_CHAIN (C)
-
-/* The DECL_TYPE node of the enclosing currently parsed
-   class. NULL_TREE if the currently parsed class isn't an inner
-   class.  */
-#define GET_ENCLOSING_CPC_CONTEXT() (GET_ENCLOSING_CPC () ?		      \
-                                     TREE_VALUE (GET_ENCLOSING_CPC ()) :      \
-				     NULL_TREE)
-
-/* Make sure that innerclass T sits in an appropriate enclosing
-   context.  */
-#define INNER_ENCLOSING_SCOPE_CHECK(T)					      \
-  (INNER_CLASS_TYPE_P ((T)) && !ANONYMOUS_CLASS_P ((T))			      \
-   && ((current_this							      \
-	/* We have a this and it's not the right one */			      \
-	&& (DECL_CONTEXT (TYPE_NAME ((T)))				      \
-	    != TYPE_NAME (TREE_TYPE (TREE_TYPE (current_this))))	      \
-	&& !inherits_from_p (TREE_TYPE (TREE_TYPE (current_this)),	      \
-			     TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T))))	      \
-        && !common_enclosing_instance_p (TREE_TYPE (TREE_TYPE (current_this)),\
-					(T))                                  \
-	&& INNER_CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (current_this)))          \
-	&& !inherits_from_p                                                   \
-	      (TREE_TYPE (DECL_CONTEXT                                        \
-			  (TYPE_NAME (TREE_TYPE (TREE_TYPE (current_this))))),\
-	       TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T)))))                     \
-       /* We don't have a this, which is OK if the current function is        \
-	  static. */                                                          \
-       || (!current_this						      \
-	   && current_function_decl                                           \
-           && ! METHOD_STATIC (current_function_decl))))
-
-/* Push macro. First argument to PUSH_CPC is a DECL_TYPE, second
-   argument is the unqualified currently parsed class name.  */
-#define PUSH_CPC(C,R) { 					\
-                        ctxp->current_parsed_class =		\
-		        tree_cons ((R), (C), GET_CPC_LIST ()); 	\
-		      }
-
-/* In case of an error, push an error.  */
-#define PUSH_ERROR() PUSH_CPC (error_mark_node, error_mark_node)
-
-/* Pop macro. Before we pop, we link the current inner class decl (if any)
-   to its enclosing class.  */
-#define POP_CPC() {					\
-		    link_nested_class_to_enclosing ();	\
-		    ctxp->current_parsed_class =	\
-		      TREE_CHAIN (GET_CPC_LIST ());	\
-		  }
-
-#define DEBUG_CPC()						\
-  do								\
-    {								\
-      tree tmp =  ctxp->current_parsed_class;			\
-      while (tmp)						\
-	{							\
-	  fprintf (stderr, "%s ",				\
-		   IDENTIFIER_POINTER (TREE_PURPOSE (tmp)));	\
-	  tmp = TREE_CHAIN (tmp);				\
-	}							\
-    } 								\
-  while (0);
-
-/* Access to the various initializer statement lists */
-#define CPC_INITIALIZER_LIST(C)          ((C)->non_static_initialized)
-#define CPC_STATIC_INITIALIZER_LIST(C)   ((C)->static_initialized)
-#define CPC_INSTANCE_INITIALIZER_LIST(C) ((C)->instance_initializers)
-
-/* Access to the various initializer statements */
-#define CPC_INITIALIZER_STMT(C) (TREE_PURPOSE (CPC_INITIALIZER_LIST (C)))
-#define CPC_STATIC_INITIALIZER_STMT(C) \
-  (TREE_PURPOSE (CPC_STATIC_INITIALIZER_LIST (C)))
-#define CPC_INSTANCE_INITIALIZER_STMT(C) \
-  (TREE_PURPOSE (CPC_INSTANCE_INITIALIZER_LIST (C)))
-
-/* Set various initializer statements */
-#define SET_CPC_INITIALIZER_STMT(C,S)			\
-  if (CPC_INITIALIZER_LIST (C))				\
-    TREE_PURPOSE (CPC_INITIALIZER_LIST (C)) = (S);
-#define SET_CPC_STATIC_INITIALIZER_STMT(C,S)			\
-  if (CPC_STATIC_INITIALIZER_LIST (C))				\
-    TREE_PURPOSE (CPC_STATIC_INITIALIZER_LIST (C)) = (S);
-#define SET_CPC_INSTANCE_INITIALIZER_STMT(C,S)			\
-  if (CPC_INSTANCE_INITIALIZER_LIST(C))				\
-    TREE_PURPOSE (CPC_INSTANCE_INITIALIZER_LIST (C)) = (S);
-
-/* This is used by the lexer to communicate with the parser.  It is
-   set on an integer constant if the radix is NOT 10, so that the parser
-   can correctly diagnose a numeric overflow.  */
-#define JAVA_NOT_RADIX10_FLAG(NODE) TREE_LANG_FLAG_0(NODE)
-
-#ifndef JC1_LITE
-void java_complete_class (void);
-void java_check_circular_reference (void);
-void java_fix_constructors (void);
-void java_layout_classes (void);
-void java_reorder_fields (void);
-tree java_method_add_stmt (tree, tree);
 int java_report_errors (void);
 extern tree do_resolve_class (tree, tree, tree, tree, tree);
-#endif
-char *java_get_line_col (const char *, int, int);
-extern void reset_report (void);
 
 /* Always in use, no matter what you compile */
 void java_push_parser_context (void);
 void java_pop_parser_context (int);
-void java_init_lex (FILE *, const char *);
 extern void java_parser_context_save_global (void);
 extern void java_parser_context_restore_global (void);
-int yyparse (void);
-extern int java_parse (void);
-extern void yyerror (const char *)
-#ifdef JC1_LITE
-ATTRIBUTE_NORETURN
-#endif
-;
-extern void java_expand_classes (void);
-extern void java_finish_classes (void);
 
-extern GTY(()) struct parser_ctxt *ctxp;
-extern GTY(()) struct parser_ctxt *ctxp_for_generation;
-extern GTY(()) struct parser_ctxt *ctxp_for_generation_last;
-
 #endif /* ! GCC_JAVA_PARSE_H */
Index: lang.c
===================================================================
--- lang.c	(revision 120056)
+++ lang.c	(working copy)
@@ -120,16 +120,11 @@
    prototypes.  Starts out false.  */
 static bool inhibit_error_function_printing;
 
-int compiling_from_source;
-
 const char *resource_name;
 
 /* When nonzero, -Wall was turned on.  */
 int flag_wall = 0;
 
-/* The encoding of the source file.  */
-const char *current_encoding = NULL;
-
 /* When nonzero, report use of deprecated classes, methods, or fields.  */
 int flag_deprecated = 1;
 
@@ -329,7 +324,7 @@
       break;
 
     case OPT_fencoding_:
-      current_encoding = arg;
+      /* Nothing.  */
       break;
 
     case OPT_fextdirs_:
Index: java-tree.h
===================================================================
--- java-tree.h	(revision 120056)
+++ java-tree.h	(working copy)
@@ -43,37 +43,15 @@
 struct JCF;
 
 /* Usage of TREE_LANG_FLAG_?:
-   0: IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (in IDENTIFIER_NODE)
-      FOR_LOOP_P (in LOOP_EXPR)
-      SUPPRESS_UNREACHABLE_ERROR (for other _EXPR nodes)
-      ANONYMOUS_CLASS_P (in RECORD_TYPE)
-      ARG_FINAL_P (in TREE_LIST)
-   1: IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
-      COMPOUND_ASSIGN_P (in EXPR (binop_*))
-      LOCAL_CLASS_P (in RECORD_TYPE)
-      BLOCK_IS_IMPLICIT (in BLOCK)
    2: QUALIFIED_P (in IDENTIFIER_NODE)
-      PRIMARY_P (in EXPR_WITH_FILE_LOCATION)
-      MODIFY_EXPR_FROM_INITIALIZATION_P (in MODIFY_EXPR)
-      CLASS_METHOD_CHECKED_P (in RECORD_TYPE) 
       CLASS_FILE_P (in a TRANSLATION_UNIT_DECL in current_file_list)
-   3: IS_AN_IMPORT_ON_DEMAND_P (in IDENTIFIER_NODE)
-      RESOLVE_PACKAGE_NAME_P (in EXPR_WITH_FILE_LOCATION)
-      SWITCH_HAS_DEFAULT (in SWITCH_EXPR)
-      HAS_FINALIZER (in RECORD_TYPE)
+   3: HAS_FINALIZER (in RECORD_TYPE)
    4: IS_A_COMMAND_LINE_FILENAME_P (in IDENTIFIER_NODE)
-      RESOLVE_TYPE_NAME_P (in EXPR_WITH_FILE_LOCATION)
-      CALL_USING_SUPER (in CALL_EXPR)
       IS_ARRAY_LENGTH_ACCESS (in INDIRECT_REF)
    5: HAS_BEEN_ALREADY_PARSED_P (in IDENTIFIER_NODE)
-      IS_BREAK_STMT_P (in EXPR_WITH_FILE_LOCATION)
-      IS_CRAFTED_STRING_BUFFER_P (in CALL_EXPR)
-      IS_INIT_CHECKED (in SAVE_EXPR)
    6: CAN_COMPLETE_NORMALLY (in statement nodes)
-      NESTED_FIELD_ACCESS_IDENTIFIER_P (in IDENTIFIER_NODE)
 
    Usage of TYPE_LANG_FLAG_?:
-   0: CLASS_ACCESS0_GENERATED_P (in RECORD_TYPE)
    1: TYPE_ARRAY_P (in RECORD_TYPE).
    2: CLASS_PARSED_P (in RECORD_TYPE).
    3: CLASS_FROM_SOURCE_P (in RECORD_TYPE).
@@ -124,10 +102,6 @@
   ? BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (TYPE), 0)) \
   : NULL_TREE)
 
-/* True if the class we are compiling is a .java source file;
-   false if it is a .class bytecode file. */
-extern int compiling_from_source;
-
 /* The class defined by the actual (main) file we are compiling. */
 #define main_class \
   java_global_trees[JTI_MAIN_CLASS]
@@ -221,9 +195,6 @@
 /* When nonzero, generate only a limited set of class meta-data. */
 extern int flag_reduced_reflection;
 
-/* Encoding used for source files.  */
-extern const char *current_encoding;
-
 /* The Java .class file that provides main_class;  the main input file. */
 extern GTY(()) struct JCF * current_jcf;
 
@@ -337,15 +308,9 @@
   JTI_TYPE_IDENTIFIER_NODE,      
   JTI_INIT_IDENTIFIER_NODE,      
   JTI_CLINIT_IDENTIFIER_NODE,      
-  JTI_FINIT_IDENTIFIER_NODE,      
-  JTI_INSTINIT_IDENTIFIER_NODE,
   JTI_VOID_SIGNATURE_NODE,       
-  JTI_LENGTH_IDENTIFIER_NODE,  
   JTI_FINALIZE_IDENTIFIER_NODE,
   JTI_THIS_IDENTIFIER_NODE,  
-  JTI_SUPER_IDENTIFIER_NODE,  
-  JTI_CONTINUE_IDENTIFIER_NODE,  
-  JTI_ACCESS0_IDENTIFIER_NODE, 
   JTI_CLASSDOLLAR_IDENTIFIER_NODE,
   JTI_ONE_ELT_ARRAY_DOMAIN_TYPE,
 
@@ -423,8 +388,6 @@
 
   JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE,
 
-  JTI_WFL_OPERATOR,
-
   JTI_MAIN_CLASS,
   JTI_CURRENT_CLASS,
   JTI_OUTPUT_CLASS,
@@ -537,25 +500,12 @@
   java_global_trees[JTI_INIT_IDENTIFIER_NODE]      /* "<init>" */
 #define clinit_identifier_node \
   java_global_trees[JTI_CLINIT_IDENTIFIER_NODE]      /* "<clinit>" */
-#define finit_identifier_node \
-  java_global_trees[JTI_FINIT_IDENTIFIER_NODE]      /* "finit$" */
-/* FIXME "instinit$" and "finit$" should be merged  */
-#define instinit_identifier_node \
-  java_global_trees[JTI_INSTINIT_IDENTIFIER_NODE]  /* "instinit$" */
 #define void_signature_node \
   java_global_trees[JTI_VOID_SIGNATURE_NODE]       /* "()V" */
-#define length_identifier_node \
-  java_global_trees[JTI_LENGTH_IDENTIFIER_NODE]  /* "length" */
 #define finalize_identifier_node \
   java_global_trees[JTI_FINALIZE_IDENTIFIER_NODE]  /* "finalize" */
 #define this_identifier_node \
   java_global_trees[JTI_THIS_IDENTIFIER_NODE]  /* "this" */
-#define super_identifier_node \
-  java_global_trees[JTI_SUPER_IDENTIFIER_NODE]  /* "super" */
-#define continue_identifier_node \
-  java_global_trees[JTI_CONTINUE_IDENTIFIER_NODE]  /* "continue" */
-#define access0_identifier_node \
-  java_global_trees[JTI_ACCESS0_IDENTIFIER_NODE] /* "access$0" */
 #define classdollar_identifier_node \
   java_global_trees[JTI_CLASSDOLLAR_IDENTIFIER_NODE] /* "class$" */
 #define one_elt_array_domain_type \
@@ -708,14 +658,9 @@
 
 #define nativecode_ptr_type_node ptr_type_node
 
-#define wfl_operator \
-  java_global_trees[JTI_WFL_OPERATOR]
-
 /* The decl for "_Jv_ResolvePoolEntry".  */
 extern GTY(()) tree soft_resolvepoolentry_node;
 
-extern const char *cyclic_inheritance_report;
-
 struct lang_identifier GTY(())
 {
   struct tree_identifier ignore;
@@ -828,20 +773,6 @@
    in DECL.  */
 #define DECL_FUNCTION_INITIALIZED_CLASS_TABLE(DECL) \
   (DECL_LANG_SPECIFIC(DECL)->u.f.ict)
-/* A list of all the static method calls in the method DECL (if optimizing).
-   Actually each TREE_VALUE points to a COMPONT_EXPR that wraps the
-   invocation so we can later patch it.  */
-#define DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND(DECL) \
-  (DECL_LANG_SPECIFIC(DECL)->u.f.smic)
-/* The Number of Artificial Parameters (NAP) DECL contains. this$<n>
-   is excluded, because sometimes created as a parameter before the
-   function decl exists. */
-#define DECL_FUNCTION_NAP(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.nap)
-/* True if DECL is a synthetic ctor.  */
-#define DECL_FUNCTION_SYNTHETIC_CTOR(DECL) \
-  (DECL_LANG_SPECIFIC(DECL)->u.f.synthetic_ctor)
-#define DECL_FIXED_CONSTRUCTOR_P(DECL) \
-  (DECL_LANG_SPECIFIC(DECL)->u.f.fixed_ctor)
 
 #define DECL_LOCAL_CNI_METHOD_P(NODE) \
     (DECL_LANG_SPECIFIC (NODE)->u.f.local_cni)
@@ -976,14 +907,10 @@
   /* Initialized (static) Class Table */
   htab_t GTY ((param_is (union tree_node))) ict;
 
-  tree smic;			/* Static method invocation compound */
   tree inner_access;		/* The identifier of the access method
 				   used for invocation from inner classes */
-  int nap;			/* Number of artificial parameters */
   unsigned int native : 1;	/* Nonzero if this is a native method  */
-  unsigned int synthetic_ctor : 1; /* Nonzero if this is a synthetic ctor */
   unsigned int init_final : 1;	/* Nonzero all finals are initialized */
-  unsigned int fixed_ctor : 1;
   unsigned int init_calls_this : 1;
   unsigned int strictfp : 1;
   unsigned int invisible : 1;	/* Set for methods we generate
@@ -1088,10 +1015,6 @@
      TYPE_LANG_SPECIFIC ((T))			\
      = ggc_alloc_cleared (sizeof (struct lang_type));
 
-#define TYPE_FINIT_STMT_LIST(T)  (TYPE_LANG_SPECIFIC (T)->finit_stmt_list)
-#define TYPE_CLINIT_STMT_LIST(T) (TYPE_LANG_SPECIFIC (T)->clinit_stmt_list)
-#define TYPE_II_STMT_LIST(T)     (TYPE_LANG_SPECIFIC (T)->ii_block)
-
 #define TYPE_DUMMY(T)		(TYPE_LANG_SPECIFIC(T)->dummy_class)
 
 /* The decl of the synthetic method `class$' used to handle `.class'
@@ -1099,8 +1022,6 @@
 
 #define TYPE_DOT_CLASS(T)        (TYPE_LANG_SPECIFIC (T)->dot_class)
 #define TYPE_PACKAGE_LIST(T)     (TYPE_LANG_SPECIFIC (T)->package_list)
-#define TYPE_IMPORT_LIST(T)      (TYPE_LANG_SPECIFIC (T)->import_list)
-#define TYPE_IMPORT_DEMAND_LIST(T) (TYPE_LANG_SPECIFIC (T)->import_demand_list)
 #define TYPE_PRIVATE_INNER_CLASS(T) (TYPE_LANG_SPECIFIC (T)->pic)
 #define TYPE_PROTECTED_INNER_CLASS(T) (TYPE_LANG_SPECIFIC (T)->poic)
 #define TYPE_STRICTFP(T) (TYPE_LANG_SPECIFIC (T)->strictfp)
@@ -1140,16 +1061,11 @@
   struct JCF *jcf;
   struct CPool *cpool;
   tree cpool_data_ref;		/* Cached */
-  tree finit_stmt_list;		/* List of statements finit$ will use */
-  tree clinit_stmt_list;	/* List of statements <clinit> will use  */
-  tree ii_block;		/* Instance initializer block */
   tree dot_class;		/* The decl of the `class$' function that
 				   needs to be invoked and generated when
 				   compiling to bytecode to implement
 				   <non_primitive_type>.class */
   tree package_list;		/* List of package names, progressive */
-  tree import_list;		/* Imported types, in the CU of this class */
-  tree import_demand_list;	/* Imported types, in the CU of this class */
 
   tree otable_methods;          /* List of static decls referred to by this
 				   class.  */
@@ -1341,7 +1257,6 @@
 extern void write_classfile (tree);
 extern char *print_int_node (tree);
 extern void finish_class (void);
-extern void java_layout_seen_class_methods (void);
 extern void check_for_initialization (tree, tree);
 extern struct CPool *cpool_for_class (tree);
 extern int find_class_or_string_constant (struct CPool *, int, tree);
@@ -1411,10 +1326,7 @@
 extern bool uses_jv_markobj_p (tree);
 extern bool class_has_finalize_method (tree);
 extern void java_check_methods (tree);
-extern void init_jcf_parse (void);
-extern void init_src_parse (void);
 
-extern int cxx_keyword_p (const char *, int);
 extern void java_mangle_decl (tree);
 extern tree java_mangle_class_field (struct obstack *, tree);
 extern tree java_mangle_vtable (struct obstack *, tree);
@@ -1487,17 +1399,13 @@
 #define DECL_CONSTRUCTOR_P(DECL) DECL_LANG_FLAG_7 (FUNCTION_DECL_CHECK (DECL))
 
 #define DECL_INIT_P(DECL)   (ID_INIT_P (DECL_NAME (DECL)))
-#define DECL_FINIT_P(DECL)  (ID_FINIT_P (DECL_NAME (DECL)))
 #define DECL_CLINIT_P(DECL) (ID_CLINIT_P (DECL_NAME (DECL)))
-#define DECL_INSTINIT_P(DECL) (ID_INSTINIT_P (DECL_NAME (DECL)))
 
 /* Predicates on method identifiers. Kept close to other macros using
    them  */
 #define ID_INIT_P(ID)   ((ID) == init_identifier_node)
-#define ID_FINIT_P(ID)  ((ID) == finit_identifier_node)
 #define ID_CLINIT_P(ID) ((ID) == clinit_identifier_node)
 #define ID_CLASSDOLLAR_P(ID) ((ID) == classdollar_identifier_node)
-#define ID_INSTINIT_P(ID) ((ID) == instinit_identifier_node)
 
 /* Access flags etc for variable/field (FIELD_DECL, VAR_DECL, or PARM_DECL): */
 
@@ -1587,16 +1495,6 @@
 /* In a type map means the type the address subroutine return address. */
 #define TYPE_RETURN_ADDR return_address_type_node
 
-/* In a subroutine's return type map, indicates that the slot was neither
-   used nor set in the subroutine. */
-#define TYPE_UNUSED error_mark_node
-
-/* When returned from pop_type_0, indicates stack underflow. */
-#define TYPE_UNDERFLOW integer_zero_node
-
-/* When returned from pop_type_0, indicates a type mismatch. */
-#define TYPE_UNEXPECTED NULL_TREE
-
 /* A array mapping variable/stack slot index to the type current
    in that variable/stack slot.
    TYPE_UNKNOWN, TYPE_SECOND, and TYPE_NULL are special cases. */
@@ -1609,9 +1507,6 @@
 #define TYPE_IS_WIDE(TYPE) \
   ((TYPE) == double_type_node || (TYPE) == long_type_node)
 
-/* True iif CLASS has it's access$0 method generated.  */
-#define CLASS_ACCESS0_GENERATED_P(CLASS) TYPE_LANG_FLAG_0 (CLASS)
-
 /* True iff TYPE is a Java array type. */
 #define TYPE_ARRAY_P(TYPE) TYPE_LANG_FLAG_1 (TYPE)
 
@@ -1648,119 +1543,32 @@
    layout of a class.  */
 #define CLASS_BEING_LAIDOUT(TYPE) TYPE_LANG_FLAG_6 (TYPE)
 
-/* True if class TYPE has a field initializer finit$ function */
-#define CLASS_HAS_FINIT_P(TYPE) TYPE_FINIT_STMT_LIST (TYPE)
-
-/* True if identifier ID was seen while processing a single type import stmt */
-#define IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P(ID) TREE_LANG_FLAG_0 (ID)
-
-/* True if identifier ID was seen while processing an import statement */
-#define IS_A_CLASSFILE_NAME(ID) TREE_LANG_FLAG_1 (ID)
-
 /* True if ID is a qualified named (contains . or /) */
 #define QUALIFIED_P(ID) TREE_LANG_FLAG_2 (ID)
 
-/* True if ID is an already processed import on demand */
-#define IS_AN_IMPORT_ON_DEMAND_P(ID) TREE_LANG_FLAG_3 (ID)
-
 /* True if ID is a command-line specified filename */
 #define IS_A_COMMAND_LINE_FILENAME_P(ID) TREE_LANG_FLAG_4 (ID)
 
 /* True if filename ID has already been parsed */
 #define HAS_BEEN_ALREADY_PARSED_P(ID) TREE_LANG_FLAG_5 (ID)
 
-/* True if EXPR is RHS sub-tree of a compound assign expression */
-#define COMPOUND_ASSIGN_P(EXPR) TREE_LANG_FLAG_1 (EXPR)
-
-/* True if a SWITCH_EXPR has a DEFAULT_EXPR. */
-#define SWITCH_HAS_DEFAULT(NODE) TREE_LANG_FLAG_3 (SWITCH_EXPR_CHECK (NODE))
-
-/* True if EXPR (a WFL in that case) was created after the
-   reduction of PRIMARY . XXX */
-#define PRIMARY_P(EXPR) TREE_LANG_FLAG_2 (EXPR_CHECK (EXPR))
-
-/* True if EXPR (a MODIFY_EXPR in that case) is the result of variable
-   initialization during its declaration */
-#define MODIFY_EXPR_FROM_INITIALIZATION_P(EXPR) \
-  TREE_LANG_FLAG_2 (MODIFY_EXPR_CHECK (EXPR))
-
-/* True if EXPR (a TREE_TYPE denoting a class type) has its methods
-   already checked (for redefinitions, etc, see java_check_regular_methods.) */
-#define CLASS_METHOD_CHECKED_P(EXPR) TREE_LANG_FLAG_2 (EXPR)
-
 /* True if TYPE (a TREE_TYPE denoting a class type) was found to
    feature a finalizer method. */
 #define HAS_FINALIZER_P(EXPR) TREE_LANG_FLAG_3 (EXPR)
 
-/* True if EXPR (a LOOP_EXPR in that case) is part of a for statement */
-#define FOR_LOOP_P(EXPR) TREE_LANG_FLAG_0 (EXPR_CHECK (EXPR))
-
-/* True if NODE (a RECORD_TYPE in that case) is an anonymous class.  */
-#define ANONYMOUS_CLASS_P(NODE) TREE_LANG_FLAG_0 (RECORD_TYPE_CHECK (NODE))
-
-/* True if NODE (a RECORD_TYPE in that case) is a block local class.  */
-#define LOCAL_CLASS_P(NODE) TREE_LANG_FLAG_1 (RECORD_TYPE_CHECK (NODE))
-
-/* True if NODE (a TREE_LIST) hold a pair of argument name/type
-   declared with the final modifier */
-#define ARG_FINAL_P(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
-
-/* True if NODE (some kind of EXPR, but not a WFL) should not give an
-   error if it is found to be unreachable.  This can only be applied
-   to those EXPRs which can be used as the update expression of a
-   `for' loop.  In particular it can't be set on a LOOP_EXPR.  */
-#define SUPPRESS_UNREACHABLE_ERROR(NODE) TREE_LANG_FLAG_0 (EXPR_CHECK (NODE))
-
-/* True if EXPR (a WFL in that case) resolves into a package name */
-#define RESOLVE_PACKAGE_NAME_P(WFL) TREE_LANG_FLAG_3 (EXPR_CHECK (WFL))
-
-/* True if EXPR (a WFL in that case) resolves into a type name */
-#define RESOLVE_TYPE_NAME_P(WFL) TREE_LANG_FLAG_4 (EXPR_CHECK (WFL))
-
-/* True if STMT (a WFL in that case) holds a BREAK statement */
-#define IS_BREAK_STMT_P(WFL) TREE_LANG_FLAG_5 (WFL)
-
-/* True if EXPR (a CALL_EXPR in that case) is a crafted StringBuffer */
-#define IS_CRAFTED_STRING_BUFFER_P(EXPR) TREE_LANG_FLAG_5 (EXPR)
-
-/* True if EXPR (a SAVE_EXPR in that case) had its content already
-   checked for (un)initialized local variables.  */
-#define IS_INIT_CHECKED(EXPR) TREE_LANG_FLAG_5 (SAVE_EXPR_CHECK (EXPR))
-
-/* If set in CALL_EXPR, the receiver is 'super'. */
-#define CALL_USING_SUPER(EXPR) TREE_LANG_FLAG_4 (EXPR_CHECK (EXPR))
-
 /* True if NODE (a statement) can complete normally. */
 #define CAN_COMPLETE_NORMALLY(NODE) TREE_LANG_FLAG_6 (NODE)
 
-/* True if NODE (an IDENTIFIER) bears the name of an outer field from
-   inner class (or vice versa) access function.  */
-#define NESTED_FIELD_ACCESS_IDENTIFIER_P(NODE) \
-  TREE_LANG_FLAG_6 (IDENTIFIER_NODE_CHECK (NODE))
-
 /* True if NODE belongs to an inner class TYPE_DECL node.
    Verifies that NODE as the attributes of a decl.  */
 #define INNER_CLASS_DECL_P(NODE) (TYPE_NAME (TREE_TYPE (NODE)) == NODE	\
 				  && DECL_CONTEXT (NODE))
 
-/* True if NODE is a top level class TYPE_DECL node: NODE isn't
-   an inner class or NODE is a static class.  */
-#define TOPLEVEL_CLASS_DECL_P(NODE) (!INNER_CLASS_DECL_P (NODE) 	\
-				     || CLASS_STATIC (NODE))
-
-/* True if the class decl NODE was declared in an inner scope and is
-   not a toplevel class */
-#define PURE_INNER_CLASS_DECL_P(NODE) \
-  (INNER_CLASS_DECL_P (NODE) && !CLASS_STATIC (NODE))
-
 /* True if NODE belongs to an inner class RECORD_TYPE node. Checks
    that TYPE_NAME bears a decl. An array type wouldn't.  */
 #define INNER_CLASS_TYPE_P(NODE) (TREE_CODE (TYPE_NAME (NODE)) == TYPE_DECL \
 				  && DECL_CONTEXT (TYPE_NAME (NODE)))
 
-#define TOPLEVEL_CLASS_TYPE_P(NODE) (!INNER_CLASS_TYPE_P (NODE) 	\
-				     || CLASS_STATIC (TYPE_NAME (NODE)))
-
 /* True if the class type NODE was declared in an inner scope and is
    not a toplevel class */
 #define PURE_INNER_CLASS_TYPE_P(NODE) \
@@ -1842,33 +1650,9 @@
 #define FINISH_RECORD_CONSTRUCTOR(CONS) \
   VEC_pop (constructor_elt, CONSTRUCTOR_ELTS (CONS))
 
-/* Macros on constructors invocations.  */
-#define CALL_CONSTRUCTOR_P(NODE)		\
-  (TREE_CODE (NODE) == NEW_CLASS_EXPR || CALL_EXPLICIT_CONSTRUCTOR_P (NODE))
-
-#define CALL_EXPLICIT_CONSTRUCTOR_P(NODE)				\
-  (CALL_THIS_CONSTRUCTOR_P (NODE) || CALL_SUPER_CONSTRUCTOR_P (NODE))
-
-#define CALL_THIS_CONSTRUCTOR_P(NODE)					\
-  (TREE_CODE (NODE) == CALL_EXPR					\
-   && EXPR_WFL_NODE (TREE_OPERAND (NODE, 0)) == this_identifier_node)
-
-#define CALL_SUPER_CONSTRUCTOR_P(NODE)					\
-  (TREE_CODE (NODE) == CALL_EXPR					\
-   && EXPR_WFL_NODE (TREE_OPERAND (NODE, 0)) == super_identifier_node)
-
-/* Using a FINALLY_EXPR node */
-#define FINALLY_EXPR_LABEL(NODE) TREE_OPERAND (FINALLY_EXPR_CHECK (NODE), 0)
-#define FINALLY_EXPR_BLOCK(NODE) TREE_OPERAND (FINALLY_EXPR_CHECK (NODE), 1)
-
 #define BLOCK_EXPR_DECLS(NODE)  BLOCK_VARS(NODE)
 #define BLOCK_EXPR_BODY(NODE)   BLOCK_SUBBLOCKS(NODE)
 
-/* True for an implicit block surrounding declaration not at start of {...}. */
-#define BLOCK_IS_IMPLICIT(NODE) TREE_LANG_FLAG_1 (BLOCK_CHECK (NODE))
-#define BLOCK_EMPTY_P(NODE) \
-  (TREE_CODE (NODE) == BLOCK && BLOCK_EXPR_BODY (NODE) == empty_stmt_node)
-
 #define BUILD_MONITOR_ENTER(WHERE, ARG)					\
   {									\
     (WHERE) = build3 (CALL_EXPR, int_type_node,				\
@@ -1887,25 +1671,10 @@
     TREE_SIDE_EFFECTS (WHERE) = 1;				\
   }
 
-/* Nonzero if TYPE is an unchecked exception */
-#define IS_UNCHECKED_EXCEPTION_P(TYPE)				\
-  (inherits_from_p ((TYPE), runtime_exception_type_node)	\
-   || inherits_from_p ((TYPE), error_exception_type_node))
-
 /* True when we can perform static class initialization optimization */
 #define STATIC_CLASS_INIT_OPT_P() \
   (flag_optimize_sci && (optimize >= 2) && ! flag_emit_class_files)
 
-extern int java_error_count;
-
-/* Make the current function where this macro is invoked report error
-   messages and and return, if any */
-#define java_parse_abort_on_error()					\
-  {									\
-     if (java_error_count > save_error_count)				\
-       return;								\
-   }
-
 /* These are the possible values for the `state' field of the class
    structure.  This must be kept in sync with libgcj.  */
 enum
@@ -1973,6 +1742,6 @@
 extern void java_genericize (tree);
 extern int java_gimplify_expr (tree *, tree *, tree *);
 
-extern tree extract_field_decl (tree);
+extern FILE *finput;
 
 #endif /* ! GCC_JAVA_TREE_H */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ecj] Patch: remove old .java parser
  2006-12-20 19:18 [ecj] Patch: remove old .java parser Tom Tromey
@ 2006-12-23  2:46 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2006-12-23  2:46 UTC (permalink / raw)
  To: Gcc Patch List; +Cc: Java Patch List

Tom> I'm going to check this in on the gcj-eclipse-merge-branch.
Tom> Andrew, if you could give it a look over first, that would be helpful.

Tom> This is the first step at removing the old .java parser and other
Tom> now-unused code from gcj.  There is still some unused code remaining,
Tom> and a few bits which I simply commented out.  I'll have more cleanups
Tom> in future patches.

On irc Andrew asked about how I decided what to remove.  It is a fair
question and I do have an answer, albeit a somewhat ugly one.

I started at the obvious starting place: delete every file which ought
to be deletable.  So, I removed the parser, the lexer, and
check-init.c (definite assignment is only needed for source analysis).
Then I removed supporting files (keyword, character tables) and random
files which have long been obsolete (buffer.[ch] and convert.h).

Then I started building gcj and seeing what broke.  If the code was
related only to parsing source files, I generally removed it.  Since
over the years gcj has not been maintained with perfect cleanliness,
sometimes java-source-language-related functions ended up in the wrong
files; there were also a few already dead things lying about.

When I determined either via compilation or later testing that a given
function was wrongly deleted, I resurrected it (eg cxx_keyword_p stuff
in the name mangler).

The only really odd bit here was java_layout_seen_class_methods, which
was in parse.y but which is needed for proper operation of the .class
compiler.  You can see all the resurrected functions by searching for
"New function" in the ChangeLog.

At this point I had a working compiler which could build libgcj and
pass all tests.  Then I worked my way through parse.h, java-tree.h,
and java-tree.def, deleting every declaration, definition, or macro
which appeared not to be in use by the remaining parts of the
compiler.  There were a couple surprises here, since things like
URSHIFT_EXPR turn out to only be referenced via token pasting... yay.
If a deleted macro referred to a field in some structure, I removed
the field as well.

This is by no means a complete patch.  However, it is a good start.  I
think it removed around 50% of the source lines in gcj.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-12-23  2:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-20 19:18 [ecj] Patch: remove old .java parser Tom Tromey
2006-12-23  2:46 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).