summaryrefslogtreecommitdiff
path: root/gnu/dist/toolchain/gcc/java
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2006-06-02 22:17:11 +0000
committermrg <mrg@NetBSD.org>2006-06-02 22:17:11 +0000
commitbd88defe28db0f3e04ee650d86c5bbc95f9a481e (patch)
treef3e56ee9f07cf1d11f0dd395f7a0029f700cbc62 /gnu/dist/toolchain/gcc/java
parentdb19e89e04ef4a31ce779771479fada19bccde62 (diff)
delete GCC2.95.3 sources.
Diffstat (limited to 'gnu/dist/toolchain/gcc/java')
-rw-r--r--gnu/dist/toolchain/gcc/java/ChangeLog6347
-rw-r--r--gnu/dist/toolchain/gcc/java/Make-lang.in209
-rw-r--r--gnu/dist/toolchain/gcc/java/Makefile.in321
-rw-r--r--gnu/dist/toolchain/gcc/java/buffer.c52
-rw-r--r--gnu/dist/toolchain/gcc/java/buffer.h46
-rw-r--r--gnu/dist/toolchain/gcc/java/check-init.c715
-rw-r--r--gnu/dist/toolchain/gcc/java/class.c1758
-rw-r--r--gnu/dist/toolchain/gcc/java/config-lang.in40
-rw-r--r--gnu/dist/toolchain/gcc/java/constants.c481
-rw-r--r--gnu/dist/toolchain/gcc/java/convert.h28
-rw-r--r--gnu/dist/toolchain/gcc/java/decl.c1675
-rw-r--r--gnu/dist/toolchain/gcc/java/except.c404
-rw-r--r--gnu/dist/toolchain/gcc/java/expr.c2612
-rw-r--r--gnu/dist/toolchain/gcc/java/gjavah.c1610
-rw-r--r--gnu/dist/toolchain/gcc/java/java-except.h71
-rw-r--r--gnu/dist/toolchain/gcc/java/java-opcodes.h5
-rw-r--r--gnu/dist/toolchain/gcc/java/java-tree.def77
-rw-r--r--gnu/dist/toolchain/gcc/java/java-tree.h939
-rw-r--r--gnu/dist/toolchain/gcc/java/javaop.def314
-rw-r--r--gnu/dist/toolchain/gcc/java/javaop.h141
-rw-r--r--gnu/dist/toolchain/gcc/java/jcf-depend.c265
-rw-r--r--gnu/dist/toolchain/gcc/java/jcf-dump.c1101
-rw-r--r--gnu/dist/toolchain/gcc/java/jcf-io.c586
-rw-r--r--gnu/dist/toolchain/gcc/java/jcf-parse.c1061
-rw-r--r--gnu/dist/toolchain/gcc/java/jcf-path.c342
-rw-r--r--gnu/dist/toolchain/gcc/java/jcf-reader.c358
-rw-r--r--gnu/dist/toolchain/gcc/java/jcf-write.c3070
-rw-r--r--gnu/dist/toolchain/gcc/java/jcf.h282
-rw-r--r--gnu/dist/toolchain/gcc/java/jv-scan.c213
-rw-r--r--gnu/dist/toolchain/gcc/java/jvgenmain.c143
-rw-r--r--gnu/dist/toolchain/gcc/java/jvspec.c488
-rw-r--r--gnu/dist/toolchain/gcc/java/keyword.gperf80
-rw-r--r--gnu/dist/toolchain/gcc/java/keyword.h178
-rw-r--r--gnu/dist/toolchain/gcc/java/lang-options.h48
-rw-r--r--gnu/dist/toolchain/gcc/java/lang-specs.h43
-rw-r--r--gnu/dist/toolchain/gcc/java/lang.c600
-rw-r--r--gnu/dist/toolchain/gcc/java/lex.c1409
-rw-r--r--gnu/dist/toolchain/gcc/java/lex.h504
-rw-r--r--gnu/dist/toolchain/gcc/java/mangle.c166
-rw-r--r--gnu/dist/toolchain/gcc/java/parse-scan.c2448
-rw-r--r--gnu/dist/toolchain/gcc/java/parse-scan.y1197
-rw-r--r--gnu/dist/toolchain/gcc/java/parse.c14429
-rw-r--r--gnu/dist/toolchain/gcc/java/parse.h679
-rw-r--r--gnu/dist/toolchain/gcc/java/parse.y11775
-rw-r--r--gnu/dist/toolchain/gcc/java/typeck.c798
-rw-r--r--gnu/dist/toolchain/gcc/java/verify.c1346
-rw-r--r--gnu/dist/toolchain/gcc/java/xref.c98
-rw-r--r--gnu/dist/toolchain/gcc/java/xref.h48
-rw-r--r--gnu/dist/toolchain/gcc/java/zextract.c345
-rw-r--r--gnu/dist/toolchain/gcc/java/zipfile.h65
50 files changed, 0 insertions, 62010 deletions
diff --git a/gnu/dist/toolchain/gcc/java/ChangeLog b/gnu/dist/toolchain/gcc/java/ChangeLog
deleted file mode 100644
index 5dcbd7be72a..00000000000
--- a/gnu/dist/toolchain/gcc/java/ChangeLog
+++ /dev/null
@@ -1,6347 +0,0 @@
-Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com)
-
- * gcc-2.95.3 Released.
-
-Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.2 Released.
-
-Sat Oct 16 15:18:42 1999 Jeffrey A Law (law@cygnus.com)
-
- 1999-10-14 Tom Tromey <tromey@cygnus.com>
- * jvspec.c (jvgenmain_spec): Use `%umain', not just `%u'.
-
-Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.1 Released.
-
-Tue Aug 10 00:28:31 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * jvgenmain.c (main): NUL-terminate name_obstack.
-
-Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-1999-06-29 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Recognize --help.
-
-Fri Jun 25 13:35:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.c: Rebuilt.
-
- * parse.y (resolve_package): Fixed bogus return statement.
- (patch_method_invocation): Resolve method invocation beginning with
- a package name qualifier.
-
- * parse.y (java_complete_lhs): When doing cross referencing, don't
- try to keep file location on a WFL expanded as a CALL_EXPR.
-
- * parse.y (finish_method_declaration): Insert a RETURN_EXPR when
- compiling to class file a void method with an empty method body.
- As a side effect, the bytecode backend will generate the
- appropriate `return' instruction.
-
- * parse.y (lookup_package_type_and_set_next): New function prototype.
- (resolve_package): Search current and imported packages.
- (lookup_package_type_and_set_next): New function.
-
-1999-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (java.stage1): Depend on stage1-start.
- (java.stage2): Likewise for stage2-start.
- (java.stage3): Likewise for stage3-start.
- (java.stage4): Likewise for stage4-start.
-
-1999-06-22 Andrew Haley <aph@cygnus.com>
-
- * verify.c (verify_jvm_instructions): Check for pending blocks
- before invalid PC test and opcode switch, not after.
-
-1999-06-21 Andrew Haley <aph@cygnus.com>
-
- * except.c (find_handler_in_range): The upper limit for exception
- ranges is exclusive, not inclusive: (start <= pc < end).
- (link_handler): find child pointer which points to outer by
- searching sibling list: previous code incorrectly assumed that
- outer->outer->first_child must point to outer.
- * verify.c (verify_jvm_instructions): FIXME added to code for
- `athrow'.
- (verify_jvm_instructions): Do not assume that the last block
- processed in a subroutine is a block which ends with a `ret'
- instruction. With some control flows it is possible that the last
- block ends with an `athrow'.
-
-Mon Jun 14 13:13:39 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Reorganized the post
- evaluation of non WFL leading expression nodes.
-
-Fri Jun 11 21:37:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Handle ARRAY_REF after
- CONVERT_EXPR.
-
-Thu Jun 10 22:26:17 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Handle qualified expression
- beginning with a STRING_CST.
-
-Thu Jun 10 20:27:25 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (register_fields): Set DECL_INITIAL on both
- pre-initialized static and public fields.
- (resolve_field_access): Static field access expressions to always
- use pointer types.
- (qualify_ambiguous_name): Work out buried CALL_EXPR for proper
- qualification. CONVERT_EXPR to be resolved as an expression name.
- (java_complete_lhs): Identify and access qualified final
- initialized field in switch statement case expression.
- (fold_constant_for_init): Pre-initialized field decl constant to
- be folded.
-
-Mon Jun 7 16:09:51 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (note_possible_classname): Mark returned node with
- QUALIFIED_P only if the original class name contained a '/'.
-
-Sat Jun 5 11:46:59 1999 Anthony Green <green@cygnus.com>
-
- * Make-lang.in (gcjh): More parallel build fixes.
-
-1999-06-03 Mike Stump <mrs@wrs.com>
-
- * Make-lang.in (JCF_DUMP_SOURCES, jvgenmain): Fix parallel builds.
-
-Wed Jun 2 10:44:38 1999 Anthony Green <green@cygnus.com>
-
- * except.c (link_handler): Chain exception handlers in order.
-
-Wed Jun 2 10:41:24 1999 Anthony Green <green@cygnus.com>
-
- * expr.c (expand_byte_code): Fill unreachable bytecode regions
- with nops and process as usual in order to always set correct EH
- ranges. Emit detailed warnings about unreachable bytecodes.
-
-Wed Jun 2 10:35:13 1999 Anthony Green <green@cygnus.com>
-
- * class.c (build_utf8_ref): Mark cinit and utf8 tree nodes as
- constant.
-
-Fri May 28 18:22:45 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (lookup_field_wrapper): Unified returned value to NULL
- or the searched field decl.
-
-Fri May 28 11:34:05 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (fold_constant_for_init): Convert numerical constant
- values to the type of the assigned field.
-
-Thu May 27 19:57:40 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (lookup_field): Relaxed the test on class loading error
- detection.
- * parse.y (fold_constant_for_init): Enabeled old code.
-
-Wed May 26 18:06:02 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (valid_ref_assignconv_cast_p): Let `_Jv_CheckCast'
- decide the validity of the cast of a java.lang.Cloneable reference
- to an array.
- (patch_conditional_expr): Fixed first argument passed to
- binary_numeric_promotion.
-
-Wed May 26 15:33:06 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Take into account that a
- CONVERT_EXPR might specify a type as a WFL.
-
-Tue May 25 15:06:13 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_assignment): Save the rhs before using it as an
- argument to _Jv_CheckArrayStore.
-
-Tue May 25 11:23:59 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (java_parse_doc_section): Fixed `tag' buffer size.
-
-Mon May 24 13:26:00 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (java_lex): Accepts `+' or `-' after the beginning of a
- floating point litteral only when the exponent indicator has been
- parsed.
-
-Sat May 22 13:54:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (formal_parameter:): Construct argument tree list
- element even if a yet unsupported final parameter was encountered.
-
-Tue May 18 00:28:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (finish_method_declaration): Issue errors for native or
- abstract methods declared with a method body, as well as for non
- native or non abstract methods with no method body.
-
-1999-05-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (build_utf8_ref): Initialize variable `field'.
-
- * decl.c (init_decl_processing): Initialize variable `field'.
-
- * expr.c (build_known_method_ref): Mark parameters `method_type',
- `method_signature' and `arg_list' with ATTRIBUTE_UNUSED.
- (process_jvm_instruction): Likewise for parameter `length'.
-
- * jvspec.c (lang_specific_driver): Mark variables `saw_math',
- `saw_libc', `saw_gc', `saw_threadlib' and `saw_libgcj' with
- ATTRIBUTE_UNUSED.
-
- * parse.y (maybe_generate_clinit): Remove unused variable
- `has_non_primitive_fields'.
- (find_in_imports_on_demand): Initialize variables `node_to_use'
- and `cl'.
- (patch_binop): Likewise for variable `prom_type'.
- (patch_unaryop): Likewise for variable `prom_type'.
-
- * verify.c (verify_jvm_instructions): Likewise for variable `last'.
-
- * xref.c (xref_table): Add missing initializer.
-
-1999-05-14 Tom Tromey <tromey@cygnus.com>
-
- * java-except.h (struct eh_range): Removed unused `next' member.
- * verify.c (verify_jvm_instructions): Call check_nested_ranges
- after adding all exception handlers. Sort exception ranges in
- order of start PC.
- (struct pc_index): New structure.
- (start_pc_cmp): New function.
- * except.c (add_handler): Return `void'. Don't call link_handler;
- instead construct an ordinary linked list and do range
- coalescing.
- (check_nested_ranges): New function.
- (link_handler): Changed interface to allow merging of eh_ranges.
- Split overlapping ranges. Return `void'.
-
-Mon May 17 19:20:24 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (constructor_block_end:): New rule, tagged <node>.
- (constructor_body:): Use `constructor_block_end' instead of
- `block_end'.
-
-Mon May 17 18:01:40 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (statement_nsi:): Pop `for' statement block.
- (java_complete_lhs): Labeled blocks containing no statement are
- marked as completing normally.
-
-Fri May 14 12:31:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * xref.c (xref_set_current_fp): New function, defined.
- * xref.h (xref_set_current_fp): New function, prototyped.
-
-Fri May 14 11:57:54 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (check_init): Take into account that
- LABELED_BLOCK_STMT can be empty.
-
-Thu May 13 18:30:48 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_check_regular_methods): Warning check on not
- overriding methods with default access in other packages does not
- apply to `<clinit>'.
- (java_complete_lhs): If block body is an empty_stmt_node, replace
- it by NULL_TREE. This prevents gcc from generating an irrelevant
- warning.
-
-Thu May 13 13:23:38 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (check_init): Removed code accepting to see things
- falling through default:, when doing xrefs.
- * java-tree.h (do_not_fold): New global variable, declared.
- * parse.y (do_not_fold): New global variable, defined.
- (java_complete_expand_method): Set `do_not_fold' to the value of
- `flag_emit_xref'. When doing xrefs: copy the thrown exceptions,
- and reinstall them after them have been purged; do not check for
- initializations; do not issue missing return errors.
- (java_complete_lhs): Do not attempt to patch INSTANCEOF_EXPR nodes
- when doing xrefs.
- (patch_binop): Skip the fold part when doing xrefs.
- (build_string_concatenation): Skip the concatenation part when
- doing xrefs.
- (patch_synchronized_statement): Do not generate a try-finally when
- doing xrefs.
- (patch_throw_statement): When doing xrefs, do not call BUILD_THROW
- and keep the location where the throw was seen.
- * typeck.c (convert): When `do_not_fold' is set, do not attempt
- any treatment on the converted node an simply return a NOP_EXPR of
- the targeted type.
- * xref.c (xref_get_data): New function, defined.
- * xref.h (xref_get_data): New function, declared.
- (XREF_GET_DATA): Use xref_get_data.
-
-1999-05-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (print_include): Cast the result of `strlen' to int
- when comparing against a signed value.
- (add_namelet): Likewise.
-
-1999-05-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * expr.c (expand_invoke): Mark parameter `nargs' with
- ATTRIBUTE_UNUSED.
- (PRE_LOOKUP_SWITCH): Likewise for variable `match'.
-
- * jcf-io.c (jcf_unexpected_eof): Mark parameter `count' with
- ATTRIBUTE_UNUSED.
-
- * jcf-reader.c (get_attribute): Cast a value to long
- when comparing against a signed expression. Likewise.
-
- * lex.h: Never define HOST_WIDE_INT, HOST_BITS_PER_WIDE_INT or
- HOST_BITS_PER_CHAR.
-
-1999-05-11 Andrew Haley <aph@cygnus.com>
-
- * parse.y (source_end_java_method): If the current method contains
- any exception handlers, force asynchronous_exceptions: this is
- necessary because signal handlers in libjava may throw exceptions.
- * decl.c (end_java_method): Ditto.
-
-1999-05-11 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (jvspec.o): Don't define WITH_THREAD_x or WITH_GC_x
- flags.
- * jvspec.c (THREAD_NAME): Removed.
- (GC_NAME): Likewise.
- (MATHLIB): Likewise.
- (WITHLIBC): Likewise.
- (GCLIB): Likewise.
- (THREADLIB): Likewise.
- (MATH_LIBRARY): Likewise.
- (lang_specific_driver): Don't add `-l' options to command line.
- Instead, add a single --specs option. Recognize `-L' options and
- use them to search for spec file.
- (find_spec_file): New function.
- (SPEC_FILE): New define.
-
-Tue May 11 11:46:36 1999 Dave Brolley <brolley@cygnus.com>
-
- * lang-options.h: -MD, -MMD, -M and -MM not needed here for
- cpplib-enabled build.
-
-1999-05-05 Per Bothner <bothner@cygnus.com>
-
- * class.c (make_field_value): DECL_INITIAL may be a string literal;
- temporarily zero it while calling rest_of_decl_compilation.
-
- * java-tree.h (string_ptr_type_node): Add declaration.
- * decl.c: Define and initialize string_ptr_type_node.
- * parse.y (patch_string_cst): Use string_ptr_type_node.
-
- * parse.h (LOOP_HAS_LABEL_P, LOOP_HAS_LABEL_SKIP_P): Removed.
- * parse.y (for_statement): Now unconditionally exit_block.
- (finish_labeled_statement): No longer exit_block if for-loop.
- (patch_loop_statement): Check harder if the loop is already labeled.
-
- * parse.y (patch_initialized_static_field): Removed function.
- (maybe_generate_clinit): Removed special handling for interfaces.
- (java_complete_expand_methods): Do a preliminary java_complete_tree
- on <clinit> to determine if it can be removed.
- (java_complete_expand_method): Remove special handling for <clinit>.
- (java_complete_lhs): For BLOCK and EXPR_WITH_FILE_LOCATION
- optimize if we get back empty_stmt_node.
- For MODIFY_EXPR, re-do checking of static initializers.
- (fold_constant_for_init): Don't return immediate if VAR_DECL.
- For VAR_DECL, pass correct context.
-
- * verify.c (verify_jvm_instructions): Better error messages.
-
-1999-05-03 Tom Tromey <tromey@cygnus.com>
-
- * parse-scan.y (interface_declaration): Call
- report_class_declaration for interfaces.
-
-1999-04-30 20:54 -0400 Zack Weinberg <zack@rabi.columbia.edu>
-
- * Makefile.in: Remove -v from bison command lines.
-
-Fri Apr 30 17:54:40 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (check_init): Exclude a case of error when doing
- xrefs.
- * class.c (layout_class_method): Don't generate the error message
- twice when compiling from source.
- * lang-options.h: Added `-Wredundant-modifers' and
- `-Wunusupported-jdk11' flags and help text.
- * lang.c (lang_decode_option): Added support for
- `-Wunsupported-jdk11' and `-Wredundant-modifiers'.
- flag_static_local_jdk11 and flag_redundant set accordingly.
- * lex.c (java_lex): Call BUILD_OPERATOR on CCB_TK.
- * parse.h (EXPR_WFL_ADD_COL): New macro.
- (DECL_END_SOURCE_LINE): Likewise.
- (DECL_INHERITED_SOURCE_LINE): Likewise.
- * parse.y (static_ref_err): New function, prototyped.
- (CCB_TK): Now tagged <operator>.
- (class_body:): Remember the location of the closing '}' of a class
- definition when doing xrefs.
- (block:): Likewise.
- (block_end:): Likewise.
- (create_class): Remember the location of the inherited class
- identifier when doing xrefs.
- (register_fields): Added test on first operand of `init' before
- testing it TREE_CODE.
- (method_header): Store the location of the class identifier in the
- class decl when doing xrefs.
- (finish_method_declaration): Don't combine first/last method line
- when doing xref.
- (java_check_regular_methods): Warning check on not overriding
- methods with default access on other packages move before check on
- static methods. Initialization of `aflags' also moved up.
- (resolve_expression_name): Call static_ref_err to report the error.
- (static_ref_err): New function, implemented.
- (resolve_field_access): Returned simplified static field access
- when doing xrefs.
- (resolve_qualified_expression_name): Check for illegal use of
- static fields in a non static context. Call static_ref_err to
- report error in various places.
- (java_complete_tree): Do not fold initialized static fields when
- doing xrefs.
- (java_complete_lhs): Likewise.
-
-1999-04-29 Anthony Green <green@cygnus.com>
-
- * expr.c (generate_name): Use ASM_GENERATE_INTERNAL_LABEL to
- create internal labels.
- (lookup_label): Ditto.
-
-Sat Apr 24 16:50:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class_method): Generate <clinit>'s rtl for
- interfaces.
- * decl.c (complete_start_java_method): Don't call _Jv_InitClass
- for interfaces' <clinit>.
- * expr.c (lookup_field): Search for fields in interfaces.
- (expand_invoke): Fixed indentation.
- (expand_java_field_op): Likewise. Use IS_CLINIT.
- * parse.h (JPRIMITIVE_TYPE_OR_VOID_P): Macro removed.
- (IS_CLINIT): New macro.
- * parse.y (type_declaration:): Call maybe_generate_clinit after an
- interface was parsed.
- (maybe_generate_clinit): Don't generate if the current class is an
- interface with only fields of primitive types.
- (reset_method_name): Use IS_CLINIT.
- (java_complete_expand_method): Expand <clinit> when it exists for
- interfaces. Use IS_CLINIT.
- (resolve_expression_name): Use DECL_CONTEXT instead of
- current_class to build static field references.
- (java_complete_lhs): Use IS__CLINIT. Don't use SAVE_EXPR on
- ARRAY_REF when doing xreferencing.
- (check_final_assignment): Fixed typo in leading comment. Use
- IS_CLINIT.
- (patch_array_ref): Don't fully expand array references when
- xreferencing.
- (patch_return): Use IS_CLINIT.
- (patch_throw_statement): Likewise.
-
-1999-04-22 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (JAVA_SRCS): Added check-init.c.
-
-Wed Apr 21 11:13:36 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (predef_filenames, predef_filenames_size): New globals
- (init_decl_processing): predef_filenames and predef_filenames_size
- initialized.
- * java-tree.h (predef_filenames, predef_filenames_size): Declared
- extern.
- * jcf-parse.c (predefined_filename_p): New function.
- (yyparse): Check that files on the command line are specified only
- once and issue a warning otherwise.
- * parse.h (JPRIMITIVE_TYPE_OR_VOID_P): New macro.
- * parse.y (source_end_java_method): Nullify NOP method bodies, to
- avoid a gcc warning with -W -Wall turned on.
- (java_expand_classes): Abort if errors were encountered.
- (java_complete_lhs): If the cross reference flag is set, wrap
- field DECL node around a WFL when resolving expression name.
-
-Mon Apr 19 14:44:48 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lang.c (lang_decode_option): Fixed returned value when parsing
- `-fxref=...' and `-Wall'.
- * parse.y (source_end_java_method): Do not generate code when
- flag_emit_xref is set.
- (resolve_expression_name): Do not build static field access when
- flag_emit_xref is set.
- (resolve_field_access): No special treatment on `length' when
- flag_emit_xref is set. Do not build qualified static field access
- when flag_emit_xref is set.
- (patch_invoke): Keep the method DECL as operand 0 of the CALL_EXPR
- when flag_emit_xref is set.
- (patch_assignment): Do not generate array store runtime check when
- flag_emit_xref is set.
- * xref.c (xref_flag_value): Fixed function declaration
- indentation.
- (xset_set_data): New function.
- * xref.h (xref_set_data): Added prototype for new function.
- (typedef struct xref_flag_table): New field data.
- (XREF_GET_DATA): New macro.
-
-1999-04-19 Tom Tromey <tromey@cygnus.com>
-
- * xref.h (enum): Removed trailing comma.
-
- * parse.y (resolve_qualified_expression_name): Added missing
- `break'.
-
-Thu Apr 15 13:08:03 1999 Anthony Green <green@cygnus.com>
-
- * gjavah.c: New prototypes for java_float_finite and
- java_double_finite.
-
-Mon Apr 12 18:27:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_unaryop): Fixed ++/-- operator check on array
- references.
-
-Tue Apr 6 23:15:52 1999 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (TREE_H): Add tree-check.h.
- (RTL_H): Add genrtl.h.
-
-Tue Apr 6 15:15:51 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_assignment): Added ArrayStoreException runtime
- check.
-
-1999-04-06 Per Bothner <bothner@cygnus.com>
-
- * expr.c (pop_type_0): New function.
- (pop_type): Use pop_type_0.
- * java-tree.h (pop_type_0): New declaration.
- * verify.c (verify_jvm_instructions): Check return instructions.
-
- * parse.y (patch_binop): Don't fold if non-constant and emiting
- class files.
-
-Mon Apr 5 16:06:09 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (gjavah.o): Depend on $(JAVA_TREE_H).
-
- * gjavah.c: Include math.h earlier. Include tree.h/java-tree.h.
- (main_jcf): Don't define.
- (process_file): Don't set `main_jcf'.
-
- * java-tree.h (main_jcf): Don't declare.
-
- * jcf-parse.c (main_jcf): Add static definition.
-
- * lang.c (main_jcf): Don't define.
-
-Mon Apr 5 15:43:51 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (add_method_1): Cast the argument of `bzero' to PTR.
-
- * decl.c (copy_lang_decl): Likewise for `bcopy'.
-
- * jcf-depend.c: Include "config.h", not <config.h>.
-
- * jcf-parse.c (jcf_figure_file_type): Cast the arguments of
- `bcopy' to PTR.
-
- * jcf-path.c: Include "config.h", not <config.h>.
-
- * lex.c: Don't include various system header files.
- (java_init_lex): Cast the argument of `bzero' to PTR
-
- * parse-scan.y (java_push_parser_context): Likewise.
-
- * parse.y (java_push_parser_context): Likewise.
- (patch_bc_statement): Match format specifier to variable argument.
-
- * xref.c: Don't include <stdio.h>.
-
-Mon Apr 5 11:24:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (struct parser_ctxt *ctxp): Now global.
- (declare_local_variables): Use WFL compound value for the
- declaration source line value, when doing cross-referencing.
-
-1999-03-31 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_field_info): Allow constants of other types.
- (print_include): Generate include when new name is proper prefix
- of already printed name.
- (add_namelet): Likewise.
- (cxx_keyword_subst): New function.
- (print_method_info): Use it.
- (print_field_name): New function.
- (get_field_name): New function.
- (print_field_info): Use get_field_name and print_field_name.
-
-Wed Mar 31 11:00:32 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (keyword.h): Generate using gperf language 'C', not
- 'KR-C', so gperf uses the `const' keyword on strings.
-
- * keyword.gperf (java_keyword): Const-ify a char*.
-
-Tue Mar 30 11:31:53 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_bc_statement): Fixed identation and a bogus
- `printf' format.
-
-Tue Mar 30 11:29:29 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_assignment): Allow static variables in other
- classes to be assigned.
-
-Sun Mar 28 22:12:10 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (maybe_add_interface): Remove unused variable
- `interface_binfo'.
- (make_class_data): Use = for assignment, not ==. Likewise.
- (emit_register_classes): Remove unused variable `decl'.
-
- * lex.c: Fix comment so as not to contain an embedded `/*'.
-
- * verify.c (verify_jvm_instructions): Remove unused variable
- `self_type'.
-
-Sat Mar 27 15:49:18 1999 Per Bothner <bothner@cygnus.com>
-
- * parse.y (complete_loop_body): Rename to finish_loop_body.
- (complete_labeled_statement): Rename to finish_labeled_statement.
- (complete_for_loop): Rename to finish_for_loop.
- (complete_method_declaration): Rename to finish_method_declaration.
-
- * java-tree.h (continue_identifier_node): New global node.
- * decl.c: Define and initialize continue_identifier_node.
- * parse.y (generate_labeled_block): Remove - no longer needed.
- (build_loop_body): Use continue_identifier_node for continue block.
- (finish_labeled_statement): Also do pop_labeled_block actions.
- (java_complete_lhs): POP_LOOP even if error.
- (build_labeled_block): Special handling for continue_identifier_node.
- (patch_loop_statement): Re-organize.
- (patch_bc_statement): Re-write.
-
-Sat Mar 27 15:13:21 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (EXPR_WFL_GET_LINECOL): Set a line and column count
- using a WFL compound value.
- * parse.y (xref.h): Include.
- (maybe_create_class_interface_decl): Set DECL_SOURCE_LINE to the
- WFL compound value.
- (register_fields): Set WFL compound value to lineno if doing
- xrefs.
- (java_complete_expand_method): Call expand_xref if flag_emit_xref
- is set.
- * xref.c (system.h, jcf.h, parse.h, obstack.h): Include.
- * xref.h (expand_xref): Prototype renamed from xref_generate.
-
-Sat Mar 27 14:16:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (BLOCK_CHAIN_DECL): New use GET_CURRENT_BLOCK.
- (GET_CURRENT_BLOCK): New macro.
- * parse.y (current_static_block): New global variable.
- (method_body:): Define action.
- (complete_method_declaration): Set current_function_decl to NULL
- when work on the current method is done.
- (declare_local_variables): Use GET_CURRENT_BLOCK.
- (java_method_add_stmt): Likewise.
- (java_complete_expand_method): Disable the use of `this' when
- expanding <clinit>.
- (enter_a_block): If no current method exist, use
- current_static_block to link static initializer blocks.
- (exit_block): Rewritten to use current_static_block when no current
- method decl exists.
- (lookup_name_in_blocks): Use GET_CURRENT_BLOCK.
- (patch_return): Forbid the use of `return' in static initializers.
- (patch_throw_statement): Fixed indentation. Issue specific error
- for uncaught thrown checked exception in static initializer
- blocks. Removed FIXME.
-
-1999-03-25 Zack Weinberg <zack@rabi.columbia.edu>
-
- * java/Make-lang.in: Remove all references to gcj.o/gcj.c.
- Link gcj from gcc.o.
-
-Tue Mar 23 10:48:24 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (find_applicable_accessible_methods_list): When dealing
- with interface: ensure that a given interface or java.lang.Object
- are searched only once.
-
-Tue Mar 23 10:05:27 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (print_c_decl): Remove unused argument `flags'.
-
- * jcf-dump.c (print_access_flags): Add braces around if-else.
-
- * jvspec.c (lang_specific_driver): Wrap variable `len' in macro
- COMBINE_INPUTS.
-
- * lex.c (build_wfl_node): Add static prototype.
-
- * lex.h (build_wfl_node): Remove static prototype.
-
- * parse.y: Include lex.c early enough to declare everything needed.
- Ensure calls to `build_wfl_node' pass the proper arguments.
- (create_class): Remove unused variable `super_decl'.
- (get_printable_method_name): Initialize variable `name'.
-
-Mon Mar 22 20:14:26 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Changelog: Fixed 1999-03-22 typos.
- * lang.c (lang_decode_option): Fixed typo in error string in the
- XARG section.
-
-1999-03-22 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Makefile.in (JAVA_OBJS): Added entry xref.o.
- (xref.o): New rule.
- * java-tree.h (flag_emit_xref): Declared extern.
- * lang.c (xref.h): Included.
- (flag_emit_xref): New global variable.
- (lang_decode_option): Added support for -fxref.
- * xref.c: Created.
- * xref.h: Likewise.
-
-1999-03-21 Manfred Hollstein <manfred@s-direktnet.de>
-
- * Make-lang.in ($(GCJ)$(exeext)): Add intl.o to list of files to be
- linked with.
-
-Sun Mar 21 08:30:30 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (jcf-dump.o): Depend on $(CONFIG_H)
- $(srcdir)/../system.h and $(JAVA_TREE_H).
- (jcf-io.o): Depend on $(JAVA_TREE_H).
- (mangle.o): Likewise.
-
- * check-init.c (check_cond_init): Add static prototype.
-
- * class.c (build_java_method_type, hashUtf8String,
- make_field_value, get_dispatch_vector, get_dispatch_table,
- append_gpp_mangled_type, mangle_static_field): Likewise.
- (strLengthUtf8): Hide unused definition.
- (hashUtf8String): Const-ify.
- (make_field_value): Un-ANSI-fy.
-
- * constants.c: Move inclusion of jcf.h above java-tree.h.
- (set_constant_entry, find_class_or_string_constant,
- find_name_and_type_constant, get_tag_node,
- build_constant_data_ref): Add static prototype.
-
- * decl.c (push_jvm_slot, builtin_function,
- lookup_name_current_level): Likewise.
- (builtin_function): Const-ify.
-
- * except.c (expand_start_java_handler, expand_end_java_handler):
- Add static prototype.
-
- * expr.c (flush_quick_stack, push_value, pop_value,
- java_stack_swap, java_stack_dup, build_java_athrow,
- build_java_jsr, build_java_ret, expand_java_multianewarray,
- expand_java_arraystore, expand_java_arrayload,
- expand_java_array_length, build_java_monitor, expand_java_pushc,
- expand_java_return, expand_java_NEW, expand_java_INSTANCEOF,
- expand_java_CHECKCAST, expand_iinc, expand_java_binop, note_label,
- expand_compare, expand_test, expand_cond, expand_java_goto,
- expand_java_call, expand_java_ret, pop_arguments, expand_invoke,
- expand_java_field_op, java_push_constant_from_pool): Likewise.
-
- (decode_newarray_type, expand_iinc): Un-ANSI-fy.
- (build_java_arraynull_check): Mark parameters `node' and `type'
- with ATTRIBUTE_UNUSED.
- (note_label): Likewise for parameter `current_pc'.
- (expand_java_call, expand_java_ret): Hide unused definition.
-
- * java-tree.h (make_class, build_constants_constructor,
- java_set_exception_lang_code, pop_labeled_block, emit_handlers,
- init_outgoing_cpool, register_class, emit_register_classes,
- java_layout_seen_class_methods): Prototype.
- (unicode_mangling_length): Const-ify.
- (append_gpp_mangled_name, append_gpp_mangled_classtype,
- emit_unicode_mangled_name, format_int, format_uint,
- jcf_trim_old_input, jcf_print_utf8, jcf_print_char,
- jcf_print_utf8_replace, open_class): Prototype.
-
- * jcf-dump.c: Include "config.h", not <config.h>. Don't include
- <stdio.h>. Include tree.h/java-tree.h.
- (utf8_equal_string usage, process_class): Add static prototype.
- (open_class): Don't prototype this here.
- (utf8_equal_string): Match arguments to format specifiers.
- (HANDLE_CODE_ATTRIBUTE, BRANCH, JSR, RET, LOOKUP_SWITCH,
- TABLE_SWITCH, disassemble_method): Likewise.
-
- * jcf-io.c: Include tree.h/java-tree.h.
- (open_class, find_classfile, jcf_print_utf8,
- jcf_print_utf8_replace): Const-ify.
-
- * jcf-parse.c (parse_zip_file_entries, process_zip_dir,
- parse_class_file): Add static prototype.
- (find_in_current_zip): Match definition to existing static
- prototype.
-
- * jcf-write.c: Include jcf.h before tree.h/java-tree.h.
- (alloc_chunk, append_chunk, append_chunk_copy, gen_jcf_label,
- finish_jcf_block, define_jcf_label, get_jcf_label_here,
- put_linenumber, localvar_alloc, localvar_free, get_access_flags,
- write_chunks, adjust_typed_op, generate_bytecode_conditional,
- generate_bytecode_return, perform_relocations, init_jcf_state,
- init_jcf_method, release_jcf_state, generate_classfile):
- Add static prototype.
- (emit_unop): Mark parameter `type' with ATTRIBUTE_UNUSED.
- (make_class_file_name): Const-ify.
-
- * jcf.h (find_classfile): Const-ify.
-
- * jv-scan.c (reset_report): Remove prototype.
-
- * jvgenmain.c: Include jcf.h/tree.h/java-tree.h.
- (error): Rewrite to allow varargs.
-
- * lang.c (lang_f_options): Const-ify.
-
- * lex.c (java_parse_escape_sequence): Add static prototype.
- (java_allocate_new_line): Match definition to existing static
- prototype.
-
- * mangle.c Include tree.h/java-tree.h.
- (unicode_mangling_length, emit_unicode_mangled_name,
- append_gpp_mangled_name, append_gpp_mangled_classtype): Const-ify.
-
- * parse.h (jdep_code): Remove trailing comma in enumeration.
- (java_get_line_col): Move prototype outside of !JC1_LITE test.
- (reset_report): Add prototype.
-
- * verify.c (push_pending_label, merge_types): Add static
- prototypes.
-
- * zipfile.h (opendir_in_zip, open_in_zip): Prototype.
-
-1999-03-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (find_applicable_accessible_methods_list): Extend the
- search to superinterfaces when relevant.
- (search_applicable_methods_list): New function.
-
-1999-03-18 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (unmangle_classname): Implemented stricter testing
- before setting the QUALIFIED_P flag on an identifier.
-
-Tue Mar 16 15:15:41 1999 Per Bothner <bothner@cygnus.com>
-
- * parse.y (java_complete_lhs): Call force_evaluation_order
- after patch_newarray.
- (patch_binop): Don't call fold if there are side effects.
-
-1999-03-16 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_stabilize_reference): Use save_expr instead of
- building a SAVE_EXPR node.
- (java_complete_lhs): Patch the resulting string of the `+='
- operator (if necessary) and complete the RHS after having built
- the cast.
-
-Mon Mar 15 12:18:29 1999 Per Bothner <bothner@cygnus.com>
-
- * class.c (make_class): Don't set CLASS_P here (because
- this function is also called by build_java_array_type).
- (push_class): Set CLASS_P here instead.
- * parse.h (TYPE_CLASS_P): Check for TYPE_ARRAY_P is redundant.
-
- * jcf-dump.c (print_access_flags): Take extra parameter to indicate
- context. If the context is class, perfer "super" over "synchronized".
- * jcf-write.c (generate_classfile): Don't add ACC_SUPER if interface.
-
- * parse.y (create_class): Don't call parser_check_super here;
- it is not robust. Always wait until later.
-
- * parse.y (method_header): For interfaces, set ACC_ABSTRACT (to
- match what JDK 1.2 does), but don't set ACC_PUBLIC.
-
-Sat Mar 13 18:16:34 1999 Per Bothner <bothner@cygnus.com>
-
- * lex.c (java_read_char): UNGET invalid non-initial utf8 character.
- * lex.h (UNGETC): Change misleading macro.
-
-1999-03-12 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_stabilize_reference): Return NODE when patching a
- COMPOUND_EXPR.
- (java_complete_lhs): Put parenthesis around truth values.
-
-1999-03-12 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class_method): Don't make rtl for interface
- methods.
- * parse.h (GET_TYPE_NAME): New macro.
- * parse.y (if_then_statement:): Fixed indentation.
- (if_then_else_statement:): Likewise.
- (for_statement:): Fixed spacing.
- (try_statement:): Fixed indentation.
- (create_interface): Don't force interfaces to be abstract.
- (method_header): Abstract methods are OK in interfaces.
- (declare_local_variables): Fixed typo in comment.
- (java_complete_expand_method): Fixed indentation.
- (resolve_qualified_expression_name): Use GET_TYPE_NAME to report
- non accessible fields.
- (java_stabilize_reference): New function.
- (java_complete_lhs): Fixed indentation. Use
- java_stabilize_reference in compound assignement. Insert the
- cast. If not processing `+' fix string constants before processing
- binop.
-
-Fri Mar 12 19:42:55 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * constants.c (find_class_or_string_constant): Cast variable `j'
- to a `jword' when comparing against one.
-
- * expr.c (java_lang_expand_expr): Remove unused variables
- `has_finally_p' and `op0'.
-
- * gjavah.c (print_field_info): Cast a value to jint when comparing
- against one. Likewise for a jlong.
- (add_namelet): Likewise cast a `sizeof' to an int when comparing
- against a signed quantity.
-
- * jcf-dump.c (print_signature_type): Remove unused variable `digit'.
- (print_signature): Don't needlessly dereference variable `str'
-
- * jcf-reader.c (get_attribute): Mark variables `max_stack' and
- `max_locals' with ATTRIBUTE_UNUSED.
- (jcf_parse_class): Likewise for variable `index'.
-
- * parse.h (reverse_jdep_list): Remove static prototype.
-
- * parse.y (build_jump_to_finally): Remove prototype and definition.
- (reverse_jdep_list): Add static prototype.
-
- * typeck.c (convert_ieee_real_to_integer): Remove unused variables
- `assignment' and `expr_decl'.
-
- * verify.c (verify_jvm_instructions): Remove unused label `bad_ldc'.
-
-1999-03-12 Andrew Haley <aph@cygnus.com>
-
- * jcf-path.c (add_entry): alloca len+2 rather than len+1 bytes;
- we'll need a directory separator and a null character.
-
-Wed Mar 10 23:20:11 1999 Per Bothner <bothner@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): Handle __builtin_fmod, for %.
-
- Tue Mar 9 11:52:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (method_header): Don't set ACC_ABSTRACT flags on
- interfaces.
-
-Fri Mar 5 15:17:29 1999 Per Bothner <bothner@cygnus.com>
-
- * lex.c (java_parse_end_comment): Take extra parameter (next char).
-
- * class.c (build_utf8_ref): Fix possible name class/ambiguity.
-
- * class.c (layout_class_method): A static method in a base class
- is never overridden, so treat it like it doesn't exist.
- However, do complain about private non-static method overriding
- public static method.
-
- * parse.y: Don't set unused INITIALIZED_P flag.
- * java-tree.h (INITIALIZED_P): Removed no-longer needed flag.
-
- * parse.y (find_expr_with_wfl): Optimize tail-calls.
- (build_array_from_name): Re-order &index[string] to &string[index].
-
- * parse.y (java_complete_lhs): Don't call patch_assignment if rhs is
- error_mark (it might catch more errors, but it is more likely to lose).
-
-Sat Mar 6 11:17:16 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (jcf-parse.o): Depend on $(PARSE_H).
- (parse-scan.o): Depend on toplev.h.
-
- * class.c (make_method_value): Add prototype. Make it static.
- Remove unused second argument, caller changed.
-
- * expr.c (java_lang_expand_expr): Remove unused variable
- `return_label'.
-
- * java-tree.h: Don't prototype find_in_current_zip.
- Add prototypes for verify_constant_pool, start_java_method,
- end_java_method, give_name_to_locals, expand_byte_code,
- open_in_zip, set_constant_value, find_constant1, find_constant2,
- find_utf8_constant, find_string_constant, find_class_constant,
- find_fieldref_index, find_methodref_index, write_constant_pool,
- count_constant_pool_bytes and encode_newarray_type.
-
- * jcf-dump.c: Remove unused variable `LONG_temp'.
-
- * jcf-parse.c: Include parse.h.
- (jcf_parse_source): Remove unused parameter, all callers changed.
- (jcf_figure_file_type): Add static prototype.
- (find_in_current_zip): Likewise. Also remove unused parameter,
- all callers changed.
- (read_class): Initialize variable `saved_pos'.
-
- * jcf-reader.c (jcf_parse_preamble): Mark variables
- `minor_version' and `major_version' with ATTRIBUTE_UNUSED.
-
- * lex.c (java_is_eol): Wrap prototype and definition in !JC1_LITE.
- (java_init_lex): Wrap variable `java_lang_imported' in !JC1_LITE.
- (java_parse_doc_section): Initialize variable `seen_star'.
- (java_lex): Wrap variable `number_beginning' in !JC1_LITE.
- (java_lex_error): Mark parameters `msg' and `forward' with
- ATTRIBUTE_UNUSED.
- (java_get_line_col): Mark parameters `filename' and `line' with
- ATTRIBUTE_UNUSED.
-
- * parse-scan.y: Include toplev.h.
- (yyerror): Mark parameter `msg' with ATTRIBUTE_UNUSED.
-
- * parse.h: use `struct JCF', not plain `JCF'.
- (java_parser_context_save_global, java_expand_classes
- java_parser_context_restore_global, java_parse): Add prototypes.
-
- * typeck.c (convert_ieee_real_to_integer): Remove unused variable
- `node'.
-
-Wed Feb 24 16:13:59 1999 Per Bothner <bothner@deneb.cygnus.com>
-
- * check-init.c (check_init): COPYN takes word count, not bit count.
-
-Fri Feb 26 14:06:21 1999 Per Bothner <bothner@cygnus.com>
-
- * typeck.c (convert_ieee_real_to_integer): Use save_expr instead of
- explicit build_decl. (Avoids crash in reload when optimizing.)
-
-Thu Feb 25 21:05:04 1999 Per Bothner <bothner@cygnus.com>
-
- * decl.c (complete_start_java_method): Handle synchronized method
- even when compiling from bytecode.
-
-1999-02-26 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (add_class_decl): Only generate `#include' if outer
- class is not the name of the class we are processing. Correctly
- append `.h' in #include.
- (process_file): Clean up newlines around generated `#include's.
- (decode_signature_piece): Correctly handle inner classes.
- (struct include): New structure.
- (all_includes): New global.
- (print_include): New function.
- (add_class_decl): Use it.
- (process_file): Likewise.
- (add_class_decl): Generate include for java-array.h if array
- seen.
- (process_file): Don't generate java-array.h include.
-
- * gjavah.c (add_namelet): Check for standard package names here.
- (add_class_decl): Don't check for standard package names here.
-
-1999-02-25 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (read_import_dir): Use `|=', not `+=', to set `found'.
- When reading a zip file, only use strncmp if both strings are
- bigger than the buffer length. Initialize `k' when looping
- through zip file.
-
-1999-02-24 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (struct namelet): New structure.
- (add_namelet): New function.
- (print_namelet): New function.
- (print_class_decls): Use add_namelet and print_namelet to generate
- namespaces and not classes.
- (method_printed): New global.
- (HANDLE_END_METHOD): Examine method_printed.
- (print_method_info): Set method_printed when required. Print
- error if function to be ignored is marked virtual. Handle $finit$
- method.
- (METHOD_IS_FINAL): New macro.
- (print_field_info): Use it.
- (HANDLE_METHOD): Clear method_printed.
- (method_pass): New global.
- (HANDLE_END_FIELD): Call add_class_decl on the first pass.
- (process_file): Do two passes over both fields and methods.
- (HANDLE_METHOD): Examine method_pass.
- (root): New global.
- (add_class_decl): New function.
- (print_class_decls): Don't scan over entire constant pool.
-
-1999-02-23 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Recognize -fsyntax-only and
- disable linking in that case.
-
-1999-02-20 Tom Tromey <tromey@cygnus.com>
-
- * jcf.h (UTF8_GET): Mask first byte of 3-byte encoding with 0x0f,
- not 0x1f.
-
-Sun Feb 21 14:56:11 1999 Per Bothner <bothner@cygnus.com>
-
- * decl.c (build_result_decl), java-tree.h: New method.
- (complete_start_java_method): Handle synchronized methods.
- Don't build DECL_RESULT here. (Ordering dependency problem.)
- (start_java_method): Call build_result_decl here instead ...
- * parse.y (java_complete_expand_method): ... and here.
- (expand_start_java_method): Don't call complete_start_java_method here.
- (java_complete_expand_method): Call it here instead.
- * parse.h (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT): Moved to ..
- * java-tree.h: ... here.
-
- * expr.c (force_evaluation_order): Fix typo, don't handle ARRAY_REF.
- * parse.y (java_complete_lhs): Don't call force_evaluation_order
- for ARRAY_REF - it doesn't work when array bounds are checked.
- (patch_array_ref): Handle it here instead.
-
- * jcf-write.c (generate_classfile): Emit "Exceptions" attribute.
-
-Fri Feb 19 15:35:01 1999 Per Bothner <bothner@cygnus.com>
-
- Force left-to-right evaluation of binary operations etc.
- * expr.c (force_evaluation_order), java-tree.h: New function.
- * parse.y (java_complete_lhs): Pass binary operations, procedure
- calls, and ARRAY_REFs to force_evaluation_order.
- (various): Set TREE_SIDE_EFFECTS more carefully.
-
- Tolerate random (non-UTF8) encoding in comments without complaining.
- * lex.c (java_read_char): Return 0xFFFE if bad UTF8 encoding.
- (java_is_eol): Handle '\r' followed by '\n' instead of vice versa.
-
- * parse.y (resolve_qualified_expression_name): Handle error_mark.
- (java_complete_node case EXPR_WITH_FILE_LOCATION): Likewise.
-
- * parse.y (java_complete_lhs): Ignore an empty statement in a
- COMPOUND_EXPR. Don't complain about empty statement after return.
-
-Fri Feb 19 13:00:56 1999 Per Bothner <bothner@cygnus.com>
-
- * parse.y (obtain_incomplete_type): Don't wrap unknown types
- in TREE_LIST - just chain the POINTER_TYPEs together.
- (resolve_class): If type already resolved, return decl.
- After resolving, update TREE_TYPE(class_type), and name (if array).
- * parse.h (do_resolve_class), parse.y: Make non-static.
- * class.c (maybe_layout_super_class): Take this_class argument.
- Do do_resolve_class if necessary.
- (layout_class, layout_class_methods): Adjust calls appropriately.
- * parse.h (JDEP_TO_RESOLVE, JDEP_RESOLVED_DECL, JDEP_RESOLVED,
- JDEP_RESOLVED_P): Redefined for new TREE_LIST-less convention.
- * typeck.c (build_java_array_type): Don't call layout_class.
-
-Wed Feb 17 15:47:20 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (check_pkg_class_access): Allow private class access
- within the same package.
- (strip_out_static_field_access_decl): New function.
- (patch_unaryop): Call strip_out_static_field_access_decl on ++/--
- operator argument before testing its nature.
-
-Wed Feb 3 12:38:43 1999 Per Bothner <bothner@cygnus.com>
-
- * java-tree.def (FINALLY_EXPR): Removed. (Now uses TRY_FINALLY_EXPR.)
- (TRY_EXPR): Simplify - it no longer has a finally clause.
- * check-init.c (check_init): Handle TRY_FINALLY_EXPR.
- Simpler handling of TRY_EXPR, which no longer has a finally clause.
- * expr.c (java_lang_expand_expr): Likewise.
- * java-tree.h (CATCH_EXPR_GET_EXPR): Removed - no longer needed.
- * parse.h (java_get_catch_block), parse.y: Removed - no longer needed.
- * parse.y (java_complete_lhs): Add support for TRY_FIANLLY_EXPR.
- (build_try_statement): Remove finally parameter and handling.
- (build_try_finally_statement): New function.
- (patch_try_statement): No longer need to support finally clause.
- (try_statement): Update grammar action rules.
- * jcf-write.c (generate_bytecode_insns): Handle TRY_FINALLY_EXPR.
- Simpler handling of TRY_EXPR, which no longer has a finally clause.
-
-1998-11-26 Andrew Haley <aph@viagra.cygnus.co.uk>
-
- * jcf-parse.c (get_constant): Add braces around computation of 'd'
- when REAL_ARITHMETIC is not defined. [Oct 26 fix got overwritten -PB]
-
-1999-02-17 Andrew Haley <aph@cygnus.com>
-
- * class.c (build_utf8_ref): Back out broken patch which was
- intended to to output signatures using '.' as a separator.
-
- * class.c (make_class_data): Output signatures using '.' as a
- separator, rather than '/'.
- (mangled_classname): Likewise.
- (make_field_value): Likewise.
- (make_method_value): Likewise.
- * constants.c (alloc_class_constant): Likewise.
- * expr.c (build_invokeinterface): Likewise.
-
-Thu Feb 11 21:25:51 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (valid_builtin_assignconv_identity_widening_p): Got rid
- of an ancient workaround.
-
-Wed Feb 10 23:27:33 1999 Jeffrey A Law (law@cygnus.com)
-
- * jvspec.c (xmalloc): Kill the prototype. It does not belong
- here anymore.
-
-1999-02-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (yylex): Encode \0 as UTF8.
-
-1999-02-10 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Use libgcj, not libjava.
- * Makefile.in (jcf-path.o): Define LIBGCJ_ZIP_FILE.
- (libgcj_zip): Renamed.
- * jcf-path.c (add_entry): Use LIBGCJ_ZIP_FILE, not
- LIBJAVA_ZIP_FILE.
- (jcf_path_init): Use LIBGCJ_ZIP_FILE.
-
- * jvspec.c (THREAD_NAME): Renamed -lqthreads to -lgcjcoop.
- (GC_NAME): Renamed -lgc to -lgcjgc.
-
-Tue Feb 9 19:31:09 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (java_lang_cloneable): Initialize.
- * parse.y (java_lang_cloneable): New static variable.
- (qualify_ambiguous_name): Take CONVERT_EXPR into account when
- doing one more qualification round.
- (valid_ref_assignconv_cast_p): Reject null source or
- destination. Allow an array to be cast into java.lang.Cloneable.
- (patch_cast): Swapped two first arguments to first call to
- valid_ref_assignconv_cast_p.
-
-Mon Feb 8 11:50:50 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h: DECL_P renamed JDECL_P.
- * parse.y: DECL_P replaced by JDECL_P.
- (build_array_from_name): Always use pointer's type.
- (patch_bc_statement): Extra code to search continue target in a
- for loop. Fixed comments. Continue target is current loop when
- unlabeled.
-
-1999-02-05 Andrew Haley <aph@cygnus.com>
-
- * class.c (make_class_data): The superclass of an interface should
- be null, not class Object.
-
- * lex.c (java_lex): Sign extend hex literals.
-
-1999-02-04 Andrew Haley <aph@cygnus.com>
-
- * class.c (build_utf8_ref): Output signatures using '.' as a
- separator, rather than '/'.
- (make_class_data): Likewise.
-
-Wed Feb 3 22:50:17 1999 Marc Espie <Marc.Espie@liafa.jussieu.fr>
-
- * Make-lang.in ($(GCJ)(exeext)): Remove choose-temp.o, pexecute.o and
- mkstemp.o. Get them from libiberty now.
-
-Tue Feb 2 19:49:12 1999 Jeffrey A Law (law@cygnus.com)
-
- * jcf-io.c: Do not include sys/stat.h or sys/wait.h
-
-Tue Feb 2 20:04:50 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jvspec.c (xmalloc): Fix the prototype to match the one obtained
- from libiberty.h
-
-Tue Feb 2 10:39:47 1999 Per Bothner <bothner@cygnus.com>
-
- Optimize: `return (a ? b : c)' as: `if (a) return b; else return c;'.
- * jcf-write.c (generate_bytecode_return): New function.
- (generate_bytecode_insns): Use it, for RETURN_EXPR.
-
- * jcf-write.c (generate_bytecode_insns): For REAL_CST that is 0 or 1,
- generate special [fd]const_[01] instructions.
-
- * jcf-parse.c (yyparse): Don't emit_register_classes if -fsyntax-only.
-
- * verify.c (verify_jvm_instructions): Do INVALIDATE_PC after
- handling OPCODE_lookupswitch or OPCODE_tableswitch.
-
-Mon Feb 1 20:44:47 1999 Per Bothner <bothner@cygnus.com>
-
- * parse.y (patch_method_invocation): Handle calling static methods,
- even in the form EXPR.METHOD(ARGS), not just TYPE.METHOD(ARGS).
-
- * parse.y (java_complete_lhs): Don't complain about unreachable
- exit condition in a do-while statement.
-
-Fri Jan 29 18:19:02 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (java_read_char): Fixed utf8 decoding.
- (java_unicode_2_utf8): Fixed utf8 encoding in the 0x800-0xffff
- range.
- * parse.y (valid_builtin_assignconv_identity_widening_p): Fixed
- comments. Local variable `all_primitive' is gone. Broadened
- acceptance of `0' to floating point targets. `long' can now be
- widened to `double' or `float'.
- (valid_method_invocation_conversion_p): Added leading
- comment. Fixed tabulation.
- (build_string_concatenation): Optimize out left or right empty
- string constants.
-
-Thu Jan 28 18:51:26 1999 Per Bothner <bothner@cygnus.com>
-
- * jcf-write.c (localvar_alloc): Only emit entry for
- LocalVariableTable if debug_info_level > DINFO_LEVEL_TERSE.
- (generate_bytecode_insns): Only call put_linenumber if
- debug_info_level > DINFO_LEVEL_NONE.
- * jvspec.c (lang_specific_driver): If no -O* or -g* option
- is specified, add -g1 (for compatibility wih javac).
-
-Thu Jan 28 09:17:51 1999 Hans-Peter Nilsson <hp@axis.se>
-
- * java/Makefile.in: Add missing dependencies for jcf-dump.o,
- gjavah.o, check-init.o, jv-scan.o
-
-Mon Feb 1 09:50:48 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (gjavah.o): Depend on $(CONFIG_H) and system.h.
-
- * gjavah.c: Include config.h and system.h.
-
- * javaop.h (inline): Don't define, its handled by system.h.
- (WORD_TO_FLOAT, WORDS_TO_LONG, WORDS_TO_DOUBLE): Change these
- from `inline' to `static inline'.
-
- * jcf.h (inline): Don't define, its handled by system.h.
-
- * lex.c (inline): Likewise.
-
-Sun Jan 31 20:34:29 1999 Zack Weinberg <zack@rabi.columbia.edu>
-
- * lang-specs.h: Map -Qn to -fno-ident.
-
-Fri Jan 29 16:51:56 1999 Richard Henderson <rth@cygnus.com>
-
- * check-init.c (check_init): Fix CLEANUP_POINT_EXPR typo.
-
-1999-01-29 Tom Tromey <tromey@cygnus.com>
-
- * parse.h (BUILD_APPEND): If ARG is a non-String object reference,
- then cast it to Object before calling `append' method.
-
-Thu Jan 28 14:45:39 1999 Per Bothner <bothner@cygnus.com>
-
- * check-init.c (check_bool2_init, check_bool_init, check_init):
- Handle TRUTH_AND_EXPR, TRUTH_OR_EXPR, and TRUTH_XOR_EXPR.
- * jcf-write.c (generate_bytecode_insns): Likewise.
-
-Thu Jan 28 11:50:11 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (jcf_parse): Don't parse the same class file twice.
- * parse.y (patch_cast): Allow a boolean to be cast into a
- boolean.
-
-Wed Jan 27 10:19:29 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y: (class_declaration:): Fixed indentation.
- (class_member_declaration:): Extra `;' after field declaration now
- accepted.
- (interface_declaration:): Removed debug messages in error reports.
- (patch_binop): Nodes created and returned inherit the orignal
- node's COMPOUND_ASSIGN_P flag value.
- (patch_cast): Fix cast from char to floating point.
-
-Mon Jan 25 17:39:19 1999 Andrew Haley <aph@cygnus.com>
-
- * except.c, java-except.h (expand_resume_after_catch): new
- function.
- * expr.c (java_lang_expand_expr): call expand_resume_after_catch
- to branch back to main flow of control after a catch block.
-
-Sat Jan 23 23:02:43 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (parse.o): Depend on $(CONFIG_H) and
- $(srcdir)/../system.h.
- (class.o): Depend on $(PARSE_H) and $(srcdir)/../output.h.
- (jcf-parse.o): Depend on $(srcdir)/../toplev.h.
- (jcf-write.o): Likewise.
- (jv-scan.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h.
- (mangle.o): Depend on $(srcdir)/../toplev.h.
- (parse-scan.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h.
- (zextract.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h.
-
- * class.c: Include output.h and parse.h.
- (mangled_classname): Add the `const' keyword to a char*.
- (find_named_method): Hide unused function definition.
- (build_utf8_ref): Change type of variable `c' to unsigned char.
- Use ISALPHA/ISDIGIT instead of isalpha/isdigit.
- (build_class_ref): Add the `const' keyword to a char*.
- (layout_class_method): Remove unused variable `buf'.
-
- * decl.c (find_local_variable): Remove unused variable `rtl'.
- (pushdecl): Likewise for variables `different_binding_level' and
- `oldglobal'.
- (pushlevel): Mark parameter `unused' with ATTRIBUTE_UNUSED.
- (maybe_build_cleanup): Likewise for parameter `decl'.
-
- * except.c (expand_start_java_handler): Mark parameter `range'
- with ATTRIBUTE_UNUSED.
-
- * expr.c: Include except.h.
- (pop_type): Remove unused variable `i'.
- (pop_value): Likewise for variables `n_words' and `i'.
- (expand_java_arrayload): Likewise for variable `convert'.
- (java_lang_expand_expr): Likewise for variables `op0', `type',
- `mode', `unsignedp', `node' and `elements'.
- (expand_byte_code): Likewise for variables `prev_eh_ranges' and
- `eh_ranges'.
- (process_jvm_instruction): Add a `const' qualifier to a char*.
-
- * gjavah.c (output_directory): Add the `const' keyword to a char*.
- (temp_directory): Likewise.
- (print_c_decl): Likewise.
- (print_method_info): Likewise.
- (decode_signature_piece): Likewise.
- (print_mangled_classname): Likewise.
-
- * java-except.h: Provide prototypes for maybe_start_try,
- maybe_end_try and add_handler.
-
- * java-tree.h (mangled_classname): Add the `const' keyword to a char*.
- (parse_error_context): Likewise. Also add ATTRIBUTE_PRINTF_2.
- (pushdecl_top_level, alloc_class_constant, unicode_mangling_length,
- init_expr_processing, push_super_field, init_class_processing,
- can_widen_reference_to, class_depth, verify_jvm_instructions,
- maybe_pushlevels, maybe_poplevels, process_jvm_instruction,
- set_local_type, merge_type_state, push_type, load_type_state,
- add_interface, find_in_current_zip, append_gpp_mangled_classtype,
- emit_unicode_mangled_name): Add prototypes.
-
- * jcf-dump.c (print_constant): Add the `const' keyword to a char*.
- (print_signature_type): Use ISDIGIT, not isdigit.
- (print_signature): Remove unused variable `j'.
-
- * jcf-io.c (jcf_filbuf_from_stdio): Cast the result of `fread' to
- int when comparing against one.
-
- * jcf-parse.c: Include toplev.h.
-
- * jcf-write.c: Likewise. Don't include <string.h> or <sys/stat.h>.
- (localvar_free): Remove unused variable `i'.
- (generate_bytecode_conditional): Likewise for variable `kind'.
-
- * jv-scan.c: Include config.h and system.h. Remove redundant
- OS header and gansidecl.h includes.
- (warning): Add the `const' keyword to a char*. Also add
- ATTRIBUTE_PRINTF_1 to the prototype. Check ANSI_PROTOTYPES, not
- __STDC__, when determining whether to use ANSI-isms.
- (fatal): Likewise. Also add ATTRIBUTE_UNUSED.
- (xmalloc): Don't redundantly prototype here.
- (main): Remove unused parameter `envp'. Also fix the arguments
- passed to function `fatal' to match the format specifier.
-
- * lang.c (java_tree_code_name): Add the `const' keyword to a char*.
-
- * mangle.c: Include toplev.h.
- (emit_unicode_mangled_name): Declare parameter `len'.
-
- * parse.y (parse_warning_context): Add the `const' keyword to a
- char*. Also add ATTRIBUTE_PRINTF_2 to the prototype. Check
- `ANSI_PROTOTYPES' not `__STDC__' for whether to use ANSI-isms.
- (issue_warning_error_from_context): Add the `const' keyword to
- a char*.
- (parse_error_context): Likewise. Also check `ANSI_PROTOTYPES'
- not `__STDC__' for whether to use ANSI-isms.
-
- * typeck.c (incomplete_type_error): Mark parameters `value' and
- `type' with ATTRIBUTE_UNUSED.
- (parse_signature_type): Use ISDIGIT, not isdigit.
-
- * verify.c (check_pending_block): Add the `const' keyword to a char*.
- (verify_jvm_instructions): Likewise. Remove unused variables
- `field_name' and `default_val'.
-
- * zextract.c: Include config.h and system.h. Remove redundant
- OS header includes.
-
- * zipfile.h: Prototype `read_zip_archive'.
-
-Thu Jan 21 16:00:06 1999 Andrew Haley <aph@cygnus.com>
-
- * typeck.c (convert): Allow conversions to void type: some
- optimizations in gcc do this.
-
-Thu Jan 21 15:21:49 1999 Andrew Haley <aph@cygnus.com>
-
- * typeck.c (convert_ieee_real_to_integer): New function.
- (convert): When not using fast-math and using hardware fp, convert
- an IEEE NaN to zero.
-
-1999-01-18 Andrew Haley <aph@cygnus.com>
-
- * parse.y (patch_binop): Do a type conversion from signed to
- unsigned and then back to signed when a ">>>" is found.
-
-Sun Jan 17 22:34:22 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h: (check_for_initialization): Added prototype.
- * lex.c (java_parse_doc_section): `\n' breaks the `*/' string.
- * parse.y (do_resolve_class): Removed unused locals.
- (read_import_dir): Likewise.
- (resolve_qualified_expression_name): Array creation
- expressions are valid primary expressions.
- (qualify_ambiguous_name): Likewise.
- (patch_synchronized_statement): Removed unused local.
-
-Sun Jan 17 21:55:42 1999 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (zextract.o): Add dependencies.
-
- * Makefile.in: Do not put ^Ls at the start of a line.
-
-Fri Jan 15 20:16:20 1999 Per Bothner <bothner@cygnus.com>
-
- * expr.c (process_jvm_instruction): Coerce to correct Throwable
- sub-type the result of the call that gets the exception value.
-
- * parse.y (java_complete_expand_methods): If flags_syntax_only,
- don't call finish_class.
-
- * parse.y (java_check_regular_methods): If METHOD_PRIVATE,
- clear found before continuing.
-
- * verify.c (verify_jvm_instructions): On an array load, allow
- and handle top of stack to be TYPE_NULL.
-
- * gjavah.c (generate_access): Translate Java package private or
- protected access to C++ public, but with a comment.
-
-1999-01-13 Andrew Haley <aph@cygnus.com>
-
- * expr.c (generate_name): Name prefix changed to avoid clashes
- with assembler temp labels.
-
- * parse.y (patch_synchronized_statement): Set TREE_SIDE_EFFECTS on
- MODIFY_EXPR. Without this, code for the assignement may not be
- generated at all and the synchronized statement will read an
- uninitialized variable.
-
-Wed Jan 13 01:24:54 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (maybe_layout_super_class): Fixed returned value.
- * lex.c: Added 1999 to the copyright.
- (java_init_lex): Initialize java_lang_imported.
- * lex.h: Added 1999 to the copyright.
- * parse.h: Added 1999 to the copyright.
- (REGISTER_IMPORT): Fixed typo in trailing macro.
- (CURRENT_OSB): New macro.
- (struct parser_ctxt): New fields osb_depth, osb_limit.
- * parse.y (java_lang_id): New global variable.
- (type_import_on_demand_declaration): Don't import java.lang.* twice.
- (array_creation_expression:): Use CURRENT_OSB.
- (dims:): Uses a stack to keep track of array dimensions.
- (cast_expression:): Use CURRENT_OSB.
- (find_expr_with_wfl): Return NULL if node found doesn't meet the
- conditions.
- (register_fields): Fixed typos in comment.
- (check_method_redefinition): Fixed comment indentation.
- (java_check_regular_methods): Set saved found wfl to NULL after
- having reinstalled it in the previously found DECL_NAME.
-
-Sun Jan 10 13:36:14 1999 Richard Henderson <rth@cygnus.com>
-
- * gjavah.c (java_float_finite): Use a union to do type punning.
- (java_double_finite): Likewise.
-
-Sat Jan 9 11:25:00 1999 Per Bothner <bothner@cygnus.com>
-
- * parse.y (build_new_array_init): Don't set EXPR_WFL_LINECOL
- on CONSTRUCTOR (since that trashes TREE_CST_RTL).
- (patch_new_array_init): Clear TREE_CONSTANT also if INDIRECT_REF.
- (register_fields): Set TREE_STATIC on NEW_ARRAY_INIT, not on
- CONSTRUCTOR (which causes expand_expr to call output_constant_def).
- * expr.c (java_lang_expand_expr): Check TREE_STATIC of NEW_ARRAY_INIT.
-
-Fri Jan 8 15:48:03 1999 Per Bothner <bothner@cygnus.com>
-
- * check-init.c (check_init): If compiling to native, we don't
- see THROW_EXPR. Instead, look for a call to throw_node (_Jv_Throw).
-
-1999-01-08 Tom Tromey <tromey@cygnus.com>
-
- * parse-scan.y (variable_declarator_id): Set or increment
- bracket_count.
- (bracket_count): New global.
- (formal_parameter): Handle case where bracket pairs trail variable
- declarator id.
-
-1999-01-07 Andrew Haley <aph@viagra.cygnus.co.uk>
-
- * jcf-parse.c (yyparse): variable len changed from a char to an
- int to prevent overflow.
-
-Wed Jan 6 17:19:46 1999 Per Bothner <bothner@cygnus.com>
-
- * java-tree.h: Declare read_class.
- * jcf-parse.c (read_class): New function.
- (load_class): Now just call read_class.
-
- * java-tree.h (java_parse_abort_on_error): Only return if new errors.
- * jcf-parse.c (parse_source_file): Declare save_error_count,
- which is needed by java_parse_abort_on_error macro,
- * parse.y (java_layout_classes, java_expand_classes): Likewise.
-
- * parse.y (register_fields): Set TREE_STATIC flag of NEW_ARRAY_INIT
- constructor, if initializing a static field.
- (patch_new_array_init): Set TREE_CONSTANT if it is.
- * expr.c (java_lang_expand_expr): For a static array constructor
- of primitive elements, allocate the array itself statically.
- Disabled until we can set the vtable field statically.
-
- * check-init.c: New file. Checks for definite assignment.
- * Makefile.in (JAVA_OBJS): Add check-init.o.
- * parse.y (java_complete_expand_method): Call check_for_initialization.
- * parse.h (BLOCK_EXPR_DECLS, BLOCK_EXPR_BODY): Moved to java-tree.h.
-
-Wed Jan 6 14:53:10 1999 Graham <grahams@rcp.co.uk>
-
- * parse.y : include system.h instead of including
- standard headers directly with the exception of <dirent.h>.
-
-Wed Jan 6 16:20:06 1999 Per Bothner <bothner@cygnus.com>
-
- * lex.h: Moved static function declarations to lex.c,
- to shut up some -Wall warnings.
- * lex.c: Static function declarations moved here.
- * jcf-dump.c: Small fixes to shut up -Wall warnings.
-
-Tue Jan 5 22:15:40 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in ($(GCJ).o): Depend on prefix.h.
-
-Tue Dec 22 11:25:19 1998 Per Bothner <bothner@cygnus.com>
-
- * expr.c (process_jvm_instruction): Do load_type_state after JSR.
- * verify.c (verify_jvm_instructions): Fix off-by-one error.
-
- * jcf-write.c (CHECK_PUT): Add (void) cast to avoid -Wall warnings.
- (localvar_alloc): Change return type to void,
- (emit_unop): Remove unused variable size.
-
- * jcf-write.c (struct jcf_block): Add new union.
- (PENDING_CLEANUP_PC, PENDING_EXIT_PC, UNDEFINED_PC): New macros.
- (call_cleanups): New functions.
- (struct jcf_partial): New fields num_finalizers and return_value_decl.
- (generate_bytecode_insns): Support CLEANUP_POINT_EXPR and
- WITH_CLEANUP_EXPR. Handle cleanups in RETURN_EXPR and EXIT_BLOCK_EXPR.
- * lang.c (lang_init): Call using_eh_for_cleanups.
- * parse.y (java_complete_lhs): For SYNCHRONIZED_EXPR, defer
- completing operands to patch_synchronized_statement.
- Support CLEANUP_POINT_EXPR, WITH_CLEANUP_EXPR.
- (patch_synchronized_statement): Re-write suing CLEANUP_POINT_EXPR and
- WITH_CLEANUP_EXPR instead of TRY_EXPR.
-
-Sun Dec 20 16:15:44 1998 John F. Carr <jfc@mit.edu>
-
- * Make-lang.in: Comment out control-Ls; they upset some makes.
-
-1998-12-18 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (check_class_interface_creation): Use DIR_SEPARATOR
- consistently.
-
-1998-12-17 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (DIR_SEPARATOR): New define.
- (check_class_interface_creation): Use it.
-
- * parse-scan.y (report_main_declaration): Recognize
- `java.lang.String' in argument to main.
-
-Wed Dec 16 16:18:59 1998 Per Bothner <bothner@cygnus.com>
-
- * parse.y (create_interface): Remove bogus test.
-
-Wed Dec 16 14:42:19 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-parse.c (get_constant): Set TREE_TYPE for string constants.
- (HANDLE_CONSTANTVALUE): If flag_emit_class_files, call get_constant.
-
-1998-12-16 Tom Tromey <tromey@cygnus.com>
-
- * parse-scan.y (qualified_name): Use correct sprintf format.
-
-1998-12-15 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_field_info): Changed how most negative number is
- printed.
-
-Mon Dec 14 18:49:29 1998 Per Bothner <bothner@cygnus.com>
-
- * parse.y (fold_constant_for_init): New function.
- (resolve_expression_name): Don't replace static final
- constant-initialized fields by its value.
- (java_complete_lhs): New. Same as java_complete_tree, except does
- not replace static final constant-initialized fields by their values.
- (register_fields): If there is an initializer, set DECL_INITIAL and
- MODIFY_EXPR_FROM_INITIALIZATION_P.
- (java_complete_tree): For MODIFY_EXPR, use java_complete_lhs for lhs.
- Only call patch_initialized_static_field if
- MODIFY_EXPR_FROM_INITIALIZATION_P.
- (patch_initialized_static_field): If not valid constant, clear
- DECL_INITIAL.
-
- * parse.y (lookup_field_wrapper): Fix thinko.
-
- * parse.y (java_complete_tree): In EXPR_WITH_FILE_LOCATION,
- set and restore global lineno.
-
-1998-12-14 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_field_info): If value to print is the smallest
- value of its size, then print as hex to avoid later warnings from
- C++ compiler.
-
-1998-12-14 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (decompile_method): Decompile `return null'.
- (process_file): Generate `#pragma interface'.
- (method_declared): New global.
- (print_method_info): Set it.
- (HANDLE_CODE_ATTRIBUTE): Only print it method_declared set.
- (print_method_info): Handle abstract methods.
-
-Sun Dec 13 17:31:40 1998 Per Bothner <bothner@cygnus.com>
-
- * parse.y (patch_method_invocation): If class_decl is null
- (e.g. an array type), use original type.
-
- * parse.y (check_thrown_exceptions): Temporary hack to suppress
- errors about uncaught exception from clone (of array, specifically).
-
-1998-12-13 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (decompile_method): Handle all types of `return'
- opcode. Decompile `return this' and `return'.
- (method_access): New global.
- (print_method_info): Set it.
- (decompile_method): Don't decompile a synchronized method.
-
-1998-12-13 Tom Tromey <tromey@cygnus.com>
-
- * jcf-reader.c (jcf_parse_one_method): Recognize
- HANDLE_END_METHOD.
- * gjavah.c (HANDLE_END_METHOD): New macro.
- (HANDLE_CODE_ATTRIBUTE): New macro.
- (decompile_method): New function.
- (print_method_info): Don't print `;\n' at end of function decl.
- Include java-opcodes.h.
- (decompiled): New global.
-
-Sat Dec 12 20:13:19 1998 Per Bothner <bothner@cygnus.com>
-
- * class.c (build_class_ref): Handle PRIMTYPE.class if
- flag_emit_class_files.
- * expr.c (expand_java_field_op): Don't optimize java.lang.XXX.TYPE
- if flag_emit_class_files.
- * parse.y (java_complete_tree): Pre-liminary support for
- COMPONENT_REF - only to handle PRIMCLASS.TYPE.
-
- * parse.y (patch_synchronized_statement): Don't call monitorexit
- unless block CAN_COMPLETE_NORMALLY. Propagate that flag properly.
-
- * java-tree.h (DECL_LOCAL_STATIC_VALUE): Removed - no longer used.
-
- * zipfile.h (opendir_in_zip): New declaration.
- * jcf-io.c (saw_java_source): Moved to jcf-parse.c.
- (opendir_in_zip): New function, using code from open_in_zip.
- (open_in_zip): Call opendir_in_zip.
- (find_class): Remove no-longer-used do_class_file parameter,
- but add source_ok parameter. Change logic so if we find a .java file,
- we don't look for .class in later classpath emtries.
- * jcf-parse.c (load_class): Pass saw_java_source to find_class.
- (jcf_figure_file_type): Only call open_in_zip if correct magic number.
- * gjavah.c: Update call to find_class.
- * jcf-dump.c: Likewise.
-
- * jcf-write.c (put_linenumber): Handle duplicate line numbers.
- (generate_bytecode_insns): For EXPR_WITH_FILE_LOCATION, do
- nothing if body is empty_stmt_node.
- Various little fixes so SP gets correctly adjusted.
- For NEW_ARRAY_INIT, handle IGNORE_TARGET.
- For CALL_EXPR, test if static first.
- (generate_classfile): Ignore fields that are DECL_ARTIFICIAL,
- such as the ones we create for Object and Class.
- Set and restore current_function_decl.
- * parse.y: Check/set IS_AN_IMPORT_ON_DEMAND_P in read_import_dir.
- (note_possible_classname): New function.
- (read_import_entry): Removed. Merged with read_import_dir.
- (read_import_dir): Don't call find_class - that only gives us
- the first classpath entry having the needed package.
- Use the struct buffer data structure from buffer.h.
- (read_import_dir, find_in_imports_on_demand): The remembered
- class names now use '.' (not '/') as package separator.
-
- * parse.y (java_complete_expand_methods): Call write_classfile
- here, and not in java_expand_classes (which only gets first class).
-
-Sat Dec 12 19:46:04 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (<type_declaration>): Do maybe_generate_clinit last.
- (register_fields): If a static fields has an initializer, just
- chain it on ctxp->static_initialized, and handle later.
- (java_complete_expand_methods): Force <clinit> first.
- (resolve_expression_name, resolve_field_access): Just get DECL_INITIAL
- - it's already been completed.
- (patch_initialized_static_field): New function.
- (java_complete_field): Call it.
-
-Sat Dec 12 19:21:11 1998 Per Bothner <bothner@cygnus.com>
-
- * expr.c (encode_newarray_type, build_new_array): New functions.
- * java-tree.h: Declare build_new_array.
- * jcf-write.c (patch_newarray): Use build_new_array.
-
- * expr.c (java_lang_expand_exp): Support NEW_ARRAY_INIT.
- * jcf-write.c (generate_bytecode_insns): Support NEW_ARRAY_INIT.
-
- * parse.y (patch_new_array_init): Re-organize.
- Now is passed the actual array (pointer) type of the value.
- Set the type of the CONSTRUCTOR to be an ARRAY_TYPE.
- (patch_array_constructor): Removed - merged into patch_new_array_init.
- (java_complete_tree): Update patch_new_array_init.
-
- * jcf-write.c (find_constant_index): New function.
- (generate_bytecode_insns): Use find_constant_index.
- (generate_classfile): Use find_constant_index for ConstantValue.
-
-1998-12-11 Tom Tromey <tromey@cygnus.com>
-
- * expr.c (invoke_build_dtable): Renamed dtable -> vtable.
- * decl.c (init_decl_processing): Renamed dtable -> vtable.
- * class.c (make_class_data): Renamed dtable -> vtable, and
- dtable_method_count -> vtable_method_count.
-
-Thu Dec 10 20:00:54 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (long_zero_node, float_zero_node, double_zero_node): New
- global variables, initialized.
- * java-tree.h (long_zero_node, float_zero_node, double_zero_node):
- Declared new global variables.
- * lex.c (java_lex): Return long_zero_node, float_zero_node,
- double_zero_node, integer_zero_node upon direct matching.
- * parse.y (purify_type_name): Added function prototype.
- (duplicate_declaration_error_p): Consider new_type as potentially
- being a incomplete type. Use purify_type_name on type string.
- (method_header): saved_type: unused variable removed. Don't figure
- return type if method name is invalid.
- (java_complete_tree): Set CAN_COMPLETE_NORMALLY after `node' was
- processed by patch_unaryop.
- (patch_unaryop): Fixed typo in comment. Re-convert pre/post
- increment/decrement node into its original type after binary
- numeric promotion on its operands.
-
-Thu Dec 10 11:02:49 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (array_initializer:): Array init operand is NULL_TREE
- instead of a TREE_LIST of NULL_TREEs when parsing `{}'. `{,}' is
- now an error. Fixed indentation problems.
- (patch_string): Handle error_mark_node as an argument.
- (patch_new_array_init): Fixed indentation problems.
- (array_constructor_check_entry): Removed check on null wfl_value.
- Return an error if wfl_value's walk returns an error.
-
-Wed Dec 9 15:37:05 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.def (NEW_ARRAY_INIT): New Java tree code.
- * lex.c (java_lex): Remember column position before advancing one
- token. Retain location information on OCB_TK.
- * lex.h (typedef struct java_lc): Added new field.
- * parse.h (GET_SKIP_TYPE): New macro.
- (QUAL_DECL_TYPE): Redefined using GET_SKIP_TYPE.
- * parse.y (build_new_array_init, patch_new_array_init,
- patch_array_constructor, maybe_build_array_element_wfl,
- array_constructor_check_entry): New function prototypes.
- (switch_block:): Tagged <node>.
- (OCB_TK): Tagged <operator>.
- (array_initializer:): Installed actions.
- (variable_initializer): Build location information on element if
- necessary.
- (switch_statement:): Fixed indentation typo.
- (switch_block:): Redefined default action.
- (java_complete_tree): Handle NEW_ARRAY_INIT in MODIFY_EXPR:.
- (patch_assignment): Removed duplicate code.
- (maybe_build_array_element_wfl, build_new_array_init,
- patch_new_array_init, patch_array_constructor,
- array_constructor_check_entry): New functions.
-
-Mon Dec 7 15:13:52 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (array_initializer): Tagged <node>.
- (variable_initializer:): Use default rule.
- (array_initializer:): Defined actions.
- (variable_initializers:): Likewise.
- (resolve_qualified_expression_name): Use DECL_CONTEXT to build
- non-static field accesses.
- (patch_invoke): Fixed indentation typo.
- (java_complete_tree): Likewise.
- (build_labeled_block): Changed leading comment. Generate an error
- in case of duplicate loop labels.
- (patch_conditional_expr): Patch results of string concatenation
- operations.
-
-Sun Dec 6 13:45:00 1998 Per Bothner <bothner@cygnus.com>
-
- * constants.c (find_methodref_index): When the class is an interface,
- generate CONSTANT_InterfaceMethodref instead of a CONSTANT_MethodRef.
-
- * decl.c (finit_identifier_node): Use "$finit$", rather than
- "<finit>" (which Sun's verifier rejects).
- * parse.y (maybe_generate_finit): Leave out meaningless final flag.
- (generate_field_initialization_code): Removed.
- (fix_constructors) Don't add call to $finit$ here (wrong order).
- (patch_method_invocation): Add $finit$ call here.
-
- * java-tree.h (CALL_USING_SUPER): New macro.
- * parse.y (patch_invoke): Remove im local variable.
- (patch_method_invocation, patch_invoke): Don't pass super parameter.
- (patch_invoke): Use CALL_USING_SUPER instead of from_super parameter.
- (resolve_qualified_expression_name): Maybe set CALL_USING_SUPER.
-
- * jcf-write.c (get_access_flags): Fix typo ACC_PUBLIC -> ACC_FINAL.
-
- * parse.y (java_complete_tree): Don't complain about unreachable
- statement if it is empty_stmt_node.
-
- * jcf-write.c (find_constant_wide): New function.
- (push_long_const): Use find_constant_wide.
-
- * jcf-write.c (generate_bytecode_insn): Fix bug in switch handling.
- (generate_bytecode_insn): Use correct dup variant for MODIFY_EXPR.
- Add "redundant" NOTE_PUSH/NOTE_POP uses so code_SP_max gets set.
- Emit invokeinterface when calling an interface method.
- Emit invokespecial also when calling super or private methods.
-
- * jcf-write.c (generate_classfile): Emit ConstantValue attributes.
-
-Sun Dec 6 13:21:18 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-dump.c (INVOKE): If invokeinterface, print number of args.
-
-Thu Dec 3 17:11:12 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (java_layout_seen_class_methods): New function
- prototype.
- (LAYOUT_SEEN_CLASS_METHODS): Macro removed.
- * jcf-parse.c (parse_class_file): Call java_layout_seen_class_methods.
- * parse.h (PROMOTE_RECORD_IF_COMPLETE): New macro.
- * parse.y (method_declarator:): Defined action.
- (issue_warning_error_from_context): input_filename saved, set to
- the appropriate value and restored after java_error is called.
- (build_unresolved_array_type): Fixed comment.
- (register_fields): Use PROMOTE_RECORD_IF_COMPLETE.
- (method_header): Deal with return type the same way type are
- handled for fields and method's parameters and local variables
- types are handled.
- (check_method_redefinition): Removed extra CR.
- (declare_local_variables): Use PROMOTE_RECORD_IF_COMPLETE.
- (java_layout_seen_class_methods): New function.
- (java_layout_classes): Call java_layout_seen_class_methods.
-
-Thu Dec 3 15:56:50 1998 Per Bothner <bothner@cygnus.com>
-
- * parse,y (patch_synchronized_statement): Set CAN_COMPLETE_NORMALLY.
-
-Thu Dec 3 15:08:30 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-dump.c (main): Fix error message.
- * jcf-path.c (add_entry): Style fix.
-
-Wed Dec 2 15:52:25 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class_method): Call build_java_argument_signature
- on constructors too.
- * parse.y (check_method_redefinition): Use TYPE_ARGUMENT_SIGNATURE.
- (patch_method_invocation): Define a primary when resolving an
- expression name. Augmented comment on code checking illegal `this'
- usage. Loosened it test by accepting NEW_CLASS_EXPR.
-
-Tue Dec 1 13:53:24 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class_method): Don't report error on non-static
- overriding static if the method is private.
- * java-tree.h (finish_class): Prototype added.
- * lex.c (java_get_line_col): Handle col argument -2 value.
- * parse.h: All static method declarations moved to parse.y.
- * parse.y: Now contains all static method declarations previously
- found in parse.h.
- (find_expr_with_wfl, missing_return_error,
- unreachable_stmt_error): New functions.
- (java_get_real_method_name): Identify constructors bearing class
- names in source code compiled classes only.
- (java_complete_expand_methods): Call missing_return_error.
- (invocation_mode): Private methods invoked as static methods.
- (java_complete_tree): Call unreachable_stmt_error.
-
-1998-12-01 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.in (+target): Removed.
- (+xmake_file): Likewise.
- (+tmake_file): Likewise.
- (.NOEXPORT): Removed duplicate.
-
-Fri Nov 27 13:20:51 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (jc1, jv-scan): Link with $(SUBDIR_OBSTACK).
-
- * jv-scan.c: Fix xmalloc prototype. Provide an xmalloc definition.
-
- * jvgenmain.c: Remove the xmalloc prototype, we get it from
- libiberty.h. Provide an xmalloc definition.
-
- * jvspec.c: Remove the xmalloc prototype.
-
- * parse-scan.y: Include config.h and system.h. Don't include
- OS headers or gansidecl.h. Don't prototype xmalloc/xstrdup.
- Provide an xstrdup definition.
-
-Thu Nov 26 22:03:58 1998 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * jcf-path.c (add_entry): Recognize ".jar" too.
- * lang-specs.h: Likewise.
-
-Thu Nov 26 12:44:07 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): In Call_EXPR, handle
- soft_monitorenter_node, soft_monitorexit_node, throw_node.
-
- * jcf-write.c (generate_bytecode_insns):
- Handle pre/post-increment/decrement of long.
-
- * jcf-write.c (generate_bytecode_insns):
- Handle missing exception handler (finally for synchronized).
-
-Wed Nov 25 09:47:15 1998 Per Bothner <bothner@cygnus.com>
-
- * java-tree.h (end_params_node): Declare global.
- * decl.c (end_params_node): New global.
- (init_decl_processing, start_java_method): Use end_params_node for
- end of list of parameter types. Follows correct gcc conventions.
- * expr.c (pop_argument_types, pop_arguments): Likewise.
- * lang.c (put_decl_node): Likewise.
- * typeck.c (various places): Likewise.
- * class.y (various places): Likewise.
- * parse.y (various places): Likewise.
-
- * parse.y (java_complete_tree): Move CAN_COMPLETE_NORMALLY.
- (build_jump_to_finally): Add missing CAN_COMPLETE_NORMALLY.
-
- * class.c: Add #include flags.h, remove no-longer needed declaration.
-
- * class.c (layout_class_method): Remove commented-out code, re-format.
- Don't add vtable entry (or index) for private methods.
- * expr.c (expand_invoke): A private method is implicitly final.
- * class.c (make_class_data): If inlining or optimizing,
- skip private methods.
-
- * class.c (finish_class): New function. Calls existing methods,
- but alls emits deferred inline functions.
- * jcf-parse.c (parse_class_file): Call finish_class.
- * parse.y (java_complete_expand_methods): Likewise.
-
- * expr.c (build_java_binop): Explicit default, to silence -Wall.
-
- * expr.c (CHECK_PC_IN_RANGE): Add void cast to kill warnings.
-
-Wed Nov 25 00:50:58 1998 Marc Espie <espie@quatramaran.ens.fr>
-
- * jcf-write.c (generate_bytecode_conditional): Fix typo.
-
-Tue Nov 24 17:06:38 1998 Per Bothner <bothner@cygnus.com>
-
- * (generate_classfile): Always write class access flag with
- ACC_SUPER set.
-
-Tue Nov 24 16:34:33 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (maybe_layout_super_class): New function.
- (layout_class): Reorganized. Loop on class methods dispatched into
- a new function. Call maybe_layout_super_class.
- (layout_class_methods, layout_class_method): New functions.
- * expr.c (expand_java_NEW): Call layout_class_methods on loaded
- class.
- (expand_invoke): Likewise.
- * java-tree.h (all_class_list): New global variable declared.
- (layout_class_methods, layout_class_method): New function
- prototypes.
- (LAYOUT_SEEN_CLASS_METHODS): New macro.
- * jcf-parse.c (all_class_list): New global variable.
- (load_class): Extended what class_or_name can be. Use parser
- context mechanism to save globals before calling jcf_parse.
- (jcf_parse_source): Don't parse twice if HAS_BEEN_ALREADY_PARSED_P
- is set on the file name.
- (jcf_parse): Layout class methods when Object is loaded, otherwise
- record class in all_class_list for delayed method layout.
- (parse_class_file): Use LAYOUT_SEEN_CLASS_METHODS.
- * lang.c (put_decl_node): Decode <init> into the decl context
- class name.
- * lex.c (java_allocate_new_line): Use xmalloc.
- * parse.h (INCOMPLETE_TYPE_P): Redefined to work with incomplete
- pointers, not TREE_LIST elements.
- (struct parser_ctxt): Fixed comment indentations, added comments
- and reordered some fields.
- (java_check_methods): Function prototype removed.
- * parse.y (java_push_parser_context): Use xmalloc.
- (java_parser_context_restore_global): Pop extra pushed ctxp only
- when there's nothing next.
- (maybe_create_class_interface_decl): Fixed comment, add new
- created class decl to all_class_list.
- (method_header): Use GET_REAL_TYPE on argument's types.
- (method_declarator): Use GET_REAL_TYPE, change type to the real
- type in TREE_LIST dependency node. Build argument list with the
- real type.
- (create_jdep_list): Use xmalloc. Removed allocation error message.
- (obtain_incomplete_type): Fixed leading comment. Broadened
- incoming argument meaning.
- (register_incomplete_type): Use xmalloc. Removed allocation error
- message.
- (safe_layout_class): Fixed leading comment.
- (jdep_resolve_class): Reversed if statement condition and switch
- if and else bodies.
- (resolve_and_layout): Fixed leading comment. Broadened incoming
- argument meaning.
- (complete_class_report_errors): New local variable name, for
- clarity. purify_type_name used for all error cases.
- (java_get_real_method_name): Stricter check on constructors.
- (java_check_regular_methods): Reverse methods list only if not
- already laid out. Layout artificial constructor.
- (java_check_methods): Deleted.
- (source_start_java_method): Obtain incomplete type for patchable
- method arguments.
- (java_layout_classes): Fixed leading comment. Use
- LAYOUT_SEEN_CLASS_METHODS, use a loop to check methods. Added else
- statement to layout operation, reuse LAYOUT_SEEN_CLASS_METHODS
- before returning. Fixed comments.
- (java_expand_classes): Check for errors up front.
- (patch_method_invocation): Class to search is resolved and laid
- out.
-
-Tue Nov 24 12:57:13 1998 Per Bothner <bothner@cygnus.com>
-
- * expr.c (java_lang_expand_expr): Add missing emit_queue.
-
- * javaop.h (int8): Removed - not used.
- (jbyte): Redefine portably with correct signedness.
-
- * jcf-write.c (generate_bytecode_insns): Don't free sw_state.cases.
-
- * jcf-write.c (generate_bytecode_insns): Fix typo
- OPCODE_getstatic to OPCODE_getfield.
-
- * java-tree.def (CASE_EXPR, DEFAULT_EXPR): Kind is 'x', not '1'.
- * parse.y (java_complete_tree): For CASE_EXPR and DEFAULT_EXPR,
- set TREE_SIDE_EFFECTS (otherwise expand_expr may skip them).
-
-Thu Nov 19 11:16:55 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (jcf_parse_source): Function returned type is
- void. Added prototype.
- (jcf_parse): Function returned type is void.
- (yyparse): Remove call to fclose on the last parsed file.
-
- * java-tree.h (jcf_parse): Changed jcf_parse prototype.
-
-Wed Nov 18 23:54:53 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (unmangle_classname): Set QUALIFIED_P when appropriate.
- (layout_class): Cope with methods featuring WFL in decl names.
- * decl.c (unqualified_object_id_node): New global variable,
- initialized.
- (build_decl_no_layout): Removed.
- * expr.c (build_primtype_type_ref): Handle Double.
- (java_lang_expand_expr): Fixed indentations.
- * java-tree.h (CLASS_METHOD_CHECKED_P): Flag deleted.
- (flag_wall, flag_redundant, flag_not_overriding,
- flag_static_local_jdk1_1, unqualified_object_id_node): Global
- variable declarations.
- (build_decl_no_layout): Removed prototype.
- (java_get_real_method_name): Added prototype.
- (IS_UNCHECKED_EXPRESSION_P): Renamed IS_UNCHECKED_EXCEPTION_P.
- (java_parse_abort_on_error): Macro now just returns.
- * jcf-parse.c (jcf_parse_source): Check fclose returned
- value. Call emit_register_classes if java_report_errors returns
- zero.
- * lanc.c (flag_wall, flag_redundant, flag_not_overriding,
- flag_static_local_jdk1_1): New integer flags.
- (lang_decode_option): New flags set here.
- * parse.h (GET_REAL_TYPE, GET_METHOD_NAME): New macros.
- (OBSOLETE_MODIFIER_WARNING): Issue error message conditionally to
- the flag_redundant variable.
- (SET_TYPE_FOR_RESOLUTION): Consider Object being java.lang.Object
- when parsing java.lang.Object class.
- (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT): Added terminal
- NULL_TREE to build.
- (resolve_qualified_expression_name): Fixed indentation.
- (patch_array_ref): Changed prototype.
- (not_initialized_as_it_should_p): Prototype removed.
- (java_report_errors): Added function prototype.
- * parse.y (formal_parameter:): Changed error message for not yet
- supported final parameters.
- (class_type_list:): Set both PURPOSE and VALUE of created
- TREE_LIST to be class_type.
- (primary_no_new_array:): Handle class literals on primitive types.
- (parse_warning_context): Reinstalled correct force_error and
- do_warning flags setups.
- (java_report_errors): Changed prototype. Return java_error_count
- value.
- (variable_redefinition_error): Consider treating variable type as
- a fake pointer.
- (create_interface): Warn about redundant abstract modifier if
- flag_redundant is set. Changed error message.
- (lookup_field_wrapper): Save/restore globals before/after looking
- up field.
- (duplicate_declaration_error_p): Consider treating declaration
- type as a fake pointer.
- (register_fields): Extract real type from dependency node. Check
- for duplicate field declaration after type adjustment. Use
- DECL_INITIAL to store static final initialized values.
- (method_header): Extract real function type from dependency node.
- (check_abstract_method_header): Use GET_METHOD_NAME.
- (obtain_incomplete_type): Layout fake pointer type.
- (safe_layout_class): Don't try to check for methods before layout.
- (java_complete_class): Don't check for correct throws clause
- elements inheritance here.
- (resolve_and_layout): Broadened name parameter meaning.
- (reset_method_name): Use GET_METHOD_NAME.
- (java_get_real_method_name): New function.
- (java_check_regular_methods): Don't check methods in
- java.lang.Object. Verify lineage of throws clause elements. Use
- flag_no_overriding in warning report.
- (check_throws_clauses): Don't check if class was from
- bytecode. Use IS_UNCHECKED_EXCEPTION_P macro.
- (java_check_methods): Don't set CLASS_METHOD_CHECKED_P flag.
- (declare_local_variables): Use flag_static_local_jdk1_1 to report
- warning on unsupported final local variables. Use build_decl
- instead of build_decl_no_layout. Get real local variable type from
- dependency node.
- (source_start_java_method): Get real parameter type from
- dependency node. Call build_decl instead of build_decl_no_layout.
- (java_layout_classes): Reverse tree and layout type and class as
- required. Mark class as loaded when done.
- (resolve_field_access): Fixed indentation. Restricted condition
- leading to static field access code generation. Set field_type
- decl's TREE_TYPE if QUAL_DECL_TYPE not available.
- (resolve_qualified_expression_name): Initialize type_found to
- null. Handle static field resolved during qualification. Fixed
- layout on non primitive field decl types.
- (not_accessible_p): Fixed typo in comment.
- (patch_method_invocation): Resolve and layout class to search from
- type.
- (lookup_method_invoke): Keep integer constant 0 as is. Resolve and
- layout non primitive type, if necessary. Make method node only to
- report errors.
- (find_applicable_accessible_methods_list): Consider WFL'ed method
- decl names. Fixed indentation.
- (argument_types_convertible): Resolve and layout target type if
- necessary.
- (java_complete_tree): Fixed indentation problems. Rewrote
- CALL_EXPR thrown exceptions check. Re-installed further processing
- of the assignment in certain cases.
- (patch_assignment): Call maybe_build_primttype_type_ref to perform
- inlining on class literals.
- (valid_builtin_assignconv_identity_widening_p): Cope with constant
- 0 literal.
- (valid_method_invocation_conversion_p): Likewise.
- (patch_string): Temporary disable forbidden use of `this' in
- explicit constructor invocations when doing string concatenation
- within their scope.
- (patch_unaryop): Added comment. Reinstalled code to disable
- further check on assignment operation with cast expression RHS.
- (patch_switch_statement): Fixed indentation.
- (build_try_statement): Call build_decl instead of
- build_decl_no_layout.
- (patch_synchronized_statement): Likewise.
- (patch_throw_statement): Use IS_UNCHECKED_EXCEPTION_P instead of
- IS_UNCHECKED_EXPRESSION_P.
- (check_thrown_exceptions_do): Changed leading comment. Resolve and
- layout argument exception type.
- (purge_unchecked_exceptions): Use IS_UNCHECKED_EXCEPTION_P instead
- of IS_UNCHECKED_EXPRESSION_P.
-
-Wed Nov 18 14:21:48 1998 Anthony Green <green@cygnus.com>
-
- * jcf-parse.c (yyparse): Open class file in binary mode.
-
-Sun Nov 15 17:14:17 1998 Per Bothner <bothner@cygnus.com>
-
- * jvgenmain.c: Need to #include "gansidecl.h" (to get PROTO).
-
- * jcf-write.c (perform_relocations): Move check out one loop.
-
-Sun Nov 15 15:09:56 1998 Anthony Green <green@hoser.cygnus.com>
-
- * Make-lang.in: Fix reference to srcdir.
- * jv-scan.c: Add missing xmalloc prototype.
- * jvgenmain.c: Ditto.
-
-Sun Nov 15 14:36:29 1998 Per Bothner <bothner@cygnus.com>
-
- * decl.c (error_mark_node), java-tree.h: New global.
- * parse.y: Use empty_stmt_node instead of size_zero_node.
- (build_if_else_statement): If missing else, use empty_stmt_node.
-
- * parse.y (not_initialized_as_it_should_p): Removed, with its callers.
- (java_complete_expand_method): Complain if return is missing.
- (java_check_regular_methods): Comment out incorrect error check.
- (not_accessible_p): Fix incorrect handling of protected methods.
- (patch_method_invocation): Pass correct context to not_accessible_p.
- (find_applicable_accessible_methods_list): Likewise.
- (qualify_ambiguous_name): If ARRAY_REF, it's an expression name.
- (java_complete_tree): For CASE_EXPR and DEFAULT_EXPR, set
- TREE_TYPE (to void_type_node); otherwise expand_expr crashes.
- (patch_if_else_statement): Fix setting of CAN_COMPLETE_NORMALLY.
-
- * jcf-write.c (CHECK_OP, CHECK_PUT): Add some error checking.
- (push_int_const): Remove reundant NOTE_PUSH.
- (generate_bytecode_insns - case STRING_CST): Do NOTE_PUSH.
- (- case SWITCH_EXPR): Fix code generation bug.
- (- case PREDECREMENT_EXPR etc): Remove redundant NOTE_PUSH.
- (generate_classfile): More robust for abstract methods.
-
-Sun Nov 15 13:52:39 1998 Anthony Green <green@cygnus.com>
-
- * Makefile.in: jv-scan and jvgenmain all require libiberty.
- * Make-lang.in: Ditto.
-
- * jv-scan.c: Remove xmalloc and xstrdup definitions.
- * jvgenmain: Ditto.
-
-Sun Nov 15 14:10:56 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-parse.c (HANDLE_EXCEPTIONS_ATTRIBUTE): New macro.
-
- * jcf-io.c (find_class): Simpler/cleaner structure fixes a bug.
-
-Sat Nov 14 17:19:18 1998 Per Bothner <bothner@cygnus.com>
-
- Allow uses of interface types to verify. This is not really
- type-safe, but it matches what Sun does, and is OK as long as
- there are appropriate run-time checks.
- * verify.c (merge_types): If merging two interface types,
- just set the result to java.lang.Object.
- * expr.c (pop_type): Any interface is matches by java.lang.Object.
-
-1998-11-13 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (main): Handle --output-class-directory argument.
- * jvspec.c (lang_specific_driver): Translate `-d' into
- -foutput-class-dir.
- * jcf.h (jcf_write_base_directory): Declare.
- * lang.c (lang_decode_option): Recognize -foutput-class-dir.
- * lang-options.h: Mention -foutput-class-dir.
- * jcf-write.c (jcf_write_base_directory): New global.
- (make_class_file_name): Put generated .class file into `-d'
- directory, or into source directory if -d not given. Function now
- static.
- (write_classfile): Free class file name. Handle case where class
- file name is NULL.
- (DIR_SEPARATOR): New macro.
- Include <sys/stat.h>
-
- * Makefile.in (prefix): New macro.
-
-Thu Nov 12 14:15:07 1998 Per Bothner <bothner@cygnus.com>
-
- * parse.y (patch_invoke): Do less if flag_emit_class_files.
- * expr.c (build_known_method_ref): Don't check flag_emit_class_files
- here (done in patch_invoke instead).
- (case_identity): Moved here from parse.y.
-
- * java-tree.h (CAN_COMPLETE_NORMALLY): New macro.
- * parse.y (java_complete_tree etc): Maybe set CAN_COMPLETE_NORMALLY.
- * parse.y (java_complete_tree): Re-order COMPOUND_EXPR in BLOCK
- so they can be efficiently scanned without recursion.
- Error it ! CAN_COMPLETE_NORMALLY first part of COMPOUND_EXPR.
- * expr.c (java_lang_expand_expr): Expand statements of COMPOUND_EXPR
- in BLOCK iteratively, rather than recursively.
-
- * parse.y (do_unary_numeric_promotion): New function.
- (patch_unaryop, patch_binop, patch_array_ref): Use it.
-
- * parse.y (patch_newarray): Various fixes.
-
- Re-do handling of switch statements (for proper block scoping).
- * parse.y: Add just a single block for the enture switch block,
- but don't create any "case blocks".
- (group_of_labels): Rmeoved unneeded non-terminal.
- CASE_EXPR and DEFAULT_EXPR are added to current block.
- * expr.c (java_lang_expand_expr): Inline SWITCH_EXPR here.
- Now also need to handle CASE_EXPR and DEFAULT_EXPR.
- * java-tree.h (SWITCH_HAS_DEFAULT): New macro.
- * parse.y (wfl_operator, print_int_node): Make non-static.
- (java_complete_tree): CASE_EXPR and DEFAULT_EXPR are now processed
- as part of recursive scan of block.
- (java_expand_switch ): Removed - inlined into java_lang_expand_expr.
- (patch_switch_statement): Most tests move dinto java_complete_tree.
-
- * parse.y: Make various production be non-typed (void).
- * parse.y (parse_error): Merged into issue_warning_error_from_context.
- * parse.y (add_stmt_to_compound): Don't create/change extra node.
- (patch_method_invocation_stmt): Renamed to patch_method_invocation.
-
- * jcf-write.c (struct jcf_handler): New type.
- (struct jcf_switch_state): New type.
- (SWITCH_ALIGN_RELOC, BLOCK_START_RELOC): New relocation kinds.
- (alloc_handler, emit_unop, emit_reloc): New functions.
- (adjust_typed_op): Add extra parameter ("max type" offset).
- (emit_switch_reloc, emit_case-reloc): New function.
- (generate_bytecode_conditional): Handle REAL_TYPE comparisons.
- (generate_bytecode_insns): Support REAL_CST, switch statements,
- exception handling, method calls, object/array creation, and more.
-
- * class.c: Remove some unused variables.
- * constants.c (find_string_constant): New function.
- (count_constant_pool_bytes): Fix to correctly handle wide constants.
- * decl.c (complete_start_java_method): Don't _Jv_InitClass
- if flag_emit_class_files.
-
-1998-11-12 Tom Tromey <tromey@cygnus.com>
-
- * jcf-io.c (find_class): Added explanatory comment.
-
- * jcf-path.c (add_entry): Look for `.zip' at end of filename. Add
- trailing slash to `.zip' entries.
-
- * jvspec.c (lang_specific_driver): Correctly handle case where
- GC_NAME not defined.
-
-1998-11-11 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (GC_NAME): New define.
- (lang_specific_driver): Use GC_NAME. Add GC_NAME to command line
- if required.
- * Make-lang.in (jvspec.o): Define WITH_GC_<name>.
-
-Wed Nov 11 19:08:52 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-dump.c (TABLE_SWITCH): Fix typos.
-
-1998-11-11 Tom Tromey <tromey@cygnus.com>
-
- * jcf-dump.c (main): Correctly recognize `--'-style long options.
-
-Tue Nov 10 12:34:03 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (is_compiled_class): Call safe_layout_class for class
- compiled from source.
- * conver.h (convert_to_integer, convert_to_real,
- convert_to_pointer): Added prototypes.
- * decl.c (init_decl_processing): Non longer push the decls of
- `methodtable', `constants', `Class', `Field', `dispatchTable'
- `jexception' and `Method'.
- * expr.c (build_invokeinterface): New function.
- (expand_invoke): static variable CLASS_IDENT now in
- build_invokeinterface. Use build_invokeinterface.
- (expand_java_field_op): Moved code to inline
- java.lang.PRIMTYPE.TYPE into a function.
- (build_primtype_type_ref): New function.
- * java-tree.def (INSTANCEOF_EXPR): New tree code.
- * java-tree.h (CLASS_METHOD_CHECKED_P, METHOD_DEPRECATED,
- FIELD_DEPRECATED, CLASS_DEPRECATED): New flag macros.
- (DECL_CONSTRUCTOR_P): Fixed typo in comment.
- (DECL_LOCAL_STATIC_VALUE): New macro.
- (build_invokeinterface, build_primtype_type_ref): New function
- prototypes.
- (java_parse_abort_on_error): Macro rewritten.
- * jcf-parse.c (current_method): Add comment to declaration.
- (parse_zip_file_entries, process_zip_dir, void parse_source_file):
- Function prototypes fixed.
- (jcf_parse_source): push/pop parser context. save/restore global.
- (parse_source_file): Fixed leading comment. Now take a
- IDENTIFIER_NODE as an argument. Doesn't check methods, layout
- classes and pop the parser context anymore.
- (yyparse): Push parser context, save globals, parse the source
- file, restore globals and pop the parser context when processing a
- source file.
- * jcf.h (VERBOSE_SKELETON): Replaces SOURCE_FRONTEND_DEBUG define.
- * lex.c (java_parse_doc_section): New function.
- (java_lex): Call java_parse_doc_section when appropriate. Build an
- operator around INSTANCEOF_TK.
- * lex.h (java_lineterminator, java_sprint_unicode,
- java_unicode_2_utf8, java_lex_error, java_store_unicode):
- Prototypes rewritten.
- (java_parse_escape_sequence, java_letter_or_digit_p,
- java_parse_doc_section, java_parse_end_comment, java_get_unicode,
- java_read_unicode, java_store_unicode, java_read_char,
- java_allocate_new_line, java_unget_unicode, java_sneak_unicode):
- Added function prototypes.
- * parse.h (VERBOSE_SKELETON): Replaces SOURCE_FRONTEND_DEBUG
- define.
- (JNULLP_TYPE_P, CHECK_METHODS, CHECK_DEPRECATED, REGISTER_IMPORT):
- New macros
- (struct parser_ctxt): New fields: deprecated,
- current_parsed_class_un, gclass_list.
- (fix_method_argument_names, issue_warning_error_from_context,
- resolve_package, lookup_package_type): New function prototypes.
- (resolve_expression_name): Fixed function prototype.
- (find_applicable_accessible_methods_list): Fixed indentation, added
- extra argument in prototype.
- (check_final_assignment, build_null_of_type, check_deprecation,
- check_method_redefinition, reset_method_name,
- java_check_regular_methods, java_check_abstract_methods,
- maybe_build_primttype_type_ref): New function prototype.
- * parse.y (conver.h): Include.
- (INSTANCEOF_TK): Tagged <operator>.
- (single_type_import_declaration): Use REGISTER_IMPORT macro.
- (relational_expression:): Build binop for instanceof.
- (java_push_parser_context): Remember ctxp->gclass_list across
- contexts.
- (java_pop_parser_context): Simply return if no context
- exists. Remember gclass_list across contexts.
- (issue_warning_error_from_context): New function.
- (parse_error_context): Don't setup ctxp->elc here. Call
- issue_warning_error_from_context instead.
- (parse_warning_context): Likewise.
- (maybe_create_class_interface_decl): Removed DECL_ARTIFICIAL
- setup. Link new class/interface to ctxp->gclass_list.
- (add_superinterfaces): Register interface as incomplete if not
- loaded.
- (create_class): Remember class unqualified name in
- ctxp->current_parsed_class_un. Check class deprecation.
- (register_fields): Check field deprecation. Remember static final
- field value in DECL_LOCAL_STATIC_VALUE. Changed comment in part
- processing INIT.
- (method_header): New local variable ORIG_ARG. Use unqualified
- current class name for check on constructor errors. Promote return
- type if of record type. Argument list fix moved in
- fix_method_argument_names, called here. Check method deprecation.
- (fix_method_argument_names): New function.
- (method_declarator): Promote record typed arguments.
- (safe_layout_class): Check class methods before layout.
- (java_complete_class): Compute field layout when patched.
- (do_resolve_class): Try to load class after having it renamed
- after the package name.
- (get_printable_method_name): Use DECL_CONTEXT.
- (reset_method_name): New function.
- (check_method_redefinition): Use reset_method_name.
- (java_check_regular_methods): New local variable
- SAVED_FOUND_WFL. Temporarily reinstall overriding/hiding method
- names for error report. Check for compile-time error when method
- found has default (package) access.
- (java_check_abstract_methods): Now takes an interface DECL node as
- an argument. Also reinstall real name on unchecked
- overriding/hiding methods for error report.
- (java_check_methods): Fixed leading comment. Get classes to verify
- from ctxp->gclass_list. Use CHECK_METHODS macro and set
- CLASS_METHOD_CHECKED_P on class verification.
- (lookup_java_method2): Get real method name if necessary.
- (find_in_imports): Don't check package class access here.
- (resolve_package, lookup_package_type): New functions.
- (java_layout_classes): Fixed leading comment. Take classes to be
- laid out from ctxp->gclass_list.
- (java_complete_expand_methods): Don't expand native and abstract
- methods.
- (java_expand_classes): New function.
- (resolve_expression_name): Use additional argument ORIG. Retrieve
- values of static final field of primitive types.
- (resolve_field_access): Handles static final field of promotive
- type.
- (resolve_qualified_expression_name): Handle STRING_CST as
- primaries and package name resolution. Check deprecation on found
- decls. Set where_found and type_found on non static field resolved
- during qualification. Layout non primitive field decl types.
- (check_deprecation): New function.
- (maybe_access_field): Simplified.
- (patch_method_invocation_stmt): Local variable CLASS_TYPE
- removed. Reverse method's argument when primary is a type. Don't
- use CLASS_TYPE to report problems, use IDENTIFIER_WFL
- instead. Include abstract class in the list of class searchable
- for constructors. Use DECL_CONTEXT of found method for access
- checks. Check method deprecation.
- (patch_invoke): Pay extra care to NEW_CLASS_EXPR type call when
- converting arguments. Handle INVOKE_INTERFACE.
- (lookup_method_invoke): Search constructor using existing
- infrastructure (don't rely on lookup_java_constructor anymore).
- (find_applicable_accessible_methods_list): Extra argument flag
- LC. Now include constructor in the search.
- (qualify_ambiguous_name): Conditional expression are primaries.
- (not_initialized_as_it_should_p): static final are always
- initialized.
- (java_complete_tree): Pass extra NULL argument to
- resolve_expression_name. Stricter test to carry on patching
- assignments. New case for INSTANCEOF_EXPR.
- (complete_function_arguments): Inline PRIMTYPE.TYPE read access.
- (check_final_assignment, maybe_build_primttype_type_ref): New
- functions.
- (patch_assignment): Detect resolved static finals and carry normal
- assignment error check on them. Inline PRIMTYPE.TYPE read access.
- (try_builtin_assignconv): Access constant 0 on all primitive
- types.
- (valid_builtin_assignconv_identity_widening_p): Accept identical
- types. Accept all promoted type on int type.
- (valid_ref_assignconv_cast_p): Accept a null pointer to be
- assigned to a reference.
- (valid_method_invocation_conversion_p): Accept to check null
- pointers.
- (build_binop): Merge declaration and initialization of local
- variable BINOP.
- (patch_binop): New case for INSTANCEOF_EXPR. NE_EXPR to accept all
- numeric types. Improved validity test for qualify operators on
- references.
- (patch_unaryop): Broadened rejection test for PREDECREMENT_EXPR
- and PREINCREMENT_EXPR. Also detect resolved static finals of a
- primitive type and issue the appropriate error message.
- (resolve_type_during_patch): Mark class loaded when resolved.
- (patch_cast): Allow null to be cased to reference types.
- (build_null_of_type): New function.
- (patch_array_ref): Handle array on references correctly.
- (patch_return): Removed unused local variable MODIFY. Force
- boolean to be returned as integers. Allows null to be returned by
- a function returning a reference.
- * typeck.c (convert_to_integer, convert_to_real,
- convert_to_pointer): Prototypes moved to convert.h
- (lookup_argument_method): Use method real name, if necessary.
-
-1998-10-30 Tom Tromey <tromey@cygnus.com>
-
- * class.c (build_class_ref): Changed name of primitive classes to
- start with `_Jv_'.
-
- * class.c (make_class_data): Renamed fields: nmethods to
- method_count, method_count to dtable_method_count. Always set
- `state' field to 0.
- * decl.c (init_decl_processing): Likewise.
-
-Wed Oct 28 08:03:31 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class): Don't mangle <finit>, produce
- __finit<class> instead. Don't verify artificial methods.
- * decl.c (finit_identifier_node): New declared global.
- (init_decl_processing): finit_identifier_node initialized.
- * java-tree.def (CONDITIONAL_EXPR): New Java tree code.
- * java-tree.h (finit_identifier_node): Declared as extern.
- (struct lang_decl): New field called_constructor.
- (DECL_CONSTRUCTOR_CALLS): Access macro to called_constructor.
- (CLASS_HAS_FINIT_P): New macro.
- (CALL_CONSTRUCTOR_P): Leading comment changed. Macro now checks
- explicit constructor invocation.
- (CALL_EXPLICIT_CONSTRUCTOR_P, CALL_THIS_CONSTRUCTOR_P,
- CALL_SUPER_CONSTRUCTOR_P): New macros.
- (write_classfile): Added prototype.
- * jcf-parse.c (jcf_parse_source): Parse and remember for
- generation if the file was seen on the command line.
- (parse_source_file): Don't write the class file here.
- (yyparse): Loop on files rewritten. Set current_jcf.
- (parse_zip_file_entries): Parse class file only if it was found.
- * lang.c (init_parse): Don't open command line provided filename
- here.
- (lang_parse): Don't set main_jcf anymore.
- * parse.h (ABSTRAC_CHECK): Capitalized arguments.
- (JCONSTRUCTOR_CHECK): New macro.
- (JBSC_TYPE_P): New macro.
- (IN_TRY_BLOCK_P, EXCEPTIONS_P): Fixed leading comment.
- (COMPLETE_CHECK_OP_2): New macro.
- (struct parse_ctxt): New field explicit_constructor_p.
- (check_class_interface_creation): Fixed prototype indentation.
- (patch_method_invocation_stmt): Prototype reflects added argument.
- (patch_invoke): Likewise.
- (complete_method_declaration, build_super_invocation,
- verify_constructor_circularity,
- build_this_super_qualified_invocation, get_printable_method_name,
- patch_conditional_expr, maybe_generate_finit, fix_constructors,
- verify_constructor_super, create_artificial_method,
- start_artificial_method_body, end_artificial_method_body,
- generate_field_initialization_code): New function prototypes.
- * parse.y: Fixed leading comment
- (constructor_header:, constructor_body:, block_end:): Rules tagged
- <node>.
- (type_declaration:): Call maybe_generate_finit.
- (method_declaration:): Action for method_body: placed in new
- function complete_method_declaration, called here.
- (constructor_declaration:): Defined actions. Removed leading
- FIXME.
- (constructor_header:): New rule with action.
- (constructor_body:): Rule rewritten using block_begin: and
- block_end:. Defined actions.
- (constructor_declarator:, explicit_constructor_invocation:):
- Defined actions.
- (block:): Use new rules block_begin: block_end:.
- (block_begin:, block_end:): New rules and actions.
- (block_statements:): Fixed error message for explicit
- constructors.
- (method_invocation:): Call build_this_super_qualified_invocation
- if primary is `this' or `super' was seen.
- (conditional_expression:): Action defined.
- (extra_ctxp_pushed_p): New static global flag.
- (java_parser_context_save_global): Create parser context if
- necessary. Use extra_ctxp_pushed_p to remember it.
- (java_parser_context_restore_global): Pop extra parser context if
- one exists.
- (build_array_from_name): Array on primitive types are marked
- loaded.
- (register_fields): Restore new name in field initializer
- expression if type was altered. Non static fields initialized upon
- declaration marked initialized.
- (maybe_generate_finit): New function.
- (maybe_generate_clinit): Use create_artificial_method,
- start_artificial_method_body, end_artificial_method_body. Generate
- debug info for enclosed initialization statements.
- (method_header): Fixed leading comment. Check constructor
- flags. Detect constructor declarations and set DECL_CONSTRUCTOR_P
- accordingly.
- (complete_method_declaration, constructor_circularity_msg,
- verify_constructor_circularity): New functions.
- (get_printable_method_name): New function.
- (check_method_redefinition): Don't rename <finit> methods. Fix
- declared constructor names. Error message for
- constructors modified.
- (java_check_regular_methods): Local variable seen_constructor
- renamed saw_constructor. Skip verification on constructors. Create
- default constructor with create_artificial_method.
- (java_check_methods): Removed unnecessary empty line.
- (create_artificial_method, start_artificial_method_body,
- end_artificial_method_body): New functions.
- (java_layout_classes): Changed leading comment. Reverse fields
- list if necessary. Always layout java.lang.Object if being
- defined.
- (java_complete_expand_methods): Verify constructor circularity.
- (java_complete_expand_method): Call fix_constructor on
- constructors. Local variable no_ac_found removed. Restore
- bindings if method body expansion failed.
- (fix_constructors, verify_constructor_super,
- generate_field_initialization_code): New function.
- (java_expand_classes): Fixed leading comment. Write class file
- here.
- (resolve_expression_name): Check for illegal instance variable
- usage within the argument scope of an explicit constructor
- invocation.
- (resolve_qualified_expression_name): Pass extra from_super flag
- when invoking patch_method_invocation_stmt. New case for
- conditional expression when used as a primary. Check for error
- when acquiring super.
- (patch_method_invocation_stmt): Added extra argument super. New
- local variable is_static_flag. Set class_to_search according to
- the nature of the constructor invocation. Don't add `this'
- argument when expanding NEW_CLASS_EXPR. Check for illegal method
- invocation within the argument scope of explicit constructor
- invocation. Set is_static according to is_static_flag. Provide
- extra `super' argument to patch_invoke invocation.
- (patch_invoke): New argument from_super. Loop on arguments
- indentation fixed. Pass from_super to invocation_mode. New switch
- case INVOKE_SUPER. Fixed error message in switch default case.
- Don't use CALL_CONSTRUCTOR_P but rather a test on the tree node
- value.
- (invocation_mode): Return INVOKE_SUPER mode when appropriate.
- (lookup_method_invoke): Fixed prototypes in candidates list. Error
- message takes constructors into account.
- (find_applicable_accessible_methods_list): Fixed indentation.
- (qualify_ambiguous_name): Take explicit constructor invocation
- into account. Deal with a conditional expression as a primary to
- a method call.
- (java_complete_tree): Added local wfl_op3. New CONDITIONAL_EXPR
- case. Added extra argument to patch_method_invocation_stmt.
- Register calls made to explicit constructor `this'. Don't call
- save_expr in ARRAY_REF case when emitting class files. Check for
- illegal use of this when expanding explicit constructor invocation
- arguments.
- (complete_function_arguments): Set and reset parser context
- explicit_constructor_p field value when appropriate.
- (build_super_invocation, build_this_super_qualified_invocation):
- New functions.
- (patch_assignment): Fixed typo.
- (patch_unaryop): Check on final fields occurs only when a decl
- exits.
- (patch_return): Take constructors into account.
- (patch_conditional_expr): New function.
- * typeck.c (build_java_signature): Removed unnecessary empty line.
-
-Wed Oct 28 00:46:15 1998 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (jcf-dump, gcjh): Link in $(LIBS) too.
-
-1998-10-28 Tom Tromey <tromey@cygnus.com>
-
- * decl.c (init_decl_processing): Renamed fields.
- * class.c (make_class_data): Renamed bfsize, nfields, nsfields,
- interface_len, msize fields.
-
- * class.c (make_class_data): Removed subclass_head and
- subclass_next fields.
- * decl.c (init_decl_processing): Removed subclass_head and
- subclass_next fields.
-
-Wed Oct 28 00:46:15 1998 Jeffrey A Law (law@cygnus.com)
-
- * jcf-write.c (emit_load_or_store): Avoid implicit int arguments.
- * mangle.c (emit_unicode_mangled_name): Similarly.
-
-Mon Oct 26 12:17:23 1998 Nick Clifton <nickc@cygnus.com>
-
- * jcf-parse.c (get_constant): Place braces around code to compute
- 'd' when REAL_ARITHMETIC is not defined.
-
-Sun Oct 25 14:58:05 1998 H.J. Lu (hjl@gnu.org)
-
- * Make-lang.in (jv-scan$(exeext)): Add stamp-objlist to
- dependency.
-
-1998-10-23 Tom Tromey <tromey@cygnus.com>
-
- * lang-specs.h: `.zip' files are input to jc1.
-
-Thu Oct 22 23:01:54 1998 Per Bothner <bothner@cygnus.com>
-
- * jvspecs.c: Add (but don't enable) support for combining multiple
- .class and .java input filenames to a single jc1 invocation.
- Add support for -C flag (copile to .class files).
- Translate -classpath and -CLASSPATH arguments.
- * lang-specs.h: Don't set %2 spec.
-
-1998-10-22 Tom Tromey <tromey@cygnus.com>
-
- * jcf-path.c (add_entry): Don't add trailing separator if entry is
- a .zip file.
- (add_path): Don't add trailing separator to non-empty path
- elements.
-
- * lang.c (lang_decode_option): Check for -fclasspath and
- -fCLASSPATH before examining other `-f' options.
-
- * java-tree.h (finalize_identifier_node): Don't declare.
- * class.c (make_class_data): Don't push "final" field.
- * decl.c (init_decl_processing): Don't push "final" field.
- (finalize_identifier_node): Removed.
- (init_decl_processing): Don't set finalize_identifier_node.
-
- * config-lang.in (stagestuff): Added jcf-dump and jv-scan.
-
-Sun Oct 11 10:31:52 1998 Anthony Green <green@cygnus.com>
-
- * Make-lang.in (java): Depend on jcf-dump and jv-scan.
- (JV_SCAN_SOURCES): New macro.
- (JCF_DUMP_SOURCES): Likewise.
- (jcf-dump$(exeext)): New target.
- (jv-scan$(exeext)): New target.
-
-1998-10-22 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.in (LEX): Removed.
- (LEXFLAGS): Likewise.
- (SET_BISON): New macro.
- (BISON): Removed.
- ($(PARSE_C)): Use SET_BISON. Run bison from srcdir to avoid
- spurious diffs in parse.c.
- ($(PARSE_SCAN_C)): Likewise.
- (PARSE_DIR): New macro.
- (PARSE_C): Use it.
- (PARSE_SCAN_C): Likewise.
- (PARSE_RELDIR): New macro.
-
- * jcf-io.c (saw_java_source): Define here, not in jcf-parse.c.
-
- * jcf-io.c (find_class): Use saw_java_source to determine when to
- look for `.java' file.
- * jcf-parse.c (saw_java_source): New global.
- (yyparse): Set it if `.java' file seen.
-
- * Make-lang.in (JAVA_SRCS): Added jcf-path.c.
- (GCJH_SOURCES): Likewise.
- * Makefile.in (datadir): New macro.
- (libjava_zip): Likewise.
- (JAVA_OBJS): Added jcf-path.o.
- (../jcf-dump$(exeext)): Depend on and link with jcf-depend.o.
- (../gcjh$(exeext)): Likewise.
- (jcf-path.o): New target.
- * java-tree.h (fix_classpath): Removed decl.
- * jcf-parse.c (fix_classpath): Removed.
- (load_class): Don't call fix_classpath.
- * parse.y (read_import_dir): Don't call fix_classpath.
- * lex.h: Don't mention classpath.
- * lex.c (java_init_lex): Don't initialize classpath.
- * jcf-io.c (classpath): Removed global.
- (find_class): Use jcf_path iteration functions. Correctly search
- class path for .java file.
- (open_in_zip): New argument `is_system'.
- * jcf-dump.c (main): Call jcf_path_init. Recognize all new
- classpath-related options.
- * lang.c (lang_decode_option): Handle -fclasspath, -fCLASSPATH,
- and -I.
- (lang_init): Call jcf_path_init.
- * lang-options.h: Mention -I, -fclasspath, and -fCLASSPATH.
- * lang-specs.h: Handle -I. Minor cleanup to -M options.
- Correctly put braces around second string in each entry.
- * gjavah.c (main): Call jcf_path_init. Recognize all the new
- classpath-related options.
- (help): Updated for new options.
- * jcf.h: Declare functions from jcf-path.c. Don't mention
- `classpath' global.
- * jcf-path.c: New file.
-
- * jcf-depend.c: Include jcf.h.
-
- * jcf-write.c (localvar_alloc): Returns `void'.
- (localvar_free): Removed unused variable.
-
- * lang.c (OBJECT_SUFFIX): Define if not already defined.
- (init_parse): Use OBJECT_SUFFIX, not ".o".
-
-Wed Oct 21 07:54:11 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (emit_register_classes): Renamed from
- emit_register_class.
- * java-tree.h (emit_register_classes): Prototype renamed from
- emit_register_class.
- * jcf-parse.c (yyparse): Call emit_register_classes once before
- returning.
- * parse.y (java_expand_classes): No longer register classes.
-
-Tue Oct 20 09:15:38 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (is_compiled_class): New local variable
- seen_in_zip. Identify classes found in currently compiled source
- file(s).
- * decl.c (complete_start_java_method): Fixed typo.
- * java-tree.h (CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P,
- HAS_BEEN_ALREADY_PARSED_P, IS_A_COMMAND_LINE_FILENAME_P): New macros.
- (CLASS_P): Moved around.
- (java_parse_abort_on_error): Macro moved from jcf-parse.c
- * jcf-parse.c (java_parse_abort_on_error): Macro moved to
- java-parse.h
- (jcf_parse_source): Changed leading comment. Removed unnecessary
- fclose and CLASS_FROM_SOURCE_P marking.
- (parse_source_file): New local variables remember_for_generation
- and filename. Mark parsed file name identifier node. Removed block
- executed when parse_only was null. Set remember_for_generation.
- Use it as an argument to java_pop_parser_context.
- (yyparse): New local variables several_files, list, next node and
- current_file_list. Split ampersand separated file names into
- current_file_list. Iterate through the list and parse accordingly.
- * parse.h (java_pop_parser_context): New function prototype.
- * parse.y (ctxp_for_generation): New static global variable.
- (java_pop_parser_context): New argument generate. Link popped ctxp
- to ctxp_for_generation list accordingly.
- (java_complete_expand_methods): Fixed indentation.
- (java_expand_classes): New function.
-
-Sat Oct 17 11:25:21 1998 Per Bothner <bothner@cygnus.com>
-
- * Makefile.in: Link with libiberty.a instead of memmove.o.
-
-Fri Oct 16 10:59:01 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (setjmp.h): No longer included.
- * lex.h (setjmp.h): Included.
- * parse.h (SET_TYPE_FOR_RESOLUTION): New macro.
- (duplicate_declaration_error_p): Renamed from
- duplicate_declaration_error.
- (build_array_from_name): New function prototype.
- * parse.y (setjmp.h): No longer included.
- (variable_declarator_id): Define action.
- (build_array_from_name): New function.
- (duplicate_declaration_error_p): Renamed from
- duplicate_declaration_error. Fixed leading comment.
- (register_fields): Main `for' loop reorganized. Uses
- SET_TYPE_FOR_RESOLUTION and build_array_from_name.
- (method_declarator): Uses SET_TYPE_FOR_RESOLUTION and call
- build_array_from_name.
- (resolve_class): Set CLASS_LOADED_P on newly build array dimension
- types.
- (read_import_dir): Don't try to skip `.' and `..'.
- (declare_local_variables): Uses SET_TYPE_FOR_RESOLUTION and
- build_array_from_name. Main `for' loop reorganized.
- (resolve_qualified_expression_name): When building access to a
- field, use the type where the field was found, not its own type.
- (maybe_access_field): Use field DECL_CONTEXT if the type where the
- field was found is null.
- (qualify_ambiguous_name): Sweep through all successive array
- dimensions.
-
-Wed Oct 14 18:21:29 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (pop_labeled_block, lang_printable_name,
- maybe_add_interface, set_super_info, get_access_flags_from_decl,
- interface_of_p, inherits_from_p, fix_classpath,
- complete_start_java_method, emit_handlers, init_outgoing_cpool,
- make_class_data, register_class, alloc_name_constant): New
- function prototypes.
- * lang.c (lang_decode_option): Set argc argument unused. Fixed
- indentation. Added cast to remove warning.
- (lang_printable_name): Set v argument unused.
- (lang_print_error): Added argument to lang_printable_name call.
- (java_dummy_print, print_lang_decl, print_lang_type,
- print_lang_identifier, lang_print_xnode): All argument marked
- unused.
- * lex.c (java_unget_unicode): Removed unnecessary argument.
- (java_allocate_new_line): Unused local variable is gone.
- (java_read_char): Added parenthesis in expressions to remove
- warnings. Added final return statement.
- (java_read_unicode): Added parenthesis in expression to remove
- warning.
- (java_parse_end_comment): Fixed java_unget_unicode invocation.
- (java_parse_escape_sequence): Likewise.
- (java_lex): Unused local variables are gone. Fixed
- java_unget_unicode invocation.
- * lex.h (set_float_handler): Prototype added when JC1_LITE not
- defined.
- * parse.h (ERROR_CANT_CONVERT_TO_BOOLEAN): Fixed
- lang_printable_name invocation in macro.
- (ERROR_CANT_CONVERT_TO_NUMERIC, ERROR_CAST_NEEDED_TO_INTEGRAL):
- Likewise.
- (duplicate_declaration_error): Suppressed unused argument in
- prototype.
- (identical_subpath_p): Function declaration is gone.
- (patch_invoke): Suppressed unused argument in prototype.
- (patch_cast, build_labeled_block, check_thrown_exceptions):
- Likewise.
- * parse.y (setjmp.h): Included
- (toplev.h): Likewise.
- (field_declaration:): Suppressed unused local
- (label_decl:): Fixed build_labeled_block invocation.
- (java_pop_parser_context): Put extra parenthesis around assignment
- in if.
- (yyerror): Suppressed unused local variables.
- (variable_redefinition_error): Fixed lang_printable_name
- invocation.
- (create_interface): Suppressed unused local variables.
- (create_class): Likewise.
- (duplicate_declaration_error): Suppressed unused argument. Fixed
- lang_printable_name invocation.
- (register_fields): Suppressed unused local variable. Fixed
- duplicate_declaration_error invocation.
- (method_header): Suppressed unused local variable.
- (method_declarator, parser_check_super): Likewise.
- (java_complete_class): Suppressed unused local variable. Fixed
- fatal error message.
- (complete_class_report_errors): Added default: in switch.
- (java_check_regular_methods): Fixed lang_printable_name
- invocations.
- (check_throws_clauses): Likewise.
- (java_check_abstract_methods): Suppressed unused local
- variable. Fixed lang_printable_name invocation.
- (read_import_entry): Added supplemental return statement.
- (read_import_dir): Suppressed unused local variables.
- (check_pkg_class_access, declare_local_variables): Likewise.
- (source_start_java_method): Suppressed unused extern variable
- declarations
- (expand_start_java_method): Suppressed unused extern and local
- variable declarations.
- (java_complete_expand_methods): Likewise.
- (java_complete_expand_method): Suppressed unused local variables.
- (make_qualified_name): Likewise.
- (resolve_qualified_expression_name): Added default: in
- switch. Fixed lang_printable_name invocation.
- (class_instance_creation_expression): Added parenthesis around
- expressions.
- (patch_method_invocation_stmt): Fixed lang_printable_name and
- patch_invoke invocations.
- (check_for_static_method_reference): Fixed lang_printable_name
- invocation.
- (patch_invoke): Suppressed unused arguments and local variables.
- (lookup_method_invoke): Suppressed unused local variables.
- (qualify_ambiguous_name): Added default: in switch.
- (identical_subpath_p): Function removed.
- (patch_assignment): Suppressed unused local variables. Suppressed
- unnecessary if statement. Fixed lang_printable_name invocations.
- (try_builtin_assignconv): Fixed lang_printable_name invocations.
- (valid_ref_assignconv_cast_p): Parenthesis around
- expression. Suppressed unused local variables.
- (build_binop): Suppressed unused local variables. fixed
- lang_printable_name invocations.
- (string_constant_concatenation): Suppressed unused local
- variables.
- (patch_unaryop): Fixed lang_printable_name invocation.
- (patch_cast): Suppressed unnecessary argument. Fixed
- lang_printable_name invocation.
- (patch_array_ref): Fixed lang_printable_name invocation.
- (patch_newarray, patch_return, patch_if_else_statement): Likewise.
- (build_labeled_block): Suppressed unused argument.
- (generate_labeled_block): Fixed build_labeled_block invocation.
- (build_loop_body): Suppressed unused local variables.
- (patch_loop_statement): Likewise.
- (patch_exit): Fixed lang_printable_name invocation.
- (patch_switch_statement): Likewise.
- (case_identity): First argument marked unused.
- (patch_try_statement): Fixed lang_printable_name invocations.
- (patch_synchronized_statement, patch_throw_statement): Likewise.
- (check_thrown_exceptions): Fixed check_thrown_exceptions and
- lang_printable_name invocations.
- (check_thrown_exceptions_do): Suppressed unused argument.
-
-1998-10-14 Tom Tromey <tromey@cygnus.com>
-
- * jcf-write.c (write_classfile): Add output class file as target.
- * lang-options.h: Added -MD, -MMD, -M, and -MM.
- * jcf.h: Added declarations for dependency-tracking functions.
- * lang-specs.h: Handle -M, -MM, MD, and -MMD.
- * lang.c (lang_decode_option): Recognize -MD and -MMD.
- (finish_parse): Call jcf_dependency_write.
- (dependency_tracking): New global.
- (DEPEND_SET_FILE): New define.
- (DEPEND_ENABLE): New define.
- (init_parse): Enable dependency tracking if required.
- Include "flags.h".
- * Makefile.in (JAVA_OBJS): Added jcf-depend.o.
- (../jcf-dump$(exeext)): Depend on and link with jcf-depend.o.
- (../gcjh$(exeext)): Likewise.
- (jcf-depend.o): New target.
- * Make-lang.in (JAVA_SRCS): Added jcf-depend.c.
- (GCJH_SOURCES): Likewise.
- * jcf-io.c (open_class): Call jcf_dependency_add_file. Added
- dep_name argument.
- (find_classfile): Added dep_name argument.
- (find_class): Compute name of dependency.
- (open_in_zip): Call jcf_dependency_add_file.
- * gjavah.c (output_file): No longer global.
- (usage): Don't mention "gjavah".
- (help): Likewise.
- (java_no_argument): Likewise.
- (version): Likewise.
- (main): Recognize and handle -M family of options.
- (print_mangled_classname): Return is void.
- (process_file): Handle case where output is suppressed.
- (HANDLE_END_FIELD): Likewise.
- (HANDLE_METHOD): Likewise.
- * jcf-depend.c: New file.
-
-Tue Oct 13 23:34:12 1998 Jeffrey A Law (law@cygnus.com)
-
- * java-tree.def: Add missing newline at EOF.
-
-1998-10-13 Tom Tromey <tromey@cygnus.com>
-
- * jcf-dump.c (process_class): Use FATAL_EXIT_CODE, not -1.
- (main): Likewise. Exit with SUCCESS_EXIT_CODE at end of
- function.
- Include <config.h> and "system.h".
- (disassemble_method): Undefine RET to avoid clash with
- config/i386/i386.h.
-
-Tue Oct 13 03:50:28 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (runtime_exception_type_node, error_exception_type_node):
- New global variables.
- (init_decl_processing): Initialized.
- * expr.c (java_lang_expand_expr): Set caught exception type to
- null if catch handler argument doesn't exit.
- * java-tree.def (SYNCHRONIZED_EXPR, THROW_EXPR): New Java specific
- tree codes.
- * java-tree.h (runtime_exception_type_node,
- error_exception_type_node): Global variables declared.
- (DECL_FUNCTION_THROWS): New macro.
- (DECL_FUNCTION_BODY): Modified comment.
- (DECL_SPECIFIC_COUNT): Likewise.
- (struct lang_decl): New field throws_list.
- (IS_UNCHECKED_EXPRESSION_P): New macro.
- * lex.c (java_lex): Generate location information for THROW_TK.
- * parse.h (PUSH_EXCEPTIONS, POP_EXCEPTIONS, IN_TRY_BLOCK_P,
- EXCEPTIONS_P): New macros.
- (enum jdep_code): New value JDEP_EXCEPTION.
- (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT,
- BUILD_ASSIGN_EXCEPTION_INFO, BUILD_THROW, SET_WFL_OPERATOR,
- PATCH_METHOD_RETURN_ERROR): New macros.
- (patch_method_invocation_stmt): Added new argument to prototype.
- (patch_synchronized_statement, patch_throw_statement,
- check_thrown_exceptions, check_thrown_exceptions_do,
- purge_unchecked_exceptions, check_throws_clauses): New function
- prototypes.
- * parse.y Fixed typo in keyword section.
- (throw:): Rule tagged <node>.
- (THROW_TK): Keyword tagged <operator>.
- (method_header:): Last argument to call to method_header passed
- from throws: rule.
- (throws:, class_type_list:, throw_statement:,
- synchronized_statement:, synchronized:): Defined actions.
- (method_header): New local variable current. Register exceptions
- from throws clause.
- (java_complete_tree): Complete and verify exceptions from throws
- clause.
- (complete_class_report_errors): Error message on exceptions not
- found
- (java_check_regular_methods): Fixed typo. Shortcut on private
- overriding methods. Changed error message on method
- redefinition. Check for throws clause compatibility.
- (check_throws_clauses): New function.
- (java_check_abstract_methods): Use DECL_NAME for wfl or current
- method. Changed error message on method redefinition.
- (currently_caught_type_list): New static variable.
- (java_complete_expand_methods): Purge unchecked exceptions from
- throws clause list. Call PUSH_EXCEPTIONS before walk and
- POP_EXCEPTIONS after.
- (resolve_qualified_expression_name): Pass new argument as NULL to
- patch_method_invocation_stmt.
- (patch_method_invocation_stmt): New argument ref_decl. Invoke
- PATCH_METHOD_RETURN_ERROR when returning with error. Reverse
- argument list when appropriate. Use new argument if non null to
- store selected method decl.
- (patch_invoke): Convert if necessary args of builtin types before
- forming CALL_EXPR. Argument list no longer reversed here.
- (invocation_mode): Treat final methods as static methods.
- (java_complete_tree): New cases for THROW_EXPR: and
- SYNCHRONIZED_EXPR:. Check thrown exceptions when completing
- function call.
- (complete_function_arguments): No more RECORD_TYPE
- conversion. Function parameter nodes no longer saved.
- (valid_ref_assignconv_cast_p): Avoid handling null type.
- (patch_binop): Fixed null constant reference handling.
- (build_try_statement): Use BUILD_ASSIGN_EXCEPTION_INFO and
- BUILD_THROW macros.
- (patch_try_statement): Fixed comments. Record caught types in
- list, push the list, expand try block and pop the list.
- (patch_synchronized_statement, patch_throw_statement,
- check_thrown_exceptions, check_thrown_exceptions_do,
- purge_unchecked_exceptions): New functions.
- * typeck.c (lookup_argument_method): Allow WFL in place of method
- DECL_NAME during method definition check
-
-1998-10-09 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (decode_signature_piece): New function.
- (print_c_decl): Use it. Added `name_override' argument.
- (print_method_info): Use name_override argument to print_c_decl.
- (seen_fields): Removed.
- (print_field_info): Don't update seen_fields.
- (struct method_name): New structure.
- (method_name_list): New global.
- (print_method_info): Add new method to list of methods.
- (name_is_method_p): New function.
- (print_field_info): If field name has same name as method, then
- change field name.
- (process_file): Parse methods before fields.
- (field_pass): New global.
- (HANDLE_END_FIELD): Take field_pass into account.
-
-Wed Oct 7 12:10:48 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (keyword.h): Add -L KR-C -F ', 0' flags to gperf.
- (keyword.h): Regenerate using gperf 2.7.1 (19981006 egcs).
-
-Sat Oct 3 13:29:46 1998 Anthony Green <green@cygnus.com>
-
- * jvspec.c: Fix bug in jvgenmain_spec patch.
-
-Fri Oct 2 17:22:52 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Makefile.in (lang.o:): Install dependency on java-tree.def.
- * decl.c (soft_exceptioninfo_call_node): New global variable.
- (init_decl_processing): Fixed indentation. soft_badarrayindex_node
- takes extra integer argument. soft_exceptioninfo_call_node
- initialized.
- * except.c (java_set_exception_lang_code): New function
- (method_init_exceptions): Called here.
- (prepare_eh_table_type): New function.
- (expand_end_java_handler): Called here.
- * expr.c (build_java_throw_out_of_bounds_exception): Now features
- one argument. Modified generation of call to
- soft_badarrayindex_node to use new argument.
- (build_java_arrayaccess): Pass faulty index value to
- build_java_throw_out_of_bounds_exception.
- (generate_name): New function.
- (java_lang_expand_expr): New local variables node, current,
- has_finally_p. Expand TRY_EXPR node.
- (process_jvm_instruction): Replace top of the stack with thrown
- object reference when entering exception handler.
- * java-tree.def (TRY_EXPR, CATCH_EXPR, FINALLY_EXPR): New Java
- specific tree codes.
- * java-tree.h (soft_exceptioninfo_call_node): Declaration of new
- global.
- (DECL_SPECIFIC_COUNT): New macro.
- (prepare_eh_table_type, java_set_exception_lang_code,
- generate_name): New function declarations.
- (match_java_method): Declaration deleted.
- (FINALLY_EXPR_LABEL, FINALLY_EXPR_BLOCK, CATCH_EXPR_GET_EXPR): New
- macros.
- * lex.c (TRY_TK, CATCH_TK): Generate location information.
- * parse.h (redefinition_error, refine_accessible_methods_list,
- can_cast_to_p): Function declaration removed.
- (classitf_redefinition_error, variable_redefinition_error,
- parse_jdk1_1_error, find_applicable_accessible_methods_list,
- find_most_specific_methods_list, argument_types_convertible,
- enter_a_block, valid_builtin_assignconv_identity_widening_p,
- valid_cast_to_p, valid_method_invocation_conversion_p,
- try_reference_assignconv, add_stmt_to_compound,
- build_jump_to_finally, build_tree_list, patch_try_statement,
- java_get_catch_block): New function declarations.
- * parse.y (string_buffer_type): Global variable deleted.
- (group_of_labels, catches, catch_clause, catch_clause_parameter,
- finally): Rules tagged <node>.
- (TRY_TK, CATCH_TK): Token tagged <operator>.
- (class_body_declaration:, class_member_declaration:,
- formal_parameter:, explicit_constructor_invocation:,
- interface_member_declaration:, constant_declaration:,
- primary_no_new_array:, class_instance_creation_expression:,
- array_creation_expression:): Issue error on unsuported JDK1.1
- features.
- (try_statement:, catches:, finally:): Define actions.
- (catch_clause_parameter): New rule.
- (catch_clause:): Use new rule catch_clause_parameter.
- (parse_jdk1_1_error): New function.
- (redefinition_error): Renamed classitf_redefinition_error.
- (variable_redefinition_error): New function.
- (check_class_interface_creation): Call
- classitf_redefinition_error.
- (java_complete_tree): Added error message on JDEP_TYPE: case.
- (complete_class_report_errors): Fixed indentation.
- (declare_local_variables): Call variable_redefinition_error.
- (source_end_java_method): Call java_set_exception_lang_code and
- emit_handlers where appropriate.
- (java_method_add_stmt): Call add_stmt_to_block.
- (add_stmt_to_block): New function.
- (lookup_method_invoke): Fixed outside comment. new local variable
- candicates. Call find_applicable_accessible_methods_list and
- find_most_specific_methods_list when searching for a
- method. Modified error report to list possible candidates when
- applicable.
- (find_applicable_accessible_methods_list,
- find_most_specific_methods_list, argument_types_convertible): New
- function.
- (refine_accessible_methods_list): Function deleted.
- (java_complete_tree): Handle TRY_EXPR. ARRAY_REF handling: save
- expr (if applicable) before calling patch_array_ref.
- (build_expr_block): Fixed BLOCK_EXPR_BODY assignment.
- (enter_block): Fixed comment.
- (enter_a_block): New function.
- (patch_assignment): Reorganized. Call try_reference_assignconv for
- references. Call valid_cast_to_p instead of can_cast_to_p.
- (try_reference_assignconv,
- valid_builtin_assignconv_identity_widening_p): New functions.
- (valid_ref_assignconv_cast_p): Fixed inverted test on CLASS_FINAL.
- (valid_cast_to_p, valid_method_invocation_conversion_p): New
- functions.
- (build_string_concatenation): Don't resolve StringBuffer.
- (patch_cast): Fixed inverted arguments.
- (patch_array_ref): Code to save array expr deleted. Call
- valid_cast_to_p instead of can_cast_to_p.
- (generate_labeled_block): Call generate_name.
- (build_jump_to_finally, build_try_statement, java_get_catch_block,
- patch_try_statement): New functions.
- * typeck.c (match_java_method): Function deleted.
-
-Fri Oct 2 13:48:36 1998 Anthony Green <green@cygnus.com>
-
- * jvspec.c: jvgenmain_spec uses different temporary file names.
-
-Fri Oct 2 12:50:19 1998 Anthony Green <green@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Fail if user specifies
- --main= when not linking.
-
-Mon Sep 28 13:48:33 1998 Tom Tromey <tromey@cygnus.com>
-
- * class.c (make_class_data): Push value for `thread' field.
- * decl.c (init_decl_processing): Added `thread' field to class.
-
- * class.c (add_field): Always make static fields externally
- visible.
-
-Sat Sep 26 08:22:47 1998 Anthony Green <green@cygnus.com>
-
- * expr.c (build_java_athrow,
- build_java_throw_out_of_bounds_exception, expand_invoke,
- build_newarray, expand_java_multianewarray, build_java_monitor):
- Update comments to reflect _Jv_* function names.
-
-Fri Sep 25 16:03:02 1998 Per Bothner <bothner@cygnus.com>
-
- * decl.c (complete_start_java_method): DECL_RESULT is always promoted.
- * decl.c (start_java_method): Handle PROMOTE_PROTOTYPES target macro.
- * parse.y (expand_start_java_method): Likewise.
-
-Thu Sep 24 12:20:35 1998 Per Bothner <bothner@cygnus.com>
-
- * expr.c (pop_arguments): Handle PROMOTE_PROTOTYPES target macro.
-
- * class.c (push_class): IDENTIFIER_SIGNATURE_TYPE is now POINTER_TYPE.
- (add_field): No longer need to convert from RECORD_TYPE to pointer,
- * expr.c: Remove no-longer-needed calls to promote_type.
- * decl.c (give_name_to_locals): Liekwise.
- * jcf-parse.c (get_class_constant): Compensate for new signatures.
- * parse.y: Add/remove promote_type calls as appropriate.
- * typeck.c (parse_signature_type): Returns POINTER_TYPE for objects.
- (parse_signature_string): Likewise.
- (build_java_array_type): Fix for now signature convenions.
-
- * lex.c (java_lex): Fix (from Alex) for JC1_LITE problem.
-
-Wed Sep 23 14:49:35 1998 Tom Tromey <tromey@cygnus.com>
-
- * class.c (init_class_processing): libjava function renamed to
- _Jv_RegisterClass.
-
-Tue Sep 22 12:00:02 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (java_lang_expand_expr): New case for SWITCH_EXPR.
- * java-tree.def: Fixed DEFTREECODE third argument.
- (UNARY_PLUS_EXPR, NEW_ARRAY_EXPR, NEW_CLASS_EXPR, THIS_EXPR,
- CASE_EXPR, DEFAULT_EXPR): New tree codes for Java.
- * java-tree.h: (IS_CRAFTED_STRING_BUFFER_P): New macro.
- (JAVA_UNARY_PLUS_EXPR, JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR,
- JAVA_THIS_EXPR): Now replaced by tree code definitions.
- (CALL_CONSTRUCTOR_P): Now uses NEW_CLASS_EXPR.
- * lang.c (java_tree_code_type, java_tree_code_length,
- java_tree_code_name): New arrays.
- (lang_init): Append Java tree node definitions to Gcc ones.
- * lex.c (expression_obstack): Declared as extern when JC1_LITE
- defined.
- (java_init_lex): Initialize wfl_append, wfl_string_buffer,
- wfl_to_string.
- (java_lex): Allow declaration of empty string constants. Retain
- location information on CASE_TK and DEFAULT_TK.
- * parse.h (JFLOAT_TYPE_P, JINTEGRAL_TYPE_P, JNUMERIC_TYPE_P,
- JPRIMITIVE_TYPE_P, JSTRING_TYPE_P, JSTRING_P, JREFERENCE_TYPE_P):
- Modified to be more robust.
- (BUILD_APPEND, BUILD_STRING_BUFFER): New macros.
- (build_new_invocation, try_builtin_assignconv,
- patch_switch_statement, string_constant_concatenation,
- build_string_concatenation, patch_string_cst, patch_string,
- java_expand_switch): New function declarations.
- * parse.y: Rules related to switch and EH tagged <node>.
- (label_id): Set to NULL_TREE
- (wfl_string_buffer, wfl_append, wfl_to_string): New static global
- tree nodes.
- (this_or_super:): Fixed indentation.
- (statement:, statement_nsi:, statement_without_trailing_substatement:,
- statement_expression:): Removed call to RULE on all sub-rules.
- (switch_expression:, switch_labels:): New rules.
- (switch_statement:, switch_block:, switch_block_statement_groups:,
- switch_block_statement_group:, switch_labels:, switch_label:):
- Defined actions.
- (throw_statement:, synchronized_statement:, try_statement:):
- Defined temporary actions.
- (class_instance_creation_expression:): Call
- build_new_invocation. Fixed indentation.
- (field_access): Fixed indentation.
- (method_invocation): Likewise.
- (make_qualified_primary): Use THIS_EXPR.
- (resolve_qualified_expression_name): Use NEW_CLASS_EXPR. When
- resolving from SUPER, set *type_found.
- (qualify_ambiguous_name): Use NEW_CLASS_EXPR.
- (java_complete_tree): Removed unused local variable `location'. Case
- for SWITCH_EXPR, sharing code with LOOP_EXPR. Use NEW_ARRAY_EXPR,
- NEW_CLASS_EXPR, UNARY_PLUS_EXPR and THIS_EXPR. New string handling
- on MODIFY_EXPR: and all binary operator tree code cases. Removed
- STRING_CST: case. default: checks for patchable strings.
- (complete_function_arguments): Transform string constant or
- crafted StringBuffer if necessary.
- (build_method_invocation): Fixed comments.
- (build_new_invocation): New function.
- (patch_assignment): Call try_builtin_assignconv to figure a valid
- assignment conversion between builtin types.
- (try_builtin_assignconv): New function.
- (build_binop): Use URSHIFT_EXPR directly to call build.
- (operator_string): Use UNARY_PLUS_EXPR.
- (patch_binop): Use UNARY_PLUS_EXPR. Handle string concatenation
- operator.
- (do_merge_string_cste, merge_string_cste,
- string_constant_concatenation, build_string_concatenation,
- patch_string, patch_string_cst): New function.
- (build_unary_op): Use UNARY_PLUS_EXPR and CONVERT_EXPR.
- (patch_unaryop): Likewise. New test of valid ++/-- operands.
- (build_newarray_node): Use NEW_ARRAY_EXPR.
- (build_this): Use THIS_EXPR.
- (build_return): Enable debug information on return statement.
- (build_if_else_statement): Likewise.
- (complete_labeled_statement): Fixed related comment.
- (build_loop_body): Fixed comment.
- (build_bc_statement): Enable debug information on break/continue
- statements.
- (patch_bc_statement): Fixed typos. Handle SWITCH statement
- context.
- (patch_switch_statement, case_identity, java_expand_switch): New
- functions.
-
-Mon Sep 21 13:21:35 1998 Per Bothner <bothner@cygnus.com>
-
- * buffer.h (BUFFER_INIT): New macro.
- * jcf-write.c (struct jcf_partial): New type. Put global stuff here.
- Pass (struct jcf_partial *state) to most functions.
- (jcf_block, jcf_relocation): New types.
- Support labels, branches, conditionals, loops.
-
-Mon Sep 21 15:08:48 1998 Tom Tromey <tromey@cygnus.com>
-
- * decl.c (INT_TYPE_SIZE): Define as BITS_PER_WORD if not defined.
-
-Mon Sep 21 13:21:35 1998 Per Bothner <bothner@cygnus.com>
-
- * decl.c (integer_type_node): Make it have INT_TYPE_SIZE.
- * verify.c (verify_jvm_instructions): Use int_type_not (32 bits),
- not integer_type_node (INT_TYPE_SIZ bits).
-
- * parse.y (patch_if_else_statement): Accept promoted_boolean_type_node.
-
- * jcf-reader.c (get_attribute): New HANDLE_EXCEPTION_TABLE hook.
- * jcf-dump.c (print_exception_table): New function.
- (disassemble_method): Better handling of wide instructions.
- Make more robust for bad input.
-
-Wed Sep 30 20:53:51 1998 Jeffrey A Law (law@cygnus.com)
-
- * jcf-write.c (OP2, OP4): Use "_i", not "_I" to avoid problems on
- FreeBSD.
-
-Thu Sep 17 19:45:01 1998 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (jcf-dump, jvgenmain): Link in memmove.o too.
-
-Thu Sep 17 16:21:52 1998 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.in ($(PARSE_H)): Removed target.
-
-Thu Sep 17 01:57:07 1998 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (JAVA_OBJS): Add memmove.o
- (memmove.o): New target & rules.
-
-Tue Sep 15 23:21:55 1998 Tom Tromey <tromey@cygnus.com>
-
- * expr.c (expand_invoke): Don't generate a call to the class init
- code.
-
-Mon Sep 14 10:14:47 1998 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in: Add many missing dependencies.
- * buffer.c, class.c, constants.c, decl.c: Use system.h and toplev.h
- as appropriate.
- * except.c, expr.c, jcf-io.c jcf-parse.c, jcf-write.c: Likewise.
- * jvgenmain.c lang.c mangle.c typeck.c verify.c: Likewise.
-
-Fri Sep 11 14:05:21 1998 Per Bothner <bothner@cygnus.com>
-
- * decl.c (complete_start_java_method): If method is static (and
- not private) call _Jv_InitClass.
- * expr.c (expand_invoke): Don't call build_class_init.
-
- * jvspec.c (jvgenmain_spec): Fix spec for generated .o file.
-
-Thu Sep 10 10:33:31 1998 Jeffrey A Law (law@cygnus.com)
-
- * Make-lang.in (GCJ): Define before using.
-
-Wed Sep 9 21:23:10 1998 Jeffrey A Law (law@cygnus.com)
-
- * gjavah.c (java_no_argument): Renamed from no_argument to avoid
- losing due to namespace pollution in GNU getopt.h
-
-Wed Sep 9 13:33:39 1998 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (java.all.build): Don't mention jvgenmain or gcjh.
- (java.all.cross): Likewise.
- (java.rest.encap): Likewise.
-
-Tue Sep 8 10:34:05 1998 Jeffrey A Law (law@cygnus.com)
-
- * gjavah.c (print_class_decls): Fix thinko in arglist
- * jcv-io.c (find_classfile): Similarly.
-
-Mon Sep 7 13:59:49 1998 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (INCLUDES): Update for recent toplevel gcc changes.
-
-Sat Sep 5 16:08:01 1998 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (java.maintainer-clean): Don't remove parse.h.
- (java.mostlyclean): Remove parse.c and parse-scan.c, not parse.h.
- * Makefile.in (PARSE_C): New macro.
- (PARSE_H): Likewise.
- (PARSE_SCAN_C): Likewise.
- ($(PARSE_C)): Target renamed from parse.c.
- ($(PARSE_SCAN_C)): Target renamed from parse-scan.c.
- (clean): Remove parse-scan.c as well.
- (parse.o): Depend on $(PARSE_C).
-
-Sat Sep 5 08:48:40 1998 Anthony Green <green@cygnus.com>
-
- * README, license.terms: Removed.
-
- * Make-lang.in, Makefile.in, class.c, config-lang.in, constants.c,
- decl.c, except.c, expr.c, gjavah.c, java-except.h, java-tree.h,
- javaop.def, javaop.h, jcf-dump.c, jcf-io.c, jcf-parse.c,
- jcf-reader.c, jcf-write.c, jcf.h, jvgenmain.c, jvspec.c,
- keyword.gperf, keyword.h, lang-options.h, lang-specs.h, lang.c,
- lex.c, lex.h, mangle.c, parse-scan.y, parse.h, parse.y, typeck.c,
- verify.c, zextract.c, zipfile.h: Fixed copyright assignment,
- and Java trademark attribution.
-
-Fri Sep 4 10:42:05 1998 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.in: Use gcjh, not gjavah.
- * config-lang.in (stagestuff): Use gcjh, not gjavah.
- * Make-lang.in: Changed gjavah to gcjh everywhere.
-
-Thu Sep 3 18:04:09 1998 Per Bothner <bothner@cygnus.com>
-
- * gjavah.c: Support new -prepend -add -append flags.
- (print_method_info): Method is not virtual if class is final.
-
-Thu Sep 3 12:03:53 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jv-scan.c: Fixed copyright assignment.
- * keyword.gperf: Likewise.
- * keyword.h: Likewise.
- * lex.c: Fixed copyright assignment.
- (java_lex): Push unicode back when parsing '<'.
- * lex.h: Fixed copyright assignment.
- * parse-scan.y: Likewise.
- * parse.h: Fixed copyright assignment.
- (build_debugable_stmt, complete_for_loop): New function prototypes.
- * parse.y: Fixed copyright assignment.
- (for_statement:): Call complete_for_loop. Set EXIT_EXPR to be
- size_zero_node when completing a loop with no exit condition.
- (for_statement_nsi:): Define action.
- (for_init:, for_update:): Return size_zero_node when empty.
- (declare_local_variables): Call build_debugable_stmt.
- (build_debugable_stmt): New function.
- (build_loop_body): Build debugable statement around loop
- condition part.
- (complete_loop_body): Take into account the debugable statement
- around the EXIT_EXPR.
- (complete_loop_body): New function.
- (patch_exit_expr): Fixed condition inversion.
-
-Wed Sep 2 11:53:58 1998 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (jvspec.o): Use GCC_THREAD_FILE to compute correct
- name of thread define.
- * jvspec.c (THREAD_NAME): New macro.
- (GCLIB): Likewise.
- (THREADLIB): Likewise.
- (lang_specific_driver): Recognize attempt to link with thread
- library or gc library. Recognize -ljava on command line so it
- isn't linked against more than once.
-
-Wed Sep 2 11:28:35 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse-scan.y (report_main_declaration): Name of the class
- containing `main' can be a qualified name.
-
-Mon Aug 31 13:25:58 1998 Tom Tromey <tromey@cygnus.com>
-
- * config-lang.in: Changed gjavac to gjc everywhere.
- * Make-lang.in: Changed gjavac to gjc everywhere.
-
-Thu Aug 27 02:28:27 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Make-lang.in (JAVA_TARGET_INDEPENDENT_BIN_TOOLS): New variable.
- (java.install-common:): Loop over JAVA_TARGET_INDEPENDENT_BIN_TOOLS
- and install the files.
- * Makefile.in (JAVA_OBJS_LITE): New variable.
- (compiler:): Now include jv-scan as a dependency.
- (../jv-scan$(exeext), parse-scan.c): New targets.
- (../jcf-dump$(exeext)): Was jcf-dump$(exeext) before.
- * config-lang.in (compilers): Removed gcj, gjavah from the list.
- * jcf-parse.c (parse_source_file): Call java_layout_classes and
- check for errors even if parse_only.
- * lex.c (java_init_lex): Reorganized and skip parts if JC1_LITE is
- defined.
- (yylex): New function. Uses java_lex body.
- (java_lex): Removed commented out statement. Remove local variable
- literal. Use SET_LVAL_NODE_TYPE and SET_LVAL_NODE where
- appropriate. Use macros FLOAT_TYPE_NODE, DOUBLE_TYPE_NODE,
- DCONST0, SET_FLOAT_HANDLER, SET_REAL_VALUE_ATOF,
- SET_LVAL_NODE_TYPE and GET_TYPE_PRECISION. Don't create STRING_CST
- if JC1_LITE is defined. Use BUILD_ID_WFL to build identifiers. Use
- SET_MODIFIER_CTX, SET_LVAL_NODE, BUILD_ID_WFL and GET_IDENTIFIER
- where appropriate.
- (java_lex_error): Empty if JC1_LITE is defined.
- (java_get_line_col): Return 0 if JC1_LITE is defined.
- * lex.h (JAVA_FLOAT_RANGE_ERROR, JAVA_INTEGRAL_RANGE_ERROR,
- SET_MODIFIER_CTX): Moved into the section containing the macros
- conditionally defined by JC1_LITE.
- (BUILD_OPERATOR,BUILD_OPERATOR2): Just return the TOKEN
- argument if JC1_LITE is defined.
- (HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, REAL_VALUE_ATOF,
- REAL_VALUE_ISINF, REAL_VALUE_ISNAN): Preset to values if JC1_LITE
- is defined.
- (DCONST0, SET_FLOAT_HANDLER, GET_IDENTIFIER, SET_REAL_VALUE_ATOF,
- FLOAT_TYPE, DOUBLE_TYPE, SET_MODIFIER_CTX, GET_TYPE_PRECISION,
- SET_LVAL_NODE, SET_LVAL_NODE_TYPE, BUILD_ID_WFL): New macros, set
- to different values according to JC1_LITE.
- * parse.h (int_fits_type_p, stabilize_reference): Prototype not
- declared if JC1_LITE set.
- (jdep_code, typedef struct _jdep, typedef struct _jdeplist): Not
- defined if JC1_LITE not set.
- (struct parser_ctx): Reorganized and skip the jc1 front end part
- if JC1_LITE set.
- (java_layout_classes): New function definition.
- (java_push_parser_context, java_init_lex, yyparse, yylex,
- yyerror): Prototype always declared. All other static function
- prototypes declared only if JC1_LITE is not set.
- * parse.y (yyparse, yylex, yyerror): No longer declared here. Now
- declared in parse.h.
- (java_layout_classes): New function.
- (java_complete_expand_methods): No longer layout the class here.
- * parse-scan.y: New file.
- * jv-scan.c: New file.
-
-Tue Aug 25 10:17:54 1998 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (main): Handle -friend option.
- (friend_specs): New global.
- (generate_access): Handle friend_specs.
- (process_file): Likewise.
- (MAX_FRIENDS): New macro.
- (friend_count): New global.
- (print_cxx_classname): Added `prefix' argument. Ignore arrays.
- Changed all callers.
-
-Mon Aug 24 20:19:27 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-dump.c (process_class): Move JCF_FINISH use to main,
- (main): Handle processing all the entries of a named .zip archive.
- * jcf-io.c (jcf_trim_old_input): New function.
- * jcf.h (GET_u2_le,GET_u4_le,JCF_readu2_le,JCF_readu4_le): New macros.
-
-Mon Aug 24 07:35:13 1998 Per Bothner <bothner@cygnus.com>
-
- * lang.c (flag_assume_compiled): Make default be on.
-
-Fri Aug 21 17:29:04 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-dump.c: Add bunches of flags to control output more.
- (process_class): New function; support printing more than one class.
- (main): Support new --print-main and --javap flags.
- * jcf-reader.c (IGNORE_ATTRIBUTE): New hook.
- * jcf.h (CPOOL_INDEX_IN_RANGE): New macro.
-
-Thu Aug 20 14:24:47 1998 Per Bothner <bothner@cygnus.com>
-
- Change mangling of dispatch table to match C++ vtable (w/thunks).
- * class.c (build_dtable_decl), java-tree.h: New function.
- (make_class_data): Call it.
- * decl.c (init_decl_processing): Likewise.
-
-Wed Aug 19 17:57:07 1998 Warren Levy <warrenl@cygnus.com>
-
- * decl.c (init_decl_processing): Use _Jv_NewObjectArray, not
- soft_anewarray; adjust args passed.
- * expr.c (build_anewarray): Adjust args for soft_anewarray_node to
- match _Jv_NewObjectArray.
-
-Wed Aug 19 09:33:23 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (push_labeled_block, pop_labeled_block): New functions.
- * expr.c (loopup_label): Call create_label_decl.
- (create_label_decl): New function.
- (java_lang_expand_expr): Call expand_start_bindings with argument
- set to zero.
- * java-tree.h Added space after PROTO in function declarations
- when necessary.
- (IS_FOR_LOOP_P, IS_BREAK_STMT_P): New macros.
- (create_label_decl, push_labeled_block): New function
- declarations.
- * lex.c (label_id): Initialize.
- (SUPER_TK, THIS_TK, RETURN_TK): Merged common actions in final
- switch.
- * parse.h Added space after PROTO in function declarations when
- necessary.
- (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, LOOP_HAS_LABEL_P, LOOP_HAS_LABEL_SKIP_P,
- PUSH_LABELED_BLOCK, POP_LABELED_BLOCK, PUSH_LOOP, POP_LOOP): New
- macros.
- (struct parser_ctxt): New fields current_loop,
- current_labeled_block.
- (build_if_else_statement, patch_if_else_statement,
- add_stmt_to_compound, patch_exit_expr, build_labeled_block,
- generate_labeled_block, complete_labeled_statement,
- build_bc_statement, patch_bc_statement, patch_loop_statement,
- build_new_loop, build_loop_body, complete_loop_body): New function
- declarations.
- * parse.y (java_warning_count): New global variable.
- (label_id): New static variable.
- (BREAK_TK, CONTINUE_TK): Token tagged <operator>.
- (block:): Return size_zero_node when block is empty.
- (empty_statement:): Return size_zero_node.
- (statement:): Implement supplemental action when for_statement: is
- reduced.
- (label_decl:): New rule.
- (labeled_statement:): Rewritten using label_decl. Actions
- implemented.
- (labeled_statement_nsi:): Likewise.
- (if_then_statement): Actions implemented.
- (while_expression): New rule.
- (while_statement:): Rewritten using while_expression. Actions
- implemented.
- (while_statement_nsi:): Likewise.
- (do_statement_begin:): New rule.
- (do_statement:): Rewritten using do_statement_begin. Actions
- implemented.
- (for_statement:): Rewritten using for_begin. Actions implemented.
- (for_statement_nsi:): Likewise.
- (for_header:, for_begin:): New rules.
- (for_init:): Actions implemented.
- (statement_expression_list:, break_statement:,
- continue_statement:): Likewise.
- (yyerror): Count number of issued warning(s).
- (java_report_errors): Report error(s) and/or warning(s).
- (java_complete_class): Use build_java_argument_signature to
- recompute completed method signature.
- (java_check_regular_methods): New locals method_wfl and aflags.
- Use method_wfl instead of lookup_cl during error reports. Fixed
- indentation and modified some error messages. Use
- lang_printable_name in method instead of the DECL_NAME. New code
- to issue warnings on methods not overriding corresponding methods
- private to a different package.
- (java_method_add_stmt): Call add_stmt_to_compound.
- (add_stmt_to_compound): New function.
- (java_complete_tree): Handle LABELED_BLOCK_EXPR, EXIT_BLOCK_EXPR,
- LOOP_EXPR, EXIT_EXPR and COND_EXPR.
- (build_if_else_statement, patch_if_else_statement,
- build_labeled_block, generate_labeled_block,
- complete_labeled_statement, build_new_loop, build_loop_body,
- complete_loop_body, patch_loop_statement, build_bc_statement,
- patch_bc_statement, patch_exit_expr): New functions.
- * typeck.c (build_java_signature): Build argument signature before
- enclosing it in between parenthesis.
-
-Mon Aug 17 17:44:24 1998 Warren Levy <warrenl@cygnus.com>
-
- * Make-lang.in (JAVA_SRCS): Created for dependencies * Makefile.in
- (JAVA_OBJS): Added reminder comment
-
-Thu Aug 13 10:01:45 1998 Nick Clifton <nickc@cygnus.com>
-
- * gjavah.c (D_NAN_MASK): Append LL to the constant to force it to
- be interpreted as a long long.
-
-Thu Aug 13 14:34:07 1998 Warren Levy <warrenl@cygnus.com>
-
- * decl.c (init_decl_processing): Use _Jv_InitClass, not
- soft_initialise_class. Use _Jv_NewMultiArray, not
- soft_multianewarray. Use _Jv_ThrowBadArrayIndex, not
- soft_badarrayindex. Use _Jv_CheckCast, not soft_checkcast. Use
- _Jv_CheckArrayStore, not soft_checkarraystore. Use
- _Jv_LookupInterfaceMethod, not soft_lookupinterfacemethod.
-
-Wed Aug 12 14:23:13 1998 Per Bothner <bothner@cygnus.com>
-
- * decl.c, java-tree.h (this_identifier_node, super_identifier_node,
- length_identifier_node): New global tree node constants.
- * parse.y (kw_super, kw_this, kw_length): Removed globals.
- Replace uses by super_identifier_node etc.
- * lex.c (kw_super, kw_this, kw_length): Don't initialize.
-
- * parse.y (resolve_field_access): Don't special-case ".length" if
- flag_emit_class_files.
- (patch_array_ref): Leave as ARRAY_REF if flag_emit_class_files.
- * jcf-write.c (generate_bytecode_insns): Handle ARRAY_REF opcode
- and ARRAY.length.
-
-Tue Aug 11 11:31:55 1998 Per Bothner <bothner@cygnus.com>
-
- * decl.c (init_decl_processing): Remove unused method_type_node fields.
- * class.c (make_method_value): Remove init for removed fields.
-
- * class.c (layout_class): Use build_java_argument_signature.
- * java-tree.h (TYPE_ARGUMENT_SIGNATURE): New macro.
-
- * typeck.c (push_java_argument_signature): Removed. Merged into ...
- (build_java_argument_signature): Use TYPE_ARGUMENT_SIGNATURE cache.
- (build_java_signature): Don't use push_java_argument_signature.
-
- * typeck.c (lookup_argument_method): New function.
- * parse.y (java_check_regular_methods): Use lookup_argument_method
- instead of lookup_java_method2 followed by lookup_java_method.
-
- * parse.y (check_method_redefinition): Minor optimization.
-
- * jcf-write.c (generate_bytecode_insns): Handle RETURN_EXPR,
- MINUS_EXPR, MULT_EXPR, TRUNC_DIV_EXPR, and RDIV_EXPR.
-
-Mon Aug 10 09:57:15 1998 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (jc1$(exeext)): Don't depend on c-common.o or
- c-pragma.o.
-
- * gjavah.c (java_float_finite): Use K&R-style definition.
- (java_double_finite): Likewise.
- (generate_access): Now returns void. Changed all callers.
- (last_access_generated): Removed.
- (process_file): Only make a single pass over the .class file.
-
-Wed Jul 29 17:50:23 1998 Per Bothner <bothner@cygnus.com>
-
- * class.c (get_dispatch_table): Add extra dummy vtable entry,
- for compatibility for G++ (with -fvtable-thunks).
- * expr.c (build_invokevirtual): Add one for extra dummy vtable entry.
-
- * gjavah.c (process_file): Use public inheritance for super-class.
-
-Wed Jul 29 13:19:03 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (java_init_lex): Initialize ctxp->package.
- * parse.h (struct parser_ctxt): package and package_len replaced
- by tree package, an identifier node. Field method_decl_list is
- gone. Fixed comments.
- (lookup_field_wrapper, merge_qualified_name, not_accessible,
- class_in_current_package): New function prototypes.
- * parse.y (array_type:): Set class loaded flag on primitive type
- arrays.
- (package_declaration:): Assign ctxp->package to the
- identifier node.
- (method_invocation:): Handle invocation of method qualified by
- `super'.
- (single_type_import_declaration:): Removed ambiguity check.
- (java_pop_parser_context): New local variable `next'. Reset and
- set IMPORT_CLASSFILE_NAME flags on current and previous import
- list.
- (java_accstring_lookup): Use new local macro COPY_RETURN.
- (lookup_field_wrapper): New function.
- (parser_qualified_classname): Use merge_qualified_name.
- (parser_check_super_interface): Broaden error message.
- (do_resolve_class): Check for qualified class name in the current
- compilation unit if appropriate.
- (process_imports): Check for already defined classes.
- (check_pkg_class_access): Got rid of call to
- get_access_flags_from_decl.
- (java_complete_expand_methods): Call safe_layout_class based on
- the current class size.
- (make_qualified_primary): Build a WFL qualification on primary if
- none exists.
- (merge_qualified_name): New function.
- (make_qualified_name): Use merge_qualified_name.
- (resolve_expression_name): Use safe_lookup_field.
- (resolve_field_access): Got rid of call to get_access_flags_from_decl.
- (resolve_qualified_expression_name): Likewise. Check on resolved
- element accessibility.
- (not_accessible_p, class_in_current_package): New functions.
- (maybe_access_field): Got rid of call to get_access_flags_from_decl.
- (patch_method_invocation_stmt): Merged common pieces. Check
- accessibility of invoked method.
- (check_for_static_method_reference): Add returned type in error
- message.
- (invocation_mode): Get rid of bogus check on PRIVATE methods.
- (refine_accessible_methods_list): Merged two conditions in test.
- (java_complete_class): Sanity check on stabilize_ref gone.
- * zextract.c (read_zip_archive): Cast lseek second argument to long.
-
-Tue Jul 28 21:39:22 1998 Per Bothner <bothner@cygnus.com>
-
- * class.c (hashUtf8String): Fix - use new JavaSoft specification.
-
-Fri Jul 24 10:43:25 1998 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (F_NAN): Removed.
- (F_NAN_MASK): New macro.
- (F_POSITIVE_INFINITY): Removed.
- (F_NEGATIVE_INFINITY): Likewise.
- (java_float_finite): Rewrote.
- (D_NAN_MASK): Renamed.
- (java_double_finite): Rewrote.
- (D_POSITIVE_INFINITY): Removed.
- (D_NEGATIVE_INFINITY): Likewise.
-
- * jcf-dump.c (print_constant): [CONSTANT_Double, CONSTANT_Float]
- If verbose, print underlying representation of value in hex.
-
-Fri Jul 24 14:14:32 1998 Per Bothner <bothner@cygnus.com>
-
- * buffer.h, buffer.c: New files.
- * Makefile.in (JAVA_OBJS): Add buffer.o.
-
- Support locals variables and writing their debug entries to .class.
- * jcf-write.c: Simplify some by user new buffer type.
- (vode_buffer_grow): Removed.
- (struct localvar_info): New type.
- (localsvars, localvartable): New buffers.
- (localvar_alloc, localvar_free): New functions.
- (generate_bytecode_insns): Handle local variables.
- (generate_classfile): Write LocalVariableTable attribute.
-
-Fri Jul 24 13:46:59 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-io.c (open_in_zip): Check the zipfile magic number.
- * zipfile.h (ZIPMAGIC): New macro.
-
-Fri Jul 24 10:43:25 1998 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.in (gjavah.o): Updated dependencies.
- (jcf-dump.o): Likewise.
- (all.indirect): Use ../gjavah.
- (../gjavah$(exeext)): Likewise.
- (clean): Don't remove gjavah.
- (clean): Remove parse.c, not java/parse.c.
- * Make-lang.in (java): Added gjavah.
- (gjavah$(exeext)): New target.
- (GJAVAH_SOURCES): New macro.
- (java.all.build): Added gjavah.
- (java.all.cross): Likewise.
- (java.rest.encap): Likewise.
- * config-lang.in (compilers, stagestuff): Added gjavah.
-
-Thu Jul 23 18:33:56 1998 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (java_float_finite): New function.
- (java_double_finite): Likewise.
- (F_POSITIVE_INFINITY): New macro.
- (F_NEGATIVE_INFINITY): Likewise.
- (F_NAN): Likewise.
- (D_POSITIVE_INFINITY): Likewise.
- (D_NEGATIVE_INFINITY): Likewise.
- (D_NAN): Likewise.
- (print_field_info): Use java_float_finite and java_double_finite.
-
-Thu Jul 23 15:28:24 1998 Per Bothner <bothner@cygnus.com>
-
- * parse.y (method_header): Name "this" implicit argument.
-
-Wed Jul 22 15:47:30 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-write.c: Write out LineNumberTable attribute in .class file.
- (linenumber_buffer, linenumber_ptr, linenumber_limit): New statics.
- (put_linenumber): New function.
- (generate_bytecode_insns, generate_classfile): Write line numbers.
-
-Wed Jul 22 14:39:00 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (CALL_EXPR_FROM_PRIMARY_P): Changed in PRIMARY_P.
- (lookup_name, build_known_method_ref, build_class_init,
- build_invokevirtual, invoke_build_dtable, match_java_method,
- build_field_ref, pushdecl_force_head, build_java_binop,
- binary_numeric_promotion, build_decl_no_layout,
- build_java_arrayaccess, build_newarray, build_anewarray,
- build_java_array_length_access, build_java_arraynull_check): New
- extern function prototypes.
- (JAVA_UNARY_PLUS_EXPR, JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR,
- JAVA_THIS_EXPR, CALL_CONSTRUCTOR_P): Macro definition moved in
- java-tree.h.
- * jcf-parse.c (init_outgoing_cpool): Set current_constant_pool_data_ref
- to NULL
- * jcf.h (jcf_out_of_synch): New extern function prototype.
- * parse.h: Static/global function implemented in parse.y
- prototyped and declarations moved at the end of the file.
- (DECL_P): Check that the argument isn't null.
- (JAVA_UNARY_PLUS_EXPR, JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR,
- JAVA_THIS_EXPR): No longer defined here. See java-tree.h
- (QUAL_DECL_TYPE): New macro.
- (PARAMS): Macro definition removed.
- * parse.y: (yyparse, yyerror): Use PROTO instead of PARAMS.
- (return_statement:): Call build_return.
- (field_access:): Call make_qualified_primary in sub rule.
- (method_invocation:): Build method invocation and call
- make_qualified_primary when processing primaries.
- (java_complete_class): Set IDENTIFIER_SIGNATURE_TYPE by calling
- get_type_from_signature.
- (java_check_regular_method): Extra integer 0 argument when calling
- lookup_java_method2.
- (lookup_java_interface_method2): Extra method DECL argument when
- calling lookup_java_interface_method2.
- (java_method_add_stmt): Set TREE_SIDE_EFFECTS on newly created
- COMPOUND_EXPR node.
- (java_complete_expand_method): Layout current class iff not
- already done. Don't process interface's methods.
- (java_complete_expand_method): Use super class only if it
- exists. Use current class otherwise.
- (make_qualified_primary): New function.
- (resolve_expression_name): Process qualified expression or
- expression from primary the same way.
- (resolve_expression_name): Two last arguments to
- resolve_field_access are now NULL_TREEs.
- (resolve_field_access): New variable is_static. Local field must
- be DECLs. is_static computed on field DECLs only. Append code in
- where_found to the field access if necessary. Use QUAL_DECL_TYPE
- to initialize field_type.
- (resolve_qualified_expression_name): New local variable,
- previous_call_static and is_static. Handle primaries with function
- calls, casts, array references and `this'. `super' now handled as
- `(super_class)this'. Use is_static to clarify boolean expressions.
- Added code to handle case where a proper handle is required to
- access a field. Use QUAL_DECL_TYPE where applicable.
- (maybe_access_field): New function.
- (patch_method_invocation_stmt): New arguments primary, where,
- is_static. Branch of the test on CALL_EXPR_FROM_PRIMARY_P
- deleted. Use `where' as a type to search from if specified. Check
- for static method reference where forbidden. Append primary or
- current_this to the argument list if not calling constructor nor
- static methods.
- (check_for_static_method_reference): New function.
- (patch_invoke): Layout the class on which new is done if
- necessary.
- (lookup_method_invoke): Changed format to report errors on
- methods.
- (qualify_ambiguous_name): New local variable this_found. Now
- handle things from primaries. Method call are considered
- expression names.
- (identical_subpath_p): NULL_TREE arguments to breakdown_qualified
- changed into NULLs.
- (not_initialized_as_it_should_p): Comply with the new DECL_P.
- (java_complete_tree): New case fo RETURN_EXPR. Process function
- call arguments in separate function.
- (complete_function_arguments): New function.
- (build_method_invocation): Don't use CALL_EXPR_FROM_PRIMARY_P
- anymore.
- (patch_assignment): Take the return function slot into account as
- a RHS. Distinguish assignment from a return.
- (valid_ref_assignconv_cast_p): Use build_java_argument_signature
- when checking methods in interfaces.
- (resolve_type_during_patch): NULL argument to unresolve_type_p
- instead of NULL_TREE.
- (patch_newarray): Fixed typo in comment.
- (buid_this): Build a WFL with `kw_this' instead of a FIELD_DECL.
- (build_return, patch_return): New functions.
- * typeck.c (lookup_java_constructor): Fixed typo in comment.
-
-Tue Jul 21 12:10:04 1998 Per Bothner <bothner@cygnus.com>
-
- * constants.c (find_name_and_type_constant, find_fieldref_index,
- find_methodref_index): New methods.
- * expr.c (build_invoke_non_interface): If flag_emit_class_files,
- just return given method. Also, rename to build_known_method_ref.
- (expand_invoke): Rename call to build_invoke_non_interface.
- * java-tree.h, parse.h: Update prototype.
- * parse.y, decl.c, jcf-parse.c: Suppress calls to back-end functions
- (such as expand_expr_stmt) if flag_emit_class_files.
- * jcf-write.c (RESERVE, OP1, OP2, OP4, NOTE_PUSH, NOTE_POP,
- STACK_TARGET, IGNORE_TARGET): New macros.
- (code_buffer, code_ptr, code_limit, code_S, code_SP_max): New globals.
- (generate_bytecode_insn): New function to generate method's bytecode.
- (generate_classfile): Node generate Code attribute for a method.
- (code_buffer_grow, push_constant1, push_constant2, push_int_const,
- push_long_const, field_op, adjust_typed_op, maybe_wide):
- New functions used by generate_bytecode_insn.
-
- * typeck.c (signature_include_return): Remove variable.
- (push_java_argument_signature, build_java_argument_signature): New.
- (build_java_signature): Use push_java_argument_signature.
- * parse.y: Use build_java_argument_signature instead of fiddling
- with signature_include_return.
-
-Fri Jul 17 09:48:51 1998 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_c_decl): Always generate JArray<>* for array
- types.
-
- * Makefile.in (all.indirect): Added gjavah$(exeext).
- (gjavah$(exeext)): Added $(exeext).
- (clean): Likewise.
-
-Thu Jul 16 15:29:20 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class): Call to java_layout_parsed_class replace
- by safe_layout_class.
- * expr.c (build_java_array_length_access): Removed static storage
- class in the function definition.
- (build_java_arraynull_check): Likewise.
- Also fixed typos in two comments.
- * lex.c (java_init_lex): Initialize static global kw_length.
- (java_lex): Use BUILD_OPERATOR on RETURN_TK.
- * lex.h (JAVA_FLOAT_RANGE_ERROR): Add extra argument to
- java_lex_error.
- (JAVA_INTEGRAL_RANGE_ERROR): Likewise.
- * parse.h (resolve_no_layout): New static function declaration.
- (get_identifier_in_static): Declaration removed.
- (java_layout_parsed_class): Function name declaration changed to
- safe_layout_class.
- (build_newarray_node, patch_newarray, resolve_type_during_patch,
- not_initialized_as_it_should_p, build_this): New static function
- declarations.
- (pushdecl_force_head, build_java_binop, int_fits_type_p,
- binary_numeric_promotion, stabilize_reference,
- build_decl_no_layout, build_java_arrayaccess): Extern function
- declarations moved into their own section.
- (build_newarray, build_anewarray, build_java_array_length_access,
- build_java_arraynull_check): New extern function declarations.
- (UNARY_PLUS_EXPR): Macro renamed into JAVA_UNARY_PLUS_EXPR.
- (JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR, JAVA_THIS_EXPR): New
- fake tree codes.
- (CALL_CONSTRUCTOR_P): New macro.
- * parse.y (kw_length): New static global tree node.
- (return_statement): Tagged <node>.
- (RETURN_TK): Tagged <operator>.
- (variable_declarator_id:): Build variable declaration with an
- empty initialization value if a syntax error was found in the
- initialization part of the variable declaration.
- (statement_without_trailing_substatement:): return_statement: now
- uses the default rule.
- (return_statement:): Temporarily fixed to return NULL_TREE.
- (primary_no_new_array:): Call build_this when THIS_TK was parsed.
- (class_instance_creation_expression:): Class creation rules now
- call build_method_invocation upon reduction.
- (array_creation_expression:): Rules call build_newarray_node upon
- reduction.
- (dim_exprs:): Build a list of dimension expressions.
- (dim_expr:): Store location of the OSB_TK in the dimension
- expression node.
- (method_invocation:): Added a new error rule.
- (build_unresolved_array_type): WFL argument may also be an array
- on a primitive type. Name of the argument changed to reflect this.
- (method_declarator): Insert argument type at the beginning of the
- argument type list and later reverse the list.
- (unresolved_type_p): Argument 'returned' may be optionally
- NULL_TREE.
- (java_layout_class_from_source): Function renamed
- safe_layout_class.
- (resolve_and_layout): Now call resolve_no_layout and
- safe_layout_class.
- (resolve_no_layout): New function.
- (purify_type_name): New function.
- (complete_class_report_errors): Call purify_type_name during error
- report on a type not found.
- (process_imports): error_found local variable doesn't need to be
- initialized to zero.
- (declare_local_variables): New local type_wfl. Fixed typo in error
- message. type_wfl assigned to unresolved type and used to register
- incomplete type. Build a WFL around the variable initialization
- statement so that debug info can be generated on it.
- (source_start_java_method): Reverse argument list after they've
- been processed.
- (current_this): New static global variable.
- (java_complete_expand_methods): Set current_this when appropriate.
- (resolve_expression_name): Build correct static and non static
- field access bearing a simple name.
- (resolve_field_access): Resolve the length field of arrays. Handle
- f.m() cases.
- (patch_method_invocation_stmt): Set the type of the method
- invocation to error_mark_node. This value is later overridden by a
- valid type, if any. Don't handle qualified constructor invocation
- as qualified method invocation. Call lookup_method_invoke with its
- new flag. It's no longer necessary to access the selected method
- as the value of a tree list. Handle constructor invocation.
- (patch_invoke): Reverse argument list when invoking non interface
- methods. Insert call to new as the first argument of the
- constructor.
- (invocation_mode): Return a INVOKE_STATIC is the invoked method is
- defined within a final class. Return INVOKE_STATIC if the invoked
- method is a constructor.
- (lookup_method_invoke): New lc argument is a flag to indicate a
- constructor lookup. Now handle constructor lookup. Choose the most
- specific method in case several were matching the invocation
- requirements. Return a method decl instead of a tree list featuring
- one single method decl element.
- (refine_accessible_methods_list): New lc flag argument to
- indicate that a constructor is being looked up.
- (not_initialized_as_it_should_p): New function.
- (java_complete_tree): Now process fake tree codes
- JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR and JAVA_THIS_EXPR. Call
- save_expr on resolved function call arguments. Case on
- UNARY_PLUS_EXPR changed into a case on JAVA_UNARY_PLUS_EXPR.
- (patch_assignment): LHS can be a field access expression. When
- dealing with reference, lhs_type is the promoted type of the
- rhs_type, not the RHS. Use not_initialized_as_it_should_p where
- applicable.
- (operator_string): JAVA_UNARY_PLUS_EXPR replaces UNARY_PLUS_EXPR.
- (patch_binop): Use not_initialized_as_it_should_p where
- applicable.
- (build_unaryop): JAVA_UNARY_PLUS_EXPR replaces UNARY_PLUS_EXPR.
- (patch_unaryop): Likewise. And use not_initialized_as_it_should_p
- where applicable.
- (resolve_type_during_patch): New function.
- (patch_cast): Call resolve_type_during_patch to resolve type and
- report error accordingly.
- (patch_array_ref): Use not_initialized_as_it_should_p where
- applicable. Array base expression is saved before being
- used. Promote the type of an array elements if it contains non
- builtin types.
- (build_newarray_node, patch_newarray, build_this): New functions.
-
-Thu Jul 16 10:46:47 1998 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_c_decl): UTF8_GET increments pointer; don't
- increment it in `for' statement.
- (print_field_info): If number is inf or nan, don't print it.
- (print_method_info): If method name is `delete', just ignore it.
- (print_c_decl): Special-case jstringArray.
-
- * gjavah.c (help): New function.
- (no_argument): New function.
- (usage): Changed text.
- (main): Rewrote argument handling. Now handles -v, --help,
- --version.
- (version): New function.
- (found_error): New global.
- (main): Return found_error.
- (generate_access): Set found_error.
- (print_c_decl): Likewise.
-
-Wed Jul 15 10:36:27 1998 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_c_decl): Don't print "," when examining field.
- Skip type name when looking at "[L" types.
- (process_file): Now static.
- (generate_access): Now returns int.
- (last_access_generated): New global.
- (process_file): Clear last_access_generated; make multiple passes
- over the class.
- (print_field_info): Just return if generate_access returns true.
- (print_method_info): Likewise. Also, allow <init> functions to
- pass through.
- (print_c_decl): Added is_init argument. Print constructors
- properly.
- (print_cxx_classname): Use UTF8_GET to extract characters from
- string.
- (print_base_classname): New function.
- (print_class_decls): New function.
- (process_file): Use it.
- (utf8_cmp): New function.
-
-Mon Jul 13 14:21:47 1998 Nick Clifton <nickc@cygnus.com>
-
- * lang-options.h: Format changed to match changes in gcc/toplev.c
- to implement a --help option.
-
-1998-07-10 Brendan Kehoe <brendan@cygnus.com>
-
- * decl.c (init_decl_processing): Revert change to dtable_type.
-
-Thu Jul 9 18:22:12 1998 Per Bothner <bothner@cygnus.com>
-
- * java-tree.h (CLASS_P): Changed DECL_LANG_FLAG_7 -> TYPE_LANG_FLAG_4.
-
-1998-07-08 Brendan Kehoe <brendan@cygnus.com>
-
- * decl.c (init_decl_processing): Set CLASS_LOADED_P on dtable_type.
-
- * lang.c (lang_init): Default flag_exceptions to 1, without
- checking to see if it's 2 first.
-
-Wed Jul 8 03:01:32 1998 Jeffrey A Law (law@cygnus.com)
-
- * constants.c: Include "system.h".
- * decl.c: Likewise.
- * lang.c (flag_new_exceptions): Get via extern now.
- (lang_init_options): New functions. Turn on flag_new_exceptions.
-
-Tue Jul 7 12:56:48 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (java_lex): Return 0 when we see an invalid character in
- the input.
-
- * lex.c (java_read_char): Specify extra argument when calling
- java_lex_error.
- (java_read_unicode, java_parse_end_comment,
- java_parse_escape_sequence): Likewise,
- (java_lex): Specify extra argument when calling
- java_lex_error. Test that IDs are beginning with a legal character
- for IDs. Handle invalid characters with an error message and a
- call to java_lex_error.
- (java_lex_error): Adjust column position by new argument
- `forward'. Issue an error even if in the middle of reporting an
- other error.
-
-1998-07-07 Brendan Kehoe <brendan@cygnus.com>
-
- * jcf-io.c (find_class): Zero out BUFFER before we use it, since
- we don't explicitly put a null pointer when we're copying it.
-
-Tue Jul 7 09:38:38 1998 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_cxx_classname): New function.
- (super_class_name): Likewise.
- (print_super_fields): Removed.
- (in_super): Removed.
- (print_field_info): Never generate #defines.
- (print_c_decl): Changed generated types to match JNI. No longer
- print class name before method name.
- (print_method_info): Print "static" before static methods.
- Print "virtual" before non-final methods.
- (usage): Use exit(1), not exit(-1).
- (main): Likewise.
- (print_field_info): Use %.17g to print a double.
- (last_access): New globals.
- (process_file): Initialize last_access.
- (usage): Now static.
- (ACC_VISIBILITY): New define.
- (generate_access): New function.
- (print_field_info): Call it.
- (print_method_info): Likewise. Also, generate information for all
- methods, not just native methods. Return void.
- (print_c_decl): Return void.
- (print_field_info): Return void.
-
-Thu Jul 2 16:53:16 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Makefile.in (JAVABISONFLAGS): Specific flag for bison when
- processing the jc1 grammar file. Prefix bison functions and
- variables with java_.
- (parse.c): Dependencies on parse.h and lex.h
- * expr.c (build_java_arrayaccess): Function now global.
- * java-tree.h: Comment reorganized to carry on previous
- classification effort.
- (RESOLVE_EXPRESSION_NAME_P, RESOLVE_PACKAGE_NAME_P,
- RESOLVE_TYPE_NAME_P): New flags on WFLs.
- * jcf-parse.c (parse_source_file): java_parse_source_file renamed
- java_parse (new prefix java_ generated by bison).
- (java_layout_parsed_class, java_register_parsed_class): Function
- call removed.
- (yyparse): Removed unnecessary call to init_outgoing_cpool.
- * lex.c (static tree wfl_op): Variable deleted.
- (java_init_lex): Initialize kw_super and kw_this. Initialize more
- ctxp fields to NULL_TREE.
- (java_lex): No longer create WFL for operators. Filename caching
- mechanism deleted. Call BUILD_OPERATOR for `.', '(', '['. Strings
- created as STRING_CST and later expanded. Removed extra argument
- to BUILD_OPERATOR and BUILD_OPERATOR2. Build operators for THIS
- and SUPER.
- (build_wfl_node): Removed code in comments.
- * lex.h (BUILD_OPERATOR, BUILD_OPERATOR2): No longer build a WFL but
- store token and location data in the current bison token.
- * parse.h: Removed pre-processor based symbol prefixes hack. Moved
- static/extern function declaration at the beginning of the file.
- (struct qualification): Data structure definition deleted.
- (RESOLVE_CHAIN_REMAINDER): Macro definition deleted.
- (qualify_ambiguous_name): Function declaration modified. Function
- now returns nothing.
- (build_array_ref, patch_array_ref, make_qualified_name,
- resolve_qualified_expression_name, maybe_generate_clinit,
- resolve_field_access): New static function declarations.
- (build_java_arrayaccess): New extern function declaration.
- (enum { RESOLVE_EXPRESION_NAME...}): Enum deleted.
- (CALL_EXPR_PRIMARY): Macro deleted.
- (EXPR_WFL_QUALIFICATION, QUAL_WFL, QUAL_RESOLUTION): New macros.
- (struct parser_ctxt): Field initialized_final
- removed. non_static_initialized, static_initialized: New fields.
- * parse.y (static tree kw_super, static tree kw_this): New global
- static.
- (%union): tree wfl field of operator member replaced by int
- location. WFLs are non longer created for operators.
- (OSB_TK, DOT_TK, THIS_TK, SUPER_TK): Tagged <operator>.
- (qualified_name:): Now calls make_qualified_name to build the
- identifier.
- (type_declaration:): Consider generating <clinit> when class
- parsing completed.
- (variable_declarator:): Directly build an assignment node when the
- variable is initialized when declared.
- (this_or_super:): Build a WFL and set current location when THIS
- or SUPER are parsed.
- (expression_statement:): Wrap statement around a WFL.
- (primary_no_new_array:): Fixed typo. Changed value returned by
- THIS_TK because of its new type (temporary).
- (dim_exprs:): Temporary fix because of OSB_TK's new type.
- (field_access:): Build qualified name with SUPER.
- (method_invocation:): Fixed returned value because of SUPER's new
- type.
- (array_access:): Use OSB_TK location information.
- (post_increment_expression:, post_decrement_expression:,
- unary_expression:, pre_increment_expression:,
- pre_decrement_expression:, unary_expression_not_plus_minus:,
- cast_expression:, multiplicative_expression:,
- additive_expression:, shift_expression:, relational_expression:,
- equality_expression:, and_expression:, exclusive_or_expression:,
- inclusive_or_expression:, conditional_and_expression:,
- conditional_or_expression:, assignment:): Use new location/token
- information available on operators.
- (create_class): Set super_decl_type to NULL_TREE when processing
- java.lang.Object.
- (register_fields): Field initialization is now a MODIFY_EXPR
- node. Chain initialization code to the matching lists (according
- the the field declaration modifiers).
- (maybe_generate_clinit): New function.
- (method_header): Don't set method's DECL_NAME to a WFL when adding
- methods to java.lang.Object.
- (resolve_and_layout): Now can return NULL_TREE if the type
- resolution fails. Otherwise, return the class DECL instead of its
- TYPE.
- (check_method_redefinition): Don't patch method DECL_NAME if it
- belongs to java.lang.Object.
- (process_imports): Simply assign error_found to the value returned
- by check_pkg_class_access.
- (declare_local_variables): Don't use their init statements (if
- any) when parsing error were previously found. Reuse MODIFY_EXPR
- build during parsing as an init statement.
- (java_method_add_stmt): Now return the current method body.
- (java_layout_parsed_class, java_register_parsed_class): Functions
- removed.
- (java_complete_expand_methods): Initialize the constant pool on a
- per class basis. Layout the classes before expanding their method
- bodies. Don't try expand artificial constructor code if error were
- found. Make the classes data and register them if no error were
- found.
- (java_complete_expand_method): Retrieve an artificial constructor
- argument list before entering its body. Assign the top block to
- the artificial constructor function body and set types of declared
- blocks and compound statements to void. Walk method body if not an
- artificial constructor.
- (make_qualified_name, cut_identifier_in_qualified): New functions.
- (resolve_expression_name): Fixed comments. Save/restore the
- current class CLASS_LOADED_P flag value. Build non qualified
- static field access and handle qualified expression names.
- (resolve_field_access, resolve_qualified_expression_name): New
- functions.
- (patch_method_invocation_stmt): Use the new expression resolution
- scheme, calling resolve_field_access when the function call is
- resolved as an expression.
- (qualify_ambiguous_name): Function rewritten to work on qualified
- expression produced by make_qualified_name.
- (java_complete_tree): Promote type when function's argument are
- RECORD_TYPEs. While processing the MODIFY_EXPR case: don't patch
- the assignment to discover further errors if RHS is a expression
- name that fails to evaluate. Declare LHS initialized even though
- the assignment failed. Don't use the location variable and removed
- extra argument in patch function calls. Now handle the ARRAY_REF
- case and build internal string representation when STRING_CSTs are
- walked.
- (build_method_invocation): Don't wrap function call around a WFL.
- (build_assignment): Likewise. Use the operator location
- information.
- (patch_assignment): Handle array access LHSs. Handle error
- provenance, resulting in a better error report.
- (build_binop): Use op_location from operator as binop location
- information.
- (build_unaryop, build_incdec, build_cast): Likewise.
- (patch_binop): Extract location information from the node. Fixed
- typo in error message.
- (patch_unary_op): Extract location information from the node.
- (build_array_ref, patch_array_ref): New functions.
-
-Wed Jul 1 13:11:36 1998 Tom Tromey <tromey@cygnus.com>
-
- * expr.c (expand_java_INSTANCEOF): Changed calling convention to
- match _Jv_IsInstanceOf.
- * decl.c (init_decl_processing): Use _Jv_NewArray, not
- soft_newarray. Use _Jv_IsInstanceOf, not soft_instanceof.
-
-Tue Jun 30 14:12:54 1998 Tom Tromey <tromey@cygnus.com>
-
- * decl.c (init_decl_processing): Functions are now named
- _Jv_MonitorEnter and _Jv_MonitorExit, and return jint.
-
-Mon Jun 29 14:47:10 1998 Per Bothner <bothner@cygnus.com>
-
- * java-tree.h (load_class): Add prototype.
- * class.c (is_compiled_class): Add missing arg to load_class.
- * expr.c (expand_java_NEW): Call load_class.
- * parse.y (process_import): Removed bogus use of void return value.
-
-Thu Jun 25 11:50:48 1998 Per Bothner <bothner@cygnus.com>
-
- * decl.c, java-tree.h (soft_athrow_node): Renamed to soft_node.
- Function name is "_Jv_Throw" instead of "soft_athrow".
- * decl.c, java-tree.h (soft_new_node): Renamed to alloc_object_node.
- Function name is "_Jv_AllocObject" instead of "soft_new".
- Takes an extra parameter (object size).
- * expr.c: Update calls.
-
-Wed Jun 24 13:59:02 1998 Per Bothner <bothner@cygnus.com>
-
- * lex.c (java_get_line_col): Handle end-of-file.
- * except.c (expand_end_java_handler): Handle null type (i.e. finally).
-
-Wed Jun 24 09:22:34 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
-
- * lang.c (lang_init): Make -fexceptions the default.
- * except.c (maybe_start_try, maybe_end_try): Don't do anything if
- exception handling is not turned on.
-
-Tue Jun 23 10:17:09 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
-
- * lang.c (flag_new_exceptions): Make this this default.
- * decl.c (end_java_method): Call emit_handlers.
- * except.c (method_init_exceptions): Set language code and version.
- (expand_start_java_handler): Enable exception, and call
- expand_eh_region_start.
- (expand_end_java_handler): Enable exception, and set up catch blocks.
- (emit_handlers): New routine to generate the saved handlers.
- * java-except.h (emit_handlers): Add prototype.
-
-Fri Jun 12 11:31:24 1998 Per Bothner <bothner@cygnus.com>
-
- We used to have three different representations of the constant pool:
- the CPool structure, the tree_constant_pool, and the constructures
- used to build the Class object (which may need class and string
- constants) in compiled code. None were appropriate for compiling
- to .class files, so I did a major overhaul.
-
- First, the tree_constant_pool array was removed. Things were
- modified to the CPool structure in the JCF could be used.
- Second, a "capacity" field was added to the CPool, and functions
- written to search for a matching constant, adding one if not found.
- The code that generated the Class object was changed to use a CPool.
- The actual TREE_LISTs used to build the CONSTRUCTORs used for
- the static Class object are now only in build_constants_constructor.
- Finally, I wrote code which can generate a .class file (including its
- constant pool) from the RECORD_TYPE of a class. This is a big step
- on the way to compiling Java source into .class files.
-
- * jcf-write.c: New file. Writes out a RECORD_TYPE as a .class file.
- * Makefile.in (JAVA_OBJS): Added jcf-write.o.
-
- * java-tree.h (CPOOL_UTF, CONSTANT_ResolvedFlag,
- CONSTANT_ResolvedString, CONSTANT_ResolvedClass): New macros.
- (NAME_AND_TYPE_NAME, NAME_AND_TYPE_SIGNATURE, COMPONENT_REF_NAME,
- COMPONENT_REF_NAME_AND_TYPE, COMPONENT_REF_SIGNATURE): Redefined.
- (COMPONENT_REF_CLASS): Replaced by COMPONENT_REF_CLASS_INDEX.
- (lang_type): Removed constant_pool field.
- * jcf.h (CPool): Renamed size to count. Added field capacity.
- (CPOO_COUNT, CPOOL_UINT, CPOOL_USHORT1, CPOOL_USHORT2,
- CPOOL_FINISH, CPOOL_INIT, CPOOL_REINIT): New macros.
- Rewrite some of the old JCF_XXX in terms of CPOOL_XXX macros.
-
- * constants.c (current_constant_pool_tags, current_constant_pool_data,
- current_constant_pool_length), java-tree.h: Replaced by outgoing_cpool.
- * constants.c (build_constants_constructor): Use new outgoing_cpool.
- (set_constant_entry, find_constant1, find_constant2,
- find_class_constant, count_constant_pool_bytes, write_constant_pool,
- find_utf8_constant, find_class_or_string_constant): New functions.
-
- * jcf-parse.c (load_class): Don't save/restore tree-constant_pool.
- (get_constant): Use current_jcf.cpool instead of tree_constant_pool.
- (give_name_to_class, get_class_constant): Likewise.
- * jcf-parse.c, java-tree.h (tree_constant_pool): Removed.
- (get_name_and_type_constant, get_ref_constant): Removed.
- * parse.h (parser_ctxt): Remove field tree_constant_pool.
- * parse.y: Don't save/restore tree_constant_pool.
- * verify.c (verify_jvm_instructions): Update for new approach.
- * expr.c (expand_invoke, expand_java_field_op): Likewise.
-
- * lang-options.h: Added -femit-class-file, -femit-class-files.
- * lang.c (flag_emit_class_files), java-tree.h: New flag.
- (lang_f_options): Added "emit-class-file(s)".
-
- * expr.c (build_java_arrayaccess): Generate more efficient array
- bounds checking, by using unsigned compare.
-
- * expr.c (expand_invoke): Re-arrange error checks to make more robust.
-
-Wed Jun 10 17:34:42 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h: New comment on the handling of unresolved type
- identifiers. JDEPs are now part of the jdep_code enum.
- (typedef struct jdep): Now use enum jdep_code or int, depending on
- availability. Both are narrowed down to an 8 bits bitfield.
- (CALL_EXPR_PRIMARY): Fixed comment.
-
-Wed Jun 10 10:54:39 1998 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (java): Added gjavac and jvgenmain.
- (java.start.encap): Depend on gjavac.
- (java.rest.encap): Depend on jvgenmain.
-
- * Make-lang.in (JAVA_INSTALL_NAME): Name is gjavac, not c++.
- (JAVA_CROSS_NAME): Likewise.
- (java.all.build): Depend on jvgenmain and gjavac.
- (java.all.cross): Depend on jvgenmain and gjavac-cross.
- (jvgenmain$(exeext)): New target.
- (java.install-common): Wrote.
- * config-lang.in (compilers, stagestuff): Added gjavac and
- jvgenmain.
-
-Wed Jun 10 12:19:04 1998 Dave Brolley <brolley@cygnus.com>
-
- * lang.c (lang_decode_option): New argc/argv interface.
-
-Tue Jun 9 18:12:46 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * ChangeLog: Fixed entries not compliant with the Gnu Coding Standard.
- * decl.c (build_decl_no_layout): New function.
- * expr.c (java_lang_expand_expr): Layout declarations found in
- blocks before they're pushed.
- * jcf-parse.c (load_class): Save current line when parsing class
- file.
- (parse_source_file): Register class before expanding their
- methods.
- * lang.c (put_decl_node): Produce `null' when `void *' is
- processed.
- * lex.c (static tree wfl_op): New static global, for error report
- on casts.
- (java_init_lex): wfl_operator and wfl_op initialized
- here. Filename caching added for wfl_op. Return wfl_op when `(' is
- parsed.
- * parse.h (build_unaryop, build_incdec, patch_unaryop, build_cast,
- patch_cast, valid_ref_assignconv_cast_p, can_cast_to_p,
- build_unresolved_array_type): New static function definitions.
- (build_decl_no_layout): New extern function declared.
- (OBSOLETE_MODIFIER_WARNING): Report error only if the WFL of the
- faulty modifier exists.
- (TYPE_INTERFACE_P, TYPE_CLASS_P): New macros.
- (ERROR_CAST_NEEDED_TO_INTEGRAL): Error message tuned.
- (UNARY_PLUS_EXPR): New fake operator.
- (struct parser_ctxt): New field osb_number.
- * parse.y (static tree wfl_operator): New static WFL for operator
- bound error messages.
- (DECR_TK, INCR_TK): Moved.
- (OP_TK): Tagged <operator>.
- (array_type:): Now call build_unresolved_array_type.
- (dim_expr:): Count the number of '[' seen.
- (post_increment_expression, post_decrement_expression,
- pre_increment_expression, pre_decrement_expression,
- unary_expression_not_plus_minus, unary_expression:): Actions are
- now building the corresponding unary expressions.
- (cast_expression:): Actions are now building cast expressions.
- (build_unresolved_array_type): New function.
- (create_interface): Reset the number of declared interfaces.
- (create_class): Likewise.
- (method_header): Methods declared within the scope of an interface
- are now implicitly set public and abstract.
- (java_complete_class): Variable's and parameter's type are patched
- with a promoted type.
- (declare_local_variables): Resolved non builtin types are promoted
- before being used to build a variable decl. Removed type patch
- posted on variable initialization statement.
- (source_start_java_method): Use build_decl_no_layout to build the
- decl of a parameter of incomplete type.
- (java_register_parsed_class): Process interfaces too. Call
- rest_of_decl_compilation on each processed class declarations.
- (java_complete_expand_methods): Don't attempt to expand things in
- interfaces.
- (java_complete_tree): Process CONVERT_EXPR, even though it always
- has a type. Propagate error_mark_node to node's type too. Promote
- method's call argument type and return error_mark_node if
- argument's completion didn't work. MODIFY_EXPR can have a WFL as a
- RHS. Fixed bug in the handling of bogus RHS of a fixed type. Now
- handle unary operator nodes.
- (build_assignment): Added comment.
- (print_int_node): New function.
- (patch_assignment): New second argument. New error handling. Use
- print_int_node. Handle references. Use can_cast_to_p to issue
- different error message according to the context and check upon
- the initialization of the RHS.
- (can_cast_to_p, valid_ref_assignconv_cast_p): New functions.
- (operator_string): Handle more operators.
- (patch_binop): No longer use a function static
- wfl_operator. Improved error message on shift distance.
- (build_unaryop, build_incdec, build_cast, patch_unaryop,
- patch_cast): New functions.
-
-Fri Jun 5 18:03:07 1998 Per Bothner <bothner@cygnus.com>
-
- * jvspec.c: New file.
- * Make-lang.in: New rules to build gjavac from jvspec.c and ../gcc.c.
-
- * java-tree.h (identifier_subst): Add declaration.
-
-Thu Jun 4 13:44:23 1998 Tom Tromey <tromey@cygnus.com>
-
- * jvgenmain.c (main): Generate call to JvRunMain.
-
- * class.c (make_class_data): Push value for "sync_info" field.
- * decl.c (init_decl_processing): Push "sync_info" field.
-
-Wed Jun 3 20:39:14 1998 Per Bothner <bothner@cygnus.com>
-
- * typeck.c (build_java_array_type): Set TYPE_NAME to actual
- Java (source) name, not signature.
- Set TYPE_ALIGN to (at least) that of element_type.
-
-Tue Jun 2 15:19:19 1998 Per Bothner <bothner@cygnus.com>
-
- * class.c: Moved classname-mangling-rekated code to ...
- * mangle.c: ... this new file.
- * jvgenmain.c: New program (needs mangle.c) to generate main program.
- * Makefile.in: Update for above changes.
-
-Mon Jun 1 09:58:36 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (truthvalue_conversion): Convert integer and floating
- point value to their truth value.
- * lex.c (java_lex): Handle the `null' literal.
- * parse.h (JREFERENCE_TYPE_P, DECL_P): New macros.
- (ERROR_CANT_CONVERT_TO_BOOLEAN, ERROR_CANT_CONVERT_TO_NUMERIC,
- ERROR_CAST_NEEDED_TO_INTEGRAL, ERROR_VARIABLE_NOT_INITIALIZED):
- New macros.
-
- * parse.y: Reorganization/documentation on token declaration.
- (binop_lookup[]): New added new tree codes.
- (relational_expression): Build corresponding binary operators.
- (equality_expression, conditional_and_expression,
- conditional_or_expression): Likewise.
- (java_complete_class): Fix crash in debug message.
- (java_complete_tree): Check initialization of method call
- arguments. Further bogus node evaluation to detect more error
- during assignments. Handles more binary operators.
- (patch_assignment): Use DECL_P.
- (build_binop): Fix crash when using URSHIFT_EXPR, a Java only tree
- code.
- (operator_string): Handle more case. Compacted source.
- (patch_binop): Changed function comment. Checking for
- uninitialized first operand takes the compound assignment into
- account and uses DECL_P. Checking for uninitialized second operand
- delayed to routine's end. Use macros to issue type bound error
- messages and issue messages on both operands if their types are
- different. Force fixed type into node. Handle all binary
- operators.
-
-Wed May 27 10:30:31 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (COMPOUND_ASSIGN_P, INITIALIZED_P): New macros.
- * lex.c (java_lex): Use BUILD_OPERATOR and BUILD_OPERATOR2 to
- build operator node and return tokens.
- * lex.h (BUILD_OPERATOR, BUILD_OPERATOR2): New macros.
- * parse.h (java_complete_tree): Changed returned type in prototype.
- (build_method_invocation, build_assignment, patch_assignment,
- patch_binop): New static function declarations.
- (JFLOAT_TYPE_P, JNUMERIC_TYPE_P, JPRIMITIVE_TYPE_P, JSTRING_P,
- BUILD_EXPR_WFL): New macros.
- * parse.y (enum tree_code binop_lookup[]): New static for token to
- TREE_CODE lookup.
- (%union): Parser union has new sub-structure `operator'.
- (ASSIGN_TK, MULT_ASSIGN_TK, DIV_ASSIGN_TK, REM_ASSIGN_TK,
- PLUS_ASSIGN_TK, MINUS_ASSIGN_TK, LS_ASSIGN_TK, SRS_ASSIGN_TK,
- ZRS_ASSIGN_TK, AND_ASSIGN_TK, XOR_ASSIGN_TK, OR_ASSIGN_TK,
- ASSIGN_ANY_TK): Tokens tagged `operator'.
- (EQ_TK, GTE_TK, ZRS_TK, SRS_TK, GT_TK, LTE_TK, LS_TK, BOOL_AND_TK,
- AND_TK, BOOL_OR_TK, OR_TK, INCR_TK, PLUS_TK, DECR_TK, MINUS_TK,
- MULT_TK, DIV_TK, XOR_TK, REM_TK, NEQ_TK, NEG_TK, REL_QM_TK,
- REL_CL_TK, NOT_TK, LT_TK): Tokens tagged `operator'.
- (assignment_operator:): Rule tagged `operator'.
- (expression_statement:): Re-installed default rule.
- (method_invocation:): Sub rules call build_method_invocation.
- (postfix_expression:): Don't attempt to resolve name here. Just
- return an ID.
- (multiplicative_expression:): Sub-rules build corresponding binop
- expression node.
- (additive_expression:, shift_expression:, and_expression:,
- exclusive_or_expression:, inclusive_or_expression:): Likewise.
- (assignment:): Sub rule invoke build_assignment.
- (assignment_operator:): Default rules on sub rules.
- (force_error): Added documentation on this variable.
- (declare_local_variables): Build initialization calling
- build_assignment.
- (expand_start_java_method): Removed unused rtx declaration. Mark
- arguments as already initialized.
- (java_method_add_stmt): Type of built COMPOUND_EXPR set to NULL.
- (java_complete_expand_methods): Don't process next method if
- completion of the previous one triggered errors.
- (java_complete_expand_method): Call source_end_java_method if no
- error were found during completion.
- (resolve_expression_name): Use IDENTIFIER_LOCAL_VALUE to retrieve
- locals declaratilon. Handle names found within a class. Return
- error_mark_node when things aren't found.
- (patch_method_invocation_stmt): Return error_mark_node on failures.
- (patch_invoke): Removed unused local. Return the correct node.
- (java_complete_tree): Now returns a value. The BLOCK section binds
- local identifiers and the type of a BLOCK is now void. Assign the
- result of operand completion on COMPOUND_EXPR. Assign the
- encapsulated node of a WFL to the result of its completion, except
- when the node is an identifier. Now handle MODIFY_EXPR and several
- binary operators. Return error_mark_node on errors.
- (build_method_invocation, build_assignment, patch_assignment,
- build_binop, operator_string, patch_binop): New functions.
- * typeck.c (binary_numeric_promotion): New function.
-
-Thu May 21 12:01:04 1998 Per Bothner <bothner@cygnus.com>
-
- * class.c (identifier_subst): New convenience wrapper for ident_subst.
- Replace most uses of ident_subst by identifier_subst.
-
- * class.c (push_class_static_dummy_field): Removed function.
- (build_class_ref): Find Class object decl by looking up "CNAME.class",
- instead of looking got "class" static field. Create that decl here.
- (class_identifier_node): Removed; no longer needed.
- (init_class_processing): Don't init class_identifier_node.
- * jcf-parse.c (jcf_parse): Don't call push_class_static_dummy_field.
- Do nreverse 0 times (instead of twice) for Object and Class.
- * parse.y (java_layout_parsed_class): No push_class_static_dummy_field.
-
-Wed May 20 16:35:04 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-parse.c (parse_class-file): Set lino to smallest line number,
- while initializing linenumber_count and linenumber_table.
- Do it before init_function_start (which calls emit_line_note).
- * expr.c (expand_byte_code): Don't need to clear lineno here.
-
-Mon May 18 16:23:32 1998 Tom Tromey <tromey@cygnus.com>
-
- * class.c (append_gpp_mangled_type): If `qualifications' is >=9,
- then mangle number as _N_.
-
- * class.c (mangle_class_field): New function.
- (build_class_ref): Set assembler name of class reference using
- mangle_class_field.
- (push_class_static_dummy_field): Likewise.
-
-Sun May 17 12:52:35 1998 Michael Tiemann <tiemann@cygnus.com>
-
- * parse.y (source_start_java_method): Use TREE_SET_CODE instead
- of assigning to TREE_CODE. The latter method exploits a feature
- of GCC that is not ANSI compliant.
-
-Thu May 12 13:44:27 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (pushdecl_force_head): New function.
- (pushlevel): Removed conditional printf.
- (complete_start_java_method): Don't enter local variable scope if
- function is compiled from source code.
- * expr.c: parse.h now included
- (java_lang_expand_expr): New function.
- * jcf-io.c (find_class): Use SOURCE_FRONTEND_DEBUG instead of
- printf. Terminate buffer when doing directories.
- * jcf-parse.c (parse_source_file): Call lang_init_source before
- parsing and before code generation.
- * jcf.h (SOURCE_FRONTEND_DEBUG): Macro redefined to conditionally
- use printf if the macro is defined.
- * lang.c (lang_init): Install lang_expand_expr hook on
- java_lang_expand_expr.
- (java_dummy_print): New function.
- (lang_init_source): New function.
- * lex.c (java_lex): Remember location of an opening brace at the
- second nesting level.
- (java_is_eol): Unget character seen after a CR if it is EOF.
- * parse.h: Now includes lex.h
- (SOURCE_FRONTEND_DEBUG): Macro redefined to conditionally use
- printf if the macro is defined.
- (expand_start_java_method, build_expr_block, enter_block,
- exit_block, lookup_name_in_blocks, maybe_absorb_scoping_blocks):
- New static function declarations.
- (pushdecl_force_head): New extern function declaration.
- (INCOMPLETE_TYPE_P): New macro.
- (JDEP_PARM, JDEP_TYPE): New entries in JDEPs enum.
- (BLOCK_CHAIN_DECL, BLOCK_EXPR_DECLS, BLOCK_EXPR_BODY,
- BLOCK_EXPR_ORIGIN): New macros.
- (DECL_SOURCE_LINE_MERGE, DECL_SOURCE_LINE_FIRST,
- DECL_SOURCE_LINE_LAST): New macros.
- (struct parser_ctxt): Removed field current_method_decl, redundant
- with the field current_function_decl. Added fields
- first_ccb_indent1 and pending_block.
- * parse.y (method_body, literal, INT_LIT_TK, FP_LIT_TK,
- BOOL_LIT_TK, CHAR_LIT_TK, STRING_LIT_TK, NULL_TK, VOID_TK): Rules
- tagged <node>
- (SOURCE_FRONTEND_DEBUG): Used as macro accepting varargs.
- (compilation_unit:): Cosmetic on sub rule.
- (type_declaration:): Cosmetic on sub rules. Added an error rule.
- (variable_initializer:): Installed default rule on expression:.
- (method_declaration:): method_header: starts a new
- method. method_body: installs the function body, absorbs blocks
- emitted for temporary variable scopings, pops function's body block
- and merges function's last statement lineno in DECL_SOURCE_LINE.
- (method_body:): Installed default rules.
- (block:): Call enter_block when an opening brace is seen. Absorb
- scoping blocks and call exit_block when a closing brace is seen.
- (block_statement:): Cosmetic changes.
- (method_invocation:): Create WFL around CALL_EXPR node.
- (patch_stage): Added comment around definition.
- (method_header): Try to use first_ccb_indent1 as the first line of
- the method, so BP debug info are emitted at the first opening
- brace of the function. If the function has no body, use the
- location of the function's name. Override currently defined method
- name with the matching WFL so we can point redefinition errors
- using the location where the function's name was declared.
- (check_abstract_method_header): Interprets DECL_NAME as an
- identifier or as a WFL, accordingly.
- (java_complete_class): New cases for JDEP_TYPE and JDEP_PARM.
- (check_method_redefinition): Use DECL_NAME as a WFL. Extract
- location and name information out of it and reinstall DECL_NAME to
- its original identifier node value.
- (lookup_cl): Use DECL_SOURCE_LINE_FIRST (first line of the
- function's source code).
- (read_import_dir): Test the value returned by find_class and issue
- a fatal accordingly.
- (declare_local_variables): Push a new block for the scope of the
- new variable(s) if code has been already generated at that nesting
- level. Pinpoint redefinition errors using the variable id
- WFLs. Generate initialization code if necessary. If the variable
- type is incomplete, register a patch on its decl.
- (source_start_java_method): Rewritten. Define a new block for the
- function's parameters. Build parameter decl out of function's
- arguments and register them for a patch if their types are
- incomplete.
- (expand_start_java_method): Includes the part of
- source_start_java_method that was pushing the parameter decls and
- completing the method start code.
- (source_end_java_method): Removed call the expand_end_bindings and
- poplevel (already taken care of). Reinstall function's arguments
- and get function's last line of code before calling
- expand_function_end.
- (java_method_add_stmt): New comment before the function's
- code. Complement the second operand of the current COMPOUND_EXPR
- if necessary.
- (java_complete_expand_methods): Don't generate debug info on line
- zero when expanding a generated constructor.
- (java_complete_expand_method): Set start and end line numbers for
- a artificially generated constructor to one and manually call
- enter_block and exit_block when defining it. For all methods:
- expand function's start calling the new expand_start_java_method
- and invoke java_complete_tree on the effective method's body, if
- any.
- (resolve_expression_name): Now use lookup_name_in_blocks to search
- local variable decls and print out an error when variables are
- undefined.
- (patch_method_invocation_stmt): Inserted comment before the
- function's code.
- (lookup_method_invoke): Chain method's arguments using chainon
- with the current arg list as a second argument. Inserted missing
- IDENTIFIER_POINTER when reporting an error on methods not found.
- (refine_accessible_methods_list): Don't retain constructors.
- (patch_arguments): Function removed.
- (java_complete_tree): Inserted comment before the function's
- code. New case for BLOCKs. Moved the WFL case a bit
- further. Complete function's arguments.
- (build_expr_block, enter_block, exit_block, lookup_name_in_blocks,
- maybe_absorb_scoping_blocks): New functions.
-
-Mon Apr 27 10:50:05 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-io.c (find_class): Reset jcf->java_source after JCF_ZERO, if
- previously set.
- * jcf-parse.c (parse_source_file, java_error_count): New forward
- and extern declarations.
- (java_parse_abort_on_error): Macro moved.
- (jcf_parse_source): fatal called if fopen fails. Now calls
- parse_source_file.
- (parse_source_file): New parse_only parameter. Reflects the
- elimination of the second pass.
- (yyparse): parse_source_file called with argument set to 0.
- * jcf.h (JCF_ZERO): Sets java_source to zero.
- * lex.c (java_init_lex): pass argument is gone. Function modified
- to be called once during the analysis of a file.
- (java_unget_unicode): Fixed typo in fatal message.
- (java_get_line_col): Likewise.
- (java_lval): Likewise. String literals no longer built during
- second pass.
- * lex.h (JAVA_COLUMN_DELTA): Take the tabulation character into
- account.
- * parse.h (MODIFIER_WFL): New macro.
- (parse_check_super, parser_check_super_interface): Now return int.
- (parser_chain_incomplete_item, not_builtin_p,
- complete_method_decl): Declarations removed.
- (build_method_invocation_stmt, build_invoke): Renamed using the
- `patch' instead of `build'
- (register-incomplete_type, obtain_incomplete_type,
- java_complete_tree, java_complete_expand_method,
- unresolved_type_p, create_jdep_list): New function declarations.
- (IC_TYPE, IC_DEPEND, DEPEND_DECL, DEPEND_WFL, BEGIN_ONLY_PASS,
- END_ONLY_PASS, ELSE_ONLY_PASS): Macro deleted.
- (jdep): New typedef on new struct _jdep.
- (JDEP_DECL, JDEP_DECL_WFL, JDEP_KIND, JDEP_SOLV, JDEP_WFL,
- JDEP_MISC, JDEP_APPLY_PATCH, JDEP_GET_PATCH, JDEP_CHAIN,
- JDEP_TO_REVOLVE, JDEP_RESOLVED_DECL, JDEP_RESOLVED,
- JDEP_RESOLVED_P): New macros.
- (JDEP_NO_PATCH, JDEP_SUPER, JDEP_FIELD, JDEP_METHOD,
- JDEP_METHOD_RETURN, JDEP_METHOD_END, JDEP_INTERFACE,
- JDEP_VARIABLE): New enum values and jdep kinds.
- (jdeplist): New typedef on struct _jdeplist.
- (CLASSD_FIRST, CLASSD_LAST, CLASSD_CHAIN, JDEP_INSERT): New
- macros.
- (CALL_EXPR_PRIMARY): New macro.
- (struct parser_ctxt): Fields java_pass, current_method_decl,
- method_decl_list deleted. New field jdeplist.
- (INCOMPLETE_P): Macro deleted.
- * parse.y (single_type_import_declaration:): Removed pass switch.
- (type_import_on_demand_declaration): Likewise.
- (field_declaration:): Removed pass switch on all sub rules.
- (class_declaration:): Call the complete_class_decl removed on
- class_body rules.
- (method_declaration:): Removed second pass switch. No longer chain
- methods decl when method_header reduced.
- (method_header:): Sub rules no longer depend on pass switch.
- (method_declarator:): Likewise.
- (method_body:): Likewise.
- (abstract_method_declaration:): Likewise.
- (block_statement:): Likewise.
- (local_variable_declaration:): Likewise.
- (argument_list:): Likewise.
- (method_invocation:): Likewise. Call to build_method_invocation_stmt
- removed. Partial CLASS_EXPR tree node built instead.
- (postfix_expression:): Removed pass switch on all sub rules.
- (java_pop_parser_context): Free classd_list content.
- (yyerror): Call obstrack_grow0 to finalize error message.
- (check_class_interface_creation): Comment modified to reflect new
- returned value meaning. Removed second pass switch. Return 1 if an
- error was found, 0 otherwise. Adjust pointer on filename if a
- leading path separator was found.
- (maybe_create_class_interface_decl): Removed first pass switch
- when linking the class decl to the class_list. Install a new
- jdep_list for the class.
- (add_superinterfaces): List of unresolved interfaces is
- gone. Unresolved interfaces are directly added to the current
- dependencies list.
- (create_interface): Second pass shortcut removed.
- ctpx->modifier_ctx access through MODIFIER_WFL.
- (create_class): Second pass shortcut removed. Call to
- register_incomplete_type replaces the call to
- parser_chain_incomplete_item.
- (complete_class_decl): Function removed.
- (duplicate_declaration_error): New way of retrieving redeclared
- item type.
- (register_fields): Call to lookup_modifier_cl replaced by
- MODIFIER_WFL. New way of handling unresolved type, using
- unresolved_type_p and obtain_incomplete_type.
- register_incomplete_type replaces call to parser_chain_incomplete_item.
- (patch_stage): New static global variable.
- (method_header): New way of handling unresolved type, using
- unresolved_type_p and obtain_incomplete_type. patch_stage used to
- indicates that the method decl needs to be patched.
- (check_abstract_method_header): Call to lookup_modifier_cl
- replaced by MODIFIER_WFL.
- (method_declarator): Incomplete argument type are registered
- calling register_incomplete_type. Patch on the declared method is
- issued in that case.
- (unresolved_type_p): New function.
- (parser_check_super_interface): New comment to reflect function's
- modified returned type (int). Function and has a new argument
- this_wfl. Call to parse_error_context uses this_wfl instead of
- relying on lookup_cl.
- (parser_check_super): Comment reflects function's new returned
- type (int). Function returns non zero value on error.
- (create_jdep_list, reverse_jdep_list, obtain_incomplete_type,
- register_incomplete_type, jdep_resolve_class): New functions to
- handle incomplete types in declarations.
- (java_complete_class): Rewritten to work with the new incomplete
- type handling scheme.
- (complete_class_report_errors): Likewise.
- (complete_method_decl): Removed: it jobs is now handled by
- java_complete_class.
- (do_resolve_class): Class loaded in not already loaded and not
- found in Java source code.
- (java_check_regular_methods, java_check_abstract_methods): Don't
- call complete_method_decl anymore.
- (lookup_modifier_cl, not_builtin_p): Functions deleted.
- (read_import_dir): Got rid of the pass number dependency.
- (declare_local_variables): New handling of unresolved types (patch
- issued).
- (source_start_java_method): New parameter level. Function called
- with level set to 1 when argument types are potentially
- unresolved. Called to complete the job with level set to 2 once
- types are complete.
- (source_end_java_method): Call to permanent_allocation
- removed. Waiting to be replaced by a more suitable obstack
- management.
- (java_complete_expand_methods, java_complete_expand_method,
- java_expand_finals): New functions.
- (build_method_invocation_stmt): Renamed
- patch_method_invocation_stmt. Extracts function call expression
- (wfl) and arguments (args) from CALL_EXPR tree operands.
- (build_invoke): Renamed patch_invoke. Fixed typo in fatal
- call. Patch the function and argument operand of the CALL_EXPR
- tree argument.
- (patch_argument, java_complete_tree): New functions.
-
-Mon Apr 20 18:26:57 1998 Per Bothner <bothner@cygnus.com>
-
- Recover from missing fields and methods (i.e. error instead of fatal).
- * decl.c, java-tree.h (TYPE_identifier_node): New global constant.
- * expr.c (expand_invoke): Recover from missing method.
- (expand_java_field_op): Recover from missing field.
- Inline references to java.lang.{Integer,Char,...}.TYPE.
- * typeck.c (get_type_from_signature), java-tree.h: New function.
- * class.c (add_method): Use get_type_from_signature.
- (build_class_ref): Handle a class that was not found.
- * typeck.c (convert): Handle conversion to pointers (for convenience).
- * verify.c (verify_jvm_instructions): Use get_type_from_signature
- instead of lookup_field to handle missing fields.
-
- * jcf-parse.c (process_zip_dir): Set java_source.
-
-1998-04-20 Brendan Kehoe <brendan@cygnus.com>
-
- * jcf-parse.c (set_source_filename): Use TYPE_NAME, not DECL_NAME.
-
-Tue Apr 14 15:59:54 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (load_class): Don't change input_filename before
- calling jcf_parse_source (but still do it before calling
- jcf_parse).
- (jcf_parse_source): Assign input_filename after having saved the
- parser context.
- * lex.c (java_init_lex): Chain a WFL node to the import on demand
- list. ctxp->modifier_ctx zeroed according to its new
- definition. ctxp->filename initialized. Removed
- JAVA_MODIFIER_CTX_UNMARK.
- (java_unget_unicode): Update the character based column position.
- (java_allocate_new_line): ref_count not used anymore. Always free
- ctxp->p_line. Initialize c_line->char_col to 0.
- (java_get_unicode): Update the character based column position.
- (java_lex): Use ctxp->elc to store current position in source
- file, at the beginning of the parsed token. Set modifier_ctx entry
- corresponding to the parse modifier to a WFL node. Return a WFL
- node when an identifier is parsed.
- (java_lex_error): Now uses ctxp->elc to store current position in
- source.
- (build_wfl_node, java_is_eol, java_get_line_col): New functions.
- * lex.h (build_wfl_node): New function definitions.
- (struct java_line): ref_count and next fields are gone. New field
- char_col.
- (JAVA_LINE_CHECK, JAVA_LINE_MARK, JAVA_LINE_CHAIN,
- JAVA_LINE_UNMARK, ID_NAME, ID_CL): Macro definitions deleted.
- (JAVA_COLUMN_DELTA): New macro.
- (java_lc): New typedef on new struct _java_lc.
- * parse.h (lookup_cl, lookup_modifier_cl): Changed returned types.
- (parse_error_context, parse_warning_context): Changed prototypes.
- (java_get_line_col): Added as an available global function.
- (JAVA_MODIFIER_CTX_UNMARK): Macro removed.
- (IC_DECL): Replaced by macro IC_TYPE
- (DEPEND_WFL): New macro.
- (THIS_MODIFIER_ONLY): Now works with WFL and only remembers the first
- wrong modifier.
- (exit_java_complete_class): Removed a commented out statement.
- (struct parser_ctxt): Added comments on fields. modifier_ctx is
- now an array of tree nodes. Deleted fields line_list and
- e_line. New field elc, to replace e_line.
- * parse.y (array_type:): Build WFL node.
- (qualified_name:): Build a single WFL node out of two. Retain
- the location information of the first node in the resulting node.
- (package_declaration:): Use package name as a WFL node
- (single_type_import_declaration:): Use imported name as a WFL node.
- (type_import_on_demand_declaration:): Use root of the imported
- packages as a WFL node.
- (field_declaration:): Removed unused local variable cl.
- (method_declaration:): Don't call JAVA_MODIFIER_CTX_UNMARK.
- (yyerror): New static elc. Removed static error_line, error_pos.
- New local code_from_source. Save ctxp->elc into elc at the first
- pass. Call java_get_line_col to get a string of the line where
- the error occured.
- (debug_line): Removed static function.
- (parse_error_context, parse_warning_context): Parameter cl is now
- a WFL node. Use its value to initialize ctxp->elc.
- (redefinition_error): Parameter cl is now a WFL node.
- (parse_add_interface): New parameter wfl. No longer call
- lookup_cl, use wfl instead.
- (check_class_interface_creation): Parameter cl is now a WFL node.
- (maybe_create_class_interface_decl): Likewise.
- (add_superinterfaces): New function.
- (create_interface): Removed local cl, node, super_decl,
- super_decl_type. Function now uses id as a WFL node. Better
- warning/error report on obsolete or forbidden mix of
- modifiers. Now calls add_superinterfaces to register interfaces.
- (create_class): Removed local cl, node. Local variable id is used
- as a WFL node. Better error report on forbidden modifier
- mix. Uses add_superinterfaces to register interfaces.
- (find_field): Argument cl is now a WFL node. Now store the WFL
- node of a fields that needs to be checked for their
- initialization.
- (method_header): Local variable node non longer used. Local
- variable id replaces cl.
- (check_modifiers_consistency): Local variable cl is now a WFL
- node.
- (method_declarator): Local variable cl replaced by parameter id.
- (parser_qualified_name): Now uses parameter name as a WFL node.
- (parser_check_super_interface): New parameter wfl, for achieve
- greater accuracy during error reports.
- (parser_chain_incomplete_item): New parameter named location. Used,
- along the decl, to construct the incomplete item node.
- (java_complete_class): resolve_class now uses WFL node extracted
- from the incomplete item node. Macro IC_TYPE replaces TREE_PURPOSE
- where appropriate.
- (complete_method_decl): Unresolved function's argument types are WFL.
- (resolve_class): Parameter cl is now a WFL node.
- (resolve_and_layout): Likewise.
- (do_resolve_class): Likewise. Try first to use cl and then do the
- lookup on the decl when calling check_pkg_class_access.
- (complete_class_report_errors): Use IC_TYPE in place of
- TREE_PURPOSE where appropriate. Use DEPEND_WFL on dependency
- instead of doing a lookup over the decl.
- (java_check_final): Use WFL info from field tree list.
- (lookup_cl): Rewritten and returns a statically defined WFL node.
- (lookup_modifier_cl): Now uses information from WFL nodes.
- (process_imports): Likewise.
- (read_import_dir): name and cl arguments replaced by a single WFL
- node. Function modified accordingly.
- (find_in_imports_on_demand): Now uses WFL node.
- (check_pkg_class_access): cl argument is now a WFL node.
- (declare_local_variables): Fixed to use WFL nodes.
- (resolve_expression_name): Likewise.
- (build_method_invocation_stmt): name_combo argument renamed
- wfl. Function modified to use WFL nodes.
- (build_invoke): cl used as a WFL node when calling build_expr_wfl.
- (lookup_method_invoke): cl is now a WFL node. Added missing
- IDENTIFIER_POINTER to class type decl name.
-
-Tue Apr 14 15:23:29 1998 Dave Brolley <brolley@cygnus.com>
-
- * lang.c (init_parse): Now returns char* containing the filename.
-
-Fri Apr 10 11:36:04 1998 Per Bothner <bothner@cygnus.com>
-
- * class.c (layout_class): Mangle repeated arg types to match cc1plus.
-
- * decl.c, java-tree.h (integer_four_node): New INTEGER_CST node.
- * class.c (make_class_data): If flag_assume_compiled, initial class
- state is CSTATE_PREPARED; make superclass and interfaces direct
- references, rather than constant pool indexes.
-
-Thu Apr 9 16:10:56 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parser.y: Include flags.h. Removed debug variable pl.
- (method_declaration:): Uses ctxp->parser_ccb_indent instead of pl.
- (block:): Likewise.
- (labeled_statement_nsi:): Generate debug info when reducing
- expression_statement:.
- (check_pkg_class_access): get_access_flags_from_decl invokation
- fixed for new CLASS_* flags location.
- (source_end_java_method): Save/restore parser context when
- entering/leaving this routine. Restore lineno to its right value
- before calling expand_end_bindings.
- (build_method_invocation_stmt): build_invoke called with the
- current line information.
- (build_invoke): New argument cl. Wrap the function call around a
- wfl node.
- (refine_accessible_methods_list): Changed comment, removed
- unnecessary code.
- * parse.h: Fixed typo in comments.
- (CLASS_OR_INTERFACE): Handle the new CLASS_* flags location.
- (JAVA_MAYBE_GENERATE_DEBUG_INFO): New macro.
- (struct parser_ctxt): New fields ccb_indent, last_ccb_indent1,
- parser_ccb_indent.
- * lex.c (java_lex): Record the last closing curly bracket of a
- function.
- * jcf-parse.c (jcf_parse_source): Now calls
- java_check_methods. Clarified comment, fixed typo.
-
-1998-04-09 Dave Brolley <brolley@cygnus.com>
-
- * lang.c (init_parse): Expose for non USE_CPPLIB builds.
- (finish_parse): Expose for non USE_CPPLIB builds.
-
-Wed Apr 8 13:06:23 1998 Jeffrey A Law (law@cygnus.com)
-
- * lang.c (lang_print_xnode): New function.
-
-Fri Apr 3 13:22:41 1998 Per Bothner <bothner@cygnus.com>
-
- * decl.c (class_dtable_decl), java-tree.h: New tree node.
- * class.c (get_dispatch_vector, get_dispatch_table): New functions
- used to build a class's dispatch table.
- (make_class_data): Generate dispatch table if flag_assume_compiled.
- Set dtable of class object to address of class_dtable_decl.
-
- * decl.c (int_decl_processing): Make soft_badarrayindex_node
- be volatile and have side effects - generates better code.
-
- * class.c, expr.c, parse.y: CLASS_INTERFACE, CLASS_FINAL, etc:
- These flags were defined for TYPE_DECLs, but used on RECORD_TYPEs.
-
- * expr.c (expand_invoke): If class is final, method is
- effectively final, so can call it directly.
-
- * java-tree.h (TYPE_NVIRTUALS, TYPE_VTABLE): New macros.
-
- * Makefile.in, Make-lang.in: Add missing $(exeext)s.
-
-Thu Mar 19 16:59:16 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (build_method_invocation_stmt): Removed extra argument
- to build_invoke.
-
-Mon Mar 16 17:25:19 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (dtable_indent): Now static global.
- (expand_invoke): Now call invoke_build_dtable and
- build_invokevirtual.
- (invoke_build_dtable, build_invokevirtual): New functions.
- * jcf-io.c (find_class): Defer issuing a warning by setting
- jcf->outofsynch to 1.
- * jcf-parse.c (jcf_out_of_synch): New function.
- (load_class): Test this_jcf.outofsynch flag and call
- jcf_out_of_synch accordingly.
- * jcf.h: (typedef struct JCF): New flag outofsynch. Fixed typo in
- comment indentation.
- * lex.c (java_get_unicode): Fixed code indentation.
- (java_lex): Create string literal. Fixed typo. Removed several
- premature obstack_free.
- * parse.h: New enums for name resolution and invocation mode.
- (struct qualification): New data structure.
- (RESOLVE_CHAIN_REMAINDER, BUILD_PTR_FROM_NAME): New macros.
- (do_resolve_class, build_method_invocation_stmt,
- breakdown_qualified, qualify_ambiguous_name, resolve_and_layout,
- debug_line, identical_subpath_p, invocation_mode,
- refine_accessible_methods_list, build_invoke,
- lookup_method_invoke): New functions declared.
- (build_invokevirtual, invoke_build_dtable, match_java_method,
- build_field_ref, jcf_out_of_synch): New references to external
- functions.
- (struct parse_ctxt): Removed artificial_constructor field.
- * parse.y: (array_type:): Type defined for this rule.
- (class_type:): Installed default rule for interface_type:.
- (array_type:): Now build Java array type.
- (qualified_name:): Now use obstack_grow0.
- (method_declaration:): Skip the artificial constructor added to
- the list, if any.
- (abstract_method_declaration:): Execute the code only during pass 1.
- (block:): Installed default rule in block_statements:.
- (block_statement:): Add the statement to the method during pass 2.
- (statement_expression): Installed default rule for
- method_invocation:.
- (argument_list:): Added code to build the argument list.
- (method_invocation:): Added call to create the method invocation
- node.
- (yyerror): Now use obstack_grow0. Removed bogus obstack_free.
- (debug_line): New function for debug.
- (complete_class_decl): No longer do something during pass 1.
- (method_header): Use BUILD_PTR_FROM_NAME.
- (parser_qualified_classname): Use obstack_grow0. Removed bogus
- obstack_free.
- (parser_chain_incomplete_item): Use BUILD_PTR_FROM_NAME. Modified
- function's main comment.
- (java_complete_class): Set CLASS_LOADED_P on all fixed incomplete
- classes.
- (complete_method_decl): Use BUILD_PTR_FROM_NAME and promote types.
- (resolve_class): Now works with arrays.
- (do_resolve_class, resolve_and_layout): New functions.
- (java_check_regular_methods): Reverse method list before and after
- having processed it. No longer set ctxp->artificial_constructor.
- (read_import_dir): Test jcf->outofsynch and call jcf_out_of_synch
- accordingly. Fixed typo in issued error message. Now use
- obstack_grow0.
- (find_in_imports_on_demand): Now use obstack_grow0.
- (declare_local_variables): Use BUILD_PTR_FROM_NAME.
- (source_end_java_method): Call expand_expr_stmt instead of
- expand_expr. Calls it before calling expand_function_end.
- (java_method_add_stmt): Do nothing if errors were found during
- parsing.
- (java_layout_parsed_class): Set CLASS_LOADED_P and fixed typo.
- (build_method_invocation_stmt, build_invoke, invocation_mode,
- lookup_method_invoke, refine_accessible_methods_list,
- qualify_ambiguous_name, breakdown_qualified, identical_subpath_p):
- New functions.
- * typeck.c (build_java_signature): Properly end method signature
- if return type skipped.
- (match_java_method): New function.
-
-Mon Mar 16 10:40:47 1998 Per Bothner <bothner@cygnus.com>
-
- * jcf-io.c (find_classfile): If USE_JCF_STDIO, fopen in binary mode.
-
-Wed Feb 25 08:55:49 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (build_invoke_non_interface): New function.
- (methods_ident, ncode_ident): Now static globals.
- (expand_invoke): Use build_invoke_non_interface.
- * java-tree.h (struct lang_decl): New field function_decl_body.
- (DECL_FUNCTION_BODY): New macro.
- * jcf-parse.c (jcf_parse_source): Deeper check before setting
- CLASS_FROM_SOURCE_P.
- (parse_source_file): Fixed typos. Call java_layout_parsed_class
- before starting pass 2. Call to java_generate_parsed_class replaced
- by java_register_parsed_class.
- * lex.c: Fixed typo in header. Some line width related formating.
- * lex.h: Some line width related formating.
- * parse.h (source_end_java_method, resolve_expression_name,
- complete_class_decl, maybe_create_class_interface_decl,
- check_class_interface_creation): New static function declarations.
- (java_layout_parsed_class, java_method_add_stmt): New function
- declarations.
- (struct parser_ctxt): Field mark_class_generate removed. New
- fields class_list and artificial_constructor.
- * parse.y: Fixed typo in header.
- (class_declaration:): Call complete_class_decl when class body
- parsed.
- (method_declaration:): Call source_end_java_method in pass 2 when
- the method body is defined.
- (postfix_expression:): Do expression name resolution on sub-rule
- name during pass 2.
- (create_class, create_interface): Merged common pieces.
- (check_class_interface_creation, maybe_create_class_interface_decl):
- New functions.
- (complete_class_decl): New function.
- (register_fields): Fixed line width related typo.
- (method_header): Correctly skip first argument when fixing
- argument line. Changed the loop.
- (java_check_circular_reference): Now use ctxp->class_list.
- (java_complete_class): Removed start/stop marking.
- (java_check_regular_methods): Now takes a class decl as an
- argument. Add default constructor if none were encountered.
- (java_check_methods): Now use ctxp->class_list. Changed call to
- java_check_regular_methods.
- (source_start_java_method): Set DECL_ARG_TYPE for each function
- arguments.
- (source_end_java_method, java_method_add_stmt): New functions.
- (java_generate_parsed_class): No longer exists.
- (java_layout_parsed_class, java_register_parsed_class): New functions.
- (resolve_expression_name): New function.
-
-Thu Feb 12 11:54:28 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c: (parse_source_file): Check on errors after init lex.
- * lex.c: (java_init_lex): Defer ctxp->java_pass initialization
- until pass initializations are done. Call read_import_dir with
- pass set to 0.
- * parse.h: (lookup_modifier_cl): New function declared.
- (INTERFACE_FIELD_MODIFIERS): New macro.
- (OBSOLETE_MODIFIER_WARNING): New macro.
- * parse.y: (register_fields): Class type and current field name in
- local variables. Check modifier(s) if adding field(s) to an interface.
- (check_abstract_method_header): Now use OBSOLETE_MODIFIER_WARNING
- and report errors using the faulty modifier line context.
- (lookup_modifier_cl): New function.
- (read_import_dir): Detect and report default import processing
- failure.
-
-1998-02-11 Brendan Kehoe <brendan@cygnus.com>
-
- Add a pair of -fassume-compiled/-fno-assume-compiled options.
- * class.c (is_compiled_class): Return 1 after making sure it
- qualifies as loaded, if FLAG_ASSUME_COMPILED is set.
- * lang-options.h: Add -fassume-compiled/-fno-assume-compiled.
- * java-tree.h (flag_assume_compiled): Add decl.
- * lang.c (lang_f_options): Add the flag.
- (flag_assume_compiled): Add decl, default to 0.
-
-Wed Feb 11 11:27:59 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (class_depth): Call to load_class uses extra VERBOSE arg.
- (is_compiled_class): Likewise.
- (layout_class): Likewise.
- (layout_class): Detect and lay out classes defined in source code.
- (interface_of_p, add_interface_do, may_add_interface): New
- function.
- (add_interface): Now use add_interface_do.
- (add_method_1): New function.
- (add_method): Now use add_method_1.
- (pushlevel): Debug message conditional to SOURCE_FRONTEND_DEBUG.
- (complete_start_java_method): New function.
- (start_java_mehod): Now call complete_start_java_method.
- * expr.c (lookup_field): Call to load_class uses extra VERBOSE arg.
- (expand_invoke): Likewise and fixed typo.
- *gjava.c: (print_super_field): Use new argument to find_class
- DO_CLASS_FILE.
- (main): Likewise.
- *java-tree.h: (CLASS_FROM_SOURCE_P): New flag on RECORD_TYPE.
- (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P, IS_A_CLASSFILE_NAME,
- QUALIFIED_P, IS_AN_IMPORT_ON_DEMAND_P): New flags on
- IDENTIFIER_NODE.
- (CLASS_COMPLETE_P): New flag on TYPE_DECL.
- (add_method_1, push_class): New prototypes.
- *jcf-dump.c: find_class now uses new DO_CLASS_FILE argument.
- *jcf-io.c: (open_in_zip): jcf now stores a pointer to the Zip
- directory where the class was found.
- (find_class): New argument DO_CLASS_FILE. Function find_class
- modified accordingly.
- *jcf-parse.c: (fix_class_path): New function.
- (load_class): Use new VERBOSE argument. load_class now finds and
- loads/parses .class/.java files. Save read_state of current_jcf
- if necessary.
- (java_parser_abort_on_error): New macro.
- (jcf_parse_source, parse_source_file): New function.
- (jcf_parse): Fixed typo.
- (yyparse): Call parse_source_file () only.
- (process_zip_dir): Fixed typo, fix zdir->filename_length when
- writing the real class name back in the zip directory entry.
- (find_in_current_zip): IDENTIFIER_CLASS_VALUE may be null.
- (jcf_figure_file_type): Fixed bogus alloc and bcopy.
- *jcf.h: (typedef struct JCF): New fields java_source and zipd.
- (find_class): Prototype fixed.
- *lex.c: Added 1998 time stamp.
- Removed all static global variables, moved into the parser
- context data structure.. Now include unistd.h if SEEK_SET not
- defined.
- (java_init_lex): Rewritten.
- (java_sneak_unicode): Modified current unicode access in current line.
- (java_unget_unicode): Likewise.
- (java_allocate_new_line): New allocation management.
- (java_read_char): Modified access and storage of unget_utf8_value.
- New way of processing current unicode.
- (java_store_unicode, java_read_unicode): Fixed typo in declaration.
- (java_get_unicode): Now use the parser context.
- (java_lineterminator): Likewise.
- (java_lex): Now used java_lval argument (pointer to YYSTYPE), part
- of the reentrant parser implementation. Function now use the
- parser context data structure and java_lval. Fixed production of
- the float and double constant "out of range" error message. Fixed
- obstack use. Return integer value when hitting a modifier. Now
- return type for TRUE, FALSE and other predefined types. Return
- identifier as a TREE_LIST list containing the current line context
- as the TREE_VALUE sub-node.
- (java_unicode_2_utf8): Fixed typo in declaration.
- (java_lex_error): Now use the parser context data structure.
- *lex.h: Added 1998 time stamp.
- (struct java_line): New fields ref_count and next.
- (JAVA_LINE_CHECK, JAVA_LINE_MARK, JAVA_LINE_CHAIN,
- JAVA_LINE_UNMARK, ID_NAME, ID_CL): New macros.
- (JAVA_FLOAT_RANGE_ERROR, JAVA_INTEGRAL_RANGE_ERROR, UNGETC): Fixed.
- *parse.h: Added 1998 time stamp.
- (java_parse_source_file): Renamed from parse_source_file.
- (YYERROR_NOW, YYNOT_TWICE): Fixed.
- (CLASS_MODIFIERS, FIELD_MODIFIERS, METHOD_MODIFIERS,
- INTERFACE_MODIFIER, INTERFACE_METHOD_MODIFIERS,
- JAVA_MODIFIER_CTX_UNMARK, IC_DECL, IC_DEPEND, DEPEND_DECL,
- THIS_MODIFIER_ONLY, ABSTRACT_CHECK, BEGIN_ONLY_PASS,
- END_ONLY_PASS, ELSE_ONLY_PASS, exit_java_complete_class,
- CLASS_OR_INTERFACE, INCOMPLETE_P): New macros.
- (struct parser_ctxt): New data structure to keep the parser context.
- *parse.y: Added 1998 time stamp, got rid of static global variables.
- (java_error_count, ctxp): New global variables.
- (%union): New value field.
- (numeric_type, integral_type): Rules removed.
- (primitive_type): Rule defined to handle integral, float, double and
- boolean types.
- (qualified_name, package_declaration,
- single_type_import_declaration, type_import_on_demand_declaration,
- modifiers, class_declaration, super, interfaces,
- interface_type_list, class_body, field_declaration,
- field_declaration, variable_declarators, variable_declarator,
- variable_declarator_id, method_declaration, method_header,
- formal_parameter_list, formal_parameter, method_body, block,
- static, interface_declaration, extends_interfaces,
- abstract_method_declaration, local_variable_declarators): Rules now
- define actions.
- (force_error, do_warning): New global statics.
- (push_parser_context, parser_context_save_global,
- parser_context_restore_global, pop_parser_context): New functions.
- (yyerror): Now uses the global parser context. Fixed use of obstack.
- (parse_error, parse_error_context, parse_warning_context,
- java_accstring_lookup, redefinition_error, check_modifiers,
- parser_add_interface, create_interface, create_class, find_field,
- duplicate_declaration_error, register_fields, method_header,
- check_modifiers_consistency, check_abstract_method_header,
- method_declarator, parser_qualified_classname,
- parser_check_super_interface, parser_check_super,
- parser_chain_incomplete_item, java_check_circular_reference,
- layout_class_from_source, java_complete_class,
- complete_method_decl, resolve_class, complete_class_report_errors,
- java_check_final, check_method_redefinition,
- java_check_regular_methods, java_check_abstract_methods,
- java_check_methods, lookup_java_interface_method2,
- lookup_java_method2, lookup_cl, find_name_in_single_imports,
- process_imports, find_in_imports, read_import_entry,
- read_import_dir, find_in_imports_on_demand,
- check_pkg_class_access, not_builtin_p, declare_local_variables,
- source_start_java_method, java_generate_parsed_class): New
- functions.
- *typeck.c: (signature_include_return): New global variable.
- (build_java_signature): Use SIGNATURE_INCLUDE_RETURN figure whether
- to add the function returned type in the signature.
-
-1998-02-09 Brendan Kehoe <brendan@cygnus.com>
-
- * jcf-io.c (open_in_zip): Use strncmp and LEN.
-
-Thu Jan 29 16:12:13 1998 Dave Brolley <brolley@cygnus.com>
-
- * Make-lang.in (java.info): Added.
- (java.install-info): Added
-
-1998-01-27 Brendan Kehoe <brendan@cygnus.com>
-
- * Makefile.in (clean): Also remove java/parse.c.
-
-1998-01-26 Brendan Kehoe <brendan@cygnus.com>
-
- Add a pair of -fbounds-check/-fno-bounds-check options.
- * lang.c (lang_decode_option): Add code to grok arguments.
- (flag_bounds_check): Add decl.
- (lang_f_options): New array w/ the option in it.
- * java-tree.h (flag_bounds_check): Add decl.
- * lang-options.h: New file.
- * expr.c (build_java_arrayaccess): Use flag_bounds_check instead
- of a static macro value.
- (JAVA_ARRAY_EXCEPTION): Delete macro.
-
-Fri Jan 23 14:19:47 1998 Per Bothner <bothner@cygnus.com>
-
- * typeck.c (build_java_array_type): Fix two bugs in previous change.
- * expr.c (build_anewarray): Add missing promote_type.
-
-Thu Jan 22 17:43:45 1998 Per Bothner <bothner@cygnus.com>
-
- Add array types with known length to optimize bounds checking.
- * typeck.c (build_java_array_type): Take length parameter.
- (java_array_type_length, build_prim_array_type): New functions.
- * java-tree.h: Update for new functions.
- * expr.c, typeck.c, verify.c: Update build_java_array_type calls.
- * class.c: Use build_prim_array_type.
- * expr.c (can_widen_reference_to): Handle known-length array types.
- (verify_jvm_instructions): Keep track of integer push instructions
- followed by newarray/anewarray, so we can build known-length arrays.
- (JAVA_ARRAY_DATA_OFFSET): Replace by ...
- (java_array_data_offset): New function.
- (build_java_array_length_access): New function. Optimize if constant.
- (build_java_arrayaccess): Constant fold bounds check.
- (expand_java_newarray, expand_java_anewarray): Replaced by ...
- (build_newarray, build_anewarray): New functions.
- (ARRAY_NEW_NUM, ARRAY_NEW_PTR): Use build_{a,}newarray.
- * verify.c (merge_types): Handle known-lengh array types.
-
-Mon Jan 19 13:09:25 1998 Per Bothner <bothner@cygnus.com>
-
- * expr.c (expand_byte_code): Fix performace bug, which caused
- searching linenumber_table to be linear rather than constant.
-
-Fri Dec 12 19:18:42 1997 Per Bothner <bothner@cygnus.com>
-
- * Makefile.in (BISON, BISONFLAGS): Add missing macros.
-
- * decl.c, java-tree.h (soft_fmod_node): New global.
- * decl.c (init_decl_processing): Define __builtin_fmod.
- * expr.c (build_java_binop): Implement TRUNC_MOD_EXPR for REAL_TYPE
- using __builtin_fmod.
-
-Thu Dec 4 13:22:59 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * keyword.h: New file, output of keyword.gperf as processed by
- gperf.
- * lex.c (java_lex_init): Initialize java_error_flag.
- * parse.c (YYERROR_NOW): Uses java_error_flag.
- * parse.y: New static java_error_flag. Useless definition of
- buffer_error gone.
- * parse.y (java_error): Portable error recovery using
- java_error_flag (not yet completely tuned).
-
-1997-12-04 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Makefile.in (parse.c): Use $(srcdir) for parse.y.
-
-Wed Dec 3 18:37:42 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Makefile.in: (JAVA_OBJS): New object jcf-parse.o.
- (parse.c, lex.c, keyword.h): New rules for Java source code
- front-end.
- * parse.c: Renamed into jcf-parse.c.
- * jcf-parse.c (yyparse): Invoke the parser to process Java source code.
- * keyword.gperf: New file, Java keywords.
- * parse.y: New file, Java language grammar.
- * parse.h: New file, Java language grammar definitions.
- * lex.c: New file, Java language lexer.
- * lex.h: New file, Java language lexer definitions.
-
-Wed Dec 3 17:00:17 1997 Per Bothner <bothner@cygnus.com>
-
- * decl.c (clinit_identifier_node), java-tree.h: New global.
- * java-tree.h (IS_METHOD_INIT_P, IS_METHOD_CLINIT_P): Removed.
- * verify.c (verify_jvm_instructions): Inline use of removed macros.
- * expr.c (expand_java_field_op): Check for invalid assignment
- to final field.
-
- * jcf-reader.c (get_attribute): Test for wrong attribute length.
-
-Mon Oct 27 17:46:36 1997 Per Bothner <bothner@cygnus.com>
-
- * verify.c (verify_jvm_instructions): When processing a handler,
- attempt to set the current_subr to the right value.
- (More complicated code combines Sep 17 and Oct 22 versions.)
-
-Fri Oct 24 11:36:54 1997 Per Bothner <bothner@cygnus.com>
-
- * class.c (push_class): Figure out (guess) name of source file.
- * parse.c (set_source_filename): Set DECL_SOURCE_FILE of class decl.
- (give_name_to_class): Don't guess source name; use DECL_SOURCE_FILE.
- (parse_class_file): Change return type from int to void.
- Call debug_start_source_file/debug_end_source_file.
-
- * expr.c (build_java_binop): Fix masking 2nd operand.
- * decl.c (init_decl_processing): Set sizetype first.
-
-Wed Oct 22 19:39:05 1997 Per Bothner <bothner@cygnus.com>
-
- * verify.c (verify_jvm_instructions): Don't set current_subr to NULL.
- (Revert Sep 17 change.)
-
-Tue Oct 21 15:09:02 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.c (process_zip_dir): Skip ZIP entries not bearing the
- .class extension in their name and fix thing so we don't process
- them parse_zip_file_entries().
- (parse_zip_file_entries): Cleaned unused local variables.
-
-Mon Oct 20 14:52:42 1997 Per Bothner <bothner@cygnus.com>
-
- * expr.c (can_widen_reference_to): Allows equal array element types.
- (expand_byte_code): PRE_RET must expand OPERAND_VALUE (to get index).
- * jcf-dump.c (RET): Get (and print) index.
-
- * verify.c (verify_jvm_instructions case OPCODE_anewarray):
- Promote element type to POINTER_TYPE.
-
-Mon Oct 20 13:40:41 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-reader.c, parse.c: (parse_zip_file, process_zip_dir,
- find_in_current_zip, jcf_figure_file_type): Moved from
- jcf-reader.c to parse.c.
- * zextract.c: (read_zip_archive): takes file_comment_length possible
- field into account.
-
-Mon Oct 20 11:45:06 1997 Per Bothner <bothner@cygnus.com>
-
- * verify.c (verify_jvm_instructions): Var can also be promoted to int.
-
- * verify.c (merge_types): Handle array types even better ...
-
-Fri Oct 17 15:56:37 1997 Per Bothner <bothner@cygnus.com>
-
- * expr.c (java_stack_pop): Fix use of NULL_TREE for TYPE_SECOND.
-
- * java-tree.h (PUSH_FIELD): Set DECL_ARTIFICIAL.
- * class.c (make_class_data): Don't build fields_decl if no fields.
- When building fields_decl, skip if DECL_ARTIFICAL.
-
- * expr.c (java_stack_swap): Update stack_type_map.
- * verify.c (merge_types): Handle array types better.
-
-Wed Oct 15 18:09:45 1997 Per Bothner <bothner@cygnus.com>
-
- * class.c (add_field): Don't promote short integral fields to
- int any more (unless JAVA_PROMOTE_TO_INT), since Kaffe doesn't.
- * expr.c (push_value): Promote and convert short integral values.
-
- * decl.c, java-tree.h (integer_two_node): New constant node.
- * verify.c (merge_types): Check for TYPE_RETURN_ADDR.
-
-Wed Oct 15 17:04:50 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (append_gpp_mangled_type): Use function argument
- unpromoted type to generate mangled name.
-
-Mon Oct 13 16:52:55 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * constants.c (build_constant_data_ref): Now uses current_class
- instead of main_class.
- (build_constants_constructor): Now uses current_class instead of
- main_class.
- * zipfile.h: (struct ZipFileCache): Now defined here. Declaration
- of the global variable SeepZipFiles done here.
- * zextract.c (read_zip_archive): extra_field optional field taken
- into account while computing the position of the class file in the
- archive.
- * verify.c (verify_jvm_instructions): Use current_jcf to search
- the constant pool.
- * parse.c (load_class): First search for the class to load in the
- current zip file. Saves current_jcf (restored before returning
- from that function). Don't call JCF_FINISH in the class was found
- in the current ZIP file.
- (jcf_parse): If the class was found in the current ZIP file, save
- its tree_constant_pool (for later reuse).
- (parse_class_file): New function. Process each method defined in
- the current class and record the class as to be later registered.
- (yyparse): Rewritten. Figure the type of the current file and switch
- accordingly.
- * lang.c: New global variable current_jcf.
- (lang_init): Removed compiling_from_source test (done later, in
- yyparse). Removed call the jcf_parse ().
- * jcf.h (JCF_ZIP, JCF_CLASS, JCF_SOURCE): New defined values.
- (typedef struct JCF): New fields seen_in_zip (to mark a class found
- in the current ZIP file) and zip_offset (offset to the class data in
- the current zip file).
- * jcf-reader.c: zipfile.h included.
- localToFile: New ZipFileCache static global variable
- (parse_zip_file_entries): New function. Browse the current ZIP
- file directory and process each class found.
- (process_zip_dir): New function. Register each class found in the
- ZIP file directory. The class aren't parsed but a valid JCF is
- link to each of them.
- (find_in_current_zip): New function. Search for a class in the
- current ZIP file directory. If found, prepare the class so that it
- can be loaded.
- (jcf_figure_file_type): New function. Examine the file structure
- to figure a class file, a ZIP file. If none of these categories are
- matched, a source file is assumed.
- * jcf-io.c: Removed definition of ZipFileCache (moved in zipfile.h).
- SeenZipFile: New global variable.
- (open_in_zip): Use zipmember's length to accelerate the search for
- a member. If zipmember was NULL and zip file successfully read,
- return 0.
- * java-tree.h: New global variable current_jcf declared. Added
- declaration for current_constant_pool_tags, current_constant_pool_data,
- current_constant_pool_length, current_constant_pool_data_ref.
- (struct lang_type): Augmented with two fields. struct JCF *jcf (to
- store the JCF of classes seen in a zip file) and tree *constant_pool
- (to save a loaded class constant pool). current_class declared here.
- * expr.c (expand_invoke): Use current_jcf instead of main_jcf to
- retrieve method_ref_constant.
- (PUSHC): java_push_constant_from_pool now uses current_jcf.
- (OBJECT): get_class_constant now uses current_jcf.
- (ARRAY_NEW_PTR): get_class_constant now uses current_jcf.
- (ARRAY_NEW_MULTI): get_class_constant now uses current_jcf.
- (expand_invoke): Now uses current_class instead of main_class
- (build_class_init): Now uses current_class instead of main_class
- * class.c: New static global variable registered_class.
- (register_class): New function.
- (emit_register_class): Modified to use registered_class instead of
- main_class
- (is_compiled_class): Now take into account class seen in the archive.
-
-Mon Oct 6 12:03:23 1997 Per Bothner <bothner@cygnus.com>
-
- * except.h: Renamed to: java-except.h.
- * parse.c, except.c, expr.c, verify.c: Update #include accordingly.
- * except.c: Add semi-working (commented out) implementation.
-
- * expr.c (expand_iinc): Add needed flush_quick_stack.
- * parse.c (set_source_filename): New function.
- (give_name_to_class): Set input_filename from package.classname.java.
-
- * jcf-io.c (find_class): Don't look first in ".".
-
-Wed Oct 1 11:26:10 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * zextract.c (read_zip_archive): Now takes into account the
- extra_field field.
- * expr.c (can_widen_reference_to): Modified to handle sub-interfaces.
-
-Sat Sep 20 12:44:28 1997 Per Bothner <bothner@cygnus.com>
-
- * constants.c, java-tree.h (build_internal_class_name): New function.
- (alloc_class_constant): Re-implement using build_internal_class_name.
- * class.c (make_class_data): Likewise.
- * class.c (hashUtf8String): Make hash algorithm match String.hashCode.
-
-Wed Sep 17 13:15:23 1997 Per Bothner <bothner@cygnus.com>
-
- * verify.c (verify_jvm_instructions): Temporarily set current_subr
- to NULL before pushing an exception handler target.
-
- * expr.c (flush_quick_stack): Save from low stack indexes to high.
- (java_stack_swap, java_stack_dup): Re-write to be safe from
- clobbering registers.
- (build_class_init): New function.
-
-Wed Sep 17 11:02:41 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * typeck.c (build_java_array_type): Temporary use
- permanent_obstack to create the array 'length' field.
- * expr.c (lookup_label): Temporay use permanent_obstack to create
- label if not found.
- * class.c (push_super_field): Tempory use permanent_obstack.
-
-Mon Sep 15 11:33:31 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * typeck.c (type_for_mode): Now handles double_type_node and
- float_type_node.
- * verify.c (verify_jvm_instructions): The instruction following
- the wide bytecode is checked. OPCODE_ret added to the list of
- wide.
-
-Thu Sep 11 19:45:18 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (make_class): Temporary use permanent_obstack. Set the
- class CLASS_P field to 1.
- (push_class): Temporary use permanent_obstack.
- (set_super_info): Temporary use permanent_obstack.
- (add_method): Temporary use permanent_obstack, set
- METHOD_TRANSIENT().
- (add_field): Temporary use permanent_obstack. Sets
- FIELD_VOLATILE() and FIELD_TRANSIENT().
- (build_class_ref): Temporary use permanent_obstack if the class
- isn't compiled.
- (build_static_field_ref): Temporary use permanent_obstack when
- creating field's rtl.
- (get_access_flags_from_decl): Handle ACC_VOLATILE, ACC_TRANSIENT,
- ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT flags for methods
- and fields. Function finalized, as far as flag handling.
- (push_class_static_dummy_field): Temporary use permanent_obstack.
- (emit_register_class): Force generation of class registration at
- -O3 or deeper.
- * decl.c (end_java_method): Call permanent_allocation() before
- returning.
- * expr.c (can_widen_reference_to): Added comment to interface
- handling, fixed typo.
- (lookup_field): Now uses CLASS_P() to correct FIXME
- (expand_invoke): Verification on public && !static &&
- !abstract moved into soft_lookupinterfacemethod (kaffe).
- Use Object class dtable if objectref is an array when expanding
- invokeinterface.
- (java_push_constant_from_pool): Temporary use permanent_obstack
- for CONSTANT_string
- * parse.c (get_ref_constant): Temporary use permanent_obstack to
- create constant references.
- (get_constant): Temporary use permanent_obstack to create constant.
- (load_class): Temporary use permanent_obstack to load class.
- (jcf_parse): Temporary use permanent_obstack to perform class
- layout.
- * typeck.c: (parse_signature_string): Temporary use permanent_obstack.
- (build_java_signature): Temporary use permanent_obstack.
- * verify.c: (verify_jvm_instruction): removed unecessary verification
- on ACC_SUPER flag.
- * java-tree.h (METHOD_NATIVE, METHOD_TRANSIENT): Defined.
- (FIELD_VOLATILE, FIELD_TRANSIENT): Defined.
- (CLASS_P): Defined
-
-Thu Sep 11 11:57:32 1997 Per Bothner <bothner@cygnus.com>
-
- * class.c (append_gpp_mangled_type): Fix typo.
- (emit_register_class): Use main_class to get class object, rather
- than looking for no-longer-existing static decl starting with _CL.
- * typeck.c (parse_signature_type): Promote array element type
- if it is a RECORD_TYPE.
-
-Wed Sep 10 16:09:23 1997 Per Bothner <bothner@cygnus.com>
-
- * class.c (push_class_static_dummy_field): New function.
- (mangle_static_field): New. Do G++-style mangling of static fields.
- (layout_class): Mandle static fields here, not in add_field.
- (build_class_ref): The class object is now a dummy static field.
- * decl.c (find_local_variable): Look for best, instead of first match.
- * expr.c (push_type): Always promote_type, not just for RECORD_TYPE.
- (build_java_athrow): Don't check here if exception is Throwable.
- * java-tree.h (TYPE_UNSET): Renamed to TYPE_UNKNOWN.
- (TYPE_USED): Removed. No longer used ...
- * parse.c (jcf_parse): Call push_class_static_dummy_field.
- * verify.c (push_pending_label): New function.
- (push_pending_block): Renamed to check_pending_block.
- (merge_types): Remove unneeded suuport for TYPE_UNUSED.
- (verify_jvm_instructions): Only reset prev_eh_ranges (to force
- re-checking possible handlers) after a store (less wasted work).
- Check for null handler (finally) before calling add_handler.
- Various changes to (finally?) correctly handle try/finally.
-
-1997-09-09 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * class.c: Include stdio.h.
-
-Thu Sep 4 21:30:55 1997 Per Bothner <bothner@cygnus.com>
-
- * expr.c (expand_invoke): Use COMPOUND_EXPR (and TREE_SIDE_EFFECTS)
- to make sure class is initialized before static/special invoke.
-
- * verify.c (verify_jvm_instructions): On a store instruction,
- call find_local_variable to force pre-allocation of decl and rtx.
- * decl.c (push_jvm_slot): Set DECL_REGISTER on stack slots.
-
-Wed Sep 3 16:13:23 1997 Per Bothner <bothner@cygnus.com>
-
- * class.c (build_class_ref): Strip off "promoted_" if need be.
- (make_field_value): Call build_java_signature when needed.
- (layout_class): Don't make_function_rtl if METHOD_ABSTRACT.
- * expr.c (build_java_athrow): Don't push_value of exception.
- (build_java_binop): Implement COMPARE_L_EXPR and COMPARE_G_EXPR to
- match specification of [fd]cmp[lg] for NaNs.
- (expand_byte_code): Add support for exception handler ranges.
- * except.c: Add skeleton for EH code-generation.
- * verify.c (merge_types): Treat all promoted integral types as equal.
- * constants.c (build_constants_constructor): To force creation of
- current_constant_pool_data_ref, call build_constant_data_ref.
-
- * javaop.def (lload): Fix typo.
- * jcf-dump.c (main): Clear filename to prevent possibly-bad free.
-
-Tue Sep 2 17:37:25 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.c: Don't include function.h.
-
-Wed Aug 27 18:33:04 1997 Per Bothner <bothner@cygnus.com>
-
- * except.[ch]: New files.
- * Makefile.in (JAVA_OBJS): Add except.o
- * expr.c: Temporary warning about unimplemented exceptions.
- * verify.c: Verify exception handlers.
-
- * jcf-dump.c (disassemble_method): Print exception table.
-
-Wed Aug 27 13:26:58 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (verify_jvm_instructions): Started a thorough
- verification of invoke* bytecodes.
- (expand_byte_code): flush quick stack if PC is the target of a
- branch. and undef RET (conflicting with config/i386/i386.h).
- (expand_java_arrayload): Fixed bogus cast, when Boolean type is
- used.
- (expand_invoke): Now handles invokeinterface and do more
- verification according to the bytecode.
- (lookup_field): Don't try to load the class if processing
- dtable_type.
- (can_widen_reference_to): Now handles interfaces.
- * decl.c (init_decl_processing): New global variable
- soft_lookupinterfacemethod_node, declared in java-tree.h.
- Call set_super_info on string_type_node.
- * java-tree.h (CLASS_INTERFACE, CLASS_ABSTRACT, CLASS_SUPER): Now
- defined.
- * class.c (set_super_info): Fills the CLASS_* flags according to
- access_flags.
- (get_access_flags_from_decl): Handles all class flags.
-
-Tue Aug 26 18:54:34 1997 Per Bothner <bothner@cygnus.com>
-
- * class.c (add_method): Zero out newly-allocated DECL_LANG_SPECIFIC.
- * parse.c (yyparse): Check for abstract method, and missing code.
- * expr.c (expand_byte_code): Change interface.
- * lang.c (put_decl_node): Print promoted types prettier.
- * verify.c (verify_jvm_instruction): Change interface.
- Partial support for scanning exception table.
- For load instructions, handle promoted integral types.
-
-Thu Aug 21 13:48:01 1997 Per Bothner <bothner@cygnus.com>
-
- * verify.c: New file, with contents moved from expr.c.
- * expr.c: Bunch of stuff (mostly verification) moved to verify.c.
- * typeck.c (is_array_type_p): Moved here from expr.c.
- * java-tree.h: Add some now-needed function declarations.
- * Makefile.in (JAVA_OBJS): Added verify.o.
-
-Wed Aug 20 14:34:34 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (add_method): Sets the METHOD_SYNCHRONIZED flag, sets the
- METHOD_ABSTRACT flag.
-
- * java-tree.h (METHOD_SYNCHRONIZED): Set to DECL_LANG_FLAG_4.
- (IS_METHOD_CLINIT_P, IS_METHOD_INIT_P): New macros.
- (METHOD_ABSTRACT): Set to DECL_LANG_FLAG_5
-
- * decl.c (soft_monitorenter_node, soft_monitorexit_node): New global
- variables.
- (start_java_method): Hook for SYNCHRONIZED methods.
-
- * expr.c (build_java_jsr, build_java_ret): New functions
- (JSR,PRE): New macros
- (PRE_TABLE_SWITCH, PRE_LOOKUP_SWITCH): Fixed and secured.
- (verify_jvm_instructions): tableswitch, lookupswitch,
- monitorenter, monitorexit, goto_w: verified.
- (LOOKUP_SWITCH, TABLE_SWITCH): Fixed generation of default: label
- (build_java_monitor): New function.
- (MONITOR_OPERATION): Modified to call build_java_monitor()
- (verify_jvm_instructions): Started a thorough verification of
- invoke* bytecodes.
-
-Tue Aug 19 13:35:49 1997 Per Bothner <bothner@cygnus.com>
-
- Support verification of jsr/ret subroutines (used for try/finally).
- * decl.c (return_address_type_node): New type node.
- * java-tree.h (LABEL_RETURN_LABEL, LABEL_RETURN_TYPE_STATE,
- RETURN_MAP_ADJUSTED, LABEL_RETURN_LABELS, LABEL_IN_SUBR,
- LABEL_SUBR_START, LABEL_SUBR_CONTEXT, BCODE_VERIFIED): New macros.
- (TYPE_UNSET, TYPE_SECOND, TYPE_NULL, TYPE_RETURN_ADDR, TYPE_UNUSED,
- TYPE_USED): New macros for special types in type_map.
-
- * java-tree.h (BCODE_JUMP_TARGET): Renamed to BCODE_TARGET.
- (BCODE_BACKWARDS_TARGET, CODE_FORWARDS_TARGET): Replaced by
- BCODE_JUMP_TARGET.
- * expr.c (expand_byte_code): Fix logic to warn of unused instructions.
-
- * expr.c (can_widen_reference_to): New function.
- (pop_type): Use it.
- (merge_type_state): Support handling start of subroutine.
- (push_pending_block): Return char* error message, instead of calling
- fatal on an error. Also handle subroutines.
- (verify_jvm_instructions): Handle errors from push_poending_block.
- Support jsr and ret instructions.
-
-Tue Aug 19 13:33:36 1997 Per Bothner <bothner@cygnus.com>
-
- * jcf-io.c (find_classfile): Fix thinko.
- * jcf-dump.c: Add CONVERT2 (to match changed javaop.def).
-
-Tue Aug 12 20:14:45 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (BISON): Remove.
-
-Thu Aug 7 23:08:24 1997 Per Bothner <bothner@cygnus.com>
-
- * Makefile.in: Convert to autoconf.
- * config-lang.in (outputs): Added java/Makefile.
-
- * Make-lang.in, lang-specs.h, config-lang.in, Makefile.in:
- Rename cc1java to jc1.
-
- * lang.c (init_parse, finihs_parse): New functions #ifdef USE_CPPLIB.
- * Makefile.in (INTERNAL_CFLAGS): Add @extra_c_flags.
-
- * class.c (class_depth): Do load_class if needed.
-
- Mostly better verification.
- * decl.c (pushdecl): Set TYPE_STUB_DECL for a type.
- (init_decl_processing): Change return type of soft_checkcast.
- * expr.c (expand_java_CHECKCAST): Do push_value of the "casted" value.
- * lang.c (put_decl_string, put_decl_node, lang_printable_name,
- lang_print_error): New functions.
- (lang_init): Set global hook print_error_function to lang_print_error.
- * expr.c: In the type_map ptr_type_node is only used for null now.
- (pop_type, merge_types): Hence ptr_type_node matches any reference.
- (merge_types): Dererence pointer to record types before comparing.
- (decode_newarray_type, merge_types): On error just return NULL.
- (build_java_binop): Add preliminary implementation (with warning)
- for COMPARE_L_EXPR and COMPARE_G_EXPR (i.e. [fd]cmp[lg]).
- (lookup_label): Set DECL_IGNORED_P (for dwarf2out).
- (expand_compare, expand_java_goto, expand_java_call): Don't
- push_pending_block, since that only makes sense when verifying.
- (merge_type_state): Different return codes.
- (push_pending_block): A block may need to be verified more than once.
- (expand_byte_code): Warn about unused code at code generation time.
- (verify_jvm_instruction): Changed logic, since code may need to be
- re-verified if type-state has changed. Also, better error handling.
- Implement acmpeq, acmpne, pop, pop2, swap, checkcast, instanceof.
- Improve newarray, anewarray, ?aload, athrow,
- * java-tree.h (LABEL_CHANGED): New macro.
-
-Tue Aug 5 12:21:27 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (soft_athrow_node): New global variable initialized.
- * javaop.def (i2b, i2c, i2s): Invoke CONVERT2
- * typeck.c (convert): Added support for REAL_TYPE.
- (convert_to_char): New function.
- (convert): Handle CHAR_TYPE.
- * expr.c (expand_java_arraystore): Modified because CHAR/BYTE/BOOLEAN/
- SHORT now expect INT but store as CHAR/BYTE/BOOLEAN/SHORT.
- (expand_java_arrayload): CHAR/BYTE/BOOLEAN/SHORT now convert result to
- promoted type.
- (verify_jvm_instructions): Added break a the end of bogus unop: label.
- (OPCODE_<b|c|s>astore): Pop an int operand from the type stack
- (OPCODE_<b|c|s>astore): Push the promoted type onto the stack
- (process_jvm_instruction): New macro CONVERT2 for i2c, i2s and i2b.
- (JAVA_ARRAY_LENGTH_OFFSET, JAVA_ARRAY_DATA_OFFSET): Modified
- to Use The Right Things.
- (pop_type): Accept CHAR/BYTE/BOOLEAN/SHORT promoted type as
- compatible with INT. BOOLEAN is made equivalent to BYTE.
- (OPCODE_athrow, OPCODE_aconst_null, OPCODE_ifnull,
- OPCODE_ifnonnull): Now supported.
- (build_java_athrow): New function.
-
-Mon Aug 4 15:46:45 1997 Per Bothner <bothner@cygnus.com>
-
- Rename method name <init> to match G++ (and fix mangling).
- * class.c (layout_class): Replace method name of <init> by class name.
- (make_method_value): Do inverse renaming of constructor from <init>.
- * java-tree.h (DECL_CONSTRUCTOR_P): New macro.
- * typeck.c (lookup_java_constructor): New function.
- * expr.c (expand_invoke): If method_name is <init>, call
- lookup_java_constructor to find constructor.
-
- * parse.c (get_constant): Handle CONSTANT_Float and CONSTANT_Double.
-
-Fri Aug 1 11:37:09 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.c (get_class_constant): Modified to handle array "classes"
- * typeck.c (set_local_type): Bug fixed when filling type_map[] with
- wide type.
- (convert): Modified to handle real type.
- * java-tree.h (soft_badarrayindex_node, soft_anewarray_node,
- soft_multianewarray, soft_newarray_node, soft_throw_node): New global
- variables declared.
- * decl.c (soft_badarrayindex_node, soft_anewarray_node,
- soft_multianewarray, soft_newarray_node, soft_throw_node): New
- global variables initialized.
- (find_local_variable): Handles the case of a pointer
- (end_java_method): Restore the use of one more scope
- * expr.c (build_java_arraynull_check, build_java_arrayaccess,
- build_java_array_length_access, expand_java_arrayload,
- expand_java_arraystore, expand_java_array_length,
- expand_java_multianewarray, expand_java_anewarray,
- build_java_check_indexed_type, is_array_type_p,
- build_java_throw_out_of_bound_exception): New functions.
- (STORE_INTERNAL): Now forces type of the decl to be type of the value.
- (OPCODE_arraylength, OPCODE_newarray, OPCODE_<t>astore,
- OPCODE_<t>aload): Implemented code for verification.
- (ARRAY_STORE, ARRAY_LOAD, ARRAY_LENGTH, ARRAY_NEW_PTR, ARRAY_NEW_NUM
- ARRAY_NEW_MULTI): Macro defined.
- (CONVERT): Modified to invoke convert().
- (case OPCODE_aload2): Fixed index typo from 2 to 1.
-
-Thu Jul 31 12:48:18 1997 Per Bothner <bothner@cygnus.com>
-
- * class.c (push_class): Set DECL_ARTIFICIAL (for dbxout.c).
- (build_class_ref, is_compiled_class): Handle pointer-to-record types.
- (make_class_data): Field name needs '/' as package prefix.
- * expr.c (type_stack_dup, java_stack_dup): Fix fencepost errors.
-
-Fri Jul 25 11:44:21 1997 Per Bothner <bothner@cygnus.com>
-
- Implement debug information for local variables.
- * java-tree.h (DECL_CODE_LENGTH, DECL_ARG_SLOT_COUNT,
- DECL_LOCAL_SLOT_NUMBER, DECL_LOCAL_START_PC, DECL_LOCAL_END_PC,
- DECL_LOCAL_SLOT_CHAIN): New macros.
- (struct lang_decl_var): New type.
- * parse.c (give_name_to_locals): Move to decl.c.
- * decl.c (give_name_to_locals): Re-written to Do The Right Thing.
- (start_java_method): Re-write parameter handling.
- (pending_local_decls): New global variable.
- (push_jvm_slot, maybe_pushlevels, maybe_poplevels): New functions.
- (find_local_variable): Accept pc so we can skips decls not in range.
- (struct binding_level): Add end_pc field.
- * expr.c (expand_byte_code): Call maybe_pushlevels and maybe_poplevels.
- (various): Change so current pc gets passed to find_local_variable.
-
- * decl.c (init_decl_processing): Re-arrange fields in
- class_type_node and and method_type_node to match kaffe 0.9.1.
- * class.c (make_method_value, make_class_data): Update
- initializations to match.
-
-Wed Jul 16 17:17:50 1997 Per Bothner <bothner@cygnus.com>
-
- * class.c (unicode_mangling_length, emit_unicode_mangled_name,
- append_gpp_mangled_name, append_gpp_mangled_type): New functions.
- (push_super_field): New function.
- (make_class_data): Handle inheritance of class static initializer.
- (layout_class): New name mangling.
- * constants.c (build_constant_data_ref): Init type of data array
- to a one-element array.
- (build_constants_constructor): Set DECL_SIZE from complete array type.
- * decl.c: Rename class_type, object_type etc to class_type_node,
- object_type_node etc. Make former inherit from latter.
- * expr.c (expand_invoke): Add cast of function address.
- * java-tree.h (TYPE_ARRAY_ELEMENT, PUSH_SUPER_VALUE): New.
- * parse.c (yyparse): Don't call layout_class here.
- * typeck.c (build_java_array_type): Set TYPE_ARRAY_ELEMENT.
-
-Sat Jun 14 12:06:57 1997 Per Bothner <bothner@cygnus.com>
-
- * decl.c, class.c: Update method type to match latest Kaffe snapshot.
- * constants.c (lookup_name_constant): Renamed to alloc_name_constant.
- (alloc_class_constant): New.
- * expr.c (expand_invoke): Make sure method's class is initialized.
- * class.c (interits_from_p, emit_register_class): New functions.
- * parse.c (yyparse): Call emit_register_class.
-
-Mon Jun 9 18:08:06 1997 Per Bothner <bothner@cygnus.com>
-
- * constants.c: New file, to handle constant pool.
- * Makefile.in (JAVA_OBJS): Add constants.o.
- * decl.c (init_decl_processing): Update, fix, finish various structs.
- (pushdecl_top_level): New.
- * parse.c (layout_class): Moved to class.c.
- * expr.c (java_push_constant_from_pool): New function.
- * class.c (build_class_ref): Make work fully
- (make_class_data): Emit super-class, constant pool, interface vector.
-
-Tue Jun 3 10:14:31 1997 Per Bothner <bothner@cygnus.com>
-
- java-tree.h (DECL_SIGNATURE, BCODE_EMITTED): Remove.
- (LABEL_VERIFIED, BCODE_EXCEPTION_TARGET, TYPE_ARRAY_P): New.
- * class.c (class_depth): New function.
- (lookup_named_class): Replaced by new function lookup_class.
- * decl.c (object_type_node, string_type_node): New.
- Remove various types that we no longer need.
- * expr.c (verify_jvm_instructions): New separate verifier pass.
- (push_type, pop_type): New functions for verifier.
- (type_stack_dup, pop_argument_types, merge_types): Likewise.
- (expand_byte_code): Simplify, since we assume already verified.
- (expand_invoke): Now mostly works.
- * javaop.def: Rename ldc1->ldc, ldc2->ldc_w, ldc2w->ldc2_w.
- * lang.c (main_class): Move to parse.c. Don't make_class yet.
- * parse.c: Wait to allocate class object until we know its name.
- (layout_class): Calculate DECL_VINDEX for each virtual method.
- * typeck.c (get_array_type): Rename to ...
- (build_java_array_type): ... and provide working implementation.
- (build_java_signature): New function - build Java signature of type.
- (set_java_signature): New function - cache signature with type.
- (lookup_java_method): New function.
-
-Tue May 6 22:08:24 1997 Per Bothner <bothner@deneb.cygnus.com>
-
- * class.c (ident_subst): Take extra SUFFIX parameter.
- (add_field): Set DECL_ASSEMBLER_NAME of static fields; more.
- (set_constant_value, build_static_field_ref, is_compiled_class): New.
- (build_class_ref): Actually implement.
- * decl.c, java-tree.h: Renamed some xx_type to xx_type_node.
- * decl.c (builtin_function): New.
- (init_decl_processing): Update for current Kaffe. Declare some
- builtin Kaffe functions.
- * expr.c (build_address_of): New.
- (expand_java_NEW, expand_java_INSTANCEOF, expand_java_CHECKCAST):
- Renamed (from expand_java_new etc), and added working implementations.
- (build_field_ref): Now also handle static fields.
- (expand_invoke): Implement invokestatic, and start implement rest.
- * java-opcodes.h: Use javaop.def to avoid duplicated list.
- * javaop.def: Rename invokevirt -> invokevirtual.
- * lang.c (use_handles): Removed.
- * parse.c: Add support for ConstantValue atribute.
- Handle nested loading of a class. (JPOOL_UTF): New.
-
-Tue Mar 11 20:11:05 1997 Per Bothner <bothner@deneb.cygnus.com>
-
- * expr.c (expand_java_pushc): Support #ifndef REAL_ARITHMETIC case.
-
-Thu Feb 27 14:24:29 1997 Per Bothner <bothner@deneb.cygnus.com>
-
- * Make-lang.in (java.install-man): New empty rule.
- * typeck.c (set_local_type): New function.
- * expr.c (STORE_INTERNAL): Call find_local_variable,
- not find_stack_slot. Call set_local_type.
-
-Wed Feb 12 16:11:05 1997 Per Bothner <bothner@kalessin.cygnus.com>
-
- * java-tree.h: Various new macros for constructing RECORD_TYPEs,
- and building RECORD_TYPE CONSTRUCTORs.
- Also support for creating Utf8Const objects from an INDETIFIER_NODE.
-
- * lang.c (use_handles): Change the default to 0.
- * decl.c: Define and build class_type, field_type, utf8const_type.
- * class.c (make_class_data, make_field_value,
- get_access_flags_from_decl, build_class_ref, build_utf8_ref,
- hashUtf8String, strLengthUtf8, mangled_classname:
- Functions to build reflective data structures.
- * parse.c (yyparse): Call make_class_data.
-
- * jcf-io.c (open_class, find_classfile): New functions.
- * jcf-dump.c: Support reading classfile from explicitly-named
- class file (without CLASSPATH searching).
-
-Thu Oct 24 14:10:16 1996 Per Bothner <bothner@deneb.cygnus.com>
-
- * jcf-reader.c: Add parameter list to HANDLE_CONSTANT_Utf8.
- * parse.c (JPOOL_UTF_LENGTH, JPOOL_UTF_DATA, HANDLE_CONSTANT_Utf8):
- Override jcf-reader macros so CONSTANT_Utf8 becomes tree node here.
- (get_constant): Now trivial for CONSTANT_Utf8.
-
- * jcf.h: Make NEW_CPOOL the default.
- * jcf.h, jcf-reader.c, parse.c: Remove support for !NEW_CPOOL.
-
-Thu Oct 24 13:52:45 1996 Per Bothner <bothner@deneb.cygnus.com>
-
- New directory.
diff --git a/gnu/dist/toolchain/gcc/java/Make-lang.in b/gnu/dist/toolchain/gcc/java/Make-lang.in
deleted file mode 100644
index 39397f267fc..00000000000
--- a/gnu/dist/toolchain/gcc/java/Make-lang.in
+++ /dev/null
@@ -1,209 +0,0 @@
-# Top level makefile fragment for the GNU compiler for the Java(TM)
-# language.
-# Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
-
-#This file is part of GNU CC.
-
-#GNU CC is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2, or (at your option)
-#any later version.
-
-#GNU CC is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with GNU CC; see the file COPYING. If not, write to
-#the Free Software Foundation, 59 Temple Place - Suite 330,
-#Boston, MA 02111-1307, USA.
-
-#Java and all Java-based marks are trademarks or registered trademarks
-#of Sun Microsystems, Inc. in the United States and other countries.
-#The Free Software Foundation is independent of Sun Microsystems, Inc.
-
-# This file provides the language dependent support in the main Makefile.
-# Each language makefile fragment must provide the following targets:
-#
-# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
-# foo.info, foo.dvi,
-# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
-# foo.uninstall, foo.distdir,
-# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
-# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
-#
-# where `foo' is the name of the language.
-#
-# It should also provide rules for:
-#
-# - making any compiler driver (eg: g++)
-# - the compiler proper (eg: jc1)
-# - define the names for selecting the language in LANGUAGES.
-#
-# Extra flags to pass to recursive makes.
-JAVA_FLAGS_TO_PASS = \
- "JAVA_FOR_BUILD=$(JAVA_FOR_BUILD)" \
- "JAVAFLAGS=$(JAVAFLAGS)" \
- "JAVA_FOR_TARGET=$(JAVA_FOR_TARGET)"
-
-# Actual names to use when installing a native compiler.
-JAVA_INSTALL_NAME = `t='$(program_transform_name)'; echo gcj | sed $$t`
-
-# Actual names to use when installing a cross-compiler.
-JAVA_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcj | sed $$t`
-
-#
-GCJ = gcj
-
-# Define the names for selecting java in LANGUAGES.
-java: jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext)
-
-# Define the name of target independant tools to be installed in $(bindir)
-# Names are subject to changes
-JAVA_TARGET_INDEPENDENT_BIN_TOOLS = gcjh jv-scan jcf-dump
-
-# Tell GNU make to ignore these if they exist.
-.PHONY: java
-
-# Remember to keep this list in sync with JAVA_OBJS in Makefile.in!!!
-#
-JAVA_SRCS = $(srcdir)/java/parse.y $(srcdir)/java/class.c \
- $(srcdir)/java/decl.c $(srcdir)/java/expr.c $(srcdir)/java/constants.c \
- $(srcdir)/java/lang.c $(srcdir)/java/typeck.c $(srcdir)/java/except.c \
- $(srcdir)/java/verify.c $(srcdir)/java/zextract.c $(srcdir)/java/jcf-io.c \
- $(srcdir)/java/jcf-parse.c $(srcdir)/java/mangle.c \
- $(srcdir)/java/jcf-write.c $(srcdir)/java/buffer.c \
- $(srcdir)/java/check-init.c \
- $(srcdir)/java/jcf-depend.c $(srcdir)/java/jcf-path.c
-
-jc1$(exeext): $(P) $(JAVA_SRCS) $(LIBDEPS) stamp-objlist
- cd java; $(MAKE) $(FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jc1$(exeext)
-
-jvspec.o: $(srcdir)/java/jvspec.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
- $(INCLUDES) $(srcdir)/java/jvspec.c
-
-# Create the compiler driver for $(GCJ).
-$(GCJ)$(exeext): gcc.o jvspec.o version.o \
- prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o jvspec.o prefix.o intl.o \
- version.o $(EXTRA_GCC_OBJS) $(LIBS)
-
-# Create a version of the $(GCJ) driver which calls the cross-compiler.
-$(GCJ)-cross$(exeext): $(GCJ)$(exeext)
- -rm -f $(GCJ)-cross$(exeext)
- cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)
-
-# Dependencies here must be kept in sync with dependencies in Makefile.in.
-jvgenmain$(exeext): $(srcdir)/java/jvgenmain.c $(srcdir)/java/mangle.c \
- $(OBSTACK) $(LIBDEPS) $(TREE_H)
- cd java && $(MAKE) $(FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jvgenmain$(exeext)
-
-# This must be kept in sync with dependencies in Makefile.in.
-GCJH_SOURCES = $(srcdir)/java/gjavah.c $(srcdir)/java/jcf-io.c \
- $(srcdir)/java/zextract.c $(srcdir)/java/jcf-reader.c \
- $(srcdir)/java/jcf.h $(srcdir)/java/javaop.h \
- $(srcdir)/java/javaop.def $(srcdir)/java/jcf-depend.c \
- $(srcdir)/java/jcf-path.c
-
-gcjh$(exeext): $(GCJH_SOURCES) $(LIBDEPS) $(TREE_H)
- cd java && $(MAKE) $(FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../gcjh$(exeext)
-
-# This must be kept in sync with dependencies in Makefile.in.
-JV_SCAN_SOURCES = $(srcdir)/java/parse-scan.y $(srcdir)/java/lex.c \
- $(srcdir)/java/parse.h $(srcdir)/java/lex.h $(srcdir)/java/jv-scan.c $(srcdir)/../libiberty/xmalloc.c $(srcdir)/../libiberty/xstrdup.c
-
-jv-scan$(exeext): $(JV_SCAN_SOURCES) stamp-objlist $(LIBDEPS)
- cd java && $(MAKE) $(FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jv-scan$(exeext)
-
-# This must be kept in sync with dependencies in Makefile.in.
-JCF_DUMP_SOURCES = $(srcdir)/java/jcf-dump.c $(srcdir)/java/jcf-io.c \
- $(srcdir)/java/zextract.c $(srcdir)/../libiberty/memmove.c $(TREE_H)
-
-jcf-dump$(exeext): $(JCF_DUMP_SOURCES)
- cd java && $(MAKE) $(FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jcf-dump$(exeext)
-
-#
-# Build hooks:
-
-java.all.build: $(GCJ)$(exeext)
-java.all.cross: $(GCJ)-cross$(exeext)
-java.start.encap: $(GCJ)$(exeext)
-java.rest.encap:
-
-java.info:
-
-# Install hooks:
-# jc1, gcj, jvgenmain, and gcjh are installed elsewhere as part
-# of $(COMPILERS).
-
-# Nothing to do here.
-java.install-normal:
-
-java.install-common:
- -if [ -f $(GCJ)$(exeext) ]; then \
- if [ -f $(GCJ)-cross$(exeext) ]; then \
- rm -f $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
- $(INSTALL_PROGRAM) $(GCJ)-cross$(exeext) $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
- chmod a+x $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
- else \
- rm -f $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- chmod a+x $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- fi ; \
- fi ; \
- for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
- if [ -f $$tool$(exeext) ]; then \
- rm -f $(bindir)/$$tool$(exeext); \
- $(INSTALL_PROGRAM) $$tool$(exeext) $(bindir)/$$tool$(exeext); \
- chmod a+x $(bindir)/$$tool$(exeext); \
- fi ; \
- done
-
-java.install-man:
-
-java.uninstall:
- -rm -rf $(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
- -rm -rf $(bindir)/$(JAVA_CROSS_NAME)$(exeext)
-
-java.install-info:
-
-#
-# Clean hooks:
-# A lot of the ancillary files are deleted by the main makefile.
-# We just have to delete files specific to us.
-
-java.mostlyclean:
- -rm -f java/*$(objext) $(DEMANGLER_PROG)
-java.clean:
-java.distclean:
- -rm -f java/config.status java/Makefile
- -rm -f java/parse.output
-java.extraclean:
-java.maintainer-clean:
- -rm -f java/parse.c java/parse-scan.c java/parse.output java/y.tab.c
-#
-# Stage hooks:
-# The main makefile has already created stage?/java.
-
-java.stage1: stage1-start
- -mv java/*$(objext) stage1/java
-java.stage2: stage2-start
- -mv java/*$(objext) stage2/java
-java.stage3: stage3-start
- -mv java/*$(objext) stage3/java
-java.stage4: stage4-start
- -mv java/*$(objext) stage4/java
-#
-# Maintenance hooks:
-
-# This target creates the files that can be rebuilt, but go in the
-# distribution anyway. It then copies the files to the distdir directory.
-java.distdir:
- mkdir tmp/java
- cd java ; $(MAKE) $(FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) parse.c hash.h
- cd java; \
- for file in *[0-9a-zA-Z+]; do \
- ln $$file ../tmp/java >/dev/null 2>&1 || cp $$file ../tmp/java; \
- done
diff --git a/gnu/dist/toolchain/gcc/java/Makefile.in b/gnu/dist/toolchain/gcc/java/Makefile.in
deleted file mode 100644
index 90f45fdde56..00000000000
--- a/gnu/dist/toolchain/gcc/java/Makefile.in
+++ /dev/null
@@ -1,321 +0,0 @@
-# Makefile for GNU compiler for the Java(TM) language.
-# Copyright (C) 1987, 88, 90-5, 1998, 1999 Free Software Foundation, Inc.
-
-#This file is part of GNU CC.
-
-#GNU CC is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2, or (at your option)
-#any later version.
-
-#GNU CC is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with GNU CC; see the file COPYING. If not, write to
-#the Free Software Foundation, 59 Temple Place - Suite 330,
-#Boston, MA 02111-1307, USA.
-
-#Java and all Java-based marks are trademarks or registered trademarks
-#of Sun Microsystems, Inc. in the United States and other countries.
-#The Free Software Foundation is independent of Sun Microsystems, Inc.
-
-# The makefile built from this file lives in the language subdirectory.
-# Its purpose is to provide support for:
-#
-# 1) recursion where necessary, and only then (building .o's), and
-# 2) building and debugging cc1 from the language subdirectory, and
-# 3) nothing else.
-#
-# The parent makefile handles all other chores, with help from the
-# language makefile fragment, of course.
-#
-# The targets for external use are:
-# all, TAGS, ???mostlyclean, ???clean.
-
-# Suppress smart makes who think they know how to automake Yacc files
-.y.c:
-
-# Variables that exist for you to override.
-# See below for how to change them for certain systems.
-
-ALLOCA =
-
-# Various ways of specifying flags for compilations:
-# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
-# BOOT_CFLAGS is the value of CFLAGS to pass
-# to the stage2 and stage3 compilations
-# XCFLAGS is used for most compilations but not when using the GCC just built.
-XCFLAGS =
-CFLAGS = -g
-BOOT_CFLAGS = -O $(CFLAGS)
-# These exists to be overridden by the x-* and t-* files, respectively.
-X_CFLAGS =
-T_CFLAGS =
-
-X_CPPFLAGS =
-T_CPPFLAGS =
-
-CC = @CC@
-SET_BISON = here=`pwd`; sdir=`cd $(srcdir) && pwd`; if test -f ../../bison; then bison="$$here/../../bison/bison -L $$sdir"; else bison=bison; fi
-BISONFLAGS =
-JAVABISONFLAGS = --name-prefix=java_
-AR = ar
-AR_FLAGS = rc
-SHELL = /bin/sh
-MAKEINFO = makeinfo
-TEXI2DVI = texi2dvi
-
-# Define this as & to perform parallel make on a Sequent.
-# Note that this has some bugs, and it seems currently necessary
-# to compile all the gen* files first by hand to avoid erroneous results.
-P =
-
-# This is used in the definition of SUBDIR_USE_ALLOCA.
-# ??? Perhaps it would be better if it just looked for *gcc*.
-OLDCC = cc
-
-# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
-# It omits XCFLAGS, and specifies -B./.
-# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
-GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)
-
-# Tools to use when building a cross-compiler.
-# These are used because `configure' appends `cross-make'
-# to the makefile when making a cross-compiler.
-
-# We don't use cross-make. Instead we use the tools
-# from the build tree, if they are available.
-# program_transform_name and objdir are set by configure.in.
-program_transform_name =
-objdir = .
-
-#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
-#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
-
-# Directory where sources are, from where we are.
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-# Directory holding libgcj.zip.
-prefix = @prefix@
-datadir = @datadir@
-libgcj_zip = $(datadir)/libgcj.zip
-
-# Additional system libraries to link with.
-CLIB=
-
-# Change this to a null string if obstacks are installed in the
-# system library.
-OBSTACK=obstack.o
-
-# Choose the real default target.
-ALL=all
-
-# End of variables for you to override.
-
-# Definition of `all' is here so that new rules inserted by sed
-# do not specify the default target.
-all: all.indirect
-
-# This tells GNU Make version 3 not to put all variables in the environment.
-.NOEXPORT:
-
-# sed inserts variable overrides after the following line.
-####target overrides
-@target_overrides@
-####host overrides
-@host_overrides@
-####cross overrides
-@cross_overrides@
-####build overrides
-@build_overrides@
-####site overrides
-#
-# Now figure out from those variables how to compile and link.
-
-all.indirect: Makefile ../jc1$(exeext) ../jcf-dump$(exeext) \
- ../jvgenmain$(exeext) ../gcjh$(exeext) ../jv-scan$(exeext)
-
-# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
-INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@
-
-# This is the variable actually used when we compile.
-ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
-
-# Likewise.
-ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
-
-SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi`
-SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac`
-SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi`
-
-# How to link with both our special library facilities
-# and the system's installed libraries.
-LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) $(CLIB)
-
-# Specify the directories to be searched for header files.
-# Both . and srcdir are used, in that order,
-# so that tm.h and config.h will be found in the compilation
-# subdirectory rather than in the source directory.
-INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)/../../include
-
-# Always use -I$(srcdir)/config when compiling.
-.c.o:
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-
-#
-# Lists of files for various purposes.
-
-# Language-specific object files for Gcc/Java:
-
-# Remember to keep this list in sync with JAVA_SRCS in Make-lang.in!!!
-#
-JAVA_OBJS = parse.o class.o decl.o expr.o constants.o lang.o typeck.o \
- except.o verify.o zextract.o jcf-io.o jcf-parse.o mangle.o jcf-write.o \
- buffer.o check-init.o jcf-depend.o jcf-path.o xref.o
-
-JAVA_OBJS_LITE = parse-scan.o jv-scan.o
-
-LIBS = ../../libiberty/libiberty.a
-LIBDEPS = $(LIBS)
-
-# Language-independent object files.
-OBJS = `cat ../stamp-objlist`
-OBJDEPS = ../stamp-objlist
-
-compiler: ../jc1$(exeext) ../jv-scan$(exeext)
-../jc1$(exeext): $(P) $(JAVA_OBJS) $(OBJDEPS) $(LIBDEPS)
- rm -f ../jc1$(exeext)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- $(JAVA_OBJS) $(OBJS) $(SUBDIR_OBSTACK) $(LIBS)
-../jv-scan$(exeext): $(P) $(JAVA_OBJS_LITE) $(OBJDEPS) $(LIBDEPS)
- rm -f ../jv-scan$(exeext)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- $(JAVA_OBJS_LITE) $(SUBDIR_OBSTACK) $(LIBS)
-
-../jcf-dump$(exeext): jcf-dump.o jcf-io.o jcf-depend.o jcf-path.o \
- zextract.o
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ jcf-dump.o jcf-io.o \
- jcf-depend.o jcf-path.o zextract.o $(LIBS)
-
-# Dependencies here must be kept in sync with dependencies in Make-lang.in.
-../jvgenmain$(exeext): jvgenmain.o mangle.o $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ jvgenmain.o mangle.o ../obstack.o $(LIBS)
-
-../gcjh$(exeext): gjavah.o jcf-io.o jcf-depend.o jcf-path.o \
- zextract.o $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gjavah.o jcf-io.o \
- jcf-depend.o jcf-path.o zextract.o $(LIBS)
-
-Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
- cd ..; $(SHELL) config.status
-
-native: config.status ../jc1$(exeext)
-#
-# Compiling object files from source files.
-TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
- $(srcdir)/../machmode.h $(srcdir)/../machmode.def ../tree-check.h
-JAVA_TREE_H = $(TREE_H) java-tree.h java-tree.def
-RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
- $(srcdir)/../machmode.h $(srcdir)/../machmode.def ../genrtl.h
-EXPR_H = $(srcdir)/../expr.h ../insn-codes.h
-
-# Separating PARSE_DIR from PARSE_RELDIR lets us easily change the
-# code to support building parse.c in the build directory, at some
-# expense in readability.
-PARSE_DIR = $(srcdir)
-PARSE_RELDIR = .
-PARSE_C = $(PARSE_DIR)/parse.c
-PARSE_SCAN_C = $(PARSE_DIR)/parse-scan.c
-PARSE_H = $(srcdir)/parse.h
-
-$(PARSE_C): $(srcdir)/parse.y $(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h
- $(SET_BISON); \
- cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
- -o parse.c $(PARSE_RELDIR)/parse.y
-$(PARSE_SCAN_C): $(srcdir)/parse-scan.y $(srcdir)/lex.c $(PARSE_H) \
- $(srcdir)/lex.h
- $(SET_BISON); \
- cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) -o parse-scan.c \
- $(PARSE_RELDIR)/parse-scan.y
-
-lex.c: keyword.h lex.h
-
-lang.o: $(srcdir)/java-tree.def
-
-keyword.h: keyword.gperf
- gperf -L C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,3,$$ \
- keyword.gperf > keyword.h
-
-jcf-path.o : jcf-path.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DLIBGCJ_ZIP_FILE='"$(libgcj_zip)"' $(srcdir)/jcf-path.c
-
-# These exist for maintenance purposes.
-
-# Update the tags table.
-TAGS: force
- cd $(srcdir) ; \
- etags *.c *.h ; \
- echo 'l' | tr 'l' '\f' >> TAGS ; \
- echo 'parse.y,0' >> TAGS ; \
- etags -a ../*.h ../*.c;
-
-.PHONY: TAGS
-
-mostlyclean:
- rm -f *.o
-
-clean: mostlyclean
-
-force:
-
-parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h
-jcf-dump.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) jcf-dump.c \
- jcf-reader.c jcf.h javaop.h javaop.def
-gjavah.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) gjavah.c \
- jcf-reader.c jcf.h javaop.h
-buffer.o : buffer.c $(CONFIG_H) buffer.h $(srcdir)/../gansidecl.h \
- $(srcdir)/../system.h $(srcdir)/../toplev.h
-check-init.o : check-init.c $(CONFIG_H) $(srcdir)/../gansidecl.h \
- $(srcdir)/../../include/libiberty.h $(JAVA_TREE_H) \
- $(srcdir)/../system.h $(srcdir)/../toplev.h
-class.o : class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) jcf.h $(PARSE_H) \
- $(srcdir)/../gansidecl.h $(srcdir)/../toplev.h $(srcdir)/../system.h \
- $(srcdir)/../output.h
-constants.o : constants.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
- $(srcdir)/../toplev.h $(srcdir)/../system.h
-decl.o : decl.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
- $(srcdir)/../toplev.h $(srcdir)/../system.h
-except.o : except.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
- $(RTL_H) javaop.h java-opcodes.h $(srcdir)/../except.h java-except.h \
- $(srcdir)/../eh-common.h $(srcdir)/../toplev.h $(srcdir)/../system.h
-expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
- $(RTL_H) $(EXPR_H) javaop.h java-opcodes.h $(srcdir)/../except.h \
- java-except.h java-except.h parse.h $(srcdir)/../toplev.h \
- $(srcdir)/../system.h
-jcf-depend.o : jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
-jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H)
-jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \
- $(srcdir)/../input.h java-except.h $(srcdir)/../system.h \
- $(srcdir)/../toplev.h $(PARSE_H)
-jcf-write.o : jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(RTL_H) \
- java-opcodes.h parse.h buffer.h $(srcdir)/../system.h $(srcdir)/../toplev.h
-jv-scan.o : jv-scan.c $(CONFIG_H) $(srcdir)/../system.h
-jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h
-lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
- $(srcdir)/../toplev.h $(srcdir)/../system.h
-mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \
- $(srcdir)/../toplev.h
-parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
-typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
- $(srcdir)/../toplev.h $(srcdir)/../system.h
-verify.o : verify.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h javaop.h java-opcodes.h \
- java-except.h $(srcdir)/../toplev.h $(srcdir)/../system.h
-xref.o : xref.h $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../toplev.h \
- $(srcdir)/../system.h
-zextract.o : zextract.c $(CONFIG_H) $(srcdir)/../system.h zipfile.h
-
diff --git a/gnu/dist/toolchain/gcc/java/buffer.c b/gnu/dist/toolchain/gcc/java/buffer.c
deleted file mode 100644
index 67dad18a5dc..00000000000
--- a/gnu/dist/toolchain/gcc/java/buffer.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* A "buffer" utility type.
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, July 1998. */
-
-#include "config.h"
-#include "system.h"
-#include "gansidecl.h"
-#include "buffer.h"
-
-/* Grow BUFP so there is room for at least SIZE more bytes. */
-
-void
-buffer_grow (bufp, size)
- struct buffer *bufp;
- int size;
-{
- if (bufp->limit - bufp->ptr >= size)
- return;
- if (bufp->data == 0)
- {
- if (size < 120)
- size = 120;
- bufp->data = (unsigned char*) xmalloc (size);
- bufp->ptr = bufp->data;
- }
- else
- {
- int index = bufp->ptr - bufp->data;
- size += 2 * (bufp->limit - bufp->data);
- bufp->data = (unsigned char *) xrealloc (bufp->data, size);
- bufp->ptr = bufp->data + index;
- }
- bufp->limit = bufp->data + size;
-}
diff --git a/gnu/dist/toolchain/gcc/java/buffer.h b/gnu/dist/toolchain/gcc/java/buffer.h
deleted file mode 100644
index 924f6e0f276..00000000000
--- a/gnu/dist/toolchain/gcc/java/buffer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* A "buffer" utility type.
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, July 1998. */
-
-/* A simple data structure for an expandable buffer. */
-
-struct buffer
-{
- /* The start of the actual data buffer. */
- unsigned char *data;
-
- /* Where to write next in the buffer. */
- unsigned char *ptr;
-
- /* The end of the allocated data buffer. */
- unsigned char *limit;
-};
-
-#define NULL_BUFFER { (void*) 0, (void*) 0, (void*) 0 }
-
-#define BUFFER_INIT(BUFP) \
- ((BUFP)->data = NULL, (BUFP)->ptr = NULL, (BUFP)->limit = NULL)
-
-#define BUFFER_LENGTH(BUFP) ((BUFP)->ptr - (BUFP)->data)
-
-#define BUFFER_RESET(BUFP) ((BUFP)->ptr = (BUFP)->data)
-
-extern void buffer_grow PROTO ((struct buffer*, int));
diff --git a/gnu/dist/toolchain/gcc/java/check-init.c b/gnu/dist/toolchain/gcc/java/check-init.c
deleted file mode 100644
index 67e2524cf9b..00000000000
--- a/gnu/dist/toolchain/gcc/java/check-init.c
+++ /dev/null
@@ -1,715 +0,0 @@
-/* Code to test for "definitive assignment".
-
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, January 1999. */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "toplev.h" /* Needed for fatal. */
-
-/* The basic idea is that we assign each local variable declaration
- an index, and then we pass around bitstrings, where the i'th bit
- is set if decl whose DECL_BIT_INDEX is i is definitely assigned. */
-
-/* One segment of a bitstring. */
-typedef unsigned int word;
-
-/* Pointer to a bitstring. */
-typedef word *words;
-
-/* For a local VAR_DECL, holds the index into a words bitstring that
- specifies if this decl is definitively assigned.
- A DECL_BIT_INDEX of -1 means we no longer care. */
-#define DECL_BIT_INDEX(DECL) DECL_FIELD_SIZE(DECL)
-
-/* Number of locals variables currently active. */
-int num_current_locals = 0;
-
-/* The index of the first local variable in the current block.
-
- The variables whose DECL_BIT_INDEX are in the range from
- start_current_locals (inclusive) up to num_current_locals (exclusive)
- are declared in the "current" block. If there is a loop or branch
- form, we set start_current_locals to num_current_locals to indicate
- there is no current block.
-
- The point is that if a variable in the current block is set,
- there are no other control paths that we have to worry about.
- Hence, we can remove it from the set of variables we are
- checking, making its bit index available for some other variable.
- For simplicity, we only do that if the variable's bit index
- is (num_current_locals-1); freeing up its bit index is then
- just a simple matter of decrementing num_current_locals.
- The reason this is worth doing is that it is simple, and
- allows us to use short (usually one-word) bit-strings,
- even for methods with thousands of local variables, as
- long as most of them are initialized immediately after or in
- their declaration. */
-int start_current_locals = 0;
-
-int num_current_words = 1;
-
-static tree wfl;
-
-#define COPYN(DST, SRC, NWORDS) memcpy (DST, SRC, NWORDS * sizeof(word))
-#define COPY(DST, SRC) COPYN (DST, SRC, num_current_words)
-
-#define SET_ALL(DST) memset (DST, ~0, num_current_words * sizeof(word))
-#define CLEAR_ALL(DST) memset (DST, 0, num_current_words * sizeof(word))
-
-#define INTERSECTN(DST, SRC1, SRC2, N) \
- do { int n = N; \
- while (--n >= 0) DST[n] = SRC1[n] & SRC2[n]; \
- } while (0)
-
-#define UNION(DST, SRC1, SRC2) \
- UNIONN (DST, SRC1, SRC2, num_current_words)
-
-#define UNIONN(DST, SRC1, SRC2, N) \
- do { int n = N; \
- while (--n >= 0) DST[n] = SRC1[n] | SRC2[n]; \
- } while (0)
-
-#define INTERSECT(DST, SRC1, SRC2) \
- INTERSECTN (DST, SRC1, SRC2, num_current_words)
-
-#define WORD_SIZE ((unsigned int)(sizeof(word) * 8))
-
-static void check_bool_init PROTO ((tree, words, words, words));
-static void check_init PROTO ((tree, words));
-static void check_cond_init PROTO ((tree, tree, tree, words, words, words));
-
-#if 0
-#define ALLOC_WORDS(NUM) ((word*) xmalloc ((NUM) * sizeof (word)))
-#define FREE_WORDS(PTR) (free (PTR))
-#else
-#define ALLOC_WORDS(NUM) ((word*)alloca ((NUM) * sizeof (word)))
-#define FREE_WORDS(PTR) ((void)0)
-#endif
-
-#define SET_P(WORDS, BIT) \
- (WORDS[BIT / WORD_SIZE] & (1 << (BIT % WORD_SIZE)))
-
-#define CLEAR_BIT(WORDS, BIT) \
- (WORDS[BIT / WORD_SIZE] &= ~ (1 << (BIT % WORD_SIZE)))
-
-#define SET_BIT(WORDS, BIT) \
- (WORDS[BIT / WORD_SIZE] |= (1 << (BIT % WORD_SIZE)))
-
-#define WORDS_NEEDED(BITS) (((BITS)+(WORD_SIZE-1))/(WORD_SIZE))
-
-/* Check a conditional form (TEST_EXP ? THEN_EXP : ELSE_EXP) for
- definite assignment.
- BEFORE, WHEN_FALSE, and WHEN_TRUE are as in check_bool_init. */
-
-static void
-check_cond_init (test_exp, then_exp, else_exp,
- before, when_false, when_true)
- tree test_exp, then_exp, else_exp;
- words before, when_false, when_true;
-{
- words tmp = ALLOC_WORDS (6 * num_current_words);
- words test_false = tmp;
- words test_true = tmp + num_current_words;
- words then_false = tmp + 2 * num_current_words;
- words then_true = tmp + 3 * num_current_words;
- words else_false = tmp + 4 * num_current_words;
- words else_true = tmp + 5 * num_current_words;
- check_bool_init (test_exp, before, test_false, test_true);
- check_bool_init (then_exp, test_true, then_false, then_true);
- check_bool_init (else_exp, test_false, else_false, else_true);
- INTERSECT (when_false, then_false, else_false);
- INTERSECT (when_true, then_true, else_true);
- FREE_WORDS (tmp);
-}
-
-/* Check a boolean binary form CODE (EXP0, EXP1),
- where CODE is one of EQ_EXPR, BIT_AND_EXPR, or BIT_IOR_EXPR.
- BEFORE, WHEN_FALSE, and WHEN_TRUE are as in check_bool_init. */
-
-static void
-check_bool2_init (code, exp0, exp1, before, when_false, when_true)
- enum tree_code code; tree exp0, exp1;
- words before, when_false, when_true;
-{
- word buf[4];
- words tmp = num_current_words <= 1 ? buf
- : ALLOC_WORDS (4 * num_current_words);
- words when_false_0 = tmp;
- words when_false_1 = tmp+num_current_words;
- words when_true_0 = tmp+2*num_current_words;
- words when_true_1 = tmp+3*num_current_words;
- check_bool_init (exp0, before, when_false_0, when_true_0);
- INTERSECT (before, when_false_0, when_true_0);
- check_bool_init (exp1, before, when_false_1, when_true_1);
-
- INTERSECT (before, when_false_1, when_true_1);
-
- if (code == EQ_EXPR)
- {
- /* Now set:
- * when_true = (when_false_1 INTERSECTION when_true_1)
- * UNION (when_true_0 INTERSECTION when_false_1)
- * UNION (when_false_0 INTERSECTION when_true_1);
- * using when_false and before as temporary working areas. */
- INTERSECT (when_true, when_true_0, when_false_1);
- INTERSECT (when_false, when_true_0, when_false_1);
- UNION (when_true, when_true, when_false);
- UNION (when_true, when_true, before);
-
- /* Now set:
- * when_false = (when_false_1 INTERSECTION when_true_1)
- * UNION (when_true_0 INTERSECTION when_true_1)
- * UNION (when_false_0 INTERSECTION when_false_1);
- * using before as a temporary working area. */
- INTERSECT (when_false, when_true_0, when_true_1);
- UNION (when_false, when_false, before);
- INTERSECT (before, when_false_0, when_false_1);
- UNION (when_false, when_false, before);
- }
- else if (code == BIT_AND_EXPR || code == TRUTH_AND_EXPR)
- {
- UNION (when_true, when_true_0, when_true_1);
- INTERSECT (when_false, when_false_0, when_false_1);
- UNION (when_false, when_false, before);
- }
- else /* if (code == BIT_IOR_EXPR || code == TRUTH_OR_EXPR) */
- {
- UNION (when_false, when_false_0, when_false_1);
- INTERSECT (when_true, when_true_0, when_true_1);
- UNION (when_true, when_true, before);
- }
-
- if (tmp != buf)
- FREE_WORDS (tmp);
-}
-
-/* Check a boolean expression EXP for definite assignment.
- BEFORE is the set of variables definitely assigned before the conditional.
- (This bitstring may be modified arbitrarily in this function.)
- On output, WHEN_FALSE is the set of variables definitely assigned after
- the conditional when the conditional is false.
- On output, WHEN_TRUE is the set of variables definitely assigned after
- the conditional when the conditional is true.
- (WHEN_FALSE and WHEN_TRUE are overwriten with initial values ignored.)
- (None of BEFORE, WHEN_FALSE, or WHEN_TRUE can overlap, as they may
- be used as temporary working areas. */
-
-static void
-check_bool_init (exp, before, when_false, when_true)
- tree exp;
- words before, when_false, when_true;
-{
- switch (TREE_CODE (exp))
- {
- case COND_EXPR:
- check_cond_init (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1),
- TREE_OPERAND (exp, 2),
- before, when_false, when_true);
- return;
-
- case TRUTH_ANDIF_EXPR:
- check_cond_init (TREE_OPERAND (exp, 0),
- TREE_OPERAND (exp, 1), boolean_false_node,
- before, when_false, when_true);
- return;
- case TRUTH_ORIF_EXPR:
- check_cond_init (TREE_OPERAND (exp, 0),
- boolean_true_node, TREE_OPERAND (exp, 1),
- before, when_false, when_true);
- return;
- case TRUTH_NOT_EXPR:
- check_bool_init (TREE_OPERAND (exp, 0), before, when_true, when_false);
- return;
- case MODIFY_EXPR:
- {
- tree tmp = TREE_OPERAND (exp, 0);
- if (TREE_CODE (tmp) == VAR_DECL && ! FIELD_STATIC (tmp))
- {
- int index;
- check_bool_init (TREE_OPERAND (exp, 1), before,
- when_false, when_true);
- index = DECL_BIT_INDEX (tmp);
- if (index >= 0)
- {
- SET_BIT (when_false, index);
- SET_BIT (when_true, index);
- }
- break;
- }
- }
- goto do_default;
-
- case BIT_AND_EXPR:
- case BIT_IOR_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case EQ_EXPR:
- check_bool2_init (TREE_CODE (exp),
- TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1),
- before, when_false, when_true);
- return;
-
- case TRUTH_XOR_EXPR:
- case BIT_XOR_EXPR:
- case NE_EXPR:
- /* Just like EQ_EXPR, but switch when_true and when_false. */
- check_bool2_init (EQ_EXPR, TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1),
- before, when_true, when_false);
-
- return;
-
- case INTEGER_CST:
- if (integer_zerop (exp))
- {
- SET_ALL (when_true);
- COPY (when_false, before);
- }
- else
- {
- SET_ALL (when_false);
- COPY (when_true, before);
- }
- break;
- default:
- do_default:
- check_init (exp, before);
- COPY (when_false, before);
- COPY (when_true, before);
- }
-}
-
-/* Used to keep track of control flow branches. */
-
-struct alternatives
-{
- struct alternatives *outer;
-
- /* The value of num_current_locals at the start of this compound. */
- int num_locals;
-
- /* The value of the "before" set at the start of the control stucture.
- Used for SWITCH_EXPR but not set for LABELED_BLOCK_EXPR. */
- words saved;
-
- int save_start_current_locals;
-
- /* If num_current_words==1, combined==&one_word, for efficiency. */
- word one_word;
-
- /* The intersection of the "after" sets from previous branches. */
- words combined;
-
- tree block;
-};
-
-struct alternatives * alternatives = NULL;
-
-#define BEGIN_ALTERNATIVES(before, current) \
-{ \
- current.saved = NULL; \
- current.num_locals = num_current_locals; \
- current.combined = num_current_words <= 1 ? &current.one_word \
- : ALLOC_WORDS (num_current_words); \
- SET_ALL (current.combined); \
- current.outer = alternatives; \
- alternatives = &current; \
- current.save_start_current_locals = start_current_locals; \
- start_current_locals = num_current_locals; \
-}
-
-static void
-done_alternative (after, current)
- words after;
- struct alternatives *current;
-{
- INTERSECTN (current->combined, current->combined, after,
- WORDS_NEEDED (current->num_locals));
-}
-
-#define END_ALTERNATIVES(after, current) \
-{ \
- alternatives = current.outer; \
- COPY (after, current.combined); \
- if (current.combined != &current.one_word) \
- FREE_WORDS (current.combined); \
- start_current_locals = current.save_start_current_locals; \
-}
-
-/* Check for (un)initialized local variables in EXP.
-*/
-
-static void
-check_init (exp, before)
- tree exp;
- words before;
-{
- tree tmp;
- again:
- switch (TREE_CODE (exp))
- {
- case VAR_DECL:
- if (! FIELD_STATIC (exp) && DECL_NAME (exp) != NULL_TREE)
- {
- int index = DECL_BIT_INDEX (exp);
- if (index >= 0 && ! SET_P (before, index))
- {
-#if 1
- parse_error_context (wfl,
- "Variable `%s' may not have been initialized"
- , IDENTIFIER_POINTER (DECL_NAME (exp)));
-#else
- error_with_decl (exp, "variable may be used uninitialized");
-#endif
- /* Suppress further errors. */
- DECL_BIT_INDEX (exp) = -1;
- }
- }
- break;
- case MODIFY_EXPR:
- tmp = TREE_OPERAND (exp, 0);
- if (TREE_CODE (tmp) == VAR_DECL && ! FIELD_STATIC (tmp))
- {
- int index;
- check_init (TREE_OPERAND (exp, 1), before);
- index = DECL_BIT_INDEX (tmp);
- if (index >= 0)
- SET_BIT (before, index);
- /* Minor optimization. See comment for start_current_locals. */
- if (index >= start_current_locals
- && index == num_current_locals - 1)
- {
- num_current_locals--;
- DECL_BIT_INDEX (tmp) = -1;
- }
- break;
- }
- else
- goto binop;
- case BLOCK:
- if (BLOCK_EXPR_BODY (exp))
- {
- tree decl = BLOCK_EXPR_DECLS (exp);
- int words_needed;
- word* tmp;
- int i;
- int save_start_current_locals = start_current_locals;
- int save_num_current_words = num_current_words;
- start_current_locals = num_current_locals;
- for (; decl != NULL_TREE; decl = TREE_CHAIN (decl))
- {
- DECL_BIT_INDEX (decl) = num_current_locals++;
- }
- words_needed = WORDS_NEEDED (num_current_locals);
- if (words_needed > num_current_words)
- {
- tmp = ALLOC_WORDS (words_needed);
- COPY (tmp, before);
- num_current_words = words_needed;
- }
- else
- tmp = before;
- for (i = start_current_locals; i < num_current_locals; i++)
- CLEAR_BIT (tmp, i);
- check_init (BLOCK_EXPR_BODY (exp), tmp);
- num_current_locals = start_current_locals;
- start_current_locals = save_start_current_locals;
- if (tmp != before)
- {
- num_current_words = save_num_current_words;
- COPY (before, tmp);
- FREE_WORDS (tmp);
- }
- }
- break;
- case LOOP_EXPR:
- {
- struct alternatives alt;
- BEGIN_ALTERNATIVES (before, alt);
- alt.block = exp;
- check_init (TREE_OPERAND (exp, 0), before);
- done_alternative (before, &alt);
- END_ALTERNATIVES (before, alt);
- return;
- }
- case EXIT_EXPR:
- {
- struct alternatives *alt = alternatives;
- words tmp = ALLOC_WORDS (2 * num_current_words);
- words when_true = tmp;
- words when_false = tmp + num_current_words;
-#ifdef ENABLE_CHECKING
- if (TREE_CODE (alt->block) != LOOP_EXPR)
- fatal ("internal error in check-init: EXIT_EXPR not in LOOP_EXPR");
-#endif
- check_bool_init (TREE_OPERAND (exp, 0), before, when_false, when_true);
- done_alternative (when_true, alt);
- COPY (before, when_false);
- FREE_WORDS (tmp);
- return;
- }
- case LABELED_BLOCK_EXPR:
- {
- struct alternatives alt;
- BEGIN_ALTERNATIVES (before, alt);
- alt.block = exp;
- if (LABELED_BLOCK_BODY (exp))
- check_init (LABELED_BLOCK_BODY (exp), before);
- done_alternative (before, &alt);
- END_ALTERNATIVES (before, alt);
- return;
- }
- case EXIT_BLOCK_EXPR:
- {
- tree block = TREE_OPERAND (exp, 0);
- struct alternatives *alt = alternatives;
- while (alt->block != block)
- alt = alt->outer;
- done_alternative (before, alt);
- SET_ALL (before);
- return;
- }
- case SWITCH_EXPR:
- {
- struct alternatives alt;
- check_init (TREE_OPERAND (exp, 0), before);
- BEGIN_ALTERNATIVES (before, alt);
- alt.saved = ALLOC_WORDS (num_current_words);
- COPY (alt.saved, before);
- alt.block = exp;
- check_init (TREE_OPERAND (exp, 1), before);
- done_alternative (before, &alt);
- FREE_WORDS (alt.saved);
- END_ALTERNATIVES (before, alt);
- return;
- }
- case CASE_EXPR:
- case DEFAULT_EXPR:
- {
- int i;
- struct alternatives *alt = alternatives;
- while (TREE_CODE (alt->block) != SWITCH_EXPR)
- alt = alt->outer;
- COPYN (before, alt->saved, WORDS_NEEDED (alt->num_locals));
- for (i = alt->num_locals; i < num_current_locals; i++)
- CLEAR_BIT (before, i);
- break;
- }
-
- case CLEANUP_POINT_EXPR:
- {
- struct alternatives alt;
- BEGIN_ALTERNATIVES (before, alt);
- CLEAR_ALL (alt.combined);
- check_init (TREE_OPERAND (exp, 0), before);
- UNION (alt.combined, alt.combined, before);
- END_ALTERNATIVES (before, alt);
- }
- return;
- case WITH_CLEANUP_EXPR:
- {
- struct alternatives *alt = alternatives;
-#ifdef ENABLE_CHECKING
- if (TREE_CODE (alt->block) != CLEANUP_POINT_EXPR)
- fatal ("internal error in check-init: WITH_CLEANUP_EXPR not in CLEANUP_POINT_EXPR");
-#endif
- check_init (TREE_OPERAND (exp, 0), before);
- UNION (alt->combined, alt->combined, before);
- check_init (TREE_OPERAND (exp, 2), alt->combined);
- return;
- }
-
- case TRY_EXPR:
- {
- tree try_clause = TREE_OPERAND (exp, 0);
- tree clause = TREE_OPERAND (exp, 1);
- words save = ALLOC_WORDS (num_current_words);
- words tmp = ALLOC_WORDS (num_current_words);
- struct alternatives alt;
- BEGIN_ALTERNATIVES (before, alt);
- COPY (save, before);
- COPY (tmp, save);
- check_init (try_clause, tmp);
- done_alternative (tmp, &alt);
- for ( ; clause != NULL_TREE; clause = TREE_CHAIN (clause))
- {
- tree catch_clause = TREE_OPERAND (clause, 0);
- COPY (tmp, save);
- check_init (catch_clause, tmp);
- done_alternative (tmp, &alt);
- }
- FREE_WORDS (tmp);
- FREE_WORDS (save);
- END_ALTERNATIVES (before, alt);
- }
- return;
-
- case TRY_FINALLY_EXPR:
- {
- words tmp = ALLOC_WORDS (num_current_words);
- COPY (tmp, before);
- check_init (TREE_OPERAND (exp, 0), tmp);
- check_init (TREE_OPERAND (exp, 1), before);
- FREE_WORDS (tmp);
- }
- return;
-
- case RETURN_EXPR:
- case THROW_EXPR:
- if (TREE_OPERAND (exp, 0))
- check_init (TREE_OPERAND (exp, 0), before);
- goto never_continues;
-
- case ERROR_MARK:
- never_continues:
- SET_ALL (before);
- return;
-
- case COND_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- {
- words tmp = ALLOC_WORDS (2 * num_current_words);
- words when_true = tmp;
- words when_false = tmp + num_current_words;
- check_bool_init (exp, before, when_false, when_true);
- INTERSECT (before, when_false, when_true);
- FREE_WORDS (tmp);
- }
- break;
- case UNARY_PLUS_EXPR:
- case NEGATE_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case TRUTH_XOR_EXPR:
- case TRUTH_NOT_EXPR:
- case BIT_NOT_EXPR:
- case CONVERT_EXPR:
- case COMPONENT_REF:
- case NOP_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case INDIRECT_REF:
- case ADDR_EXPR:
- case SAVE_EXPR:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case NON_LVALUE_EXPR:
- case INSTANCEOF_EXPR:
- /* Avoid needless recursion. */
- exp = TREE_OPERAND (exp, 0);
- goto again;
-
- case COMPOUND_EXPR:
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case TRUNC_MOD_EXPR:
- case RDIV_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case URSHIFT_EXPR:
- case BIT_AND_EXPR:
- case BIT_XOR_EXPR:
- case BIT_IOR_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- case ARRAY_REF:
- binop:
- check_init (TREE_OPERAND (exp, 0), before);
- /* Avoid needless recursion, especially for COMPOUND_EXPR. */
- exp = TREE_OPERAND (exp, 1);
- goto again;
-
- case PARM_DECL:
- case RESULT_DECL:
- case FUNCTION_DECL:
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- break;
-
- case NEW_CLASS_EXPR:
- case CALL_EXPR:
- {
- tree func = TREE_OPERAND (exp, 0);
- tree x = TREE_OPERAND (exp, 1);
- if (TREE_CODE (func) == ADDR_EXPR)
- func = TREE_OPERAND (func, 0);
- check_init (func, before);
-
- for ( ; x != NULL_TREE; x = TREE_CHAIN (x))
- check_init (TREE_VALUE (x), before);
- if (func == throw_node)
- goto never_continues;
- }
- break;
-
- case NEW_ARRAY_INIT:
- {
- tree x = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0));
- for ( ; x != NULL_TREE; x = TREE_CHAIN (x))
- check_init (TREE_VALUE (x), before);
- }
- break;
-
- case EXPR_WITH_FILE_LOCATION:
- {
- char *saved_input_filename = input_filename;
- tree saved_wfl = wfl;
- tree body = EXPR_WFL_NODE (exp);
- int saved_lineno = lineno;
- if (body == empty_stmt_node)
- break;
- wfl = exp;
- input_filename = EXPR_WFL_FILENAME (exp);
- lineno = EXPR_WFL_LINENO (exp);
- check_init (body, before);
- input_filename = saved_input_filename;
- lineno = saved_lineno;
- wfl = saved_wfl;
- }
- break;
-
- default:
- fatal ("internal error in check-init: tree code not implemented: %s",
- tree_code_name [(int) TREE_CODE (exp)]);
- }
-}
-
-void
-check_for_initialization (body)
- tree body;
-{
- word before = 0;
- check_init (body, &before);
-}
diff --git a/gnu/dist/toolchain/gcc/java/class.c b/gnu/dist/toolchain/gcc/java/class.c
deleted file mode 100644
index 8217a950768..00000000000
--- a/gnu/dist/toolchain/gcc/java/class.c
+++ /dev/null
@@ -1,1758 +0,0 @@
-/* Functions related to building classes and their related objects.
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com> */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "rtl.h"
-#include "flags.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "obstack.h"
-#include "toplev.h"
-#include "output.h"
-#include "parse.h"
-
-static tree mangle_class_field PROTO ((tree class));
-static tree make_method_value PROTO ((tree));
-static tree build_java_method_type PROTO ((tree, tree, int));
-static int32 hashUtf8String PROTO ((const char *, int));
-static tree make_field_value PROTO ((tree));
-static tree get_dispatch_vector PROTO ((tree));
-static tree get_dispatch_table PROTO ((tree, tree));
-static void append_gpp_mangled_type PROTO ((struct obstack *, tree));
-static tree mangle_static_field PROTO ((tree));
-
-static rtx registerClass_libfunc;
-
-extern struct obstack permanent_obstack;
-extern struct obstack temporary_obstack;
-
-/* Return an IDENTIFIER_NODE the same as (OLD_NAME, OLD_LENGTH).
- except that characters matching OLD_CHAR are substituted by NEW_CHAR.
- Also, PREFIX is prepended, and SUFFIX is appended. */
-
-tree
-ident_subst (old_name, old_length, prefix, old_char, new_char, suffix)
- const char* old_name;
- int old_length;
- const char *prefix;
- int old_char;
- int new_char;
- const char *suffix;
-{
- int prefix_len = strlen (prefix);
- int suffix_len = strlen (suffix);
- int i = prefix_len + old_length + suffix_len + 1;
-#ifdef __GNUC__
- char buffer[i];
-#else
- char *buffer = (char *)alloca (i);
-#endif
- strcpy (buffer, prefix);
- for (i = 0; i < old_length; i++)
- {
- char ch = old_name[i];
- if (ch == old_char)
- ch = new_char;
- buffer[prefix_len + i] = ch;
- }
- strcpy (buffer + prefix_len + old_length, suffix);
- return get_identifier (buffer);
-}
-
-/* Return an IDENTIFIER_NODE the same as OLD_ID,
- except that characters matching OLD_CHAR are substituted by NEW_CHAR.
- Also, PREFIX is prepended, and SUFFIX is appended. */
-
-tree
-identifier_subst (old_id, prefix, old_char, new_char, suffix)
- const tree old_id;
- const char *prefix;
- int old_char;
- int new_char;
- const char *suffix;
-{
- return ident_subst (IDENTIFIER_POINTER (old_id), IDENTIFIER_LENGTH (old_id),
- prefix, old_char, new_char, suffix);
-}
-
-/* Generate a valid C identifier from the name of the class TYPE,
- prefixed by PREFIX. */
-
-tree
-mangled_classname (prefix, type)
- const char *prefix;
- tree type;
-{
- tree ident = TYPE_NAME (type);
- if (TREE_CODE (ident) != IDENTIFIER_NODE)
- ident = DECL_NAME (ident);
- return identifier_subst (ident, prefix, '.', '_', "");
-}
-
-tree
-make_class ()
-{
- tree type;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- type = make_node (RECORD_TYPE);
-#ifdef JAVA_USE_HANDLES
- tree field1 = build_decl (FIELD_DECL, get_identifier ("obj"),
- build_pointer_type (type));
- tree field2 = build_decl (FIELD_DECL, get_identifier ("methods"),
- methodtable_ptr_type);
- tree handle_type = make_node (RECORD_TYPE);
- TREE_CHAIN (field1) = field2;
- TYPE_FIELDS (handle_type) = field1;
- TYPE_BINFO (type) = make_tree_vec (7);
- TYPE_BINFO (handle_type) = make_tree_vec (7);
- BINFO_HANDLE (TYPE_BINFO (handle_type)) = type;
- BINFO_HANDLE (TYPE_BINFO (type)) = handle_type;
-#else
- TYPE_BINFO (type) = make_tree_vec (6);
-#endif
- pop_obstacks ();
-
- return type;
-}
-
-/* Given a fully-qualified classname in NAME (whose length is NAME_LENGTH),
- and where each of the constituents is separated by '/',
- return a corresponding IDENTIFIER_NODE, except using '.' as separator. */
-
-tree
-unmangle_classname (name, name_length)
- const char *name; int name_length;
-{
- tree to_return = ident_subst (name, name_length, "", '/', '.', "");
- /* It's not sufficient to compare to_return and get_identifier
- (name) to determine whether to_return is qualified. There are
- cases in signature analysis where name will be stripped of a
- trailing ';'. */
- name = IDENTIFIER_POINTER (to_return);
- while (*name)
- if (*name++ == '.')
- {
- QUALIFIED_P (to_return) = 1;
- break;
- }
-
- return to_return;
-}
-
-tree
-push_class (class_type, class_name)
- tree class_type, class_name;
-{
- tree decl, signature;
- char *save_input_filename = input_filename;
- int save_lineno = lineno;
- tree source_name = identifier_subst (class_name, "", '.', '/', ".java");
- push_obstacks (&permanent_obstack, &permanent_obstack);
- CLASS_P (class_type) = 1;
- input_filename = IDENTIFIER_POINTER (source_name);
- lineno = 0;
- decl = build_decl (TYPE_DECL, class_name, class_type);
- input_filename = save_input_filename;
- lineno = save_lineno;
- signature = identifier_subst (class_name, "L", '.', '/', ";");
- IDENTIFIER_SIGNATURE_TYPE (signature) = build_pointer_type (class_type);
-
- /* Setting DECL_ARTIFICAL forces dbxout.c to specific the type is
- both a typedef and in the struct name-space. We may want to re-visit
- this later, but for now it reduces the changes needed for gdb. */
- DECL_ARTIFICIAL (decl) = 1;
-
- pushdecl_top_level (decl);
-#ifdef JAVA_USE_HANDLES
- {
- tree handle_name = identifier_subst (class_name,
- "Handle$", '.', '.', "");
- tree handle_decl = build_decl (TYPE_DECL, handle_name,
- CLASS_TO_HANDLE_TYPE (class_type));
- pushdecl (handle_decl);
- }
-#endif
-
- pop_obstacks ();
- return decl;
-}
-
-/* Finds the (global) class named NAME. Creates the class if not found.
- Also creates associated TYPE_DECL.
- Does not check if the class actually exists, load the class,
- fill in field or methods, or do layout_type. */
-
-tree
-lookup_class (name)
- tree name;
-{
- tree decl = IDENTIFIER_CLASS_VALUE (name);
- if (decl == NULL_TREE)
- decl = push_class (make_class (), name);
- return TREE_TYPE (decl);
-}
-
-void
-set_super_info (access_flags, this_class, super_class, interfaces_count)
- int access_flags;
- tree this_class;
- tree super_class;
- int interfaces_count;
-{
- int total_supers = interfaces_count;
- tree class_decl = TYPE_NAME (this_class);
- if (super_class)
- total_supers++;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- TYPE_BINFO_BASETYPES (this_class) = make_tree_vec (total_supers);
- if (super_class)
- {
- tree super_binfo = make_tree_vec (6);
- BINFO_TYPE (super_binfo) = super_class;
- BINFO_OFFSET (super_binfo) = integer_zero_node;
- TREE_VIA_PUBLIC (super_binfo) = 1;
- TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (this_class)), 0)
- = super_binfo;
- CLASS_HAS_SUPER (this_class) = 1;
- }
- pop_obstacks ();
-
- if (access_flags & ACC_PUBLIC) CLASS_PUBLIC (class_decl) = 1;
- if (access_flags & ACC_FINAL) CLASS_FINAL (class_decl) = 1;
- if (access_flags & ACC_SUPER) CLASS_SUPER (class_decl) = 1;
- if (access_flags & ACC_INTERFACE) CLASS_INTERFACE (class_decl) = 1;
- if (access_flags & ACC_ABSTRACT) CLASS_ABSTRACT (class_decl) = 1;
-}
-
-/* Return length of inheritance chain of CLAS, where java.lang.Object is 0,
- direct sub-classes of Object are 1, and so on. */
-
-int
-class_depth (clas)
- tree clas;
-{
- int depth = 0;
- if (! CLASS_LOADED_P (clas))
- load_class (clas, 1);
- while (clas != object_type_node)
- {
- depth++;
- clas = TYPE_BINFO_BASETYPE (clas, 0);
- }
- return depth;
-}
-
-/* Return true iff TYPE2 is an interface that extends interface TYPE1 */
-
-int
-interface_of_p (type1, type2)
- tree type1, type2;
-{
- int n, i;
- tree basetype_vec;
-
- if (!(basetype_vec = TYPE_BINFO_BASETYPES (type2)))
- return 0;
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
- if (vec_elt && BINFO_TYPE (vec_elt) == type1)
- return 1;
- }
- for (i = 0; i < n; i++)
- {
- tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
- if (vec_elt && BINFO_TYPE (vec_elt)
- && interface_of_p (type1, BINFO_TYPE (vec_elt)))
- return 1;
- }
- return 0;
-}
-
-/* Return true iff TYPE1 inherits from TYPE2. */
-
-int
-inherits_from_p (type1, type2)
- tree type1, type2;
-{
- while (type1 != NULL_TREE && TREE_CODE (type1) == RECORD_TYPE)
- {
- if (type1 == type2)
- return 1;
- type1 = CLASSTYPE_SUPER (type1);
- }
- return 0;
-}
-
-static void
-add_interface_do (basetype_vec, interface_class, i)
- tree basetype_vec, interface_class;
- int i;
-{
- tree interface_binfo = make_tree_vec (6);
- BINFO_TYPE (interface_binfo) = interface_class;
- BINFO_OFFSET (interface_binfo) = integer_zero_node;
- TREE_VIA_VIRTUAL (interface_binfo) = 1;
- TREE_VIA_PUBLIC (interface_binfo) = 1;
- TREE_VEC_ELT (basetype_vec, i) = interface_binfo;
-}
-
-/* Add INTERFACE_CLASS to THIS_CLASS iff INTERFACE_CLASS can't be
- found in THIS_CLASS. Returns NULL_TREE upon success, INTERFACE_CLASS
- if attempt is made to add it twice. */
-
-tree
-maybe_add_interface (this_class, interface_class)
- tree this_class, interface_class;
-{
- tree basetype_vec = TYPE_BINFO_BASETYPES (this_class);
- int i;
- int n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; ; i++)
- {
- if (i >= n)
- {
- error ("internal error - too many interface type");
- return NULL_TREE;
- }
- else if (TREE_VEC_ELT (basetype_vec, i) == NULL_TREE)
- break;
- else if (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)) == interface_class)
- return interface_class;
- }
- add_interface_do (basetype_vec, interface_class, i);
- return NULL_TREE;
-}
-
-/* Add the INTERFACE_CLASS as one of the interfaces of THIS_CLASS. */
-
-void
-add_interface (this_class, interface_class)
- tree this_class, interface_class;
-{
- tree basetype_vec = TYPE_BINFO_BASETYPES (this_class);
- int i;
- int n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; ; i++)
- {
- if (i >= n)
- {
- error ("internal error - too many interface type");
- return;
- }
- else if (TREE_VEC_ELT (basetype_vec, i) == NULL_TREE)
- break;
- }
- add_interface_do (basetype_vec, interface_class, i);
-}
-
-#if 0
-/* Return the address of a pointer to the first FUNCTION_DECL
- in the list (*LIST) whose DECL_NAME is NAME. */
-
-static tree *
-find_named_method (list, name)
- tree *list;
- tree name;
-{
- while (*list && DECL_NAME (*list) != name)
- list = &TREE_CHAIN (*list);
- return list;
-}
-#endif
-
-static tree
-build_java_method_type (fntype, this_class, access_flags)
- tree fntype;
- tree this_class;
- int access_flags;
-{
- if (access_flags & ACC_STATIC)
- return fntype;
- return build_method_type (CLASS_TO_HANDLE_TYPE (this_class), fntype);
-}
-
-tree
-add_method_1 (handle_class, access_flags, name, function_type)
- tree handle_class;
- int access_flags;
- tree name;
- tree function_type;
-{
- tree method_type, fndecl;
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- method_type = build_java_method_type (function_type,
- handle_class, access_flags);
-
- fndecl = build_decl (FUNCTION_DECL, name, method_type);
- DECL_CONTEXT (fndecl) = handle_class;
-
- DECL_LANG_SPECIFIC (fndecl)
- = (struct lang_decl *) permalloc (sizeof (struct lang_decl));
- bzero ((PTR) DECL_LANG_SPECIFIC (fndecl), sizeof (struct lang_decl));
-
- TREE_CHAIN (fndecl) = TYPE_METHODS (handle_class);
- TYPE_METHODS (handle_class) = fndecl;
- pop_obstacks ();
-
- if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1;
- if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
- if (access_flags & ACC_PRIVATE) METHOD_PRIVATE (fndecl) = 1;
- if (access_flags & ACC_NATIVE) METHOD_NATIVE (fndecl) = 1;
- if (access_flags & ACC_STATIC) METHOD_STATIC (fndecl) = 1;
- if (access_flags & ACC_FINAL) METHOD_FINAL (fndecl) = 1;
- if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1;
- if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1;
- if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1;
- return fndecl;
-}
-
-/* Add a method to THIS_CLASS.
- The method's name is NAME.
- Its signature (mangled type) is METHOD_SIG (an IDENTIFIER_NODE). */
-
-tree
-add_method (this_class, access_flags, name, method_sig)
- tree this_class;
- int access_flags;
- tree name;
- tree method_sig;
-{
- tree handle_class = CLASS_TO_HANDLE_TYPE (this_class);
- tree function_type, fndecl;
- unsigned char *sig = (unsigned char*)IDENTIFIER_POINTER (method_sig);
- push_obstacks (&permanent_obstack, &permanent_obstack);
- if (sig[0] != '(')
- fatal ("bad method signature");
- function_type = get_type_from_signature (method_sig);
- fndecl = add_method_1 (handle_class, access_flags, name, function_type);
- set_java_signature (TREE_TYPE (fndecl), method_sig);
- pop_obstacks ();
- return fndecl;
-}
-
-tree
-add_field (class, name, field_type, flags)
- tree class;
- tree name;
- tree field_type;
- int flags;
-{
- int is_static = (flags & ACC_STATIC) != 0;
- tree field;
- /* Push the obstack of field_type ? FIXME */
- push_obstacks (&permanent_obstack, &permanent_obstack);
- field = build_decl (is_static ? VAR_DECL : FIELD_DECL, name, field_type);
- pop_obstacks ();
- TREE_CHAIN (field) = TYPE_FIELDS (class);
- TYPE_FIELDS (class) = field;
- DECL_CONTEXT (field) = class;
-
- if (flags & ACC_PUBLIC) FIELD_PUBLIC (field) = 1;
- if (flags & ACC_PROTECTED) FIELD_PROTECTED (field) = 1;
- if (flags & ACC_PRIVATE) FIELD_PRIVATE (field) = 1;
- if (flags & ACC_FINAL) FIELD_FINAL (field) = 1;
- if (flags & ACC_VOLATILE) FIELD_VOLATILE (field) = 1;
- if (flags & ACC_TRANSIENT) FIELD_TRANSIENT (field) = 1;
- if (is_static)
- {
- FIELD_STATIC (field) = 1;
- /* Always make field externally visible. This is required so
- that native methods can always access the field. */
- TREE_PUBLIC (field) = 1;
- }
- return field;
-}
-
-/* Associate a constant value CONSTANT with VAR_DECL FIELD. */
-
-void
-set_constant_value (field, constant)
- tree field, constant;
-{
- if (field == NULL_TREE)
- warning ("misplaced ConstantValue attribute (not in any field)");
- else if (DECL_INITIAL (field) != NULL_TREE)
- warning ("duplicate ConstanValue atribute for field '%s'",
- IDENTIFIER_POINTER (DECL_NAME (field)));
- else
- DECL_INITIAL (field) = constant;
-}
-
-/* Count the number of Unicode chars encoded in a given Ut8 string. */
-
-#if 0
-int
-strLengthUtf8 (str, len)
- char *str;
- int len;
-{
- register unsigned char* ptr = (unsigned char*) str;
- register unsigned char *limit = ptr + len;
- int str_length = 0;
- for (; ptr < limit; str_length++) {
- if (UTF8_GET (ptr, limit) < 0)
- return -1;
- }
- return str_length;
-}
-#endif
-
-
-/* Calculate a hash value for a string encoded in Utf8 format.
- * This returns the same hash value as specified for java.lang.String.hashCode.
- */
-
-static int32
-hashUtf8String (str, len)
- const char *str;
- int len;
-{
- register const unsigned char* ptr = (const unsigned char*) str;
- register const unsigned char *limit = ptr + len;
- int32 hash = 0;
- for (; ptr < limit;)
- {
- int ch = UTF8_GET (ptr, limit);
- /* Updated specification from
- http://www.javasoft.com/docs/books/jls/clarify.html. */
- hash = (31 * hash) + ch;
- }
- return hash;
-}
-
-tree utf8_decl_list = NULL_TREE;
-
-tree
-build_utf8_ref (name)
- tree name;
-{
- char* name_ptr = IDENTIFIER_POINTER(name);
- int name_len = IDENTIFIER_LENGTH(name);
- char buf[60];
- char *buf_ptr;
- tree ctype, field = NULL_TREE, str_type, cinit, string;
- static int utf8_count = 0;
- int name_hash;
- tree ref = IDENTIFIER_UTF8_REF (name);
- tree decl;
- if (ref != NULL_TREE)
- return ref;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- ctype = make_node (RECORD_TYPE);
- str_type = build_prim_array_type (unsigned_byte_type_node,
- name_len + 1); /* Allow for final '\0'. */
- PUSH_FIELD (ctype, field, "hash", unsigned_short_type_node);
- PUSH_FIELD (ctype, field, "length", unsigned_short_type_node);
- PUSH_FIELD (ctype, field, "data", str_type);
- FINISH_RECORD (ctype);
- START_RECORD_CONSTRUCTOR (cinit, ctype);
- name_hash = hashUtf8String (name_ptr, name_len) & 0xFFFF;
- PUSH_FIELD_VALUE (cinit, "hash", build_int_2 (name_hash, 0));
- PUSH_FIELD_VALUE (cinit, "length", build_int_2 (name_len, 0));
- string = build_string (name_len, name_ptr);
- TREE_TYPE (string) = str_type;
- PUSH_FIELD_VALUE (cinit, "data", string);
- FINISH_RECORD_CONSTRUCTOR (cinit);
- TREE_CONSTANT (cinit) = 1;
-
- /* Build a unique identifier based on buf. */
- sprintf(buf, "_Utf%d", ++utf8_count);
- buf_ptr = &buf[strlen (buf)];
- if (name_len > 0 && name_ptr[0] >= '0' && name_ptr[0] <= '9')
- *buf_ptr++ = '_';
- while (--name_len >= 0)
- {
- unsigned char c = *name_ptr++;
- if (c & 0x80)
- continue;
- if (!ISALPHA(c) && !ISDIGIT(c))
- c = '_';
- *buf_ptr++ = c;
- if (buf_ptr >= buf + 50)
- break;
- }
- *buf_ptr = '\0';
-
- decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_type);
- /* FIXME get some way to force this into .text, not .data. */
- TREE_STATIC (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_IGNORED_P (decl) = 1;
- TREE_READONLY (decl) = 1;
- TREE_THIS_VOLATILE (decl) = 0;
- DECL_INITIAL (decl) = cinit;
- TREE_CHAIN (decl) = utf8_decl_list;
- layout_decl (decl, 0);
- pushdecl (decl);
- rest_of_decl_compilation (decl, (char*) 0, global_bindings_p (), 0);
- utf8_decl_list = decl;
- make_decl_rtl (decl, (char*) 0, 1);
- ref = build1 (ADDR_EXPR, utf8const_ptr_type, decl);
- IDENTIFIER_UTF8_REF (name) = ref;
- pop_obstacks ();
- return ref;
-}
-
-/* Build a reference to the class TYPE.
- Also handles primitive types and array types. */
-
-tree
-build_class_ref (type)
- tree type;
-{
- int is_compiled = is_compiled_class (type);
- if (is_compiled)
- {
- tree ref, decl_name, decl;
- if (TREE_CODE (type) == POINTER_TYPE)
- type = TREE_TYPE (type);
- if (TREE_CODE (type) == RECORD_TYPE)
- {
- if (TYPE_SIZE (type) == error_mark_node)
- return null_pointer_node;
- decl_name = identifier_subst (DECL_NAME (TYPE_NAME (type)),
- "", '/', '/', ".class");
- decl = IDENTIFIER_GLOBAL_VALUE (decl_name);
- if (decl == NULL_TREE)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- decl = build_decl (VAR_DECL, decl_name, class_type_node);
- DECL_SIZE (decl) = TYPE_SIZE (class_type_node);
- TREE_STATIC (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- DECL_IGNORED_P (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_ASSEMBLER_NAME (decl) = mangle_class_field (type);
- make_decl_rtl (decl, NULL, 1);
- pushdecl_top_level (decl);
- if (is_compiled == 1)
- DECL_EXTERNAL (decl) = 1;
- pop_obstacks ();
- }
- }
- else
- {
- char *name;
- char buffer[25];
- if (flag_emit_class_files)
- {
- const char *prim_class_name;
- tree prim_class;
- if (type == char_type_node)
- prim_class_name = "java.lang.Character";
- else if (type == boolean_type_node)
- prim_class_name = "java.lang.Boolean";
- else if (type == byte_type_node)
- prim_class_name = "java.lang.Byte";
- else if (type == short_type_node)
- prim_class_name = "java.lang.Short";
- else if (type == int_type_node)
- prim_class_name = "java.lang.Integer";
- else if (type == long_type_node)
- prim_class_name = "java.lang.Long";
- else if (type == float_type_node)
- prim_class_name = "java.lang.Float";
- else if (type == double_type_node)
- prim_class_name = "java.lang.Double";
- else if (type == void_type_node)
- prim_class_name = "java.lang.Void";
- else
- fatal ("internal error - bad type to build_class_ref");
- prim_class = lookup_class (get_identifier (prim_class_name));
- return build (COMPONENT_REF, NULL_TREE,
- prim_class, TYPE_identifier_node);
- }
- decl_name = TYPE_NAME (type);
- if (TREE_CODE (decl_name) == TYPE_DECL)
- decl_name = DECL_NAME (decl_name);
- name = IDENTIFIER_POINTER (decl_name);
- if (strncmp (name, "promoted_", 9) == 0)
- name += 9;
- sprintf (buffer, "_Jv_%sClass", name);
- decl_name = get_identifier (buffer);
- decl = IDENTIFIER_GLOBAL_VALUE (decl_name);
- if (decl == NULL_TREE)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- decl = build_decl (VAR_DECL, decl_name, class_type_node);
- TREE_STATIC (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- make_decl_rtl (decl, NULL, 1);
- pushdecl_top_level (decl);
- if (is_compiled == 1)
- DECL_EXTERNAL (decl) = 1;
- pop_obstacks ();
- }
- }
-
- ref = build1 (ADDR_EXPR, class_ptr_type, decl);
- return ref;
- }
- else
- {
- int index;
- tree cl;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- index = alloc_class_constant (type);
- cl = build_ref_from_constant_pool (index);
- TREE_TYPE (cl) = promote_type (class_ptr_type);
- pop_obstacks ();
- return cl;
- }
-}
-
-tree
-build_static_field_ref (fdecl)
- tree fdecl;
-{
- tree fclass = DECL_CONTEXT (fdecl);
- int is_compiled = is_compiled_class (fclass);
- if (is_compiled)
- {
- if (DECL_RTL (fdecl) == 0)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- make_decl_rtl (fdecl, NULL, 1);
- pop_obstacks ();
- if (is_compiled == 1)
- DECL_EXTERNAL (fdecl) = 1;
- }
- return fdecl;
- }
- else
- {
- /* Compile as:
- * *(FTYPE*)build_class_ref(FCLASS)->fields[INDEX].info.addr
- */
- static tree fields_ident = NULL_TREE;
- static tree info_ident = NULL_TREE;
- tree ref = build_class_ref (fclass);
- tree fld;
- int field_index = 0;
- ref = build1 (INDIRECT_REF, class_type_node, ref);
- if (fields_ident == NULL_TREE)
- fields_ident = get_identifier ("fields");
- if (info_ident == NULL_TREE)
- info_ident = get_identifier ("info");
- ref = build (COMPONENT_REF, field_ptr_type_node, ref,
- lookup_field (&class_type_node, fields_ident));
-
- for (fld = TYPE_FIELDS (fclass); ; fld = TREE_CHAIN (fld))
- {
- if (fld == fdecl)
- break;
- if (fld == NULL_TREE)
- fatal ("field '%s' not found in class",
- IDENTIFIER_POINTER (DECL_NAME (fdecl)));
- if (FIELD_STATIC (fld))
- field_index++;
- }
- field_index *= int_size_in_bytes (field_type_node);
- ref = fold (build (PLUS_EXPR, field_ptr_type_node,
- ref, build_int_2 (field_index, 0)));
- ref = build1 (INDIRECT_REF, field_type_node, ref);
- ref = build (COMPONENT_REF, field_info_union_node,
- ref, lookup_field (&field_type_node, info_ident));
- ref = build (COMPONENT_REF, ptr_type_node,
- ref, TREE_CHAIN (TYPE_FIELDS (field_info_union_node)));
- return fold (build1 (INDIRECT_REF, TREE_TYPE(fdecl), ref));
- }
-}
-
-int
-get_access_flags_from_decl (decl)
- tree decl;
-{
- int access_flags = 0;
- if (TREE_CODE (decl) == FIELD_DECL || TREE_CODE (decl) == VAR_DECL)
- {
- if (FIELD_STATIC (decl))
- access_flags |= ACC_STATIC;
- if (FIELD_PUBLIC (decl))
- access_flags |= ACC_PUBLIC;
- if (FIELD_PROTECTED (decl))
- access_flags |= ACC_PROTECTED;
- if (FIELD_PRIVATE (decl))
- access_flags |= ACC_PRIVATE;
- if (FIELD_FINAL (decl))
- access_flags |= ACC_FINAL;
- if (FIELD_VOLATILE (decl))
- access_flags |= ACC_VOLATILE;
- if (FIELD_TRANSIENT (decl))
- access_flags |= ACC_TRANSIENT;
- return access_flags;
- }
- if (TREE_CODE (decl) == TYPE_DECL)
- {
- if (CLASS_PUBLIC (decl))
- access_flags |= ACC_PUBLIC;
- if (CLASS_FINAL (decl))
- access_flags |= ACC_FINAL;
- if (CLASS_SUPER (decl))
- access_flags |= ACC_SUPER;
- if (CLASS_INTERFACE (decl))
- access_flags |= ACC_INTERFACE;
- if (CLASS_ABSTRACT (decl))
- access_flags |= ACC_ABSTRACT;
- return access_flags;
- }
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- if (METHOD_PUBLIC (decl))
- access_flags |= ACC_PUBLIC;
- if (METHOD_PRIVATE (decl))
- access_flags |= ACC_PRIVATE;
- if (METHOD_PROTECTED (decl))
- access_flags |= ACC_PROTECTED;
- if (METHOD_STATIC (decl))
- access_flags |= ACC_STATIC;
- if (METHOD_FINAL (decl))
- access_flags |= ACC_FINAL;
- if (METHOD_SYNCHRONIZED (decl))
- access_flags |= ACC_SYNCHRONIZED;
- if (METHOD_NATIVE (decl))
- access_flags |= ACC_NATIVE;
- if (METHOD_ABSTRACT (decl))
- access_flags |= ACC_ABSTRACT;
- if (METHOD_TRANSIENT (decl))
- access_flags |= ACC_TRANSIENT;
- return access_flags;
- }
- abort ();
-}
-
-static tree
-make_field_value (fdecl)
- tree fdecl;
-{
- tree finit, info;
- int bsize, flags;
- tree type = TREE_TYPE (fdecl);
- int resolved = is_compiled_class (type);
- START_RECORD_CONSTRUCTOR (finit, field_type_node);
- PUSH_FIELD_VALUE (finit, "name", build_utf8_ref (DECL_NAME (fdecl)));
- if (resolved)
- type = build_class_ref (type);
- else
- {
- tree signature = build_java_signature (type);
- type = build_utf8_ref (unmangle_classname
- (IDENTIFIER_POINTER(signature),
- IDENTIFIER_LENGTH(signature)));
- }
- PUSH_FIELD_VALUE (finit, "type", type);
- flags = get_access_flags_from_decl (fdecl);
- if (! resolved)
- flags |= 0x8000 /* FIELD_UNRESOLVED_FLAG */;
- PUSH_FIELD_VALUE (finit, "accflags", build_int_2 (flags, 0));
- bsize = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (fdecl))) / BITS_PER_UNIT;
- PUSH_FIELD_VALUE (finit, "bsize", build_int_2 (bsize, 0));
- if (FIELD_STATIC (fdecl))
- {
- tree cfield = TREE_CHAIN (TYPE_FIELDS(field_info_union_node));
- tree faddr = build_address_of (build_static_field_ref (fdecl));
- info = build (CONSTRUCTOR, field_info_union_node, NULL_TREE,
- build_tree_list (cfield, faddr));
- }
- else
- {
- int boffset
- = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (fdecl)) / BITS_PER_UNIT;
- info = build (CONSTRUCTOR, field_info_union_node, NULL_TREE,
- build_tree_list (TYPE_FIELDS(field_info_union_node),
- build_int_2 (boffset, 0)));
- }
- PUSH_FIELD_VALUE (finit, "info", info);
-
- FINISH_RECORD_CONSTRUCTOR (finit);
- return finit;
-}
-
-static tree
-make_method_value (mdecl)
- tree mdecl;
-{
- tree minit;
- tree code;
-#define ACC_TRANSLATED 0x4000
- int accflags = get_access_flags_from_decl (mdecl) | ACC_TRANSLATED;
- code = null_pointer_node;
- if (DECL_RTL (mdecl))
- code = build1 (ADDR_EXPR, nativecode_ptr_type_node, mdecl);
- START_RECORD_CONSTRUCTOR (minit, method_type_node);
- PUSH_FIELD_VALUE (minit, "name",
- build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ?
- init_identifier_node
- : DECL_NAME (mdecl)));
- {
- tree signature = build_java_signature (TREE_TYPE (mdecl));
- PUSH_FIELD_VALUE (minit, "signature",
- (build_utf8_ref
- (unmangle_classname
- (IDENTIFIER_POINTER(signature),
- IDENTIFIER_LENGTH(signature)))));
- }
- PUSH_FIELD_VALUE (minit, "accflags", build_int_2 (accflags, 0));
- PUSH_FIELD_VALUE (minit, "ncode", code);
- FINISH_RECORD_CONSTRUCTOR (minit);
- return minit;
-}
-
-static tree
-get_dispatch_vector (type)
- tree type;
-{
- tree vtable = TYPE_VTABLE (type);
- if (vtable == NULL)
- {
- int i;
- tree method;
- tree super = CLASSTYPE_SUPER (type);
- int nvirtuals = TREE_INT_CST_LOW (TYPE_NVIRTUALS (type));
- vtable = make_tree_vec (nvirtuals);
- TYPE_VTABLE (type) = vtable;
- if (super != NULL_TREE)
- {
- tree super_vtable = get_dispatch_vector (super);
- for ( i = TREE_INT_CST_LOW (TYPE_NVIRTUALS (super)); --i >= 0; )
- TREE_VEC_ELT (vtable, i) = TREE_VEC_ELT (super_vtable, i);
- }
- for (method = TYPE_METHODS (type); method != NULL_TREE;
- method = TREE_CHAIN (method))
- {
- if (DECL_VINDEX (method) != NULL_TREE
- && TREE_CODE (DECL_VINDEX (method)) == INTEGER_CST)
- {
- TREE_VEC_ELT (vtable, TREE_INT_CST_LOW (DECL_VINDEX (method)))
- = method;
- }
- }
- }
- return vtable;
-}
-
-static tree
-get_dispatch_table (type, this_class_addr)
- tree type, this_class_addr;
-{
- tree vtable = get_dispatch_vector (type);
- int i;
- tree list = NULL_TREE;
- int nvirtuals = TREE_VEC_LENGTH (vtable);
- for (i = nvirtuals; --i >= 0; )
- {
- tree method = TREE_VEC_ELT (vtable, i);
- if (METHOD_ABSTRACT (method))
- warning_with_decl (method, "abstract method in non-abstract class");
- if (DECL_RTL (method) == 0)
- make_decl_rtl (method, NULL, 1);
- list = tree_cons (NULL_TREE /*DECL_VINDEX (method) + 2*/,
- build1 (ADDR_EXPR, nativecode_ptr_type_node, method),
- list);
- }
- /* Dummy entry for compatibility with G++ -fvtable-thunks. */
- list = tree_cons (integer_zero_node, null_pointer_node, list);
- list = tree_cons (integer_zero_node, this_class_addr, list);
- return build (CONSTRUCTOR, build_prim_array_type (nativecode_ptr_type_node,
- nvirtuals + 2),
- NULL_TREE, list);
-}
-
-void
-make_class_data (type)
- tree type;
-{
- tree decl, cons, temp;
- tree field, fields_decl;
- tree static_fields = NULL_TREE;
- tree instance_fields = NULL_TREE;
- HOST_WIDE_INT static_field_count = 0;
- HOST_WIDE_INT instance_field_count = 0;
- HOST_WIDE_INT field_count;
- tree field_array_type;
- tree method;
- tree methods = NULL_TREE;
- tree dtable_decl = NULL_TREE;
- HOST_WIDE_INT method_count = 0;
- tree method_array_type;
- tree methods_decl;
- tree super;
- tree this_class_addr;
- tree constant_pool_constructor;
- tree interfaces = null_pointer_node;
- int interface_len = 0;
- tree type_decl = TYPE_NAME (type);
-
- this_class_addr = build_class_ref (type);
- decl = TREE_OPERAND (this_class_addr, 0);
-
- /* Build Field array. */
- field = TYPE_FIELDS (type);
- if (DECL_NAME (field) == NULL_TREE)
- field = TREE_CHAIN (field); /* Skip dummy field for inherited data. */
- for ( ; field != NULL_TREE; field = TREE_CHAIN (field))
- {
- if (! DECL_ARTIFICIAL (field))
- {
- tree init = make_field_value (field);
- if (FIELD_STATIC (field))
- {
- tree initial = DECL_INITIAL (field);
- static_field_count++;
- static_fields = tree_cons (NULL_TREE, init, static_fields);
- /* If the initial value is a string constant,
- prevent output_constant from trying to assemble the value. */
- if (initial != NULL_TREE
- && TREE_TYPE (initial) == string_ptr_type_node)
- DECL_INITIAL (field) = NULL_TREE;
- rest_of_decl_compilation (field, (char*) 0, 1, 1);
- DECL_INITIAL (field) = initial;
- }
- else
- {
- instance_field_count++;
- instance_fields = tree_cons (NULL_TREE, init, instance_fields);
- }
- }
- }
- field_count = static_field_count + instance_field_count;
- if (field_count > 0)
- {
- static_fields = nreverse (static_fields);
- instance_fields = nreverse (instance_fields);
- static_fields = chainon (static_fields, instance_fields);
- field_array_type = build_prim_array_type (field_type_node, field_count);
- fields_decl = build_decl (VAR_DECL, mangled_classname ("_FL_", type),
- field_array_type);
- DECL_INITIAL (fields_decl) = build (CONSTRUCTOR, field_array_type,
- NULL_TREE, static_fields);
- TREE_STATIC (fields_decl) = 1;
- DECL_ARTIFICIAL (fields_decl) = 1;
- DECL_IGNORED_P (fields_decl) = 1;
- rest_of_decl_compilation (fields_decl, (char*) 0, 1, 0);
- }
- else
- fields_decl = NULL_TREE;
-
- /* Build Method array. */
- for (method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (type));
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- tree init;
- if (METHOD_PRIVATE (method)
- && (flag_inline_functions || optimize))
- continue;
- init = make_method_value (method);
- method_count++;
- methods = tree_cons (NULL_TREE, init, methods);
- }
- method_array_type = build_prim_array_type (method_type_node, method_count);
- methods_decl = build_decl (VAR_DECL, mangled_classname ("_MT_", type),
- method_array_type);
- DECL_INITIAL (methods_decl) = build (CONSTRUCTOR, method_array_type,
- NULL_TREE, nreverse (methods));
- TREE_STATIC (methods_decl) = 1;
- DECL_ARTIFICIAL (methods_decl) = 1;
- DECL_IGNORED_P (methods_decl) = 1;
- rest_of_decl_compilation (methods_decl, (char*) 0, 1, 0);
-
- if (flag_assume_compiled
- && ! CLASS_ABSTRACT (type_decl) && ! CLASS_INTERFACE (type_decl))
- {
- tree dtable = get_dispatch_table (type, this_class_addr);
- dtable_decl = build_dtable_decl (type);
- DECL_INITIAL (dtable_decl) = dtable;
- TREE_STATIC (dtable_decl) = 1;
- DECL_ARTIFICIAL (dtable_decl) = 1;
- DECL_IGNORED_P (dtable_decl) = 1;
- TREE_PUBLIC (dtable_decl) = 1;
- rest_of_decl_compilation (dtable_decl, (char*) 0, 1, 0);
- }
-
- super = CLASSTYPE_SUPER (type);
- if (super == NULL_TREE)
- super = null_pointer_node;
- else if (flag_assume_compiled)
- super = build_class_ref (super);
- else
- {
- int super_index = alloc_class_constant (super);
- super = build_int_2 (super_index, 0);
- TREE_TYPE (super) = ptr_type_node;
- }
-
- /* Build and emit the array of implemented interfaces. */
- if (type != object_type_node)
- interface_len = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type)) - 1;
- if (interface_len > 0)
- {
- tree init = NULL_TREE;
- int i;
- tree interface_array_type, idecl;
- interface_array_type
- = build_prim_array_type (class_ptr_type, interface_len);
- idecl = build_decl (VAR_DECL, mangled_classname ("_IF_", type),
- interface_array_type);
- for (i = interface_len; i > 0; i--)
- {
- tree child = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), i);
- tree iclass = BINFO_TYPE (child);
- tree index;
- if (flag_assume_compiled)
- index = build_class_ref (iclass);
- else
- {
- int int_index = alloc_class_constant (iclass);
- index = build_int_2 (int_index, 0);
- TREE_TYPE (index) = ptr_type_node;
- }
- init = tree_cons (NULL_TREE, index, init);
- }
- DECL_INITIAL (idecl) = build (CONSTRUCTOR, interface_array_type,
- NULL_TREE, init);
- TREE_STATIC (idecl) = 1;
- DECL_ARTIFICIAL (idecl) = 1;
- DECL_IGNORED_P (idecl) = 1;
- interfaces = build1 (ADDR_EXPR, ptr_type_node, idecl);
- rest_of_decl_compilation (idecl, (char*) 0, 1, 0);
- }
-
- constant_pool_constructor = build_constants_constructor ();
-
- START_RECORD_CONSTRUCTOR (temp, object_type_node);
-#if 0
- PUSH_FIELD_VALUE (temp, "vtable", NULL_TREE);
-#else
- PUSH_FIELD_VALUE (temp, "vtable",
- build1 (ADDR_EXPR, dtable_ptr_type, class_dtable_decl));
-#endif
- PUSH_FIELD_VALUE (temp, "sync_info", null_pointer_node);
- FINISH_RECORD_CONSTRUCTOR (temp);
- START_RECORD_CONSTRUCTOR (cons, class_type_node);
- PUSH_SUPER_VALUE (cons, temp);
- PUSH_FIELD_VALUE (cons, "next", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "name", build_utf8_ref (DECL_NAME (type_decl)));
- PUSH_FIELD_VALUE (cons, "accflags",
- build_int_2 (get_access_flags_from_decl (type_decl), 0));
-
- PUSH_FIELD_VALUE (cons, "superclass",
- CLASS_INTERFACE (type_decl) ? null_pointer_node : super);
- PUSH_FIELD_VALUE (cons, "constants", constant_pool_constructor);
- PUSH_FIELD_VALUE (cons, "methods",
- build1 (ADDR_EXPR, method_ptr_type_node, methods_decl));
- PUSH_FIELD_VALUE (cons, "method_count", build_int_2 (method_count, 0));
- PUSH_FIELD_VALUE (cons, "vtable_method_count", TYPE_NVIRTUALS (type));
- PUSH_FIELD_VALUE (cons, "fields",
- fields_decl == NULL_TREE ? null_pointer_node
- : build1 (ADDR_EXPR, field_ptr_type_node, fields_decl));
- PUSH_FIELD_VALUE (cons, "size_in_bytes", size_in_bytes (type));
- PUSH_FIELD_VALUE (cons, "field_count", build_int_2 (field_count, 0));
- PUSH_FIELD_VALUE (cons, "static_field_count",
- build_int_2 (static_field_count, 0));
- PUSH_FIELD_VALUE (cons, "vtable",
- dtable_decl == NULL_TREE ? null_pointer_node
- : build1 (ADDR_EXPR, dtable_ptr_type, dtable_decl));
- PUSH_FIELD_VALUE (cons, "interfaces", interfaces);
- PUSH_FIELD_VALUE (cons, "loader", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "interface_count", build_int_2 (interface_len, 0));
- PUSH_FIELD_VALUE (cons, "state", integer_zero_node);
-
- PUSH_FIELD_VALUE (cons, "thread", null_pointer_node);
-
- FINISH_RECORD_CONSTRUCTOR (cons);
-
- DECL_INITIAL (decl) = cons;
- rest_of_decl_compilation (decl, (char*) 0, 1, 0);
-}
-
-void
-finish_class (cl)
- tree cl;
-{
- tree method;
-
- /* Emit deferred inline methods. */
- for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- if (! TREE_ASM_WRITTEN (method) && DECL_SAVED_INSNS (method) != 0)
- {
- /* It's a deferred inline method. Decide if we need to emit it. */
- if (flag_keep_inline_functions
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (method))
- || ! METHOD_PRIVATE (method))
- {
- temporary_allocation ();
- output_inline_function (method);
- permanent_allocation (1);
- }
- }
- }
-
- make_class_data (current_class);
- register_class ();
- rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0);
-}
-
-/* Return 2 if CLASS is compiled by this compilation job;
- return 1 if CLASS can otherwise be assumed to be compiled;
- return 0 if we cannot assume that CLASS is compiled.
- Returns 1 for primitive and 0 for array types. */
-int
-is_compiled_class (class)
- tree class;
-{
- int seen_in_zip;
- if (TREE_CODE (class) == POINTER_TYPE)
- class = TREE_TYPE (class);
- if (TREE_CODE (class) != RECORD_TYPE) /* Primitive types are static. */
- return 1;
- if (TYPE_ARRAY_P (class))
- return 0;
- if (class == current_class)
- return 2;
-
- seen_in_zip = (TYPE_LANG_SPECIFIC (class) && TYPE_LANG_SPECIFIC (class)->jcf
- && TYPE_LANG_SPECIFIC (class)->jcf->seen_in_zip);
- if (CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (class) || seen_in_zip)
- {
- /* The class was seen in the current ZIP file and will be
- available as a compiled class in the future but may not have
- been loaded already. Load it if necessary. This prevent
- build_class_ref () from crashing. */
-
- if (seen_in_zip && !CLASS_LOADED_P (class))
- load_class (class, 1);
-
- /* We return 2 for class seen in ZIP and class from files
- belonging to the same compilation unit */
- return 2;
- }
-
- if (flag_assume_compiled)
- {
- if (!CLASS_LOADED_P (class))
- {
- if (CLASS_FROM_SOURCE_P (class))
- safe_layout_class (class);
- else
- load_class (class, 1);
- }
- return 1;
- }
-
- return 0;
-}
-
-/* Append the mangled name of TYPE onto OBSTACK. */
-
-static void
-append_gpp_mangled_type (obstack, type)
- struct obstack *obstack;
- tree type;
-{
- switch (TREE_CODE (type))
- {
- char code;
- case BOOLEAN_TYPE: code = 'b'; goto primitive;
- case CHAR_TYPE: code = 'w'; goto primitive;
- case VOID_TYPE: code = 'v'; goto primitive;
- case INTEGER_TYPE:
- /* Get the original type instead of the arguments promoted type.
- Avoid symbol name clashes. Should call a function to do that.
- FIXME. */
- if (type == promoted_short_type_node)
- type = short_type_node;
- if (type == promoted_byte_type_node)
- type = byte_type_node;
- switch (TYPE_PRECISION (type))
- {
- case 8: code = 'c'; goto primitive;
- case 16: code = 's'; goto primitive;
- case 32: code = 'i'; goto primitive;
- case 64: code = 'x'; goto primitive;
- default: goto bad_type;
- }
- primitive:
- obstack_1grow (obstack, code);
- break;
- case REAL_TYPE:
- switch (TYPE_PRECISION (type))
- {
- case 32: code = 'f'; goto primitive;
- case 64: code = 'd'; goto primitive;
- default: goto bad_type;
- }
- case POINTER_TYPE:
- type = TREE_TYPE (type);
- obstack_1grow (obstack, 'P');
- case RECORD_TYPE:
- if (TYPE_ARRAY_P (type))
- {
- obstack_grow (obstack, "t6JArray1Z", sizeof("t6JArray1Z")-1);
- append_gpp_mangled_type (obstack, TYPE_ARRAY_ELEMENT (type));
- }
- else
- {
- char *class_name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
- append_gpp_mangled_classtype (obstack, class_name);
- }
- break;
- bad_type:
- default:
- fatal ("internal error - trying to mangle unknown type");
- }
-}
-
-/* Build the mangled name of the `class' field. */
-
-static tree
-mangle_class_field (class)
- tree class;
-{
- tree name;
- obstack_grow (&temporary_obstack, "_CL_", 4);
- append_gpp_mangled_type (&temporary_obstack, class);
- obstack_1grow (&temporary_obstack, '\0');
- name = get_identifier (obstack_base (&temporary_obstack));
- obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
- return name;
-}
-
-/* Build the mangled (assembly-level) name of the static field FIELD. */
-
-static tree
-mangle_static_field (field)
- tree field;
-{
- tree class = DECL_CONTEXT (field);
- tree name = DECL_NAME (field);
- int encoded_len;
-#if ! defined (NO_DOLLAR_IN_LABEL) || ! defined (NO_DOT_IN_LABEL)
- obstack_1grow (&temporary_obstack, '_');
-#else
- obstack_grow (&temporary_obstack, "__static_", 9);
-#endif
- append_gpp_mangled_type (&temporary_obstack, class);
- encoded_len = unicode_mangling_length (IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name));
- if (encoded_len > 0)
- {
- obstack_1grow (&temporary_obstack, 'U');
- }
-#ifndef NO_DOLLAR_IN_LABEL
- obstack_1grow (&temporary_obstack, '$');
-#else /* NO_DOLLAR_IN_LABEL */
-#ifndef NO_DOT_IN_LABEL
- obstack_1grow (&temporary_obstack, '.');
-#else /* NO_DOT_IN_LABEL */
- obstack_1grow (&temporary_obstack, '_');
-#endif /* NO_DOT_IN_LABEL */
-#endif /* NO_DOLLAR_IN_LABEL */
- if (encoded_len > 0)
- {
- emit_unicode_mangled_name (&temporary_obstack,
- IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name));
- }
- else
- {
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name));
- }
- obstack_1grow (&temporary_obstack, '\0');
- name = get_identifier (obstack_base (&temporary_obstack));
- obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
- return name;
-}
-
-/* Build a VAR_DECL for the dispatch table (vtable) for class TYPE. */
-
-tree
-build_dtable_decl (type)
- tree type;
-{
- tree name;
- obstack_grow (&temporary_obstack, "__vt_", 5);
- append_gpp_mangled_type (&temporary_obstack, type);
- obstack_1grow (&temporary_obstack, '\0');
- name = get_identifier (obstack_base (&temporary_obstack));
- obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
- return build_decl (VAR_DECL, name, dtable_type);
-}
-
-/* Pre-pend the TYPE_FIELDS of THIS_CLASS with a dummy FIELD_DECL for the
- fields inherited from SUPER_CLASS. */
-
-void
-push_super_field (this_class, super_class)
- tree this_class, super_class;
-{
- tree base_decl;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- base_decl = build_decl (FIELD_DECL, NULL_TREE, super_class);
- pop_obstacks ();
- DECL_IGNORED_P (base_decl) = 1;
- TREE_CHAIN (base_decl) = TYPE_FIELDS (this_class);
- TYPE_FIELDS (this_class) = base_decl;
- DECL_SIZE (base_decl) = TYPE_SIZE (super_class);
-}
-
-/* Handle the different manners we may have to lay out a super class. */
-
-static tree
-maybe_layout_super_class (super_class, this_class)
- tree super_class;
- tree this_class;
-{
- if (TREE_CODE (super_class) == RECORD_TYPE)
- {
- if (!CLASS_LOADED_P (super_class)
- && CLASS_FROM_SOURCE_P (super_class))
- safe_layout_class (super_class);
- if (!CLASS_LOADED_P (super_class))
- load_class (super_class, 1);
- }
- /* We might have to layout the class before its dependency on
- the super class gets resolved by java_complete_class */
- else if (TREE_CODE (super_class) == POINTER_TYPE)
- {
- if (TREE_TYPE (super_class) != NULL_TREE)
- super_class = TREE_TYPE (super_class);
- else
- {
- super_class = do_resolve_class (super_class, NULL_TREE, this_class);
- if (!super_class)
- return NULL_TREE; /* FIXME, NULL_TREE not checked by caller. */
- super_class = TREE_TYPE (super_class);
- }
- }
- if (!TYPE_SIZE (super_class))
- safe_layout_class (super_class);
-
- return super_class;
-}
-
-void
-layout_class (this_class)
- tree this_class;
-{
- tree super_class = CLASSTYPE_SUPER (this_class);
- tree field;
-
- if (super_class)
- {
- super_class = maybe_layout_super_class (super_class, this_class);
- if (TREE_CODE (TYPE_SIZE (super_class)) == ERROR_MARK)
- {
- TYPE_SIZE (this_class) = error_mark_node;
- return;
- }
- if (TYPE_SIZE (this_class) == NULL_TREE)
- push_super_field (this_class, super_class);
- }
-
- for (field = TYPE_FIELDS (this_class);
- field != NULL_TREE; field = TREE_CHAIN (field))
- {
- if (FIELD_STATIC (field))
- {
- /* Set DECL_ASSEMBLER_NAME to something suitably mangled. */
- DECL_ASSEMBLER_NAME (field) = mangle_static_field (field);
- }
- }
-
- layout_type (this_class);
-}
-
-void
-layout_class_methods (this_class)
- tree this_class;
-{
- tree method_decl, dtable_count;
- tree super_class, handle_type;
-
- if (TYPE_NVIRTUALS (this_class))
- return;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- super_class = CLASSTYPE_SUPER (this_class);
- handle_type = CLASS_TO_HANDLE_TYPE (this_class);
-
- if (super_class)
- {
- super_class = maybe_layout_super_class (super_class, this_class);
- if (!TYPE_NVIRTUALS (super_class))
- layout_class_methods (super_class);
- dtable_count = TYPE_NVIRTUALS (super_class);
- }
- else
- dtable_count = integer_zero_node;
-
- TYPE_METHODS (handle_type) = nreverse (TYPE_METHODS (handle_type));
-
- for (method_decl = TYPE_METHODS (handle_type);
- method_decl; method_decl = TREE_CHAIN (method_decl))
- dtable_count = layout_class_method (this_class, super_class,
- method_decl, dtable_count);
-
- TYPE_NVIRTUALS (this_class) = dtable_count;
-
-#ifdef JAVA_USE_HANDLES
- layout_type (handle_type);
-#endif
- pop_obstacks ();
-}
-
-/* Lay METHOD_DECL out, returning a possibly new value of
- DTABLE_COUNT. */
-
-tree
-layout_class_method (this_class, super_class, method_decl, dtable_count)
- tree this_class, super_class, method_decl, dtable_count;
-{
- char *ptr;
- char *asm_name;
- tree arg, arglist, t;
- int method_name_needs_escapes = 0;
- tree method_name = DECL_NAME (method_decl);
- int method_name_is_wfl =
- (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION);
- if (method_name_is_wfl)
- method_name = java_get_real_method_name (method_decl);
-
- if (method_name != init_identifier_node
- && method_name != finit_identifier_node)
- {
- int encoded_len
- = unicode_mangling_length (IDENTIFIER_POINTER (method_name),
- IDENTIFIER_LENGTH (method_name));
- if (encoded_len > 0)
- {
- method_name_needs_escapes = 1;
- emit_unicode_mangled_name (&temporary_obstack,
- IDENTIFIER_POINTER (method_name),
- IDENTIFIER_LENGTH (method_name));
- }
- else
- {
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (method_name),
- IDENTIFIER_LENGTH (method_name));
- }
- }
-
- obstack_grow (&temporary_obstack, "__", 2);
- if (method_name == finit_identifier_node)
- obstack_grow (&temporary_obstack, "finit", 5);
- append_gpp_mangled_type (&temporary_obstack, this_class);
- TREE_PUBLIC (method_decl) = 1;
-
- t = TREE_TYPE (method_decl);
- arglist = TYPE_ARG_TYPES (t);
- if (TREE_CODE (t) == METHOD_TYPE)
- arglist = TREE_CHAIN (arglist);
- for (arg = arglist; arg != end_params_node; )
- {
- tree a = arglist;
- tree argtype = TREE_VALUE (arg);
- int tindex = 1;
- if (TREE_CODE (argtype) == POINTER_TYPE)
- {
- /* This is O(N**2). Do we care? Cfr gcc/cp/method.c. */
- while (a != arg && argtype != TREE_VALUE (a))
- a = TREE_CHAIN (a), tindex++;
- }
- else
- a = arg;
- if (a != arg)
- {
- char buf[12];
- int nrepeats = 0;
- do
- {
- arg = TREE_CHAIN (arg); nrepeats++;
- }
- while (arg != end_params_node && argtype == TREE_VALUE (arg));
- if (nrepeats > 1)
- {
- obstack_1grow (&temporary_obstack, 'N');
- sprintf (buf, "%d", nrepeats);
- obstack_grow (&temporary_obstack, buf, strlen (buf));
- if (nrepeats > 9)
- obstack_1grow (&temporary_obstack, '_');
- }
- else
- obstack_1grow (&temporary_obstack, 'T');
- sprintf (buf, "%d", tindex);
- obstack_grow (&temporary_obstack, buf, strlen (buf));
- if (tindex > 9)
- obstack_1grow (&temporary_obstack, '_');
- }
- else
- {
- append_gpp_mangled_type (&temporary_obstack, argtype);
- arg = TREE_CHAIN (arg);
- }
- }
- if (method_name_needs_escapes)
- obstack_1grow (&temporary_obstack, 'U');
-
- obstack_1grow (&temporary_obstack, '\0');
- asm_name = obstack_finish (&temporary_obstack);
- DECL_ASSEMBLER_NAME (method_decl) = get_identifier (asm_name);
- /* We don't generate a RTL for the method if it's abstract, or if
- it's an interface method that isn't clinit. */
- if (! METHOD_ABSTRACT (method_decl)
- || (CLASS_INTERFACE (TYPE_NAME (this_class))
- && (IS_CLINIT (method_decl))))
- make_function_rtl (method_decl);
- obstack_free (&temporary_obstack, asm_name);
-
- if (method_name == init_identifier_node)
- {
- char *p = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class)));
- for (ptr = p; *ptr; )
- {
- if (*ptr++ == '.')
- p = ptr;
- }
- if (method_name_is_wfl)
- EXPR_WFL_NODE (DECL_NAME (method_decl)) = get_identifier (p);
- else
- DECL_NAME (method_decl) = get_identifier (p);
- DECL_CONSTRUCTOR_P (method_decl) = 1;
- build_java_argument_signature (TREE_TYPE (method_decl));
- }
- else if (! METHOD_STATIC (method_decl) && !DECL_ARTIFICIAL (method_decl))
- {
- tree method_sig =
- build_java_argument_signature (TREE_TYPE (method_decl));
- tree super_method = lookup_argument_method (super_class, method_name,
- method_sig);
- if (super_method != NULL_TREE && ! METHOD_PRIVATE (super_method))
- {
- DECL_VINDEX (method_decl) = DECL_VINDEX (super_method);
- if (DECL_VINDEX (method_decl) == NULL_TREE
- && !CLASS_FROM_SOURCE_P (this_class))
- error_with_decl (method_decl,
- "non-static method '%s' overrides static method");
-#if 0
- else if (TREE_TYPE (TREE_TYPE (method_decl))
- != TREE_TYPE (TREE_TYPE (super_method)))
- {
- error_with_decl (method_decl,
- "Method `%s' redefined with different return type");
- error_with_decl (super_method,
- "Overridden decl is here");
- }
-#endif
- }
- else if (! METHOD_FINAL (method_decl)
- && ! METHOD_PRIVATE (method_decl)
- && ! CLASS_FINAL (TYPE_NAME (this_class))
- && dtable_count)
- {
- DECL_VINDEX (method_decl) = dtable_count;
- dtable_count = build_int_2 (1+TREE_INT_CST_LOW (dtable_count), 0);
- }
- }
- return dtable_count;
-}
-
-static tree registered_class = NULL_TREE;
-
-void
-register_class ()
-{
- static tree end;
- tree node = TREE_OPERAND (build_class_ref (current_class), 0);
- tree current = copy_node (node);
-
- XEXP (DECL_RTL (current), 0) = copy_rtx (XEXP (DECL_RTL(node), 0));
- if (!registered_class)
- registered_class = current;
- else
- TREE_CHAIN (end) = current;
-
- end = current;
-}
-
-/* Generate a function that gets called at start-up (static contructor) time,
- which calls registerClass for all the compiled classes. */
-
-void
-emit_register_classes ()
-{
- extern tree get_file_function_name PROTO((int));
- tree init_name = get_file_function_name ('I');
- tree init_type = build_function_type (void_type_node, end_params_node);
- tree init_decl;
- tree t;
-
- start_sequence ();
- init_decl = build_decl (FUNCTION_DECL, init_name, init_type);
- DECL_ASSEMBLER_NAME (init_decl) = init_name;
- TREE_STATIC (init_decl) = 1;
- current_function_decl = init_decl;
- DECL_RESULT (init_decl) = build_decl(RESULT_DECL, NULL_TREE, void_type_node);
- /* DECL_EXTERNAL (init_decl) = 1;*/
- TREE_PUBLIC (init_decl) = 1;
- pushlevel (0);
- make_function_rtl (init_decl);
- init_function_start (init_decl, input_filename, 0);
- expand_function_start (init_decl, 0);
-
- for ( t = registered_class; t; t = TREE_CHAIN (t))
- emit_library_call (registerClass_libfunc, 0, VOIDmode, 1,
- XEXP (DECL_RTL (t), 0), Pmode);
-
- expand_function_end (input_filename, 0, 0);
- poplevel (1, 0, 1);
- {
- /* Force generation, even with -O3 or deeper. Gross hack. FIXME */
- int saved_flag = flag_inline_functions;
- flag_inline_functions = 0;
- rest_of_compilation (init_decl);
- flag_inline_functions = saved_flag;
- }
- current_function_decl = NULL_TREE;
- assemble_constructor (IDENTIFIER_POINTER (init_name));
-}
-
-void
-init_class_processing ()
-{
- registerClass_libfunc = gen_rtx (SYMBOL_REF, Pmode, "_Jv_RegisterClass");
-}
diff --git a/gnu/dist/toolchain/gcc/java/config-lang.in b/gnu/dist/toolchain/gcc/java/config-lang.in
deleted file mode 100644
index 07f77493037..00000000000
--- a/gnu/dist/toolchain/gcc/java/config-lang.in
+++ /dev/null
@@ -1,40 +0,0 @@
-# Top level configure fragment for the GNU compiler for the Java(TM)
-# language.
-# Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-
-#This file is part of GNU CC.
-
-#GNU CC is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2, or (at your option)
-#any later version.
-
-#GNU CC is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with GNU CC; see the file COPYING. If not, write to
-#the Free Software Foundation, 59 Temple Place - Suite 330,
-#Boston, MA 02111-1307, USA.
-
-#Java and all Java-based marks are trademarks or registered trademarks
-#of Sun Microsystems, Inc. in the United States and other countries.
-#The Free Software Foundation is independent of Sun Microsystems, Inc.
-
-# Configure looks for the existence of this file to auto-config each language.
-# We define several parameters used by configure:
-#
-# language - name of language as it would appear in $(LANGUAGES)
-# compilers - value to add to $(COMPILERS)
-# stagestuff - files to add to $(STAGESTUFF)
-# diff_excludes - files to ignore when building diffs between two versions.
-
-language="java"
-
-compilers="jc1\$(exeext) jvgenmain\$(exeext)"
-
-stagestuff="jc1\$(exeext) gcj\$(exeext) jvgenmain\$(exeext) gcjh\$(exeext) jv-scan\$(exeext) jcf-dump\$(exeext)"
-
-outputs=java/Makefile
diff --git a/gnu/dist/toolchain/gcc/java/constants.c b/gnu/dist/toolchain/gcc/java/constants.c
deleted file mode 100644
index a1f820e0dd2..00000000000
--- a/gnu/dist/toolchain/gcc/java/constants.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/* Handle the constant pool of the Java(TM) Virtual Machine.
- Copyright (C) 1997 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#include "config.h"
-#include "system.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "toplev.h"
-
-extern struct obstack permanent_obstack;
-
-static void set_constant_entry PROTO ((CPool *, int, int, jword));
-static int find_class_or_string_constant PROTO ((CPool *, int, tree));
-static int find_name_and_type_constant PROTO ((CPool *, tree, tree));
-static tree get_tag_node PROTO ((int));
-static tree build_constant_data_ref PROTO ((void));
-
-/* Set the INDEX'th constant in CPOOL to have the given TAG and VALUE. */
-
-static void
-set_constant_entry (cpool, index, tag, value)
- CPool *cpool;
- int index;
- int tag;
- jword value;
-{
- if (cpool->data == NULL)
- {
- cpool->capacity = 100;
- cpool->tags = (uint8*) xmalloc (sizeof(uint8) * cpool->capacity);
- cpool->data = (jword*) xmalloc (sizeof(jword) * cpool->capacity);
- cpool->count = 1;
- }
- if (index >= cpool->capacity)
- {
- cpool->capacity *= 2;
- if (index >= cpool->capacity)
- cpool->capacity = index + 10;
- cpool->tags = (uint8*) xrealloc (cpool->tags,
- sizeof(uint8) * cpool->capacity);
- cpool->data = (jword*) xrealloc (cpool->data,
- sizeof(jword) * cpool->capacity);
- }
- if (index >= cpool->count)
- cpool->count = index + 1;
- cpool->tags[index] = tag;
- cpool->data[index] = value;
-}
-
-/* Find (or create) a constant pool entry matching TAG and VALUE. */
-
-int
-find_constant1 (cpool, tag, value)
- CPool *cpool;
- int tag;
- jword value;
-{
- int i;
- for (i = cpool->count; --i > 0; )
- {
- if (cpool->tags[i] == tag && cpool->data[i] == value)
- return i;
- }
- i = cpool->count == 0 ? 1 : cpool->count;
- set_constant_entry (cpool, i, tag, value);
- return i;
-}
-
-/* Find a double-word constant pool entry matching TAG and WORD1/WORD2. */
-
-int
-find_constant2 (cpool, tag, word1, word2)
- CPool *cpool;
- int tag;
- jword word1, word2;
-{
- int i;
- for (i = cpool->count - 1; --i > 0; )
- {
- if (cpool->tags[i] == tag
- && cpool->data[i] == word1
- && cpool->data[i+1] == word2)
- return i;
- }
- i = cpool->count == 0 ? 1 : cpool->count;
- set_constant_entry (cpool, i, tag, word1);
- set_constant_entry (cpool, i+1, 0, word2);
- return i;
-}
-
-int
-find_utf8_constant (cpool, name)
- CPool *cpool;
- tree name;
-{
- if (name == NULL_TREE)
- return 0;
- return find_constant1 (cpool, CONSTANT_Utf8, (jword) name);
-}
-
-static int
-find_class_or_string_constant (cpool, tag, name)
- CPool *cpool;
- int tag;
- tree name;
-{
- int j = find_utf8_constant (cpool, name);
- int i;
- for (i = cpool->count; --i > 0; )
- {
- if (cpool->tags[i] == tag && cpool->data[i] == (jword) j)
- return i;
- }
- i = cpool->count;
- set_constant_entry (cpool, i, tag, (jword) j);
- return i;
-}
-
-int
-find_class_constant (cpool, type)
- CPool *cpool;
- tree type;
-{
- return find_class_or_string_constant (cpool, CONSTANT_Class,
- build_internal_class_name (type));
-}
-
-/* Allocate a CONSTANT_string entry given a STRING_CST. */
-
-int
-find_string_constant (cpool, string)
- CPool *cpool;
- tree string;
-{
- string = get_identifier (TREE_STRING_POINTER (string));
- return find_class_or_string_constant (cpool, CONSTANT_String, string);
-
-}
-
-/* Find (or create) a CONSTANT_NameAndType matching NAME and TYPE.
- Return its index in the constant pool CPOOL. */
-
-static int
-find_name_and_type_constant (cpool, name, type)
- CPool *cpool;
- tree name;
- tree type;
-{
- int name_index = find_utf8_constant (cpool, name);
- int type_index = find_utf8_constant (cpool, build_java_signature (type));
- return find_constant1 (cpool, CONSTANT_NameAndType,
- (name_index << 16) | type_index);
-}
-
-/* Find (or create) a CONSTANT_Fieldref for DECL (a FIELD_DECL or VAR_DECL).
- Return its index in the constant pool CPOOL. */
-
-int
-find_fieldref_index (cpool, decl)
- CPool *cpool;
- tree decl;
-{
- int class_index = find_class_constant (cpool, DECL_CONTEXT (decl));
- int name_type_index
- = find_name_and_type_constant (cpool, DECL_NAME (decl), TREE_TYPE (decl));
- return find_constant1 (cpool, CONSTANT_Fieldref,
- (class_index << 16) | name_type_index);
-}
-
-/* Find (or create) a CONSTANT_Methodref for DECL (a FUNCTION_DECL).
- Return its index in the constant pool CPOOL. */
-
-int
-find_methodref_index (cpool, decl)
- CPool *cpool;
- tree decl;
-{
- tree mclass = DECL_CONTEXT (decl);
- int class_index = find_class_constant (cpool, mclass);
- tree name = DECL_CONSTRUCTOR_P (decl) ? init_identifier_node
- : DECL_NAME (decl);
- int name_type_index
- = find_name_and_type_constant (cpool, name, TREE_TYPE (decl));
- return find_constant1 (cpool,
- CLASS_INTERFACE (TYPE_NAME (mclass))
- ? CONSTANT_InterfaceMethodref
- : CONSTANT_Methodref,
- (class_index << 16) | name_type_index);
-}
-
-#define PUT1(X) (*ptr++ = (X))
-#define PUT2(X) (PUT1((X) >> 8), PUT1(X))
-#define PUT4(X) (PUT2((X) >> 16), PUT2(X))
-#define PUTN(P, N) (bcopy(P, ptr, N), ptr += (N))
-
-/* Give the number of bytes needed in a .class file for the CPOOL
- constant pool. Includes the 2-byte constant_pool_count. */
-
-int
-count_constant_pool_bytes (cpool)
- CPool *cpool;
-{
- int size = 2;
- int i = 1;
- for ( ; i < cpool->count; i++)
- {
- size++;
- switch (cpool->tags[i])
- {
- case CONSTANT_NameAndType:
- case CONSTANT_Fieldref:
- case CONSTANT_Methodref:
- case CONSTANT_InterfaceMethodref:
- case CONSTANT_Float:
- case CONSTANT_Integer:
- size += 4;
- break;
- case CONSTANT_Class:
- case CONSTANT_String:
- size += 2;
- break;
- case CONSTANT_Long:
- case CONSTANT_Double:
- size += 8;
- i++;
- break;
- case CONSTANT_Utf8:
- {
- tree t = (tree) cpool->data[i];
- int len = IDENTIFIER_LENGTH (t);
- size += len + 2;
- }
- break;
- default:
- /* Second word of CONSTANT_Long and CONSTANT_Double. */
- size--;
- }
- }
- return size;
-}
-
-/* Write the constant pool CPOOL into BUFFER.
- The length of BUFFER is LENGTH, which must match the needed length. */
-
-void
-write_constant_pool (cpool, buffer, length)
- CPool *cpool;
- unsigned char* buffer;
- int length;
-{
- unsigned char* ptr = buffer;
- int i = 1;
- jword *datap = &cpool->data[1];
- PUT2 (cpool->count);
- for ( ; i < cpool->count; i++, datap++)
- {
- int tag = cpool->tags[i];
- PUT1 (tag);
- switch (tag)
- {
- case CONSTANT_NameAndType:
- case CONSTANT_Fieldref:
- case CONSTANT_Methodref:
- case CONSTANT_InterfaceMethodref:
- case CONSTANT_Float:
- case CONSTANT_Integer:
- PUT4 (*datap);
- break;
- case CONSTANT_Class:
- case CONSTANT_String:
- PUT2 (*datap);
- break;
- break;
- case CONSTANT_Long:
- case CONSTANT_Double:
- PUT4(*datap);
- i++;
- datap++;
- PUT4 (*datap);
- break;
- case CONSTANT_Utf8:
- {
- tree t = (tree) *datap;
- int len = IDENTIFIER_LENGTH (t);
- PUT2 (len);
- PUTN (IDENTIFIER_POINTER (t), len);
- }
- break;
- }
- }
- if (ptr != buffer + length)
- fatal("internal error - incorrect constant pool");
-}
-
-CPool *outgoing_cpool;
-
-/* If non-NULL, an ADDR_EXPR referencing a VAR_DECL containing
- the constant data array for the current class. */
-tree current_constant_pool_data_ref;
-
-/* A Cache for build_int_2 (CONSTANT_XXX, 0). */
-static tree tag_nodes[13];
-
-static tree
-get_tag_node (tag)
- int tag;
-{
- if (tag_nodes[tag] == NULL_TREE)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tag_nodes[tag] = build_int_2 (tag, 0);
- pop_obstacks ();
- }
- return tag_nodes[tag];
-}
-
-/* Look for a constant pool entry that matches TAG and NAME.
- Creates a new entry if not found.
- TAG is one of CONSTANT_Utf8, CONSTANT_String or CONSTANT_Class.
- NAME is an IDENTIFIER_NODE naming the Utf8 constant, string, or class.
- Returns the index of the entry. */
-
-int
-alloc_name_constant (tag, name)
- int tag;
- tree name;
-{
- return find_constant1 (outgoing_cpool, tag, (jword) name);
-}
-
-/* Build an identifier for the internal name of reference type TYPE. */
-
-tree
-build_internal_class_name (type)
- tree type;
-{
- tree name;
- if (TYPE_ARRAY_P (type))
- name = build_java_signature (type);
- else
- {
- name = TYPE_NAME (type);
- if (TREE_CODE (name) != IDENTIFIER_NODE)
- name = DECL_NAME (name);
- name = identifier_subst (name, "", '.', '/', "");
- }
- return name;
-}
-
-/* Look for a CONSTANT_Class entry for CLAS, creating a new one if needed. */
-
-int
-alloc_class_constant (clas)
- tree clas;
-{
- tree class_name = build_internal_class_name (clas);
-
- return alloc_name_constant (CONSTANT_Class,
- (unmangle_classname
- (IDENTIFIER_POINTER(class_name),
- IDENTIFIER_LENGTH(class_name))));
-}
-
-/* Return a reference to the data array of the current constant pool. */
-
-static tree
-build_constant_data_ref ()
-{
- if (current_constant_pool_data_ref == NULL_TREE)
- {
- tree decl;
- tree decl_name = mangled_classname ("_CD_", current_class);
- push_obstacks (&permanent_obstack, &permanent_obstack);
- decl = build_decl (VAR_DECL, decl_name,
- build_array_type (ptr_type_node,
- one_elt_array_domain_type));
- TREE_STATIC (decl) = 1;
- make_decl_rtl (decl, NULL, 1);
- pop_obstacks ();
- current_constant_pool_data_ref
- = build1 (ADDR_EXPR, ptr_type_node, decl);
- }
- return current_constant_pool_data_ref;
-}
-
-/* Get the pointer value at the INDEX'th element of the constant pool. */
-
-tree
-build_ref_from_constant_pool (index)
- int index;
-{
- tree t = build_constant_data_ref ();
- index *= int_size_in_bytes (ptr_type_node);
- t = fold (build (PLUS_EXPR, ptr_type_node,
- t, build_int_2 (index, 0)));
- return build1 (INDIRECT_REF, ptr_type_node, t);
-}
-
-/* Build an initializer for the constants field of the current constal pool.
- Should only be called at top-level, since it may emit declarations. */
-
-tree
-build_constants_constructor ()
-{
- tree tags_value, data_value;
- tree cons;
- tree tags_list = NULL_TREE;
- tree data_list = NULL_TREE;
- int i;
- for (i = outgoing_cpool->count; --i > 0; )
- {
- tags_list
- = tree_cons (NULL_TREE, get_tag_node (outgoing_cpool->tags[i]),
- tags_list);
- data_list
- = tree_cons (NULL_TREE, build_utf8_ref ((tree)outgoing_cpool->data[i]),
- data_list);
- }
- if (outgoing_cpool->count > 0)
- {
- tree index_type;
- tree data_decl, tags_decl, tags_type;
- tree max_index = build_int_2 (outgoing_cpool->count - 1, 0);
- TREE_TYPE (max_index) = sizetype;
- index_type = build_index_type (max_index);
-
- /* Add dummy 0'th element of constant pool. */
- tags_list = tree_cons (NULL_TREE, get_tag_node (0), tags_list);
- data_list = tree_cons (NULL_TREE, null_pointer_node, data_list);
-
- data_decl = TREE_OPERAND (build_constant_data_ref (), 0);
- TREE_TYPE (data_decl) = build_array_type (ptr_type_node, index_type),
- DECL_INITIAL (data_decl) = build (CONSTRUCTOR, TREE_TYPE (data_decl),
- NULL_TREE, data_list);
- DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
- rest_of_decl_compilation (data_decl, (char*) 0, 1, 0);
- data_value = build_address_of (data_decl);
-
- tags_type = build_array_type (unsigned_byte_type_node, index_type);
- tags_decl = build_decl (VAR_DECL, mangled_classname ("_CT_",
- current_class),
- tags_type);
- TREE_STATIC (tags_decl) = 1;
- DECL_INITIAL (tags_decl) = build (CONSTRUCTOR, tags_type,
- NULL_TREE, tags_list);
- rest_of_decl_compilation (tags_decl, (char*) 0, 1, 0);
- tags_value = build_address_of (tags_decl);
- }
- else
- {
- data_value = null_pointer_node;
- tags_value = null_pointer_node;
- }
- START_RECORD_CONSTRUCTOR (cons, constants_type_node);
- PUSH_FIELD_VALUE (cons, "size", build_int_2 (outgoing_cpool->count, 0));
- PUSH_FIELD_VALUE (cons, "tags", tags_value);
- PUSH_FIELD_VALUE (cons, "data", data_value);
- FINISH_RECORD_CONSTRUCTOR (cons);
- return cons;
-}
diff --git a/gnu/dist/toolchain/gcc/java/convert.h b/gnu/dist/toolchain/gcc/java/convert.h
deleted file mode 100644
index a627bc2aca8..00000000000
--- a/gnu/dist/toolchain/gcc/java/convert.h
+++ /dev/null
@@ -1,28 +0,0 @@
-
-/* Definition of conversion functions.
- Copyright (C) 1993 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* Written by Jeffrey Hsu <hsu@cygnus.com> */
-
-extern tree convert_to_boolean PROTO ((tree, tree));
-extern tree convert_to_char PROTO ((tree, tree));
-extern tree convert_to_integer PROTO ((tree type, tree expr));
-extern tree convert_to_real PROTO ((tree type, tree expr));
-extern tree convert_to_pointer PROTO ((tree type, tree expr));
diff --git a/gnu/dist/toolchain/gcc/java/decl.c b/gnu/dist/toolchain/gcc/java/decl.c
deleted file mode 100644
index de03e5fd007..00000000000
--- a/gnu/dist/toolchain/gcc/java/decl.c
+++ /dev/null
@@ -1,1675 +0,0 @@
-/* Process declarations and variables for the GNU compiler for the
- Java(TM) language.
-
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "toplev.h"
-#include "except.h"
-
-static tree push_jvm_slot PROTO ((int, tree));
-static tree builtin_function PROTO ((const char *, tree,
- enum built_in_function, const char *));
-static tree lookup_name_current_level PROTO ((tree));
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-/* The DECL_MAP is a mapping from (index, type) to a decl node.
- If index < max_locals, it is the index of a local variable.
- if index >= max_locals, then index-max_locals is a stack slot.
- The DECL_MAP mapping is represented as a TREE_VEC whose elements
- are a list of decls (VAR_DECL or PARM_DECL) chained by
- DECL_LOCAL_SLOT_CHAIN; the index finds the TREE_VEC element, and then
- we search the chain for a decl with a matching TREE_TYPE. */
-
-tree decl_map;
-
-/* A list of local variables VAR_DECLs for this method that we have seen
- debug information, but we have not reached their starting (byte) PC yet. */
-
-tree pending_local_decls = NULL_TREE;
-
-/* Push a local variable or stack slot into the decl_map,
- and assign it an rtl. */
-
-static tree
-push_jvm_slot (index, decl)
- int index;
- tree decl;
-{
- struct rtx_def *rtl = NULL;
- tree type = TREE_TYPE (decl);
- tree tmp;
-
- DECL_CONTEXT (decl) = current_function_decl;
- layout_decl (decl, 0);
-
- /* See if we have an appropriate rtl (i.e. same mode) at this index.
- If so, we must use it. */
- tmp = TREE_VEC_ELT (decl_map, index);
- while (tmp != NULL_TREE)
- {
- if (TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp)))
- rtl = DECL_RTL (tmp);
- if (rtl != NULL)
- break;
- tmp = DECL_LOCAL_SLOT_CHAIN (tmp);
- }
- if (rtl != NULL)
- DECL_RTL (decl) = rtl;
- else
- {
- if (index >= DECL_MAX_LOCALS (current_function_decl))
- DECL_REGISTER (decl) = 1;
- expand_decl (decl);
- }
-
- /* Now link the decl into the decl_map. */
- if (DECL_LANG_SPECIFIC (decl) == NULL)
- {
- DECL_LANG_SPECIFIC (decl)
- = (struct lang_decl *) permalloc (sizeof (struct lang_decl_var));
- DECL_LOCAL_START_PC (decl) = 0;
- DECL_LOCAL_END_PC (decl) = DECL_CODE_LENGTH (current_function_decl);
- DECL_LOCAL_SLOT_NUMBER (decl) = index;
- }
- DECL_LOCAL_SLOT_CHAIN (decl) = TREE_VEC_ELT (decl_map, index);
- TREE_VEC_ELT (decl_map, index) = decl;
- return decl;
-}
-
-/* Find a VAR_DECL (or PARM_DECL) at local index INDEX that has type TYPE,
- that is valid at PC (or -1 if any pc).
- If there is no existing matching decl, allocate one.
- If we find a decl with matching modes but different types,
- we re-use the rtl, but create a new decl. */
-
-tree
-find_local_variable (index, type, pc)
- int index;
- tree type;
- int pc;
-{
- tree decl = TREE_VEC_ELT (decl_map, index);
- tree best = NULL_TREE;
- while (decl != NULL_TREE)
- {
- int in_range;
- in_range = pc < 0
- || (pc >= DECL_LOCAL_START_PC (decl)
- && pc < DECL_LOCAL_END_PC (decl));
-
- if ((TREE_TYPE (decl) == type
- || (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
- && type == ptr_type_node))
- && in_range)
- {
- if (best == NULL_TREE
- || (TREE_TYPE (decl) == type && TREE_TYPE (best) != type)
- || DECL_LOCAL_START_PC (decl) > DECL_LOCAL_START_PC (best)
- || DECL_LOCAL_END_PC (decl) < DECL_LOCAL_START_PC (decl))
- best = decl;
- }
- decl = DECL_LOCAL_SLOT_CHAIN (decl);
- }
- if (best != NULL_TREE)
- return best;
- return push_jvm_slot (index, build_decl (VAR_DECL, NULL_TREE, type));
-}
-
-
-/* Same as find_local_index, except that INDEX is a stack index. */
-
-tree
-find_stack_slot (index, type)
- int index;
- tree type;
-{
- return find_local_variable (index + DECL_MAX_LOCALS (current_function_decl),
- type, -1);
-}
-
-struct binding_level
- {
- /* A chain of _DECL nodes for all variables, constants, functions,
- * and typedef types. These are in the reverse of the order supplied.
- */
- tree names;
-
- /* For each level, a list of shadowed outer-level local definitions
- to be restored when this level is popped.
- Each link is a TREE_LIST whose TREE_PURPOSE is an identifier and
- whose TREE_VALUE is its old definition (a kind of ..._DECL node). */
- tree shadowed;
-
- /* For each level (except not the global one),
- a chain of BLOCK nodes for all the levels
- that were entered and exited one level down. */
- tree blocks;
-
- /* The BLOCK node for this level, if one has been preallocated.
- If 0, the BLOCK is allocated (if needed) when the level is popped. */
- tree this_block;
-
- /* The binding level which this one is contained in (inherits from). */
- struct binding_level *level_chain;
-
- /* 1 means make a BLOCK for this level regardless of all else.
- 2 for temporary binding contours created by the compiler. */
- char keep;
-
- /* Nonzero means make a BLOCK if this level has any subblocks. */
- char keep_if_subblocks;
-
- /* Nonzero if this level can safely have additional
- cleanup-needing variables added to it. */
- char more_cleanups_ok;
- char have_cleanups;
-
- /* The bytecode PC that marks the end of this level. */
- int end_pc;
- };
-
-#define NULL_BINDING_LEVEL (struct binding_level *) NULL
-
-/* The binding level currently in effect. */
-
-static struct binding_level *current_binding_level;
-
-/* A chain of binding_level structures awaiting reuse. */
-
-static struct binding_level *free_binding_level;
-
-/* The outermost binding level, for names of file scope.
- This is created when the compiler is started and exists
- through the entire run. */
-
-static struct binding_level *global_binding_level;
-
-/* Binding level structures are initialized by copying this one. */
-
-static struct binding_level clear_binding_level
- = {NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE,
- NULL_BINDING_LEVEL, 0, 0, 0, 0, 1000000000};
-
-#if 0
-/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function
- that have names. Here so we can clear out their names' definitions
- at the end of the function. */
-
-static tree named_labels;
-
-/* A list of LABEL_DECLs from outer contexts that are currently shadowed. */
-
-static tree shadowed_labels;
-#endif
-
-int flag_traditional;
-
-/* Nonzero means unconditionally make a BLOCK for the next level pushed. */
-
-static int keep_next_level_flag;
-
-/* Nonzero means make a BLOCK for the next level pushed
- if it has subblocks. */
-
-static int keep_next_if_subblocks;
-
-/* The FUNCTION_DECL for the function currently being compiled,
- or 0 if between functions. */
-tree current_function_decl;
-
-/* The type node for the ordinary character type. */
-tree char_type_node;
-
-tree object_type_node;
-tree unqualified_object_id_node;
-tree object_ptr_type_node;
-tree string_type_node;
-tree string_ptr_type_node;
-tree throwable_type_node;
-tree runtime_exception_type_node;
-tree error_exception_type_node;
-tree *predef_filenames;
-int predef_filenames_size;
-
-tree boolean_type_node;
-
-tree float_type_node;
-tree double_type_node;
-
-/* a VOID_TYPE node. */
-
-tree void_type_node;
-tree ptr_type_node;
-tree return_address_type_node;
-
-tree integer_type_node;
-
-tree byte_type_node;
-tree short_type_node;
-tree int_type_node;
-tree long_type_node;
-
-tree promoted_byte_type_node;
-tree promoted_short_type_node;
-tree promoted_char_type_node;
-tree promoted_boolean_type_node;
-
-tree unsigned_byte_type_node;
-tree unsigned_short_type_node;
-tree unsigned_int_type_node;
-tree unsigned_long_type_node;
-
-/* The type for struct methodtable. */
-tree methodtable_type;
-tree methodtable_ptr_type;
-
-tree utf8const_type;
-tree utf8const_ptr_type;
-tree class_type_node;
-tree class_ptr_type;
-tree field_type_node;
-tree field_ptr_type_node;
-tree field_info_union_node;
-tree jexception_type;
-tree jexception_ptr_type;
-tree lineNumberEntry_type;
-tree lineNumbers_type;
-tree constants_type_node;
-tree dtable_type;
-tree dtable_ptr_type;
-tree method_type_node;
-tree method_ptr_type_node;
-tree nativecode_ptr_array_type_node;
-tree one_elt_array_domain_type;
-tree access_flags_type_node;
-tree class_dtable_decl;
-
-/* a node which has tree code ERROR_MARK, and whose type is itself.
- All erroneous expressions are replaced with this node. All functions
- that accept nodes as arguments should avoid generating error messages
- if this node is one of the arguments, since it is undesirable to get
- multiple error messages from one error in the input. */
-
-tree error_mark_node;
-
-/* Two expressions that are constants with value zero.
- The first is of type `int', the second of type `void *'.
- Other of type `long', `float' and `double' follow. */
-tree integer_zero_node;
-tree null_pointer_node;
-tree long_zero_node;
-tree float_zero_node;
-tree double_zero_node;
-
-tree empty_stmt_node;
-
-/* Nodes for boolean constants TRUE and FALSE. */
-tree boolean_true_node, boolean_false_node;
-
-tree TYPE_identifier_node;
-tree init_identifier_node;
-tree clinit_identifier_node;
-tree finit_identifier_node;
-tree void_signature_node;
-tree length_identifier_node;
-tree this_identifier_node;
-tree super_identifier_node;
-tree continue_identifier_node;
-
-tree end_params_node;
-
-/* References to internal libjava functions we use. */
-tree alloc_object_node;
-tree soft_instanceof_node;
-tree soft_checkcast_node;
-tree soft_initclass_node;
-tree soft_newarray_node;
-tree soft_anewarray_node;
-tree soft_multianewarray_node;
-tree soft_badarrayindex_node;
-tree throw_node;
-tree soft_checkarraystore_node;
-tree soft_monitorenter_node;
-tree soft_monitorexit_node;
-tree soft_lookupinterfacemethod_node;
-tree soft_fmod_node;
-tree soft_exceptioninfo_call_node;
-
-/* Build (and pushdecl) a "promoted type" for all standard
- types shorter than int. */
-
-static tree
-push_promoted_type (name, actual_type)
- char *name;
- tree actual_type;
-{
- tree type = make_node (TREE_CODE (actual_type));
-#if 1
- tree in_min = TYPE_MIN_VALUE (int_type_node);
- tree in_max = TYPE_MAX_VALUE (int_type_node);
-#else
- tree in_min = TYPE_MIN_VALUE (actual_type);
- tree in_max = TYPE_MAX_VALUE (actual_type);
-#endif
- TYPE_MIN_VALUE (type) = build_int_2 (TREE_INT_CST_LOW (in_min),
- TREE_INT_CST_HIGH (in_min));
- TREE_TYPE (TYPE_MIN_VALUE (type)) = type;
- TYPE_MAX_VALUE (type) = build_int_2 (TREE_INT_CST_LOW (in_max),
- TREE_INT_CST_HIGH (in_max));
- TREE_TYPE (TYPE_MAX_VALUE (type)) = type;
- TYPE_PRECISION (type) = TYPE_PRECISION (int_type_node);
- layout_type (type);
- pushdecl (build_decl (TYPE_DECL, get_identifier (name), type));
- return type;
-}
-
-/* Nodes for integer constants. */
-tree integer_one_node, integer_two_node, integer_four_node;
-tree integer_negative_one_node;
-
-/* Return a definition for a builtin function named NAME and whose data type
- is TYPE. TYPE should be a function type with argument types.
- FUNCTION_CODE tells later passes how to compile calls to this function.
- See tree.h for its possible values.
-
- If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
- the name to be called if we can't opencode the function. */
-
-static tree
-builtin_function (name, type, function_code, library_name)
- const char *name;
- tree type;
- enum built_in_function function_code;
- const char *library_name;
-{
- tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- if (library_name)
- DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
- make_decl_rtl (decl, NULL_PTR, 1);
- pushdecl (decl);
- if (function_code != NOT_BUILT_IN)
- {
- DECL_BUILT_IN (decl) = 1;
- DECL_FUNCTION_CODE (decl) = function_code;
- }
- return decl;
-}
-
-void
-init_decl_processing ()
-{
- register tree endlink;
- tree field = NULL_TREE;
- tree t;
-
- current_function_decl = NULL;
- current_binding_level = NULL_BINDING_LEVEL;
- free_binding_level = NULL_BINDING_LEVEL;
- pushlevel (0); /* make the binding_level structure for global names */
- global_binding_level = current_binding_level;
-
- error_mark_node = make_node (ERROR_MARK);
- TREE_TYPE (error_mark_node) = error_mark_node;
-
- /* Create sizetype first - needed for other types. */
- sizetype = make_unsigned_type (POINTER_SIZE);
- size_zero_node = build_int_2 (0, 0);
- TREE_TYPE (size_zero_node) = sizetype;
- size_one_node = build_int_2 (1, 0);
- TREE_TYPE (size_one_node) = sizetype;
-
- byte_type_node = make_signed_type (8);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("byte"), byte_type_node));
- short_type_node = make_signed_type (16);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("short"), short_type_node));
- int_type_node = make_signed_type (32);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("int"), int_type_node));
- long_type_node = make_signed_type (64);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("long"), long_type_node));
-
- unsigned_byte_type_node = make_unsigned_type (8);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned byte"),
- unsigned_byte_type_node));
- unsigned_short_type_node = make_unsigned_type (16);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned short"),
- unsigned_short_type_node));
- unsigned_int_type_node = make_unsigned_type (32);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"),
- unsigned_int_type_node));
- unsigned_long_type_node = make_unsigned_type (64);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned long"),
- unsigned_long_type_node));
-
- integer_type_node = type_for_size (INT_TYPE_SIZE, 0);
-
- integer_zero_node = build_int_2 (0, 0);
- integer_one_node = build_int_2 (1, 0);
- integer_two_node = build_int_2 (2, 0);
- integer_four_node = build_int_2 (4, 0);
- integer_negative_one_node = build_int_2 (-1, 0);
-
- long_zero_node = build_int_2 (0, 0);
- TREE_TYPE (long_zero_node) = long_type_node;
-
- void_type_node = make_node (VOID_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("void"), void_type_node));
- layout_type (void_type_node); /* Uses size_zero_node */
- ptr_type_node = build_pointer_type (void_type_node);
- t = make_node (VOID_TYPE);
- layout_type (t); /* Uses size_zero_node */
- return_address_type_node = build_pointer_type (t);
-
- null_pointer_node = build_int_2 (0, 0);
- TREE_TYPE (null_pointer_node) = ptr_type_node;
-
- /* Used by the parser to represent empty statements and blocks. */
- empty_stmt_node = build1 (NOP_EXPR, void_type_node, size_zero_node);
- CAN_COMPLETE_NORMALLY (empty_stmt_node) = 1;
-
-#if 0
- /* Make a type to be the domain of a few array types
- whose domains don't really matter.
- 200 is small enough that it always fits in size_t
- and large enough that it can hold most function names for the
- initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */
- short_array_type_node = build_prim_array_type (short_type_node, 200);
-#endif
- char_type_node = make_node (CHAR_TYPE);
- TYPE_PRECISION (char_type_node) = 16;
- fixup_unsigned_type (char_type_node);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), char_type_node));
-
- boolean_type_node = make_node (BOOLEAN_TYPE);
- TYPE_PRECISION (boolean_type_node) = 1;
- fixup_unsigned_type (boolean_type_node);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("boolean"),
- boolean_type_node));
- boolean_false_node = TYPE_MIN_VALUE (boolean_type_node);
- boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
-
- promoted_byte_type_node
- = push_promoted_type ("promoted_byte", byte_type_node);
- promoted_short_type_node
- = push_promoted_type ("promoted_short", short_type_node);
- promoted_char_type_node
- = push_promoted_type ("promoted_char", char_type_node);
- promoted_boolean_type_node
- = push_promoted_type ("promoted_boolean", boolean_type_node);
-
- float_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (float_type_node) = 32;
- pushdecl (build_decl (TYPE_DECL, get_identifier ("float"),
- float_type_node));
- layout_type (float_type_node);
-
- double_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (double_type_node) = 64;
- pushdecl (build_decl (TYPE_DECL, get_identifier ("double"),
- double_type_node));
- layout_type (double_type_node);
-
- float_zero_node = build_real (float_type_node, dconst0);
- double_zero_node = build_real (double_type_node, dconst0);
-
- /* As your adding items here, please update the code right after
- this section, so that the filename containing the source code of
- the pre-defined class gets registered correctly. */
- unqualified_object_id_node = get_identifier ("Object");
- object_type_node = lookup_class (get_identifier ("java.lang.Object"));
- object_ptr_type_node = promote_type (object_type_node);
- string_type_node = lookup_class (get_identifier ("java.lang.String"));
- string_ptr_type_node = promote_type (string_type_node);
- class_type_node = lookup_class (get_identifier ("java.lang.Class"));
- throwable_type_node = lookup_class (get_identifier ("java.lang.Throwable"));
- runtime_exception_type_node =
- lookup_class (get_identifier ("java.lang.RuntimeException"));
- error_exception_type_node =
- lookup_class (get_identifier ("java.lang.Error"));
-
- /* This section has to be updated as items are added to the previous
- section. */
- predef_filenames_size = 6;
- predef_filenames = (tree *)xmalloc (predef_filenames_size * sizeof (tree));
- predef_filenames [0] = get_identifier ("java/lang/Class.java");
- predef_filenames [1] = get_identifier ("java/lang/Error.java");
- predef_filenames [2] = get_identifier ("java/lang/Object.java");
- predef_filenames [3] = get_identifier ("java/lang/RuntimeException.java");
- predef_filenames [4] = get_identifier ("java/lang/String.java");
- predef_filenames [5] = get_identifier ("java/lang/Throwable.java");
-
- methodtable_type = make_node (RECORD_TYPE);
- layout_type (methodtable_type);
- build_decl (TYPE_DECL, get_identifier ("methodtable"), methodtable_type);
- methodtable_ptr_type = build_pointer_type (methodtable_type);
-
- TYPE_identifier_node = get_identifier ("TYPE");
- init_identifier_node = get_identifier ("<init>");
- clinit_identifier_node = get_identifier ("<clinit>");
- finit_identifier_node = get_identifier ("$finit$");
- void_signature_node = get_identifier ("()V");
- length_identifier_node = get_identifier ("length");
- this_identifier_node = get_identifier ("this");
- super_identifier_node = get_identifier ("super");
- continue_identifier_node = get_identifier ("continue");
-
- /* for lack of a better place to put this stub call */
- init_expr_processing();
-
- utf8const_type = make_node (RECORD_TYPE);
- PUSH_FIELD (utf8const_type, field, "hash", unsigned_short_type_node);
- PUSH_FIELD (utf8const_type, field, "length", unsigned_short_type_node);
- FINISH_RECORD (utf8const_type);
- utf8const_ptr_type = build_pointer_type (utf8const_type);
-
- constants_type_node = make_node (RECORD_TYPE);
- PUSH_FIELD (constants_type_node, field, "size", unsigned_int_type_node);
- PUSH_FIELD (constants_type_node, field, "tags", ptr_type_node);
- PUSH_FIELD (constants_type_node, field, "data", ptr_type_node);
- FINISH_RECORD (constants_type_node);
- build_decl (TYPE_DECL, get_identifier ("constants"), constants_type_node);
-
- access_flags_type_node = unsigned_short_type_node;
-
- dtable_type = make_node (RECORD_TYPE);
- dtable_ptr_type = build_pointer_type (dtable_type);
-
- PUSH_FIELD (object_type_node, field, "vtable", dtable_ptr_type);
- PUSH_FIELD (object_type_node, field, "sync_info", ptr_type_node);
- for (t = TYPE_FIELDS (object_type_node); t != NULL_TREE; t = TREE_CHAIN (t))
- FIELD_PRIVATE (t) = 1;
- FINISH_RECORD (object_type_node);
-
- class_dtable_decl = build_dtable_decl (class_type_node);
- TREE_STATIC (class_dtable_decl) = 1;
- DECL_ARTIFICIAL (class_dtable_decl) = 1;
- DECL_IGNORED_P (class_dtable_decl) = 1;
- rest_of_decl_compilation (class_dtable_decl, (char*) 0, 1, 0);
-
- field_type_node = make_node (RECORD_TYPE);
- field_ptr_type_node = build_pointer_type (field_type_node);
- method_type_node = make_node (RECORD_TYPE);
- method_ptr_type_node = build_pointer_type (method_type_node);
-
- set_super_info (0, class_type_node, object_type_node, 0);
- set_super_info (0, string_type_node, object_type_node, 0);
- class_ptr_type = build_pointer_type (class_type_node);
-
- PUSH_FIELD (class_type_node, field, "next", class_ptr_type);
- PUSH_FIELD (class_type_node, field, "name", utf8const_ptr_type);
- PUSH_FIELD (class_type_node, field, "accflags", access_flags_type_node);
- PUSH_FIELD (class_type_node, field, "superclass", class_ptr_type);
- PUSH_FIELD (class_type_node, field, "constants", constants_type_node);
- PUSH_FIELD (class_type_node, field, "methods", method_ptr_type_node);
- PUSH_FIELD (class_type_node, field, "method_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "vtable_method_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "fields", field_ptr_type_node);
- PUSH_FIELD (class_type_node, field, "size_in_bytes", int_type_node);
- PUSH_FIELD (class_type_node, field, "field_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "static_field_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "vtable", dtable_ptr_type);
- PUSH_FIELD (class_type_node, field, "interfaces",
- build_pointer_type (class_ptr_type));
- PUSH_FIELD (class_type_node, field, "loader", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "interface_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "state", byte_type_node);
- PUSH_FIELD (class_type_node, field, "thread", ptr_type_node);
- for (t = TYPE_FIELDS (class_type_node); t != NULL_TREE; t = TREE_CHAIN (t))
- FIELD_PRIVATE (t) = 1;
- push_super_field (class_type_node, object_type_node);
- FINISH_RECORD (class_type_node);
- build_decl (TYPE_DECL, get_identifier ("Class"), class_type_node);
-
- field_info_union_node = make_node (UNION_TYPE);
- PUSH_FIELD (field_info_union_node, field, "boffset", int_type_node);
- PUSH_FIELD (field_info_union_node, field, "addr", ptr_type_node);
-#if 0
- PUSH_FIELD (field_info_union_node, field, "idx", unsigned_short_type_node);
-#endif
- layout_type (field_info_union_node);
-
- PUSH_FIELD (field_type_node, field, "name", utf8const_ptr_type);
- PUSH_FIELD (field_type_node, field, "type", class_ptr_type);
- PUSH_FIELD (field_type_node, field, "accflags", access_flags_type_node);
- PUSH_FIELD (field_type_node, field, "bsize", unsigned_short_type_node);
- PUSH_FIELD (field_type_node, field, "info", field_info_union_node);
- FINISH_RECORD (field_type_node);
- CLASS_LOADED_P (field_type_node) = 1;
- build_decl (TYPE_DECL, get_identifier ("Field"), field_type_node);
-
- one_elt_array_domain_type = build_index_type (integer_one_node);
- nativecode_ptr_array_type_node
- = build_array_type (nativecode_ptr_type_node, one_elt_array_domain_type);
-
- PUSH_FIELD (dtable_type, field, "class", class_ptr_type);
- PUSH_FIELD (dtable_type, field, "methods", nativecode_ptr_array_type_node);
- FINISH_RECORD (dtable_type);
- build_decl (TYPE_DECL, get_identifier ("dispatchTable"), dtable_type);
-
-#define jint_type int_type_node
-#define jint_ptr_type ptr_type_node
-
- jexception_type = make_node (RECORD_TYPE);
- PUSH_FIELD (jexception_type, field, "start_pc", ptr_type_node);
- PUSH_FIELD (jexception_type, field, "end_pc", ptr_type_node);
- PUSH_FIELD (jexception_type, field, "handler_pc", ptr_type_node);
- PUSH_FIELD (jexception_type, field, "catch_type", class_ptr_type);
- FINISH_RECORD (jexception_type);
- build_decl (TYPE_DECL, get_identifier ("jexception"), field_type_node);
- jexception_ptr_type = build_pointer_type (jexception_type);
-
- lineNumberEntry_type = make_node (RECORD_TYPE);
- PUSH_FIELD (lineNumberEntry_type, field, "line_nr", unsigned_short_type_node);
- PUSH_FIELD (lineNumberEntry_type, field, "start_pc", ptr_type_node);
- FINISH_RECORD (lineNumberEntry_type);
-
- lineNumbers_type = make_node (RECORD_TYPE);
- PUSH_FIELD (lineNumbers_type, field, "length", unsigned_int_type_node);
- FINISH_RECORD (lineNumbers_type);
-
-#define instn_ptr_type_node ptr_type_node /* XXX JH */
-
-#define lineNumbers_ptr_type_node build_pointer_type(lineNumbers_type)
-
- PUSH_FIELD (method_type_node, field, "name", utf8const_ptr_type);
- PUSH_FIELD (method_type_node, field, "signature", utf8const_ptr_type);
- PUSH_FIELD (method_type_node, field, "accflags", access_flags_type_node);
- PUSH_FIELD (method_type_node, field, "ncode", nativecode_ptr_type_node);
- FINISH_RECORD (method_type_node);
- CLASS_LOADED_P (method_type_node) = 1;
- build_decl (TYPE_DECL, get_identifier ("Method"), method_type_node);
-
- endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
-
- t = tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, int_type_node, endlink));
- alloc_object_node = builtin_function ("_Jv_AllocObject",
- build_function_type (ptr_type_node, t),
- NOT_BUILT_IN, NULL_PTR);
- soft_initclass_node = builtin_function ("_Jv_InitClass",
- build_function_type (void_type_node,
- t),
- NOT_BUILT_IN, NULL_PTR);
- t = tree_cons (NULL_TREE, ptr_type_node, endlink);
- throw_node = builtin_function ("_Jv_Throw",
- build_function_type (ptr_type_node, t),
- NOT_BUILT_IN, NULL_PTR);
- t = build_function_type (int_type_node, endlink);
- soft_monitorenter_node
- = builtin_function ("_Jv_MonitorEnter", t, NOT_BUILT_IN, NULL_PTR);
- soft_monitorexit_node
- = builtin_function ("_Jv_MonitorExit", t, NOT_BUILT_IN, NULL_PTR);
-
- t = tree_cons (NULL_TREE, int_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
- soft_newarray_node
- = builtin_function ("_Jv_NewArray",
- build_function_type(ptr_type_node, t),
- NOT_BUILT_IN, NULL_PTR );
-
- t = tree_cons (NULL_TREE, int_type_node,
- tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, object_ptr_type_node, endlink)));
- soft_anewarray_node
- = builtin_function ("_Jv_NewObjectArray",
- build_function_type (ptr_type_node, t),
- NOT_BUILT_IN, NULL_PTR );
-
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
- soft_multianewarray_node
- = builtin_function ("_Jv_NewMultiArray",
- build_function_type (ptr_type_node, t),
- NOT_BUILT_IN, NULL_PTR );
-
- t = build_function_type (void_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
- soft_badarrayindex_node
- = builtin_function ("_Jv_ThrowBadArrayIndex", t,
- NOT_BUILT_IN, NULL_PTR);
- TREE_THIS_VOLATILE (soft_badarrayindex_node) = 1;
- TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
-
- t = tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, object_ptr_type_node, endlink));
- soft_checkcast_node
- = builtin_function ("_Jv_CheckCast",
- build_function_type (ptr_type_node, t),
- NOT_BUILT_IN, NULL_PTR);
- t = tree_cons (NULL_TREE, object_ptr_type_node,
- tree_cons (NULL_TREE, class_ptr_type, endlink));
- soft_instanceof_node
- = builtin_function ("_Jv_IsInstanceOf",
- build_function_type (promoted_boolean_type_node, t),
- NOT_BUILT_IN, NULL_PTR);
- t = tree_cons (NULL_TREE, object_ptr_type_node,
- tree_cons (NULL_TREE, object_ptr_type_node, endlink));
- soft_checkarraystore_node
- = builtin_function ("_Jv_CheckArrayStore",
- build_function_type (void_type_node, t),
- NOT_BUILT_IN, NULL_PTR);
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node, endlink)));
- soft_lookupinterfacemethod_node
- = builtin_function ("_Jv_LookupInterfaceMethod",
- build_function_type (ptr_type_node, t),
- NOT_BUILT_IN, NULL_PTR);
- t = tree_cons (NULL_TREE, double_type_node,
- tree_cons (NULL_TREE, double_type_node, endlink));
- soft_fmod_node
- = builtin_function ("__builtin_fmod",
- build_function_type (double_type_node, t),
- BUILT_IN_FMOD, "fmod");
-
- soft_exceptioninfo_call_node
- = build (CALL_EXPR,
- ptr_type_node,
- build_address_of
- (builtin_function ("_Jv_exception_info",
- build_function_type (ptr_type_node, endlink),
- NOT_BUILT_IN, NULL_PTR)),
- NULL_TREE, NULL_TREE);
- TREE_SIDE_EFFECTS (soft_exceptioninfo_call_node) = 1;
-#if 0
- t = tree_cons (NULL_TREE, float_type_node,
- tree_cons (NULL_TREE, float_type_node, endlink));
- soft_fmodf_node
- = builtin_function ("__builtin_fmodf",
- build_function_type (float_type_node, t),
- BUILT_IN_FMOD, "fmodf");
-#endif
-
- init_class_processing ();
-}
-
-
-/* Look up NAME in the current binding level and its superiors
- in the namespace of variables, functions and typedefs.
- Return a ..._DECL node of some kind representing its definition,
- or return 0 if it is undefined. */
-
-tree
-lookup_name (name)
- tree name;
-{
- register tree val;
- if (current_binding_level != global_binding_level
- && IDENTIFIER_LOCAL_VALUE (name))
- val = IDENTIFIER_LOCAL_VALUE (name);
- else
- val = IDENTIFIER_GLOBAL_VALUE (name);
- return val;
-}
-
-/* Similar to `lookup_name' but look only at current binding level and
- the previous one if its the parameter level. */
-
-static tree
-lookup_name_current_level (name)
- tree name;
-{
- register tree t;
-
- if (current_binding_level == global_binding_level)
- return IDENTIFIER_GLOBAL_VALUE (name);
-
- if (IDENTIFIER_LOCAL_VALUE (name) == 0)
- return 0;
-
- for (t = current_binding_level->names; t; t = TREE_CHAIN (t))
- if (DECL_NAME (t) == name)
- break;
-
- return t;
-}
-
-/* Use a binding level to record a labeled block declaration */
-
-void
-push_labeled_block (lb)
- tree lb;
-{
- register tree name = DECL_NAME (LABELED_BLOCK_LABEL (lb));
- register struct binding_level *b = current_binding_level;
- tree oldlocal = IDENTIFIER_LOCAL_VALUE (name);
- if (oldlocal != 0)
- b->shadowed = tree_cons (name, oldlocal, b->shadowed);
- TREE_CHAIN (lb) = b->names;
- b->names = lb;
- IDENTIFIER_LOCAL_VALUE (name) = lb;
-}
-
-/* Pop the current binding level, reinstalling values for the previous
- labeled block */
-
-void
-pop_labeled_block ()
-{
- struct binding_level *b = current_binding_level;
- tree label = b->names;
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (LABELED_BLOCK_LABEL (label))) =
- NULL_TREE;
- if (b->shadowed)
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (b->shadowed)) =
- TREE_VALUE (b->shadowed);
-
- /* Pop the current level, and free the structure for reuse. */
- current_binding_level = current_binding_level->level_chain;
- b->level_chain = free_binding_level;
- free_binding_level = b;
-}
-
-/* Record a decl-node X as belonging to the current lexical scope.
- Check for errors (such as an incompatible declaration for the same
- name already seen in the same scope).
-
- Returns either X or an old decl for the same name.
- If an old decl is returned, it may have been smashed
- to agree with what X says. */
-
-tree
-pushdecl (x)
- tree x;
-{
- register tree t;
- register tree name = DECL_NAME (x);
- register struct binding_level *b = current_binding_level;
-
- DECL_CONTEXT (x) = current_function_decl;
- if (name)
- {
- char *file;
- int line;
-
- t = lookup_name_current_level (name);
- if (t != 0 && t == error_mark_node)
- /* error_mark_node is 0 for a while during initialization! */
- {
- t = 0;
- error_with_decl (x, "`%s' used prior to declaration");
- }
-
- if (t != 0)
- {
- file = DECL_SOURCE_FILE (t);
- line = DECL_SOURCE_LINE (t);
- }
-
- /* If we're naming a hitherto-unnamed type, set its TYPE_NAME
- to point to the TYPE_DECL.
- Since Java does not have typedefs, a type can only have
- one (true) name, given by a class, interface, or builtin. */
- if (TREE_CODE (x) == TYPE_DECL
- && TYPE_NAME (TREE_TYPE (x)) == 0
- && TREE_TYPE (x) != error_mark_node)
- {
- TYPE_NAME (TREE_TYPE (x)) = x;
- TYPE_STUB_DECL (TREE_TYPE (x)) = x;
- }
-
- /* This name is new in its binding level.
- Install the new declaration and return it. */
- if (b == global_binding_level)
- {
- /* Install a global value. */
-
- IDENTIFIER_GLOBAL_VALUE (name) = x;
- }
- else
- {
- /* Here to install a non-global value. */
- tree oldlocal = IDENTIFIER_LOCAL_VALUE (name);
- IDENTIFIER_LOCAL_VALUE (name) = x;
-
-#if 0
- /* Warn if shadowing an argument at the top level of the body. */
- if (oldlocal != 0 && !DECL_EXTERNAL (x)
- /* This warning doesn't apply to the parms of a nested fcn. */
- && ! current_binding_level->parm_flag
- /* Check that this is one level down from the parms. */
- && current_binding_level->level_chain->parm_flag
- /* Check that the decl being shadowed
- comes from the parm level, one level up. */
- && chain_member (oldlocal, current_binding_level->level_chain->names))
- {
- if (TREE_CODE (oldlocal) == PARM_DECL)
- pedwarn ("declaration of `%s' shadows a parameter",
- IDENTIFIER_POINTER (name));
- else
- pedwarn ("declaration of `%s' shadows a symbol from the parameter list",
- IDENTIFIER_POINTER (name));
- }
-
- /* Maybe warn if shadowing something else. */
- else if (warn_shadow && !DECL_EXTERNAL (x)
- /* No shadow warnings for internally generated vars. */
- && DECL_SOURCE_LINE (x) != 0
- /* No shadow warnings for vars made for inlining. */
- && ! DECL_FROM_INLINE (x))
- {
- char *warnstring = 0;
-
- if (TREE_CODE (x) == PARM_DECL
- && current_binding_level->level_chain->parm_flag)
- /* Don't warn about the parm names in function declarator
- within a function declarator.
- It would be nice to avoid warning in any function
- declarator in a declaration, as opposed to a definition,
- but there is no way to tell it's not a definition. */
- ;
- else if (oldlocal != 0 && TREE_CODE (oldlocal) == PARM_DECL)
- warnstring = "declaration of `%s' shadows a parameter";
- else if (oldlocal != 0)
- warnstring = "declaration of `%s' shadows previous local";
- else if (IDENTIFIER_GLOBAL_VALUE (name) != 0
- && IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node)
- warnstring = "declaration of `%s' shadows global declaration";
-
- if (warnstring)
- warning (warnstring, IDENTIFIER_POINTER (name));
- }
-#endif
-
- /* If storing a local value, there may already be one (inherited).
- If so, record it for restoration when this binding level ends. */
- if (oldlocal != 0)
- b->shadowed = tree_cons (name, oldlocal, b->shadowed);
- }
- }
-
- /* Put decls on list in reverse order.
- We will reverse them later if necessary. */
- TREE_CHAIN (x) = b->names;
- b->names = x;
-
- return x;
-}
-void
-pushdecl_force_head (x)
- tree x;
-{
- current_binding_level->names = x;
-}
-
-/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL, if appropriate. */
-
-tree
-pushdecl_top_level (x)
- tree x;
-{
- register tree t;
- register struct binding_level *b = current_binding_level;
-
- current_binding_level = global_binding_level;
- t = pushdecl (x);
- current_binding_level = b;
- return t;
-}
-
-/* Nonzero if we are currently in the global binding level. */
-
-int
-global_bindings_p ()
-{
- return current_binding_level == global_binding_level;
-}
-
-/* Return the list of declarations of the current level.
- Note that this list is in reverse order unless/until
- you nreverse it; and when you do nreverse it, you must
- store the result back using `storedecls' or you will lose. */
-
-tree
-getdecls ()
-{
- return current_binding_level->names;
-}
-
-/* Create a new `struct binding_level'. */
-
-static
-struct binding_level *
-make_binding_level ()
-{
- /* NOSTRICT */
- return (struct binding_level *) xmalloc (sizeof (struct binding_level));
-}
-
-void
-pushlevel (unused)
- int unused ATTRIBUTE_UNUSED;
-{
- register struct binding_level *newlevel = NULL_BINDING_LEVEL;
-
-#if 0
- /* If this is the top level of a function,
- just make sure that NAMED_LABELS is 0. */
-
- if (current_binding_level == global_binding_level)
- named_labels = 0;
-#endif
-
- /* Reuse or create a struct for this binding level. */
-
- if (free_binding_level)
- {
- newlevel = free_binding_level;
- free_binding_level = free_binding_level->level_chain;
- }
- else
- {
- newlevel = make_binding_level ();
- }
-
- /* Add this level to the front of the chain (stack) of levels that
- are active. */
-
- *newlevel = clear_binding_level;
- newlevel->level_chain = current_binding_level;
- current_binding_level = newlevel;
- newlevel->keep = keep_next_level_flag;
- keep_next_level_flag = 0;
- newlevel->keep_if_subblocks = keep_next_if_subblocks;
- keep_next_if_subblocks = 0;
-}
-
-/* Exit a binding level.
- Pop the level off, and restore the state of the identifier-decl mappings
- that were in effect when this level was entered.
-
- If KEEP is nonzero, this level had explicit declarations, so
- and create a "block" (a BLOCK node) for the level
- to record its declarations and subblocks for symbol table output.
-
- If FUNCTIONBODY is nonzero, this level is the body of a function,
- so create a block as if KEEP were set and also clear out all
- label names.
-
- If REVERSE is nonzero, reverse the order of decls before putting
- them into the BLOCK. */
-
-tree
-poplevel (keep, reverse, functionbody)
- int keep;
- int reverse;
- int functionbody;
-{
- register tree link;
- /* The chain of decls was accumulated in reverse order.
- Put it into forward order, just for cleanliness. */
- tree decls;
- tree subblocks = current_binding_level->blocks;
- tree block = 0;
- tree decl;
- int block_previously_created;
-
- keep |= current_binding_level->keep;
-
- /* Get the decls in the order they were written.
- Usually current_binding_level->names is in reverse order.
- But parameter decls were previously put in forward order. */
-
- if (reverse)
- current_binding_level->names
- = decls = nreverse (current_binding_level->names);
- else
- decls = current_binding_level->names;
-
- /* Output any nested inline functions within this block
- if they weren't already output. */
-
- for (decl = decls; decl; decl = TREE_CHAIN (decl))
- if (TREE_CODE (decl) == FUNCTION_DECL
- && ! TREE_ASM_WRITTEN (decl)
- && DECL_INITIAL (decl) != 0
- && TREE_ADDRESSABLE (decl))
- {
- /* If this decl was copied from a file-scope decl
- on account of a block-scope extern decl,
- propagate TREE_ADDRESSABLE to the file-scope decl.
-
- DECL_ABSTRACT_ORIGIN can be set to itself if warn_return_type is
- true, since then the decl goes through save_for_inline_copying. */
- if (DECL_ABSTRACT_ORIGIN (decl) != 0
- && DECL_ABSTRACT_ORIGIN (decl) != decl)
- TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1;
- else
- {
- push_function_context ();
- output_inline_function (decl);
- pop_function_context ();
- }
- }
-
- /* If there were any declarations in that level,
- or if this level is a function body,
- create a BLOCK to record them for the life of this function. */
-
- block = 0;
- block_previously_created = (current_binding_level->this_block != 0);
- if (block_previously_created)
- block = current_binding_level->this_block;
- else if (keep || functionbody
- || (current_binding_level->keep_if_subblocks && subblocks != 0))
- block = make_node (BLOCK);
- if (block != 0)
- {
- BLOCK_VARS (block) = decls;
- BLOCK_TYPE_TAGS (block) = NULL_TREE;
- BLOCK_SUBBLOCKS (block) = subblocks;
- remember_end_note (block);
- }
-
- /* In each subblock, record that this is its superior. */
-
- for (link = subblocks; link; link = TREE_CHAIN (link))
- BLOCK_SUPERCONTEXT (link) = block;
-
- /* Clear out the meanings of the local variables of this level. */
-
- for (link = decls; link; link = TREE_CHAIN (link))
- {
- tree name = DECL_NAME (link);
- if (name != 0 && IDENTIFIER_LOCAL_VALUE (name) == link)
- {
- /* If the ident. was used or addressed via a local extern decl,
- don't forget that fact. */
- if (DECL_EXTERNAL (link))
- {
- if (TREE_USED (link))
- TREE_USED (name) = 1;
- if (TREE_ADDRESSABLE (link))
- TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (link)) = 1;
- }
- IDENTIFIER_LOCAL_VALUE (name) = 0;
- }
- }
-
- /* Restore all name-meanings of the outer levels
- that were shadowed by this level. */
-
- for (link = current_binding_level->shadowed; link; link = TREE_CHAIN (link))
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
-
- /* If the level being exited is the top level of a function,
- check over all the labels, and clear out the current
- (function local) meanings of their names. */
-
- if (functionbody)
- {
- /* If this is the top level block of a function,
- the vars are the function's parameters.
- Don't leave them in the BLOCK because they are
- found in the FUNCTION_DECL instead. */
-
- BLOCK_VARS (block) = 0;
-
- /* Clear out the definitions of all label names,
- since their scopes end here,
- and add them to BLOCK_VARS. */
-
-#if 0
- for (link = named_labels; link; link = TREE_CHAIN (link))
- {
- register tree label = TREE_VALUE (link);
-
- if (DECL_INITIAL (label) == 0)
- {
- error_with_decl (label, "label `%s' used but not defined");
- /* Avoid crashing later. */
- define_label (input_filename, lineno,
- DECL_NAME (label));
- }
- else if (warn_unused && !TREE_USED (label))
- warning_with_decl (label, "label `%s' defined but not used");
- IDENTIFIER_LABEL_VALUE (DECL_NAME (label)) = 0;
-
- /* Put the labels into the "variables" of the
- top-level block, so debugger can see them. */
- TREE_CHAIN (label) = BLOCK_VARS (block);
- BLOCK_VARS (block) = label;
- }
-#endif
- }
-
- /* Pop the current level, and free the structure for reuse. */
-
- {
- register struct binding_level *level = current_binding_level;
- current_binding_level = current_binding_level->level_chain;
-
- level->level_chain = free_binding_level;
- free_binding_level = level;
- }
-
- /* Dispose of the block that we just made inside some higher level. */
- if (functionbody)
- DECL_INITIAL (current_function_decl) = block;
- else if (block)
- {
- if (!block_previously_created)
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
- }
- /* If we did not make a block for the level just exited,
- any blocks made for inner levels
- (since they cannot be recorded as subblocks in that level)
- must be carried forward so they will later become subblocks
- of something else. */
- else if (subblocks)
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, subblocks);
-
- /* Set the TYPE_CONTEXTs for all of the tagged types belonging to this
- binding contour so that they point to the appropriate construct, i.e.
- either to the current FUNCTION_DECL node, or else to the BLOCK node
- we just constructed.
-
- Note that for tagged types whose scope is just the formal parameter
- list for some function type specification, we can't properly set
- their TYPE_CONTEXTs here, because we don't have a pointer to the
- appropriate FUNCTION_TYPE node readily available to us. For those
- cases, the TYPE_CONTEXTs of the relevant tagged type nodes get set
- in `grokdeclarator' as soon as we have created the FUNCTION_TYPE
- node which will represent the "scope" for these "parameter list local"
- tagged types.
- */
-
- if (block)
- TREE_USED (block) = 1;
- return block;
-}
-
-void
-maybe_pushlevels (pc)
- int pc;
-{
- while (pending_local_decls != NULL_TREE &&
- DECL_LOCAL_START_PC (pending_local_decls) <= pc)
- {
- tree *ptr = &pending_local_decls;
- tree decl = *ptr;
- int end_pc = DECL_LOCAL_END_PC (decl);
-
- while (*ptr != NULL_TREE
- && DECL_LOCAL_START_PC (*ptr) <= pc
- && DECL_LOCAL_END_PC (*ptr) == end_pc)
- ptr = &TREE_CHAIN (*ptr);
- pending_local_decls = *ptr;
- *ptr = NULL_TREE;
-
- /* Force non-nested range to be nested in current range. */
- if (end_pc > current_binding_level->end_pc)
- end_pc = current_binding_level->end_pc;
-
- pushlevel (1);
- expand_start_bindings (0);
- current_binding_level->end_pc = end_pc;
-
- current_binding_level->names = decl;
- for ( ; decl != NULL_TREE; decl = TREE_CHAIN (decl))
- {
- push_jvm_slot (DECL_LOCAL_SLOT_NUMBER (decl), decl);
- }
- }
-}
-
-void
-maybe_poplevels (pc)
- int pc;
-{
- while (current_binding_level->end_pc <= pc)
- {
- expand_end_bindings (getdecls (), 1, 0);
- poplevel (1, 0, 0);
- }
-}
-
-/* Insert BLOCK at the end of the list of subblocks of the
- current binding level. This is used when a BIND_EXPR is expanded,
- to handle the BLOCK node inside the BIND_EXPR. */
-
-void
-insert_block (block)
- tree block;
-{
- TREE_USED (block) = 1;
- abort ();
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
-}
-
-/* Set the BLOCK node for the innermost scope
- (the one we are currently in). */
-
-void
-set_block (block)
- register tree block;
-{
- current_binding_level->this_block = block;
-}
-
-/* integrate_decl_tree calls this function. */
-
-void
-copy_lang_decl (node)
- tree node;
-{
- int lang_decl_size
- = TREE_CODE (node) == VAR_DECL ? sizeof (struct lang_decl_var)
- : sizeof (struct lang_decl);
- struct lang_decl *x = (struct lang_decl *) oballoc (lang_decl_size);
- bcopy ((PTR) DECL_LANG_SPECIFIC (node), (PTR) x, lang_decl_size);
- DECL_LANG_SPECIFIC (node) = x;
-}
-
-/* If DECL has a cleanup, build and return that cleanup here.
- This is a callback called by expand_expr. */
-
-tree
-maybe_build_cleanup (decl)
- tree decl ATTRIBUTE_UNUSED;
-{
- /* There are no cleanups in Java (I think). */
- return NULL_TREE;
-}
-
-void
-give_name_to_locals (jcf)
- JCF *jcf;
-{
- int i, n = DECL_LOCALVARIABLES_OFFSET (current_function_decl);
- tree parm;
- pending_local_decls = NULL_TREE;
- if (n == 0)
- return;
- JCF_SEEK (jcf, n);
- n = JCF_readu2 (jcf);
- for (i = 0; i < n; i++)
- {
- int start_pc = JCF_readu2 (jcf);
- int length = JCF_readu2 (jcf);
- int name_index = JCF_readu2 (jcf);
- int signature_index = JCF_readu2 (jcf);
- int slot = JCF_readu2 (jcf);
- tree name = get_name_constant (jcf, name_index);
- tree type = parse_signature (jcf, signature_index);
- if (slot < DECL_ARG_SLOT_COUNT (current_function_decl)
- && start_pc == 0
- && length == DECL_CODE_LENGTH (current_function_decl))
- {
- tree decl = TREE_VEC_ELT (decl_map, slot);
- DECL_NAME (decl) = name;
- DECL_ASSEMBLER_NAME (decl) = name;
- if (TREE_CODE (decl) != PARM_DECL || TREE_TYPE (decl) != type)
- warning ("bad type in parameter debug info");
- }
- else
- {
- tree *ptr;
- int end_pc = start_pc + length;
- tree decl = build_decl (VAR_DECL, name, type);
- if (end_pc > DECL_CODE_LENGTH (current_function_decl))
- {
- warning_with_decl (decl,
- "bad PC range for debug info for local `%s'");
- end_pc = DECL_CODE_LENGTH (current_function_decl);
- }
- DECL_LANG_SPECIFIC (decl)
- = (struct lang_decl *) permalloc (sizeof (struct lang_decl_var));
- DECL_LOCAL_SLOT_NUMBER (decl) = slot;
- DECL_LOCAL_START_PC (decl) = start_pc;
- DECL_LOCAL_END_PC (decl) = end_pc;
-
- /* Now insert the new decl in the proper place in
- pending_local_decls. We are essentially doing an insertion sort,
- which works fine, since the list input will normally already
- be sorted. */
- ptr = &pending_local_decls;
- while (*ptr != NULL_TREE
- && (DECL_LOCAL_START_PC (*ptr) > start_pc
- || (DECL_LOCAL_START_PC (*ptr) == start_pc
- && DECL_LOCAL_END_PC (*ptr) < end_pc)))
- ptr = &TREE_CHAIN (*ptr);
- TREE_CHAIN (decl) = *ptr;
- *ptr = decl;
- }
- }
-
- pending_local_decls = nreverse (pending_local_decls);
-
- /* Fill in default names for the parameters. */
- for (parm = DECL_ARGUMENTS (current_function_decl), i = 0;
- parm != NULL_TREE; parm = TREE_CHAIN (parm), i++)
- {
- if (DECL_NAME (parm) == NULL_TREE)
- {
- int arg_i = METHOD_STATIC (current_function_decl) ? i+1 : i;
- if (arg_i == 0)
- DECL_NAME (parm) = get_identifier ("this");
- else
- {
- char buffer[12];
- sprintf (buffer, "ARG_%d", arg_i);
- DECL_NAME (parm) = get_identifier (buffer);
- }
- DECL_ASSEMBLER_NAME (parm) = DECL_NAME (parm);
- }
- }
-}
-
-tree
-build_result_decl (fndecl)
- tree fndecl;
-{
- tree restype = TREE_TYPE (TREE_TYPE (fndecl));
- /* To be compatible with C_PROMOTING_INTEGER_TYPE_P in cc1/cc1plus. */
- if (INTEGRAL_TYPE_P (restype)
- && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node))
- restype = integer_type_node;
- return (DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, restype));
-}
-
-void
-complete_start_java_method (fndecl)
- tree fndecl;
-{
- if (! flag_emit_class_files)
- {
- /* Initialize the RTL code for the function. */
- init_function_start (fndecl, input_filename, lineno);
-
- /* Set up parameters and prepare for return, for the function. */
- expand_function_start (fndecl, 0);
- }
-
- /* Allocate further tree nodes temporarily during compilation
- of this function only. */
- temporary_allocation ();
-
-#if 0
- /* If this fcn was already referenced via a block-scope `extern' decl (or
- an implicit decl), propagate certain information about the usage. */
- if (TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (current_function_decl)))
- TREE_ADDRESSABLE (current_function_decl) = 1;
-
-#endif
-
- if (METHOD_STATIC (fndecl) && ! METHOD_PRIVATE (fndecl)
- && ! flag_emit_class_files
- && ! CLASS_INTERFACE (TYPE_NAME (current_class)))
- {
- tree clas = DECL_CONTEXT (fndecl);
- tree init = build (CALL_EXPR, void_type_node,
- build_address_of (soft_initclass_node),
- build_tree_list (NULL_TREE, build_class_ref (clas)),
- NULL_TREE);
- TREE_SIDE_EFFECTS (init) = 1;
- expand_expr_stmt (init);
- }
-
- /* Push local variables. Function compiled from source code are
- using a different local variables management, and for them,
- pushlevel shouldn't be called from here. */
- if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (fndecl)))
- {
- pushlevel (2);
- if (! flag_emit_class_files)
- expand_start_bindings (1);
- }
-
- if (METHOD_SYNCHRONIZED (fndecl) && ! flag_emit_class_files)
- {
- /* Warp function body with a monitorenter plus monitorexit cleanup. */
- tree enter, exit, lock;
- if (METHOD_STATIC (fndecl))
- lock = build_class_ref (DECL_CONTEXT (fndecl));
- else
- lock = DECL_ARGUMENTS (fndecl);
- BUILD_MONITOR_ENTER (enter, lock);
- BUILD_MONITOR_EXIT (exit, lock);
- if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (fndecl)))
- {
- expand_expr_stmt (enter);
- expand_decl_cleanup (NULL_TREE, exit);
- }
- else
- {
- tree function_body = DECL_FUNCTION_BODY (fndecl);
- tree body = BLOCK_EXPR_BODY (function_body);
- lock = build (WITH_CLEANUP_EXPR, void_type_node,
- enter, NULL_TREE, exit);
- TREE_SIDE_EFFECTS (lock) = 1;
- lock = build (COMPOUND_EXPR, TREE_TYPE (body), lock, body);
- TREE_SIDE_EFFECTS (lock) = 1;
- lock = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (body), lock);
- TREE_SIDE_EFFECTS (lock) = 1;
- BLOCK_EXPR_BODY (function_body) = lock;
- }
- }
-}
-
-void
-start_java_method (fndecl)
- tree fndecl;
-{
- tree tem, *ptr;
- int i;
-
- current_function_decl = fndecl;
- announce_function (fndecl);
-
- i = DECL_MAX_LOCALS(fndecl) + DECL_MAX_STACK(fndecl);
- decl_map = make_tree_vec (i);
- type_map = (tree *) oballoc (i * sizeof (tree));
-
- pushlevel (1); /* Push parameters. */
-
- ptr = &DECL_ARGUMENTS (fndecl);
- for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
- tem != end_params_node; tem = TREE_CHAIN (tem), i++)
- {
- tree parm_name = NULL_TREE, parm_decl;
- tree parm_type = TREE_VALUE (tem);
- if (i >= DECL_MAX_LOCALS(fndecl))
- fatal ("function has more parameters than local slots");
-
- parm_decl = build_decl (PARM_DECL, parm_name, parm_type);
- DECL_CONTEXT (parm_decl) = fndecl;
-#ifdef PROMOTE_PROTOTYPES
- if (TYPE_PRECISION (parm_type) < TYPE_PRECISION (integer_type_node)
- && INTEGRAL_TYPE_P (parm_type))
- parm_type = integer_type_node;
-#endif
- DECL_ARG_TYPE (parm_decl) = parm_type;
-
- *ptr = parm_decl;
- ptr = &TREE_CHAIN (parm_decl);
-
- /* Add parm_decl to the decl_map. */
- push_jvm_slot (i, parm_decl);
-
- type_map[i] = TREE_TYPE (parm_decl);
- if (TYPE_IS_WIDE (TREE_TYPE (parm_decl)))
- {
- i++;
- type_map[i] = void_type_node;
- }
- }
- *ptr = NULL_TREE;
- DECL_ARG_SLOT_COUNT (current_function_decl) = i;
-
- while (i < DECL_MAX_LOCALS(fndecl))
- type_map[i++] = NULL_TREE;
-
- build_result_decl (fndecl);
- complete_start_java_method (fndecl);
-}
-
-void
-end_java_method ()
-{
- tree fndecl = current_function_decl;
- int flag_asynchronous_exceptions = asynchronous_exceptions;
-
- expand_end_bindings (getdecls (), 1, 0);
- /* pop out of function */
- poplevel (1, 1, 0);
-
- /* pop out of its parameters */
- poplevel (1, 0, 1);
-
- BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
-
- emit_handlers ();
-
- /* Generate rtl for function exit. */
- expand_function_end (input_filename, lineno, 0);
-
- /* FIXME: If the current method contains any exception handlers,
- force asynchronous_exceptions: this is necessary because signal
- handlers in libjava may throw exceptions. This is far from being
- a perfect solution, but it's better than doing nothing at all.*/
- if (catch_clauses)
- asynchronous_exceptions = 1;
-
- /* Run the optimizers and output assembler code for this function. */
- rest_of_compilation (fndecl);
-
- current_function_decl = NULL_TREE;
- permanent_allocation (1);
- asynchronous_exceptions = flag_asynchronous_exceptions;
-}
diff --git a/gnu/dist/toolchain/gcc/java/except.c b/gnu/dist/toolchain/gcc/java/except.c
deleted file mode 100644
index 920f81a3a42..00000000000
--- a/gnu/dist/toolchain/gcc/java/except.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* Handle exceptions for GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "real.h"
-#include "rtl.h"
-#include "java-tree.h"
-#include "javaop.h"
-#include "java-opcodes.h"
-#include "jcf.h"
-#include "except.h"
-#include "java-except.h"
-#include "eh-common.h"
-#include "toplev.h"
-
-static void expand_start_java_handler PROTO ((struct eh_range *));
-static void expand_end_java_handler PROTO ((struct eh_range *));
-
-extern struct obstack permanent_obstack;
-
-struct eh_range *current_method_handlers;
-
-struct eh_range *current_try_block = NULL;
-
-struct eh_range *eh_range_freelist = NULL;
-
-/* These variables are used to speed up find_handler. */
-
-static int cache_range_start, cache_range_end;
-static struct eh_range *cache_range;
-static struct eh_range *cache_next_child;
-
-/* A dummy range that represents the entire method. */
-
-struct eh_range whole_range;
-
-/* Search for the most specific eh_range containing PC.
- Assume PC is within RANGE.
- CHILD is a list of children of RANGE such that any
- previous children have end_pc values that are too low. */
-
-static struct eh_range *
-find_handler_in_range (pc, range, child)
- int pc;
- struct eh_range *range;
- register struct eh_range *child;
-{
- for (; child != NULL; child = child->next_sibling)
- {
- if (pc < child->start_pc)
- break;
- if (pc < child->end_pc)
- return find_handler_in_range (pc, child, child->first_child);
- }
- cache_range = range;
- cache_range_start = pc;
- cache_next_child = child;
- cache_range_end = child == NULL ? range->end_pc : child->start_pc;
- return range;
-}
-
-/* Find the inner-most handler that contains PC. */
-
-struct eh_range *
-find_handler (pc)
- int pc;
-{
- struct eh_range *h;
- if (pc >= cache_range_start)
- {
- h = cache_range;
- if (pc < cache_range_end)
- return h;
- while (pc >= h->end_pc)
- {
- cache_next_child = h->next_sibling;
- h = h->outer;
- }
- }
- else
- {
- h = &whole_range;
- cache_next_child = h->first_child;
- }
- return find_handler_in_range (pc, h, cache_next_child);
-}
-
-/* Recursive helper routine for check_nested_ranges. */
-
-static void
-link_handler (range, outer)
- struct eh_range *range, *outer;
-{
- struct eh_range **ptr;
-
- if (range->start_pc == outer->start_pc && range->end_pc == outer->end_pc)
- {
- outer->handlers = chainon (range->handlers, outer->handlers);
- return;
- }
-
- /* If the new range completely encloses the `outer' range, then insert it
- between the outer range and its parent. */
- if (range->start_pc <= outer->start_pc && range->end_pc >= outer->end_pc)
- {
- range->outer = outer->outer;
- range->next_sibling = NULL;
- range->first_child = outer;
- {
- struct eh_range **pr = &(outer->outer->first_child);
- while (*pr != outer)
- pr = &(*pr)->next_sibling;
- *pr = range;
- }
- outer->outer = range;
- return;
- }
-
- /* Handle overlapping ranges by splitting the new range. */
- if (range->start_pc < outer->start_pc || range->end_pc > outer->end_pc)
- {
- struct eh_range *h
- = (struct eh_range *) oballoc (sizeof (struct eh_range));
- if (range->start_pc < outer->start_pc)
- {
- h->start_pc = range->start_pc;
- h->end_pc = outer->start_pc;
- range->start_pc = outer->start_pc;
- }
- else
- {
- h->start_pc = outer->end_pc;
- h->end_pc = range->end_pc;
- range->end_pc = outer->end_pc;
- }
- h->first_child = NULL;
- h->outer = NULL;
- h->handlers = build_tree_list (TREE_PURPOSE (range->handlers),
- TREE_VALUE (range->handlers));
- h->next_sibling = NULL;
- /* Restart both from the top to avoid having to make this
- function smart about reentrancy. */
- link_handler (h, &whole_range);
- link_handler (range, &whole_range);
- return;
- }
-
- ptr = &outer->first_child;
- for (;; ptr = &(*ptr)->next_sibling)
- {
- if (*ptr == NULL || range->end_pc <= (*ptr)->start_pc)
- {
- range->next_sibling = *ptr;
- range->first_child = NULL;
- range->outer = outer;
- *ptr = range;
- return;
- }
- else if (range->start_pc < (*ptr)->end_pc)
- {
- link_handler (range, *ptr);
- return;
- }
- /* end_pc > (*ptr)->start_pc && start_pc >= (*ptr)->end_pc. */
- }
-}
-
-/* The first pass of exception range processing (calling add_handler)
- constructs a linked list of exception ranges. We turn this into
- the data structure expected by the rest of the code, and also
- ensure that exception ranges are properly nested. */
-
-void
-handle_nested_ranges ()
-{
- struct eh_range *ptr, *next;
-
- ptr = whole_range.first_child;
- whole_range.first_child = NULL;
- for (; ptr; ptr = next)
- {
- next = ptr->next_sibling;
- ptr->next_sibling = NULL;
- link_handler (ptr, &whole_range);
- }
-}
-
-
-/* Called to re-initialize the exception machinery for a new method. */
-
-void
-method_init_exceptions ()
-{
- whole_range.start_pc = 0;
- whole_range.end_pc = DECL_CODE_LENGTH (current_function_decl) + 1;
- whole_range.outer = NULL;
- whole_range.first_child = NULL;
- whole_range.next_sibling = NULL;
- cache_range_start = 0xFFFFFF;
- java_set_exception_lang_code ();
-}
-
-void
-java_set_exception_lang_code ()
-{
- set_exception_lang_code (EH_LANG_Java);
- set_exception_version_code (1);
-}
-
-/* Add an exception range. If we already have an exception range
- which has the same handler and label, and the new range overlaps
- that one, then we simply extend the existing range. Some bytecode
- obfuscators generate seemingly nonoverlapping exception ranges
- which, when coalesced, do in fact nest correctly.
-
- This constructs an ordinary linked list which check_nested_ranges()
- later turns into the data structure we actually want.
-
- We expect the input to come in order of increasing START_PC. This
- function doesn't attempt to detect the case where two previously
- added disjoint ranges could be coalesced by a new range; that is
- what the sorting counteracts. */
-
-void
-add_handler (start_pc, end_pc, handler, type)
- int start_pc, end_pc;
- tree handler;
- tree type;
-{
- struct eh_range *ptr, *prev = NULL, *h;
-
- for (ptr = whole_range.first_child; ptr; ptr = ptr->next_sibling)
- {
- if (start_pc >= ptr->start_pc
- && start_pc <= ptr->end_pc
- && TREE_PURPOSE (ptr->handlers) == type
- && TREE_VALUE (ptr->handlers) == handler)
- {
- /* Already found an overlapping range, so coalesce. */
- ptr->end_pc = MAX (ptr->end_pc, end_pc);
- return;
- }
- prev = ptr;
- }
-
- h = (struct eh_range *) oballoc (sizeof (struct eh_range));
- h->start_pc = start_pc;
- h->end_pc = end_pc;
- h->first_child = NULL;
- h->outer = NULL;
- h->handlers = build_tree_list (type, handler);
- h->next_sibling = NULL;
-
- if (prev == NULL)
- whole_range.first_child = h;
- else
- prev->next_sibling = h;
-}
-
-
-/* if there are any handlers for this range, issue start of region */
-static void
-expand_start_java_handler (range)
- struct eh_range *range ATTRIBUTE_UNUSED;
-{
- expand_eh_region_start ();
-}
-
-tree
-prepare_eh_table_type (type)
- tree type;
-{
- tree exp;
-
- /* The "type" (metch_info) in a (Java) exception table is one:
- * a) NULL - meaning match any type in a try-finally.
- * b) a pointer to a (ccmpiled) class (low-order bit 0).
- * c) a pointer to the Utf8Const name of the class, plus one
- * (which yields a value with low-order bit 1). */
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- if (type == NULL_TREE)
- exp = null_pointer_node;
- else if (is_compiled_class (type))
- exp = build_class_ref (type);
- else
- exp = fold (build
- (PLUS_EXPR, ptr_type_node,
- build_utf8_ref (build_internal_class_name (type)),
- size_one_node));
- pop_obstacks ();
- return exp;
-}
-
-/* if there are any handlers for this range, isssue end of range,
- and then all handler blocks */
-static void
-expand_end_java_handler (range)
- struct eh_range *range;
-{
- tree handler = range->handlers;
- expand_start_all_catch ();
- for ( ; handler != NULL_TREE; handler = TREE_CHAIN (handler))
- {
- start_catch_handler (prepare_eh_table_type (TREE_PURPOSE (handler)));
- /* Push the thrown object on the top of the stack */
- expand_goto (TREE_VALUE (handler));
- }
- expand_end_all_catch ();
-}
-
-/* Recursive helper routine for maybe_start_handlers. */
-
-static void
-check_start_handlers (range, pc)
- struct eh_range *range;
- int pc;
-{
- if (range != NULL_EH_RANGE && range->start_pc == pc)
- {
- check_start_handlers (range->outer, pc);
- expand_start_java_handler (range);
- }
-}
-
-struct eh_range *current_range;
-
-/* Emit any start-of-try-range start at PC. */
-
-void
-maybe_start_try (pc)
- int pc;
-{
- if (! doing_eh (1))
- return;
-
- current_range = find_handler (pc);
- check_start_handlers (current_range, pc);
-}
-
-/* Emit any end-of-try-range end at PC. */
-
-void
-maybe_end_try (pc)
- int pc;
-{
- if (! doing_eh (1))
- return;
-
- while (current_range != NULL_EH_RANGE && current_range->end_pc <= pc)
- {
- expand_end_java_handler (current_range);
- current_range = current_range->outer;
- }
-}
-
-/* Emit the handler labels and their code */
-
-void
-emit_handlers ()
-{
- if (catch_clauses)
- {
- rtx funcend = gen_label_rtx ();
- emit_jump (funcend);
-
- emit_insns (catch_clauses);
- expand_leftover_cleanups ();
-
- emit_label (funcend);
- }
-}
-
-/* Resume executing at the statement immediately after the end of an
- exception region. */
-
-void
-expand_resume_after_catch ()
-{
- expand_goto (top_label_entry (&caught_return_label_stack));
-}
diff --git a/gnu/dist/toolchain/gcc/java/expr.c b/gnu/dist/toolchain/gcc/java/expr.c
deleted file mode 100644
index 9beb724ea37..00000000000
--- a/gnu/dist/toolchain/gcc/java/expr.c
+++ /dev/null
@@ -1,2612 +0,0 @@
-/* Process expressions for the GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "real.h"
-#include "rtl.h"
-#include "flags.h"
-#include "expr.h"
-#include "java-tree.h"
-#include "javaop.h"
-#include "java-opcodes.h"
-#include "jcf.h"
-#include "java-except.h"
-#include "parse.h"
-#include "toplev.h"
-#include "except.h"
-
-static void flush_quick_stack PROTO ((void));
-static void push_value PROTO ((tree));
-static tree pop_value PROTO ((tree));
-static void java_stack_swap PROTO ((void));
-static void java_stack_dup PROTO ((int, int));
-static tree build_java_athrow PROTO ((tree));
-static void build_java_jsr PROTO ((tree, tree));
-static void build_java_ret PROTO ((tree));
-static void expand_java_multianewarray PROTO ((tree, int));
-static void expand_java_arraystore PROTO ((tree));
-static void expand_java_arrayload PROTO ((tree));
-static void expand_java_array_length PROTO ((void));
-static tree build_java_monitor PROTO ((tree, tree));
-static void expand_java_pushc PROTO ((int, tree));
-static void expand_java_return PROTO ((tree));
-static void expand_java_NEW PROTO ((tree));
-static void expand_java_INSTANCEOF PROTO ((tree));
-static void expand_java_CHECKCAST PROTO ((tree));
-static void expand_iinc PROTO ((unsigned int, int, int));
-static void expand_java_binop PROTO ((tree, enum tree_code));
-static void note_label PROTO ((int, int));
-static void expand_compare PROTO ((enum tree_code, tree, tree, int));
-static void expand_test PROTO ((enum tree_code, tree, int));
-static void expand_cond PROTO ((enum tree_code, tree, int));
-static void expand_java_goto PROTO ((int));
-#if 0
-static void expand_java_call PROTO ((int, int));
-static void expand_java_ret PROTO ((tree));
-#endif
-static tree pop_arguments PROTO ((tree));
-static void expand_invoke PROTO ((int, int, int));
-static void expand_java_field_op PROTO ((int, int, int));
-static void java_push_constant_from_pool PROTO ((struct JCF *, int));
-
-static tree operand_type[59];
-extern struct obstack permanent_obstack;
-
-void
-init_expr_processing()
-{
- operand_type[21] = operand_type[54] = int_type_node;
- operand_type[22] = operand_type[55] = long_type_node;
- operand_type[23] = operand_type[56] = float_type_node;
- operand_type[24] = operand_type[57] = double_type_node;
- operand_type[25] = operand_type[58] = ptr_type_node;
-}
-
-/* We store the stack state in two places:
- Within a basic block, we use the quick_stack, which is a
- pushdown list (TREE_LISTs) of expression nodes.
- This is the top part of the stack; below that we use find_stack_slot.
- At the end of a basic block, the quick_stack must be flushed
- to the stack slot array (as handled by find_stack_slot).
- Using quick_stack generates better code (especially when
- compiled without optimization), because we do not have to
- explicitly store and load trees to temporary variables.
-
- If a variable is on the quick stack, it means the value of variable
- when the quick stack was last flushed. Conceptually, flush_quick_stack
- saves all the the quick_stack elements in parellel. However, that is
- complicated, so it actually saves them (i.e. copies each stack value
- to is home virtual register) from low indexes. This allows a quick_stack
- element at index i (counting from the bottom of stack the) to references
- slot virtuals for register that are >= i, but not those that are deeper.
- This convention makes most operations easier. For example iadd works
- even when the stack contains (reg[0], reg[1]): It results in the
- stack containing (reg[0]+reg[1]), which is OK. However, some stack
- operations are more complicated. For example dup given a stack
- containing (reg[0]) would yield (reg[0], reg[0]), which would violate
- the convention, since stack value 1 would refer to a register with
- lower index (reg[0]), which flush_quick_stack does not safely handle.
- So dup cannot just add an extra element to the quick_stack, but iadd can.
-*/
-
-tree quick_stack = NULL_TREE;
-
-/* A free-list of unused permamnet TREE_LIST nodes. */
-tree tree_list_free_list = NULL_TREE;
-
-/* The stack pointer of the Java virtual machine.
- This does include the size of the quick_stack. */
-
-int stack_pointer;
-
-unsigned char *linenumber_table;
-int linenumber_count;
-
-tree
-truthvalue_conversion (expr)
- tree expr;
-{
- /* It is simpler and generates better code to have only TRUTH_*_EXPR
- or comparison expressions as truth values at this level.
-
- This function should normally be identity for Java. */
-
- switch (TREE_CODE (expr))
- {
- case EQ_EXPR:
- case NE_EXPR: case LE_EXPR: case GE_EXPR: case LT_EXPR: case GT_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case ERROR_MARK:
- return expr;
-
- case INTEGER_CST:
- return integer_zerop (expr) ? boolean_false_node : boolean_true_node;
-
- case REAL_CST:
- return real_zerop (expr) ? boolean_false_node : boolean_true_node;
-
- /* are these legal? XXX JH */
- case NEGATE_EXPR:
- case ABS_EXPR:
- case FLOAT_EXPR:
- case FFS_EXPR:
- /* These don't change whether an object is non-zero or zero. */
- return truthvalue_conversion (TREE_OPERAND (expr, 0));
-
- case COND_EXPR:
- /* Distribute the conversion into the arms of a COND_EXPR. */
- return fold (build (COND_EXPR, boolean_type_node, TREE_OPERAND (expr, 0),
- truthvalue_conversion (TREE_OPERAND (expr, 1)),
- truthvalue_conversion (TREE_OPERAND (expr, 2))));
-
- case NOP_EXPR:
- /* If this is widening the argument, we can ignore it. */
- if (TYPE_PRECISION (TREE_TYPE (expr))
- >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (expr, 0))))
- return truthvalue_conversion (TREE_OPERAND (expr, 0));
- /* fall through to default */
-
- default:
- return fold (build (NE_EXPR, boolean_type_node, expr, boolean_false_node));
- }
-}
-
-#ifdef JAVA_USE_HANDLES
-/* Given a pointer to a handle, get a pointer to an object. */
-
-tree
-unhand_expr (expr)
- tree expr;
-{
- tree field, handle_type;
- expr = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (expr)), expr);
- handle_type = TREE_TYPE (expr);
- field = TYPE_FIELDS (handle_type);
- expr = build (COMPONENT_REF, TREE_TYPE (field), expr, field);
- return expr;
-}
-#endif
-
-/* Save any stack slots that happen to be in the quick_stack into their
- home virtual register slots.
-
- The copy order is from low stack index to high, to support the invariant
- that the expression for a slot may contain decls for stack slots with
- higher (or the same) index, but not lower. */
-
-static void
-flush_quick_stack ()
-{
- int stack_index = stack_pointer;
- register tree prev, cur, next;
-
- /* First reverse the quick_stack, and count the number of slots it has. */
- for (cur = quick_stack, prev = NULL_TREE; cur != NULL_TREE; cur = next)
- {
- next = TREE_CHAIN (cur);
- TREE_CHAIN (cur) = prev;
- prev = cur;
- stack_index -= 1 + TYPE_IS_WIDE (TREE_TYPE (TREE_VALUE (cur)));
- }
- quick_stack = prev;
-
- while (quick_stack != NULL_TREE)
- {
- tree decl;
- tree node = quick_stack, type;
- quick_stack = TREE_CHAIN (node);
- TREE_CHAIN (node) = tree_list_free_list;
- tree_list_free_list = node;
- node = TREE_VALUE (node);
- type = TREE_TYPE (node);
-
- decl = find_stack_slot (stack_index, type);
- if (decl != node)
- expand_assignment (decl, node, 0, 0);
- stack_index += 1 + TYPE_IS_WIDE (type);
- }
-}
-
-void
-push_type (type)
- tree type;
-{
- int n_words;
- type = promote_type (type);
- n_words = 1 + TYPE_IS_WIDE (type);
- if (stack_pointer + n_words > DECL_MAX_STACK (current_function_decl))
- fatal ("stack overflow");
- stack_type_map[stack_pointer++] = type;
- n_words--;
- while (--n_words >= 0)
- stack_type_map[stack_pointer++] = TYPE_SECOND;
-}
-
-static void
-push_value (value)
- tree value;
-{
- tree type = TREE_TYPE (value);
- if (TYPE_PRECISION (type) < 32 && INTEGRAL_TYPE_P (type))
- {
- type = promote_type (type);
- value = convert (type, value);
- }
- push_type (type);
- if (tree_list_free_list == NULL_TREE)
- quick_stack = perm_tree_cons (NULL_TREE, value, quick_stack);
- else
- {
- tree node = tree_list_free_list;
- tree_list_free_list = TREE_CHAIN (tree_list_free_list);
- TREE_VALUE (node) = value;
- TREE_CHAIN (node) = quick_stack;
- quick_stack = node;
- }
-}
-
-/* Pop a type from the type stack.
- TYPE is the expected type. Return the actual type, which must be
- convertible to TYPE, otherwise NULL_TREE is returned. */
-
-tree
-pop_type_0 (type)
- tree type;
-{
- int n_words;
- tree t;
- if (TREE_CODE (type) == RECORD_TYPE)
- type = promote_type (type);
- n_words = 1 + TYPE_IS_WIDE (type);
- if (stack_pointer < n_words)
- fatal ("stack underflow");
- while (--n_words > 0)
- {
- if (stack_type_map[--stack_pointer] != void_type_node)
- fatal ("Invalid multi-word value on type stack");
- }
- t = stack_type_map[--stack_pointer];
- if (type == NULL_TREE || t == type)
- return t;
- if (INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (t)
- && TYPE_PRECISION (type) <= 32 && TYPE_PRECISION (t) <= 32)
- return t;
- if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (t) == POINTER_TYPE)
- {
- if (type == ptr_type_node || type == object_ptr_type_node)
- return t;
- else if (t == ptr_type_node) /* Special case for null reference. */
- return type;
- else if (can_widen_reference_to (t, type))
- return t;
- /* This is a kludge, but matches what Sun's verifier does.
- It can be tricked, but is safe as long as type errors
- (i.e. interface method calls) are caught at run-time. */
- else if (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (type)))
- && t == object_ptr_type_node)
- return t;
- }
- return NULL_TREE;
-}
-
-/* Pop a type from the type stack.
- TYPE is the expected type. Return the actual type, which must be
- convertible to TYPE, otherwise call error. */
-
-tree
-pop_type (type)
- tree type;
-{
- tree t = pop_type_0 (type);
- if (t != NULL_TREE)
- return t;
- error ("unexpected type on stack");
- return type;
-}
-
-/* Return 1f if SOURCE_TYPE can be safely widened to TARGET_TYPE.
- Handles array types and interfaces. */
-
-int
-can_widen_reference_to (source_type, target_type)
- tree source_type, target_type;
-{
- if (source_type == ptr_type_node || target_type == object_ptr_type_node)
- return 1;
-
- /* Get rid of pointers */
- if (TREE_CODE (source_type) == POINTER_TYPE)
- source_type = TREE_TYPE (source_type);
- if (TREE_CODE (target_type) == POINTER_TYPE)
- target_type = TREE_TYPE (target_type);
-
- if (source_type == target_type)
- return 1;
- else
- {
- source_type = HANDLE_TO_CLASS_TYPE (source_type);
- target_type = HANDLE_TO_CLASS_TYPE (target_type);
- if (TYPE_ARRAY_P (source_type) || TYPE_ARRAY_P (target_type))
- {
- HOST_WIDE_INT source_length, target_length;
- if (TYPE_ARRAY_P (source_type) != TYPE_ARRAY_P (target_type))
- return 0;
- target_length = java_array_type_length (target_type);
- if (target_length >= 0)
- {
- source_length = java_array_type_length (source_type);
- if (source_length != target_length)
- return 0;
- }
- source_type = TYPE_ARRAY_ELEMENT (source_type);
- target_type = TYPE_ARRAY_ELEMENT (target_type);
- if (source_type == target_type)
- return 1;
- if (TREE_CODE (source_type) != POINTER_TYPE
- || TREE_CODE (target_type) != POINTER_TYPE)
- return 0;
- return can_widen_reference_to (source_type, target_type);
- }
- else
- {
- int source_depth = class_depth (source_type);
- int target_depth = class_depth (target_type);
-
- if (CLASS_INTERFACE (TYPE_NAME (target_type)))
- {
- /* target_type is OK if source_type or source_type ancestors
- implement target_type. We handle multiple sub-interfaces */
-
- tree basetype_vec = TYPE_BINFO_BASETYPES (source_type);
- int n = TREE_VEC_LENGTH (basetype_vec), i;
- for (i=0 ; i < n; i++)
- if (can_widen_reference_to
- (TREE_TYPE (TREE_VEC_ELT (basetype_vec, i)),
- target_type))
- return 1;
- if (n == 0)
- return 0;
- }
-
- for ( ; source_depth > target_depth; source_depth--)
- {
- source_type = TYPE_BINFO_BASETYPE (source_type, 0);
- }
- return source_type == target_type;
- }
- }
-}
-
-static tree
-pop_value (type)
- tree type;
-{
- type = pop_type (type);
- if (quick_stack)
- {
- tree node = quick_stack;
- quick_stack = TREE_CHAIN (quick_stack);
- TREE_CHAIN (node) = tree_list_free_list;
- tree_list_free_list = node;
- node = TREE_VALUE (node);
- return node;
- }
- else
- return find_stack_slot (stack_pointer, promote_type (type));
-}
-
-
-/* Pop and discrad the top COUNT stack slots. */
-
-static void
-java_stack_pop (count)
- int count;
-{
- while (count > 0)
- {
- tree type, val;
- if (stack_pointer == 0)
- fatal ("stack underflow");
- type = stack_type_map[stack_pointer - 1];
- if (type == TYPE_SECOND)
- {
- count--;
- if (stack_pointer == 1 || count <= 0)
- fatal ("stack underflow");
- type = stack_type_map[stack_pointer - 2];
- }
- val = pop_value (type);
- count--;
- }
-}
-
-/* Implement the 'swap' operator (to swap two top stack slots). */
-
-static void
-java_stack_swap ()
-{
- tree type1, type2;
- rtx temp;
- tree decl1, decl2;
-
- if (stack_pointer < 2
- || (type1 = stack_type_map[stack_pointer - 1]) == TYPE_UNKNOWN
- || (type2 = stack_type_map[stack_pointer - 2]) == TYPE_UNKNOWN
- || type1 == TYPE_SECOND || type2 == TYPE_SECOND
- || TYPE_IS_WIDE (type1) || TYPE_IS_WIDE (type2))
- fatal ("bad stack swap");
-
- flush_quick_stack ();
- decl1 = find_stack_slot (stack_pointer - 1, type1);
- decl2 = find_stack_slot (stack_pointer - 2, type2);
- temp = copy_to_reg (DECL_RTL (decl1));
- emit_move_insn (DECL_RTL (decl1), DECL_RTL (decl2));
- emit_move_insn (DECL_RTL (decl2), temp);
- stack_type_map[stack_pointer - 1] = type2;
- stack_type_map[stack_pointer - 2] = type1;
-}
-
-static void
-java_stack_dup (size, offset)
- int size, offset;
-{
- int low_index = stack_pointer - size - offset;
- int dst_index;
- if (low_index < 0)
- error ("stack underflow - dup* operation");
-
- flush_quick_stack ();
-
- stack_pointer += size;
- dst_index = stack_pointer;
-
- for (dst_index = stack_pointer; --dst_index >= low_index; )
- {
- tree type;
- int src_index = dst_index - size;
- if (src_index < low_index)
- src_index = dst_index + size + offset;
- type = stack_type_map [src_index];
- if (type == TYPE_SECOND)
- {
- if (src_index <= low_index)
- fatal ("dup operation splits 64-bit number");
- stack_type_map[dst_index] = type;
- src_index--; dst_index--;
- type = stack_type_map[src_index];
- if (! TYPE_IS_WIDE (type))
- fatal ("internal error - dup operation");
- }
- else if (TYPE_IS_WIDE (type))
- fatal ("internal error - dup operation");
- if (src_index != dst_index)
- {
- tree src_decl = find_stack_slot (src_index, type);
- tree dst_decl = find_stack_slot (dst_index, type);
- emit_move_insn (DECL_RTL (dst_decl), DECL_RTL (src_decl));
- stack_type_map[dst_index] = type;
- }
- }
-}
-
-/* Calls _Jv_Throw. Discard the contents of the value stack. */
-
-static tree
-build_java_athrow (node)
- tree node;
-{
- tree call;
-
- call = build (CALL_EXPR,
- void_type_node,
- build_address_of (throw_node),
- build_tree_list (NULL_TREE, node),
- NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- expand_expr_stmt (call);
- java_stack_pop (stack_pointer);
-}
-
-/* Implementation for jsr/ret */
-
-static void
-build_java_jsr (where, ret)
- tree where;
- tree ret;
-{
- tree ret_label = fold (build1 (ADDR_EXPR, return_address_type_node, ret));
- push_value (ret_label);
- flush_quick_stack ();
- expand_goto (where);
- expand_label (ret);
-}
-
-static void
-build_java_ret (location)
- tree location;
-{
- expand_computed_goto (location);
-}
-
-/* Implementation of operations on array: new, load, store, length */
-
-/* Array core info access macros */
-
-#define JAVA_ARRAY_LENGTH_OFFSET(A) \
- size_binop (CEIL_DIV_EXPR, \
- (DECL_FIELD_BITPOS \
- (TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (TREE_TYPE (A)))))), \
- size_int (BITS_PER_UNIT))
-
-tree
-decode_newarray_type (atype)
- int atype;
-{
- switch (atype)
- {
- case 4: return boolean_type_node;
- case 5: return char_type_node;
- case 6: return float_type_node;
- case 7: return double_type_node;
- case 8: return byte_type_node;
- case 9: return short_type_node;
- case 10: return int_type_node;
- case 11: return long_type_node;
- default: return NULL_TREE;
- }
-}
-
-/* Map primitive type to the code used by OPCODE_newarray. */
-
-int
-encode_newarray_type (type)
- tree type;
-{
- if (type == boolean_type_node)
- return 4;
- else if (type == char_type_node)
- return 5;
- else if (type == float_type_node)
- return 6;
- else if (type == double_type_node)
- return 7;
- else if (type == byte_type_node)
- return 8;
- else if (type == short_type_node)
- return 9;
- else if (type == int_type_node)
- return 10;
- else if (type == long_type_node)
- return 11;
- else
- fatal ("Can't compute type code - patch_newarray");
-}
-
-/* Build a call to _Jv_ThrowBadArrayIndex(), the
- ArrayIndexOfBoundsException exception handler. */
-
-static tree
-build_java_throw_out_of_bounds_exception (index)
- tree index;
-{
- tree node = build (CALL_EXPR, int_type_node,
- build_address_of (soft_badarrayindex_node),
- build_tree_list (NULL_TREE, index), NULL_TREE);
- TREE_SIDE_EFFECTS (node) = 1; /* Allows expansion within ANDIF */
- return (node);
-}
-
-/* Return the length of an array. Doesn't perform any checking on the nature
- or value of the array NODE. May be used to implement some bytecodes. */
-
-tree
-build_java_array_length_access (node)
- tree node;
-{
- tree type = TREE_TYPE (node);
- HOST_WIDE_INT length;
- if (!is_array_type_p (type))
- fatal ("array length on a non-array reference");
- length = java_array_type_length (type);
- if (length >= 0)
- return build_int_2 (length, 0);
- return fold (build1 (INDIRECT_REF,
- int_type_node,
- fold (build (PLUS_EXPR, ptr_type_node,
- node,
- JAVA_ARRAY_LENGTH_OFFSET(node)))));
-}
-
-/* Optionally checks an array against the NULL pointer, eventually throwing a
- NullPointerException. It could replace signal handling, but tied to NULL.
- ARG1: the pointer to check, ARG2: the expression to use if
- the pointer is non-null and ARG3 the type that should be returned. */
-
-tree
-build_java_arraynull_check (node, expr, type)
- tree node ATTRIBUTE_UNUSED;
- tree expr;
- tree type ATTRIBUTE_UNUSED;
-{
-#if 0
- static int java_array_access_throws_null_exception = 0;
- node = ???;
- if (java_array_access_throws_null_exception)
- return (build (COND_EXPR,
- type,
- build (EQ_EXPR, int_type_node, node, null_pointer_node),
- build_java_athrow (node), expr ));
- else
-#endif
- return (expr);
-}
-
-static tree
-java_array_data_offset (array)
- tree array;
-{
- tree array_type = TREE_TYPE (TREE_TYPE (array));
- tree data_fld = TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (array_type)));
- if (data_fld == NULL_TREE)
- return size_in_bytes (array_type);
- else
- return build_int_2 (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (data_fld))
- / BITS_PER_UNIT, 0);
-}
-
-/* Implement array indexing (either as l-value or r-value).
- Returns a tree for ARRAY[INDEX], assume TYPE is the element type.
- Optionally performs bounds checking and/or test to NULL.
- At this point, ARRAY should have been verified as an array. */
-
-tree
-build_java_arrayaccess (array, type, index)
- tree array, type, index;
-{
- tree arith, node, throw = NULL_TREE;
-
- arith = fold (build (PLUS_EXPR, int_type_node,
- java_array_data_offset (array),
- fold (build (MULT_EXPR, int_type_node,
- index, size_in_bytes(type)))));
-
- if (flag_bounds_check)
- {
- /* Generate:
- * (unsigned jint) INDEX >= (unsigned jint) LEN
- * && throw ArrayIndexOutOfBoundsException.
- * Note this is equivalent to and more efficient than:
- * INDEX < 0 || INDEX >= LEN && throw ... */
- tree test;
- tree len = build_java_array_length_access (array);
- TREE_TYPE (len) = unsigned_int_type_node;
- test = fold (build (GE_EXPR, boolean_type_node,
- convert (unsigned_int_type_node, index),
- len));
- if (! integer_zerop (test))
- {
- throw = build (TRUTH_ANDIF_EXPR, int_type_node, test,
- build_java_throw_out_of_bounds_exception (index));
- /* allows expansion within COMPOUND */
- TREE_SIDE_EFFECTS( throw ) = 1;
- }
- }
-
- node = build1 (INDIRECT_REF, type,
- fold (build (PLUS_EXPR, ptr_type_node,
- array,
- (throw ? build (COMPOUND_EXPR, int_type_node,
- throw, arith )
- : arith))));
-
- return (fold (build_java_arraynull_check (array, node, type)));
-}
-
-/* Makes sure that INDEXED_TYPE is appropriate. If not, make it from
- ARRAY_NODE. This function is used to retrieve something less vague than
- a pointer type when indexing the first dimension of something like [[<t>.
- May return a corrected type, if necessary, otherwise INDEXED_TYPE is
- return unchanged.
- As a side effect, it also makes sure that ARRAY_NODE is an array. */
-
-static tree
-build_java_check_indexed_type (array_node, indexed_type)
- tree array_node;
- tree indexed_type;
-{
- tree elt_type;
-
- if (!is_array_type_p (TREE_TYPE (array_node)))
- fatal ("array indexing on a non-array reference");
-
- elt_type = (TYPE_ARRAY_ELEMENT (TREE_TYPE (TREE_TYPE (array_node))));
-
- if (indexed_type == ptr_type_node )
- return promote_type (elt_type);
-
- /* BYTE/BOOLEAN store and load are used for both type */
- if (indexed_type == byte_type_node && elt_type == boolean_type_node )
- return boolean_type_node;
-
- if (indexed_type != elt_type )
- fatal ("type array element mismatch");
- else
- return indexed_type;
-}
-
-/* newarray triggers a call to _Jv_NewArray. This function should be called
- with an integer code (the type of array to create) and get from the stack
- the size of the dimmension. */
-
-tree
-build_newarray (atype_value, length)
- int atype_value;
- tree length;
-{
- tree type = build_java_array_type (decode_newarray_type (atype_value),
- TREE_CODE (length) == INTEGER_CST
- ? TREE_INT_CST_LOW (length)
- : -1);
- return build (CALL_EXPR, promote_type (type),
- build_address_of (soft_newarray_node),
- tree_cons (NULL_TREE,
- build_int_2 (atype_value, 0),
- build_tree_list (NULL_TREE, length)),
- NULL_TREE);
-}
-
-/* Generates anewarray from a given CLASS_TYPE. Gets from the stack the size
- of the dimension. */
-
-tree
-build_anewarray (class_type, length)
- tree class_type;
- tree length;
-{
- tree type = build_java_array_type (class_type,
- TREE_CODE (length) == INTEGER_CST
- ? TREE_INT_CST_LOW (length)
- : -1);
- return build (CALL_EXPR, promote_type (type),
- build_address_of (soft_anewarray_node),
- tree_cons (NULL_TREE, length,
- tree_cons (NULL_TREE, build_class_ref (class_type),
- build_tree_list (NULL_TREE,
- null_pointer_node))),
- NULL_TREE);
-}
-
-/* Return a node the evaluates 'new TYPE[LENGTH]'. */
-
-tree
-build_new_array (type, length)
- tree type;
- tree length;
-{
- if (JPRIMITIVE_TYPE_P (type))
- return build_newarray (encode_newarray_type (type), length);
- else
- return build_anewarray (TREE_TYPE (type), length);
-}
-
-/* Generates a call to _Jv_NewMultiArray. multianewarray expects a
- class pointer, a number of dimensions and the matching number of
- dimensions. The argument list is NULL terminated. */
-
-static void
-expand_java_multianewarray (class_type, ndim)
- tree class_type;
- int ndim;
-{
- int i;
- tree args = build_tree_list( NULL_TREE, null_pointer_node );
-
- for( i = 0; i < ndim; i++ )
- args = tree_cons (NULL_TREE, pop_value (int_type_node), args);
-
- push_value (build (CALL_EXPR,
- promote_type (class_type),
- build_address_of (soft_multianewarray_node),
- tree_cons (NULL_TREE, build_class_ref (class_type),
- tree_cons (NULL_TREE,
- build_int_2 (ndim, 0), args )),
- NULL_TREE));
-}
-
-/* ARRAY[INDEX] <- RHS. build_java_check_indexed_type makes sure that
- ARRAY is an array type. May expand some bound checking and NULL
- pointer checking. RHS_TYPE_NODE we are going to store. In the case
- of the CHAR/BYTE/BOOLEAN SHORT, the type popped of the stack is an
- INT. In those cases, we make the convertion.
-
- if ARRAy is a reference type, the assignment is checked at run-time
- to make sure that the RHS can be assigned to the array element
- type. It is not necessary to generate this code if ARRAY is final. */
-
-static void
-expand_java_arraystore (rhs_type_node)
- tree rhs_type_node;
-{
- tree rhs_node = pop_value ((INTEGRAL_TYPE_P (rhs_type_node)
- && TYPE_PRECISION (rhs_type_node) <= 32) ?
- int_type_node : rhs_type_node);
- tree index = pop_value (int_type_node);
- tree array = pop_value (ptr_type_node);
-
- rhs_type_node = build_java_check_indexed_type (array, rhs_type_node);
-
- flush_quick_stack ();
-
- index = save_expr (index);
- array = save_expr (array);
-
- if (TREE_CODE (rhs_type_node) == POINTER_TYPE
- && !CLASS_FINAL (TYPE_NAME (TREE_TYPE (rhs_type_node))))
- {
- tree check = build (CALL_EXPR, void_type_node,
- build_address_of (soft_checkarraystore_node),
- tree_cons (NULL_TREE, array,
- build_tree_list (NULL_TREE, rhs_node)),
- NULL_TREE);
- TREE_SIDE_EFFECTS (check) = 1;
- expand_expr_stmt (check);
- }
-
- expand_assignment (build_java_arrayaccess (array,
- rhs_type_node,
- index),
- rhs_node, 0, 0);
-}
-
-/* Expand the evaluation of ARRAY[INDEX]. build_java_check_indexed_type makes
- sure that LHS is an array type. May expand some bound checking and NULL
- pointer checking.
- LHS_TYPE_NODE is the type of ARRAY[INDEX]. But in the case of CHAR/BYTE/
- BOOLEAN/SHORT, we push a promoted type back to the stack.
-*/
-
-static void
-expand_java_arrayload (lhs_type_node )
- tree lhs_type_node;
-{
- tree load_node;
- tree index_node = pop_value (int_type_node);
- tree array_node = pop_value (ptr_type_node);
-
- index_node = save_expr (index_node);
- array_node = save_expr (array_node);
- lhs_type_node = build_java_check_indexed_type (array_node, lhs_type_node);
-
- load_node = build_java_arrayaccess (array_node,
- lhs_type_node,
- index_node);
-
- if (INTEGRAL_TYPE_P (lhs_type_node) && TYPE_PRECISION (lhs_type_node) <= 32)
- load_node = fold (build1 (NOP_EXPR, int_type_node, load_node));
- push_value (load_node);
-}
-
-/* Expands .length. Makes sure that we deal with and array and may expand
- a NULL check on the array object. */
-
-static void
-expand_java_array_length ()
-{
- tree array = pop_value (ptr_type_node);
- tree length = build_java_array_length_access (array);
-
- push_value (build_java_arraynull_check (array, length, int_type_node));
-}
-
-/* Emit code for the call to _Jv_Monitor{Enter,Exit}. CALL can be
- either soft_monitorenter_node or soft_monitorexit_node. */
-
-static tree
-build_java_monitor (call, object)
- tree call;
- tree object;
-{
- return (build (CALL_EXPR,
- void_type_node,
- build_address_of (call),
- build_tree_list (NULL_TREE, object),
- NULL_TREE));
-}
-
-/* Emit code for one of the PUSHC instructions. */
-
-static void
-expand_java_pushc (ival, type)
- int ival;
- tree type;
-{
- tree value;
- if (type == ptr_type_node && ival == 0)
- value = null_pointer_node;
- else if (type == int_type_node || type == long_type_node)
- {
- value = build_int_2 (ival, ival < 0 ? -1 : 0);
- TREE_TYPE (value) = type;
- }
- else if (type == float_type_node || type == double_type_node)
- {
- REAL_VALUE_TYPE x;
-#ifdef REAL_ARITHMETIC
- REAL_VALUE_FROM_INT (x, ival, 0, TYPE_MODE (type));
-#else
- x = ival;
-#endif
- value = build_real (type, x);
- }
- else
- fatal ("internal error in expand_java_pushc");
- push_value (value);
-}
-
-static void
-expand_java_return (type)
- tree type;
-{
- if (type == void_type_node)
- expand_null_return ();
- else
- {
- tree retval = pop_value (type);
- tree res = DECL_RESULT (current_function_decl);
- retval = build (MODIFY_EXPR, TREE_TYPE (res), res, retval);
- TREE_SIDE_EFFECTS (retval) = 1;
- expand_return (retval);
- }
-}
-
-tree
-build_address_of (value)
- tree value;
-{
- return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (value)), value);
-}
-
-static void
-expand_java_NEW (type)
- tree type;
-{
- if (! CLASS_LOADED_P (type))
- load_class (type, 1);
- layout_class_methods (type);
- push_value (build (CALL_EXPR, promote_type (type),
- build_address_of (alloc_object_node),
- tree_cons (NULL_TREE, build_class_ref (type),
- build_tree_list (NULL_TREE,
- size_in_bytes (type))),
- NULL_TREE));
-}
-
-static void
-expand_java_INSTANCEOF (type)
- tree type;
-{
- tree value = pop_value (object_ptr_type_node);
- value = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (soft_instanceof_node)),
- build_address_of (soft_instanceof_node),
- tree_cons (NULL_TREE, value,
- build_tree_list (NULL_TREE,
- build_class_ref (type))),
- NULL_TREE);
- push_value (value);
-}
-
-static void
-expand_java_CHECKCAST (type)
- tree type;
-{
- tree value = pop_value (ptr_type_node);
- value = build (CALL_EXPR, promote_type (type),
- build_address_of (soft_checkcast_node),
- tree_cons (NULL_TREE, build_class_ref (type),
- build_tree_list (NULL_TREE, value)),
- NULL_TREE);
- push_value (value);
-}
-
-static void
-expand_iinc (local_var_index, ival, pc)
- unsigned int local_var_index;
- int ival;
- int pc;
-{
- tree local_var, res;
- tree constant_value;
-
- flush_quick_stack ();
- local_var = find_local_variable (local_var_index, int_type_node, pc);
- constant_value = build_int_2 (ival, ival < 0 ? -1 : 0);
- res = fold (build (PLUS_EXPR, int_type_node, local_var, constant_value));
- expand_assignment (local_var, res, 0, 0);
-}
-
-tree
-build_java_binop (op, type, arg1, arg2)
- enum tree_code op;
- tree type, arg1, arg2;
-{
- tree mask;
- switch (op)
- {
- case URSHIFT_EXPR:
- {
- tree u_type = unsigned_type (type);
- arg1 = convert (u_type, arg1);
- arg1 = build_java_binop (RSHIFT_EXPR, u_type, arg1, arg2);
- return convert (type, arg1);
- }
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- mask = build_int_2 (TYPE_PRECISION (TREE_TYPE (arg1)) - 1, 0);
- arg2 = fold (build (BIT_AND_EXPR, int_type_node, arg2, mask));
- break;
-
- case COMPARE_L_EXPR: /* arg1 > arg2 ? 1 : arg1 == arg2 ? 0 : -1 */
- case COMPARE_G_EXPR: /* arg1 < arg2 ? -1 : arg1 == arg2 ? 0 : 1 */
- arg1 = save_expr (arg1); arg2 = save_expr (arg2);
- {
- tree ifexp1 = fold ( build (op == COMPARE_L_EXPR ? GT_EXPR : LT_EXPR,
- boolean_type_node, arg1, arg2));
- tree ifexp2 = fold ( build (EQ_EXPR, boolean_type_node, arg1, arg2));
- tree second_compare = fold (build (COND_EXPR, int_type_node,
- ifexp2, integer_zero_node,
- op == COMPARE_L_EXPR
- ? integer_negative_one_node
- : integer_one_node));
- return fold (build (COND_EXPR, int_type_node, ifexp1,
- op == COMPARE_L_EXPR ? integer_one_node
- : integer_negative_one_node,
- second_compare));
- }
- case COMPARE_EXPR:
- arg1 = save_expr (arg1); arg2 = save_expr (arg2);
- {
- tree ifexp1 = fold ( build (LT_EXPR, boolean_type_node, arg1, arg2));
- tree ifexp2 = fold ( build (GT_EXPR, boolean_type_node, arg1, arg2));
- tree second_compare = fold ( build (COND_EXPR, int_type_node,
- ifexp2, integer_one_node,
- integer_zero_node));
- return fold (build (COND_EXPR, int_type_node,
- ifexp1, integer_negative_one_node, second_compare));
- }
-
- case TRUNC_MOD_EXPR:
- if (TREE_CODE (type) == REAL_TYPE)
- {
- tree call;
- if (type != double_type_node)
- {
- arg1 = convert (double_type_node, arg1);
- arg2 = convert (double_type_node, arg2);
- }
- call = build (CALL_EXPR, double_type_node,
- build_address_of (soft_fmod_node),
- tree_cons (NULL_TREE, arg1,
- build_tree_list (NULL_TREE, arg2)),
- NULL_TREE);
- if (type != double_type_node)
- call = convert (type, call);
- return call;
- }
- break;
- default: ;
- }
- return fold (build (op, type, arg1, arg2));
-}
-
-static void
-expand_java_binop (type, op)
- tree type; enum tree_code op;
-{
- tree larg, rarg;
- tree ltype = type;
- tree rtype = type;
- switch (op)
- {
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case URSHIFT_EXPR:
- rtype = int_type_node;
- rarg = pop_value (rtype);
- break;
- default:
- rarg = pop_value (rtype);
- }
- larg = pop_value (ltype);
- push_value (build_java_binop (op, type, larg, rarg));
-}
-
-/* Lookup the field named NAME in *TYPEP or its super classes.
- If not found, return NULL_TREE.
- (If the *TYPEP is not found, return error_mark_node.)
- If found, return the FIELD_DECL, and set *TYPEP to the
- class containing the field. */
-
-tree
-lookup_field (typep, name)
- tree *typep;
- tree name;
-{
- if (CLASS_P (*typep) && !CLASS_LOADED_P (*typep))
- {
- load_class (*typep, 1);
- if (!TYPE_SIZE (*typep) || TREE_CODE (TYPE_SIZE (*typep)) == ERROR_MARK)
- return error_mark_node;
- }
- do
- {
- tree field, basetype_vec;
- int n, i;
-
- for (field = TYPE_FIELDS (*typep); field; field = TREE_CHAIN (field))
- if (DECL_NAME (field) == name)
- return field;
-
- /* Process implemented interfaces. */
- basetype_vec = TYPE_BINFO_BASETYPES (*typep);
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
- if ((field = lookup_field (&t, name)))
- return field;
- }
- *typep = CLASSTYPE_SUPER (*typep);
- } while (*typep);
- return NULL_TREE;
-}
-
-/* Look up the field named NAME in object SELF_VALUE,
- which has class SELF_CLASS (a non-handle RECORD_TYPE).
- SELF_VALUE is NULL_TREE if looking for a static field. */
-
-tree
-build_field_ref (self_value, self_class, name)
- tree self_value, self_class, name;
-{
- tree base_class = self_class;
- tree field_decl = lookup_field (&base_class, name);
- if (field_decl == NULL_TREE)
- {
- error ("field `%s' not found", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- if (self_value == NULL_TREE)
- {
- return build_static_field_ref (field_decl);
- }
- else
- {
- tree base_handle_type = promote_type (base_class);
- if (base_handle_type != TREE_TYPE (self_value))
- self_value = fold (build1 (NOP_EXPR, base_handle_type, self_value));
-#ifdef JAVA_USE_HANDLES
- self_value = unhand_expr (self_value);
-#endif
- self_value = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (self_value)),
- self_value);
- return fold (build (COMPONENT_REF, TREE_TYPE (field_decl),
- self_value, field_decl));
- }
-}
-
-tree
-lookup_label (pc)
- int pc;
-{
- tree name;
- char buf[32];
- ASM_GENERATE_INTERNAL_LABEL(buf, "LJpc=", pc);
- name = get_identifier (buf);
- if (IDENTIFIER_LOCAL_VALUE (name))
- return IDENTIFIER_LOCAL_VALUE (name);
- else
- {
- /* The type of the address of a label is return_address_type_node. */
- tree decl = create_label_decl (name);
- LABEL_PC (decl) = pc;
- label_rtx (decl);
- return pushdecl (decl);
- }
-}
-
-/* Generate a unique name for the purpose of loops and switches
- labels, and try-catch-finally blocks label or temporary variables. */
-
-tree
-generate_name ()
-{
- static int l_number = 0;
- char buff [32];
- ASM_GENERATE_INTERNAL_LABEL(buff, "LJv", l_number);
- l_number++;
- return get_identifier (buff);
-}
-
-tree
-create_label_decl (name)
- tree name;
-{
- tree decl;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- decl = build_decl (LABEL_DECL, name,
- TREE_TYPE (return_address_type_node));
- pop_obstacks ();
- DECL_CONTEXT (decl) = current_function_decl;
- DECL_IGNORED_P (decl) = 1;
- return decl;
-}
-
-/* This maps a bytecode offset (PC) to various flags. */
-char *instruction_bits;
-
-static void
-note_label (current_pc, target_pc)
- int current_pc ATTRIBUTE_UNUSED, target_pc;
-{
- lookup_label (target_pc);
- instruction_bits [target_pc] |= BCODE_JUMP_TARGET;
-}
-
-/* Emit code to jump to TARGET_PC if VALUE1 CONDITION VALUE2,
- where CONDITION is one of one the compare operators. */
-
-static void
-expand_compare (condition, value1, value2, target_pc)
- enum tree_code condition;
- tree value1, value2;
- int target_pc;
-{
- tree target = lookup_label (target_pc);
- tree cond = fold (build (condition, boolean_type_node, value1, value2));
- expand_start_cond (truthvalue_conversion (cond), 0);
- expand_goto (target);
- expand_end_cond ();
-}
-
-/* Emit code for a TEST-type opcode. */
-
-static void
-expand_test (condition, type, target_pc)
- enum tree_code condition;
- tree type;
- int target_pc;
-{
- tree value1, value2;
- flush_quick_stack ();
- value1 = pop_value (type);
- value2 = (type == ptr_type_node) ? null_pointer_node : integer_zero_node;
- expand_compare (condition, value1, value2, target_pc);
-}
-
-/* Emit code for a COND-type opcode. */
-
-static void
-expand_cond (condition, type, target_pc)
- enum tree_code condition;
- tree type;
- int target_pc;
-{
- tree value1, value2;
- flush_quick_stack ();
- /* note: pop values in opposite order */
- value2 = pop_value (type);
- value1 = pop_value (type);
- /* Maybe should check value1 and value2 for type compatibility ??? */
- expand_compare (condition, value1, value2, target_pc);
-}
-
-static void
-expand_java_goto (target_pc)
- int target_pc;
-{
- tree target_label = lookup_label (target_pc);
- flush_quick_stack ();
- expand_goto (target_label);
-}
-
-#if 0
-static void
-expand_java_call (target_pc, return_address)
- int target_pc, return_address;
-{
- tree target_label = lookup_label (target_pc);
- tree value = build_int_2 (return_address, return_address < 0 ? -1 : 0);
- push_value (value);
- flush_quick_stack ();
- expand_goto (target_label);
-}
-
-static void
-expand_java_ret (return_address)
- tree return_address ATTRIBUTE_UNUSED;
-{
- warning ("ret instruction not implemented");
-#if 0
- tree target_label = lookup_label (target_pc);
- flush_quick_stack ();
- expand_goto (target_label);
-#endif
-}
-#endif
-
-/* Recursive helper function to pop argument types during verifiation. */
-
-void
-pop_argument_types (arg_types)
- tree arg_types;
-{
- if (arg_types == end_params_node)
- return;
- if (TREE_CODE (arg_types) == TREE_LIST)
- {
- pop_argument_types (TREE_CHAIN (arg_types));
- pop_type (TREE_VALUE (arg_types));
- return;
- }
- abort ();
-}
-
-static tree
-pop_arguments (arg_types)
- tree arg_types;
-{
- if (arg_types == end_params_node)
- return NULL_TREE;
- if (TREE_CODE (arg_types) == TREE_LIST)
- {
- tree tail = pop_arguments (TREE_CHAIN (arg_types));
- tree type = TREE_VALUE (arg_types);
- tree arg = pop_value (type);
-#ifdef PROMOTE_PROTOTYPES
- if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
- && INTEGRAL_TYPE_P (type))
- arg = convert (integer_type_node, arg);
-#endif
- return tree_cons (NULL_TREE, arg, tail);
- }
- abort ();
-}
-
-/* Build an expression to initialize the class CLAS.
- if EXPR is non-NULL, returns an expression to first call the initializer
- (if it is needed) and then calls EXPR. */
-
-tree
-build_class_init (clas, expr)
- tree clas, expr;
-{
- tree init;
- if (inherits_from_p (current_class, clas))
- return expr;
- init = build (CALL_EXPR, void_type_node,
- build_address_of (soft_initclass_node),
- build_tree_list (NULL_TREE, build_class_ref (clas)),
- NULL_TREE);
- TREE_SIDE_EFFECTS (init) = 1;
- if (expr != NULL_TREE)
- {
- expr = build (COMPOUND_EXPR, TREE_TYPE (expr), init, expr);
- TREE_SIDE_EFFECTS (expr) = 1;
- return expr;
- }
- return init;
-}
-
-static tree methods_ident = NULL_TREE;
-static tree ncode_ident = NULL_TREE;
-tree dtable_ident = NULL_TREE;
-
-tree
-build_known_method_ref (method, method_type, self_type, method_signature, arg_list)
- tree method, method_type ATTRIBUTE_UNUSED, self_type,
- method_signature ATTRIBUTE_UNUSED, arg_list ATTRIBUTE_UNUSED;
-{
- tree func;
- if (is_compiled_class (self_type))
- {
- make_decl_rtl (method, NULL, 1);
- func = build1 (ADDR_EXPR, method_ptr_type_node, method);
- }
- else
- {
- /* We don't know whether the method has been (statically) compiled.
- Compile this code to get a reference to the method's code:
-
- SELF_TYPE->methods[METHOD_INDEX].ncode
-
- This is guaranteed to work (assuming SELF_TYPE has
- been initialized), since if the method is not compiled yet,
- its ncode points to a trampoline that forces compilation. */
-
- int method_index = 0;
- tree meth;
- tree ref = build_class_ref (self_type);
- ref = build1 (INDIRECT_REF, class_type_node, ref);
- if (ncode_ident == NULL_TREE)
- ncode_ident = get_identifier ("ncode");
- if (methods_ident == NULL_TREE)
- methods_ident = get_identifier ("methods");
- ref = build (COMPONENT_REF, method_ptr_type_node, ref,
- lookup_field (&class_type_node, methods_ident));
- for (meth = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (self_type));
- ; meth = TREE_CHAIN (meth))
- {
- if (method == meth)
- break;
- if (meth == NULL_TREE)
- fatal ("method '%s' not found in class",
- IDENTIFIER_POINTER (DECL_NAME (method)));
- method_index++;
- }
- method_index *= int_size_in_bytes (method_type_node);
- ref = fold (build (PLUS_EXPR, method_ptr_type_node,
- ref, build_int_2 (method_index, 0)));
- ref = build1 (INDIRECT_REF, method_type_node, ref);
- func = build (COMPONENT_REF, nativecode_ptr_type_node,
- ref,
- lookup_field (&method_type_node, ncode_ident));
- }
- return func;
-}
-
-tree
-invoke_build_dtable (is_invoke_interface, arg_list)
- int is_invoke_interface;
- tree arg_list;
-{
- tree dtable, objectref;
-
- TREE_VALUE (arg_list) = save_expr (TREE_VALUE (arg_list));
-
- /* If we're dealing with interfaces and if the objectref
- argument is an array then get the dispatch table of the class
- Object rather than the one from the objectref. */
- objectref = (is_invoke_interface
- && is_array_type_p (TREE_TYPE (TREE_VALUE (arg_list))) ?
- object_type_node : TREE_VALUE (arg_list));
-
- if (dtable_ident == NULL_TREE)
- dtable_ident = get_identifier ("vtable");
- dtable = build1 (INDIRECT_REF, object_type_node, objectref );
- dtable = build (COMPONENT_REF, dtable_ptr_type, dtable,
- lookup_field (&object_type_node, dtable_ident));
-
- return dtable;
-}
-
-tree
-build_invokevirtual (dtable, method)
- tree dtable, method;
-{
- tree func;
- tree nativecode_ptr_ptr_type_node
- = build_pointer_type (nativecode_ptr_type_node);
- int method_index = TREE_INT_CST_LOW (DECL_VINDEX (method));
- /* Add one to skip "class" field of dtable, and one to skip unused
- vtable entry (for C++ compatibility). */
- method_index += 2;
- method_index
- *= int_size_in_bytes (nativecode_ptr_ptr_type_node);
- func = fold (build (PLUS_EXPR, nativecode_ptr_ptr_type_node,
- dtable, build_int_2 (method_index, 0)));
- func = build1 (INDIRECT_REF, nativecode_ptr_type_node, func);
-
- return func;
-}
-
-tree
-build_invokeinterface (dtable, method_name, method_signature)
- tree dtable, method_name, method_signature;
-{
- static tree class_ident = NULL_TREE;
- tree lookup_arg;
-
- /* We expand invokeinterface here. _Jv_LookupInterfaceMethod() will
- ensure that the selected method exists, is public and not
- abstract nor static. */
-
- if (class_ident == NULL_TREE)
- class_ident = get_identifier ("class");
-
- dtable = build1 (INDIRECT_REF, dtable_type, dtable);
- dtable = build (COMPONENT_REF, class_ptr_type, dtable,
- lookup_field (&dtable_type, class_ident));
- lookup_arg = build_tree_list (NULL_TREE,
- (build_utf8_ref
- (unmangle_classname
- (IDENTIFIER_POINTER(method_signature),
- IDENTIFIER_LENGTH(method_signature)))));
- lookup_arg = tree_cons (NULL_TREE, dtable,
- tree_cons (NULL_TREE, build_utf8_ref (method_name),
- lookup_arg));
- return build (CALL_EXPR, ptr_type_node,
- build_address_of (soft_lookupinterfacemethod_node),
- lookup_arg, NULL_TREE);
-}
-
-/* Expand one of the invoke_* opcodes.
- OCPODE is the specific opcode.
- METHOD_REF_INDEX is an index into the constant pool.
- NARGS is the number of arguments, or -1 if not specified. */
-
-static void
-expand_invoke (opcode, method_ref_index, nargs)
- int opcode;
- int method_ref_index;
- int nargs ATTRIBUTE_UNUSED;
-{
- tree method_signature = COMPONENT_REF_SIGNATURE(&current_jcf->cpool, method_ref_index);
- tree method_name = COMPONENT_REF_NAME (&current_jcf->cpool, method_ref_index);
- tree self_type = get_class_constant
- (current_jcf, COMPONENT_REF_CLASS_INDEX(&current_jcf->cpool, method_ref_index));
- char *self_name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (self_type)));
- tree call, func, method, arg_list, method_type;
-
- if (! CLASS_LOADED_P (self_type))
- {
- load_class (self_type, 1);
- if (TREE_CODE (TYPE_SIZE (self_type)) == ERROR_MARK)
- fatal ("failed to find class '%s'", self_name);
- }
- layout_class_methods (self_type);
-
- if (method_name == init_identifier_node)
- method = lookup_java_constructor (CLASS_TO_HANDLE_TYPE (self_type),
- method_signature);
- else
- method = lookup_java_method (CLASS_TO_HANDLE_TYPE (self_type),
- method_name, method_signature);
- if (method == NULL_TREE)
- {
- error ("Class '%s' has no method named '%s' matching signature '%s'",
- self_name,
- IDENTIFIER_POINTER (method_name),
- IDENTIFIER_POINTER (method_signature));
- }
- /* Invoke static can't invoke static/abstract method */
- else if (opcode == OPCODE_invokestatic)
- {
- if (!METHOD_STATIC (method))
- {
- error ("invokestatic on non static method");
- method = NULL_TREE;
- }
- else if (METHOD_ABSTRACT (method))
- {
- error ("invokestatic on abstract method");
- method = NULL_TREE;
- }
- }
- else
- {
- if (METHOD_STATIC (method))
- {
- error ("invoke[non-static] on static method");
- method = NULL_TREE;
- }
- }
-
- if (method == NULL_TREE)
- {
- method_type = get_type_from_signature (method_signature);
- pop_arguments (TYPE_ARG_TYPES (method_type));
- if (opcode != OPCODE_invokestatic)
- pop_type (self_type);
- method_type = promote_type (TREE_TYPE (method_type));
- push_value (convert (method_type, integer_zero_node));
- return;
- }
-
- method_type = TREE_TYPE (method);
- arg_list = pop_arguments (TYPE_ARG_TYPES (method_type));
- flush_quick_stack ();
-
- func = NULL_TREE;
- if (opcode == OPCODE_invokestatic || opcode == OPCODE_invokespecial
- || (opcode == OPCODE_invokevirtual
- && (METHOD_PRIVATE (method)
- || METHOD_FINAL (method)
- || CLASS_FINAL (TYPE_NAME (self_type)))))
- func = build_known_method_ref (method, method_type, self_type,
- method_signature, arg_list);
- else
- {
- tree dtable = invoke_build_dtable (opcode == OPCODE_invokeinterface,
- arg_list);
- if (opcode == OPCODE_invokevirtual)
- func = build_invokevirtual (dtable, method);
- else
- func = build_invokeinterface (dtable, method_name, method_signature);
- }
- func = build1 (NOP_EXPR, build_pointer_type (method_type), func);
- call = build (CALL_EXPR, TREE_TYPE (method_type), func, arg_list, NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
-
- if (TREE_CODE (TREE_TYPE (method_type)) == VOID_TYPE)
- expand_expr_stmt (call);
- else
- {
- push_value (call);
- flush_quick_stack ();
- }
-}
-
-
-/* Expand an operation to extract from or store into a field.
- IS_STATIC is 1 iff the field is static.
- IS_PUTTING is 1 for putting into a field; 0 for getting from the field.
- FIELD_REF_INDEX is an index into the constant pool. */
-
-static void
-expand_java_field_op (is_static, is_putting, field_ref_index)
- int is_static;
- int is_putting;
- int field_ref_index;
-{
- tree self_type =
- get_class_constant (current_jcf,
- COMPONENT_REF_CLASS_INDEX (&current_jcf->cpool,
- field_ref_index));
- char *self_name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (self_type)));
- tree field_name = COMPONENT_REF_NAME (&current_jcf->cpool, field_ref_index);
- tree field_signature = COMPONENT_REF_SIGNATURE (&current_jcf->cpool,
- field_ref_index);
- tree field_type = get_type_from_signature (field_signature);
- tree new_value = is_putting ? pop_value (field_type) : NULL_TREE;
- tree field_ref;
- int is_error = 0;
- tree field_decl = lookup_field (&self_type, field_name);
- if (field_decl == error_mark_node)
- {
- is_error = 1;
- }
- else if (field_decl == NULL_TREE)
- {
- error ("Missing field '%s' in '%s'",
- IDENTIFIER_POINTER (field_name), self_name);
- is_error = 1;
- }
- else if (build_java_signature (TREE_TYPE (field_decl)) != field_signature)
- {
- error ("Mismatching signature for field '%s' in '%s'",
- IDENTIFIER_POINTER (field_name), self_name);
- is_error = 1;
- }
- field_ref = is_static ? NULL_TREE : pop_value (self_type);
- if (is_error)
- {
- if (! is_putting)
- push_value (convert (field_type, integer_zero_node));
- flush_quick_stack ();
- return;
- }
-
- /* Inline references to java.lang.PRIMTYPE.TYPE.
- In addition to being a useful (minor) optimization,
- this is also needed to avoid circularities in the implementation
- of these fields in libjava. */
- if (field_name == TYPE_identifier_node && ! is_putting
- && ! flag_emit_class_files && field_type == class_ptr_type
- && strncmp (self_name, "java.lang.", 10) == 0)
- {
- tree typ = build_primtype_type_ref (self_name);
- if (typ)
- {
- push_value (typ);
- return;
- }
- }
-
- field_ref = build_field_ref (field_ref, self_type, field_name);
- if (is_static)
- field_ref = build_class_init (self_type, field_ref);
- if (is_putting)
- {
- flush_quick_stack ();
- if (FIELD_FINAL (field_decl))
- {
- if (DECL_CONTEXT (field_decl) != current_class)
- error_with_decl (field_decl,
- "assignment to final field `%s' not in field's class");
- else if (FIELD_STATIC (field_decl))
- {
- if (!IS_CLINIT (current_function_decl))
- error_with_decl (field_decl,
- "assignment to final static field `%s' not in class initializer");
- }
- else
- {
- if (! DECL_CONSTRUCTOR_P (current_function_decl))
- error_with_decl (field_decl, "assignment to final field `%s' "
- "not in constructor");
- }
- }
- expand_assignment (field_ref, new_value, 0, 0);
- }
- else
- push_value (field_ref);
-}
-
-tree
-build_primtype_type_ref (self_name)
- char *self_name;
-{
- char *class_name = self_name+10;
- tree typ;
- if (strncmp(class_name, "Byte", 4) == 0)
- typ = byte_type_node;
- else if (strncmp(class_name, "Short", 5) == 0)
- typ = short_type_node;
- else if (strncmp(class_name, "Integer", 7) == 0)
- typ = int_type_node;
- else if (strncmp(class_name, "Long", 4) == 0)
- typ = long_type_node;
- else if (strncmp(class_name, "Float", 5) == 0)
- typ = float_type_node;
- else if (strncmp(class_name, "Double", 6) == 0)
- typ = double_type_node;
- else if (strncmp(class_name, "Boolean", 7) == 0)
- typ = boolean_type_node;
- else if (strncmp(class_name, "Char", 4) == 0)
- typ = char_type_node;
- else if (strncmp(class_name, "Void", 4) == 0)
- typ = void_type_node;
- else
- typ = NULL_TREE;
- if (typ != NULL_TREE)
- return build_class_ref (typ);
- else
- return NULL_TREE;
-}
-
-void
-load_type_state (label)
- tree label;
-{
- int i;
- tree vec = LABEL_TYPE_STATE (label);
- int cur_length = TREE_VEC_LENGTH (vec);
- stack_pointer = cur_length - DECL_MAX_LOCALS(current_function_decl);
- for (i = 0; i < cur_length; i++)
- type_map [i] = TREE_VEC_ELT (vec, i);
-}
-
-/* Do the expansion of a Java switch. With Gcc, switches are front-end
- dependant things, but they rely on gcc routines. This function is
- placed here because it uses things defined locally in parse.y. */
-
-static tree
-case_identity (t, v)
- tree t __attribute__ ((__unused__));
- tree v;
-{
- return v;
-}
-
-struct rtx_def *
-java_lang_expand_expr (exp, target, tmode, modifier)
- register tree exp;
- rtx target;
- enum machine_mode tmode;
- enum expand_modifier modifier;
-{
- tree current;
-
- switch (TREE_CODE (exp))
- {
- case NEW_ARRAY_INIT:
- {
- rtx tmp;
- tree array_type = TREE_TYPE (TREE_TYPE (exp));
- tree element_type = TYPE_ARRAY_ELEMENT (array_type);
- tree data_fld = TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (array_type)));
- HOST_WIDE_INT ilength = java_array_type_length (array_type);
- tree length = build_int_2 (ilength, 0);
- tree init = TREE_OPERAND (exp, 0);
- tree array_decl;
-#if 0
- /* Enable this once we can set the vtable field statically. FIXME */
- if (TREE_CONSTANT (init) && TREE_STATIC (exp)
- && JPRIMITIVE_TYPE_P (element_type))
- {
- tree temp, value, init_decl;
- START_RECORD_CONSTRUCTOR (temp, object_type_node);
- PUSH_FIELD_VALUE (temp, "vtable",
- null_pointer_node /* FIXME */
- );
- PUSH_FIELD_VALUE (temp, "sync_info", null_pointer_node);
- FINISH_RECORD_CONSTRUCTOR (temp);
- START_RECORD_CONSTRUCTOR (value, array_type);
- PUSH_SUPER_VALUE (value, temp);
- PUSH_FIELD_VALUE (value, "length", length);
- PUSH_FIELD_VALUE (value, "data", init);
- FINISH_RECORD_CONSTRUCTOR (value);
-
- init_decl = build_decl (VAR_DECL, generate_name (), array_type);
- pushdecl_top_level (init_decl);
- TREE_STATIC (init_decl) = 1;
- DECL_INITIAL (init_decl) = value;
- DECL_IGNORED_P (init_decl) = 1;
- TREE_READONLY (init_decl) = 1;
- make_decl_rtl (init_decl, NULL, 1);
- init = build1 (ADDR_EXPR, TREE_TYPE (exp), init_decl);
- return expand_expr (init, target, tmode, modifier);
- }
-#endif
- array_decl = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (exp));
- expand_decl (array_decl);
- tmp = expand_assignment (array_decl,
- build_new_array (element_type, length),
- 1, 0);
- if (TREE_CONSTANT (init)
- && ilength >= 10 && JPRIMITIVE_TYPE_P (element_type))
- {
- tree init_decl = build_decl (VAR_DECL, generate_name (),
- TREE_TYPE (init));
- pushdecl_top_level (init_decl);
- TREE_STATIC (init_decl) = 1;
- DECL_INITIAL (init_decl) = init;
- DECL_IGNORED_P (init_decl) = 1;
- TREE_READONLY (init_decl) = 1;
- make_decl_rtl (init_decl, NULL, 1);
- init = init_decl;
- }
- expand_assignment (build (COMPONENT_REF, TREE_TYPE (data_fld),
- build1 (INDIRECT_REF, array_type, array_decl),
- data_fld),
- init, 0, 0);
- return tmp;
- }
- case BLOCK:
- if (BLOCK_EXPR_BODY (exp))
- {
- tree local;
- tree body = BLOCK_EXPR_BODY (exp);
- struct rtx_def *to_return;
- pushlevel (2); /* 2 and above */
- expand_start_bindings (0);
- local = BLOCK_EXPR_DECLS (exp);
- while (local)
- {
- tree next = TREE_CHAIN (local);
- layout_decl (local, 0);
- expand_decl (pushdecl (local));
- local = next;
- }
- /* Avoid deep recursion for long block. */
- while (TREE_CODE (body) == COMPOUND_EXPR)
- {
- expand_expr (TREE_OPERAND (body, 0), const0_rtx, VOIDmode, 0);
- emit_queue ();
- body = TREE_OPERAND (body, 1);
- }
- to_return = expand_expr (body, target, tmode, modifier);
- poplevel (1, 1, 0);
- expand_end_bindings (getdecls (), 1, 0);
- return to_return;
- }
- break;
-
- case CASE_EXPR:
- {
- tree duplicate;
- if (pushcase (TREE_OPERAND (exp, 0), case_identity,
- build_decl (LABEL_DECL, NULL_TREE, NULL_TREE),
- &duplicate) == 2)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (exp);
- parse_error_context
- (wfl_operator, "Duplicate case label: `%s'",
- print_int_node (TREE_OPERAND (exp, 0)));
- }
- return const0_rtx;
- }
-
- case DEFAULT_EXPR:
- pushcase (NULL_TREE, 0,
- build_decl (LABEL_DECL, NULL_TREE, NULL_TREE), NULL);
- return const0_rtx;
-
- case SWITCH_EXPR:
- expand_start_case (0, TREE_OPERAND (exp, 0), int_type_node, "switch");
- expand_expr_stmt (TREE_OPERAND (exp, 1));
- expand_end_case (TREE_OPERAND (exp, 0));
- return const0_rtx;
-
- case TRY_EXPR:
- /* We expand a try[-catch] block */
-
- /* Expand the try block */
- expand_eh_region_start ();
- expand_expr_stmt (TREE_OPERAND (exp, 0));
- expand_start_all_catch ();
-
- /* Expand all catch clauses (EH handlers) */
- for (current = TREE_OPERAND (exp, 1); current;
- current = TREE_CHAIN (current))
- {
- tree type;
- tree catch = TREE_OPERAND (current, 0);
- tree decl = BLOCK_EXPR_DECLS (catch);
- type = (decl ? TREE_TYPE (TREE_TYPE (decl)) : NULL_TREE);
- start_catch_handler (prepare_eh_table_type (type));
- expand_expr_stmt (TREE_OPERAND (current, 0));
-
- expand_resume_after_catch ();
- end_catch_handler ();
- }
- expand_end_all_catch ();
- break;
-
- default:
- fatal ("Can't expand '%s' tree - java_lang_expand_expr",
- tree_code_name [TREE_CODE (exp)]);
- }
-}
-
-void
-expand_byte_code (jcf, method)
- JCF *jcf;
- tree method;
-{
- int PC;
- int i;
- int saw_index;
- unsigned char *linenumber_pointer;
- int dead_code_index = -1;
-
-#undef RET /* Defined by config/i386/i386.h */
-#undef AND /* Causes problems with opcodes for iand and land. */
-#undef PTR
-#define BCODE byte_ops
-#define BYTE_type_node byte_type_node
-#define SHORT_type_node short_type_node
-#define INT_type_node int_type_node
-#define LONG_type_node long_type_node
-#define CHAR_type_node char_type_node
-#define PTR_type_node ptr_type_node
-#define FLOAT_type_node float_type_node
-#define DOUBLE_type_node double_type_node
-#define VOID_type_node void_type_node
- jint INT_temp;
- unsigned char* byte_ops;
- long length = DECL_CODE_LENGTH (method);
-
- stack_pointer = 0;
- JCF_SEEK (jcf, DECL_CODE_OFFSET (method));
- byte_ops = jcf->read_ptr;
-
-#define CONST_INDEX_1 (saw_index = 1, IMMEDIATE_u1)
-#define CONST_INDEX_2 (saw_index = 1, IMMEDIATE_u2)
-#define VAR_INDEX_1 (saw_index = 1, IMMEDIATE_u1)
-#define VAR_INDEX_2 (saw_index = 1, IMMEDIATE_u2)
-
-#define CHECK_PC_IN_RANGE(PC) ((void)1) /* Already handled by verifier. */
-
- instruction_bits = oballoc (length + 1);
- bzero (instruction_bits, length + 1);
-
- /* We make an initial pass of the line number table, to note
- which instructions have associated line number entries. */
- linenumber_pointer = linenumber_table;
- for (i = 0; i < linenumber_count; i++)
- {
- int pc = GET_u2 (linenumber_pointer);
- linenumber_pointer += 4;
- if (pc >= length)
- warning ("invalid PC in line number table");
- else
- {
- if ((instruction_bits[pc] & BCODE_HAS_LINENUMBER) != 0)
- instruction_bits[pc] |= BCODE_HAS_MULTI_LINENUMBERS;
- instruction_bits[pc] |= BCODE_HAS_LINENUMBER;
- }
- }
-
- /* Do a preliminary pass.
- * This figures out which PC can be the targets of jumps. */
- for (PC = 0; PC < length;)
- {
- int oldpc = PC; /* PC at instruction start. */
- instruction_bits [PC] |= BCODE_INSTRUCTION_START;
- switch (byte_ops[PC++])
- {
-#define JAVAOP(OPNAME, OPCODE, OPKIND, OPERAND_TYPE, OPERAND_VALUE) \
- case OPCODE: \
- PRE_##OPKIND(OPERAND_TYPE, OPERAND_VALUE); \
- break;
-
-#define NOTE_LABEL(PC) note_label(oldpc, PC)
-
-#define PRE_PUSHC(OPERAND_TYPE, OPERAND_VALUE) (void)(OPERAND_VALUE);
-#define PRE_LOAD(OPERAND_TYPE, OPERAND_VALUE) (void)(OPERAND_VALUE);
-#define PRE_STORE(OPERAND_TYPE, OPERAND_VALUE) (void)(OPERAND_VALUE);
-#define PRE_STACK(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define PRE_UNOP(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define PRE_BINOP(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define PRE_CONVERT(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define PRE_CONVERT2(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-
-#define PRE_SPECIAL(OPERAND_TYPE, INSTRUCTION) \
- PRE_SPECIAL_##INSTRUCTION(OPERAND_TYPE)
-#define PRE_SPECIAL_IINC(OPERAND_TYPE) \
- ((void) IMMEDIATE_u1, (void) IMMEDIATE_s1)
-#define PRE_SPECIAL_ENTER(IGNORE) /* nothing */
-#define PRE_SPECIAL_EXIT(IGNORE) /* nothing */
-#define PRE_SPECIAL_THROW(IGNORE) /* nothing */
-#define PRE_SPECIAL_BREAK(IGNORE) /* nothing */
-
-/* two forms of wide instructions */
-#define PRE_SPECIAL_WIDE(IGNORE) \
- { \
- int modified_opcode = IMMEDIATE_u1; \
- if (modified_opcode == OPCODE_iinc) \
- { \
- (void) IMMEDIATE_u2; /* indexbyte1 and indexbyte2 */ \
- (void) IMMEDIATE_s2; /* constbyte1 and constbyte2 */ \
- } \
- else \
- { \
- (void) IMMEDIATE_u2; /* indexbyte1 and indexbyte2 */ \
- } \
- }
-
-/* nothing */ /* XXX JH */
-
-#define PRE_IMPL(IGNORE1, IGNORE2) /* nothing */
-
-#define PRE_MONITOR(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-
-#define PRE_RETURN(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define PRE_ARRAY(OPERAND_TYPE, SUBOP) \
- PRE_ARRAY_##SUBOP(OPERAND_TYPE)
-#define PRE_ARRAY_LOAD(TYPE) /* nothing */
-#define PRE_ARRAY_STORE(TYPE) /* nothing */
-#define PRE_ARRAY_LENGTH(TYPE) /* nothing */
-#define PRE_ARRAY_NEW(TYPE) PRE_ARRAY_NEW_##TYPE
-#define PRE_ARRAY_NEW_NUM ((void) IMMEDIATE_u1)
-#define PRE_ARRAY_NEW_PTR ((void) IMMEDIATE_u2)
-#define PRE_ARRAY_NEW_MULTI ((void) IMMEDIATE_u2, (void) IMMEDIATE_u1)
-
-#define PRE_TEST(OPERAND_TYPE, OPERAND_VALUE) NOTE_LABEL (oldpc+IMMEDIATE_s2)
-#define PRE_COND(OPERAND_TYPE, OPERAND_VALUE) NOTE_LABEL (oldpc+IMMEDIATE_s2)
-#define PRE_BRANCH(OPERAND_TYPE, OPERAND_VALUE) \
- saw_index = 0; INT_temp = (OPERAND_VALUE); \
- if (!saw_index) NOTE_LABEL(oldpc + INT_temp);
-#define PRE_JSR(OPERAND_TYPE, OPERAND_VALUE) \
- saw_index = 0; INT_temp = (OPERAND_VALUE); \
- if (!saw_index) NOTE_LABEL(oldpc + INT_temp);
-
-#define PRE_RET(OPERAND_TYPE, OPERAND_VALUE) (void)(OPERAND_VALUE)
-
-#define PRE_SWITCH(OPERAND_TYPE, TABLE_OR_LOOKUP) \
- PC = (PC + 3) / 4 * 4; PRE_##TABLE_OR_LOOKUP##_SWITCH
-
-#define PRE_LOOKUP_SWITCH \
- { jint default_offset = IMMEDIATE_s4; jint npairs = IMMEDIATE_s4; \
- NOTE_LABEL (default_offset+oldpc); \
- if (npairs >= 0) \
- while (--npairs >= 0) { \
- jint match ATTRIBUTE_UNUSED = IMMEDIATE_s4; \
- jint offset = IMMEDIATE_s4; \
- NOTE_LABEL (offset+oldpc); } \
- }
-
-#define PRE_TABLE_SWITCH \
- { jint default_offset = IMMEDIATE_s4; \
- jint low = IMMEDIATE_s4; jint high = IMMEDIATE_s4; \
- NOTE_LABEL (default_offset+oldpc); \
- if (low <= high) \
- while (low++ <= high) { \
- jint offset = IMMEDIATE_s4; \
- NOTE_LABEL (offset+oldpc); } \
- }
-
-#define PRE_FIELD(MAYBE_STATIC, PUT_OR_GET) (void)(IMMEDIATE_u2);
-#define PRE_OBJECT(MAYBE_STATIC, PUT_OR_GET) (void)(IMMEDIATE_u2);
-#define PRE_INVOKE(MAYBE_STATIC, IS_INTERFACE) \
- (void)(IMMEDIATE_u2); \
- PC += 2 * IS_INTERFACE /* for invokeinterface */;
-
-#include "javaop.def"
-#undef JAVAOP
- }
- } /* for */
-
- if (! verify_jvm_instructions (jcf, byte_ops, length))
- return;
-
- /* Translate bytecodes to rtl instructions. */
- linenumber_pointer = linenumber_table;
- for (PC = 0; PC < length;)
- {
- if ((instruction_bits [PC] & BCODE_TARGET) != 0 || PC == 0)
- {
- tree label = lookup_label (PC);
- flush_quick_stack ();
- if ((instruction_bits [PC] & BCODE_TARGET) != 0)
- expand_label (label);
- if (LABEL_VERIFIED (label) || PC == 0)
- load_type_state (label);
- }
-
- if (! (instruction_bits [PC] & BCODE_VERIFIED))
- {
- if (dead_code_index == -1)
- {
- /* This is the start of a region of unreachable bytecodes.
- They still need to be processed in order for EH ranges
- to get handled correctly. However, we can simply
- replace these bytecodes with nops. */
- dead_code_index = PC;
- }
-
- /* Turn this bytecode into a nop. */
- byte_ops[PC] = 0x0;
- }
- else
- {
- if (dead_code_index != -1)
- {
- /* We've just reached the end of a region of dead code. */
- warning ("Unreachable bytecode from %d to before %d.",
- dead_code_index, PC);
- dead_code_index = -1;
- }
- }
-
- /* Handle possible line number entry for this PC.
-
- This code handles out-of-order and multiple linenumbers per PC,
- but is optimized for the case of line numbers increasing
- monotonically with PC. */
- if ((instruction_bits[PC] & BCODE_HAS_LINENUMBER) != 0)
- {
- if ((instruction_bits[PC] & BCODE_HAS_MULTI_LINENUMBERS) != 0
- || GET_u2 (linenumber_pointer) != PC)
- linenumber_pointer = linenumber_table;
- while (linenumber_pointer < linenumber_table + linenumber_count * 4)
- {
- int pc = GET_u2 (linenumber_pointer);
- linenumber_pointer += 4;
- if (pc == PC)
- {
- lineno = GET_u2 (linenumber_pointer - 2);
- emit_line_note (input_filename, lineno);
- if (!(instruction_bits[PC] & BCODE_HAS_MULTI_LINENUMBERS))
- break;
- }
- }
- }
- maybe_start_try (PC);
- maybe_pushlevels (PC);
-
- PC = process_jvm_instruction (PC, byte_ops, length);
-
- maybe_poplevels (PC);
- maybe_end_try (PC);
- } /* for */
-
- if (dead_code_index != -1)
- {
- /* We've just reached the end of a region of dead code. */
- warning ("Unreachable bytecode from %d to the end of the method.",
- dead_code_index);
- }
-}
-
-static void
-java_push_constant_from_pool (jcf, index)
- JCF *jcf;
- int index;
-{
- tree c;
- if (JPOOL_TAG (jcf, index) == CONSTANT_String)
- {
- tree name;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index));
- index = alloc_name_constant (CONSTANT_String, name);
- c = build_ref_from_constant_pool (index);
- TREE_TYPE (c) = promote_type (string_type_node);
- pop_obstacks ();
- }
- else
- c = get_constant (jcf, index);
- push_value (c);
-}
-
-int
-process_jvm_instruction (PC, byte_ops, length)
- int PC;
- unsigned char* byte_ops;
- long length ATTRIBUTE_UNUSED;
-{
- const char *opname; /* Temporary ??? */
- int oldpc = PC; /* PC at instruction start. */
-
- /* If the instruction is at the beginning of a exception handler,
- replace the top of the stack with the thrown object reference */
- if (instruction_bits [PC] & BCODE_EXCEPTION_TARGET)
- {
- tree type = pop_type (ptr_type_node);
- push_value (build1 (NOP_EXPR, type, soft_exceptioninfo_call_node));
- }
-
- switch (byte_ops[PC++])
- {
-#define JAVAOP(OPNAME, OPCODE, OPKIND, OPERAND_TYPE, OPERAND_VALUE) \
- case OPCODE: \
- opname = #OPNAME; \
- OPKIND(OPERAND_TYPE, OPERAND_VALUE); \
- break;
-
-#define RET(OPERAND_TYPE, OPERAND_VALUE) \
- { \
- int saw_index = 0; \
- int index = OPERAND_VALUE; \
- build_java_ret (find_local_variable (index, ptr_type_node, oldpc)); \
- }
-
-#define JSR(OPERAND_TYPE, OPERAND_VALUE) \
- { \
- tree where = lookup_label (oldpc+OPERAND_VALUE); \
- tree ret = lookup_label (PC); \
- build_java_jsr (where, ret); \
- load_type_state (ret); \
- }
-
-/* Push a constant onto the stack. */
-#define PUSHC(OPERAND_TYPE, OPERAND_VALUE) \
- { int saw_index = 0; int ival = (OPERAND_VALUE); \
- if (saw_index) java_push_constant_from_pool (current_jcf, ival); \
- else expand_java_pushc (ival, OPERAND_TYPE##_type_node); }
-
-/* internal macro added for use by the WIDE case */
-#define LOAD_INTERNAL(OPTYPE, OPVALUE) \
- push_value (find_local_variable (OPVALUE, type_map[OPVALUE], oldpc));
-
-/* Push local variable onto the opcode stack. */
-#define LOAD(OPERAND_TYPE, OPERAND_VALUE) \
- { \
- /* have to do this since OPERAND_VALUE may have side-effects */ \
- int opvalue = OPERAND_VALUE; \
- LOAD_INTERNAL(OPERAND_TYPE##_type_node, opvalue); \
- }
-
-#define RETURN(OPERAND_TYPE, OPERAND_VALUE) \
- expand_java_return (OPERAND_TYPE##_type_node)
-
-#define REM_EXPR TRUNC_MOD_EXPR
-#define BINOP(OPERAND_TYPE, OPERAND_VALUE) \
- expand_java_binop (OPERAND_TYPE##_type_node, OPERAND_VALUE##_EXPR)
-
-#define FIELD(IS_STATIC, IS_PUT) \
- expand_java_field_op (IS_STATIC, IS_PUT, IMMEDIATE_u2)
-
-#define TEST(OPERAND_TYPE, CONDITION) \
- expand_test (CONDITION##_EXPR, OPERAND_TYPE##_type_node, oldpc+IMMEDIATE_s2)
-
-#define COND(OPERAND_TYPE, CONDITION) \
- expand_cond (CONDITION##_EXPR, OPERAND_TYPE##_type_node, oldpc+IMMEDIATE_s2)
-
-#define BRANCH(OPERAND_TYPE, OPERAND_VALUE) \
- BRANCH_##OPERAND_TYPE (OPERAND_VALUE)
-
-#define BRANCH_GOTO(OPERAND_VALUE) \
- expand_java_goto (oldpc + OPERAND_VALUE)
-
-#define BRANCH_CALL(OPERAND_VALUE) \
- expand_java_call (oldpc + OPERAND_VALUE, oldpc)
-
-#if 0
-#define BRANCH_RETURN(OPERAND_VALUE) \
- { \
- tree type = OPERAND_TYPE##_type_node; \
- tree value = find_local_variable (OPERAND_VALUE, type, oldpc); \
- expand_java_ret (value); \
- }
-#endif
-
-#define NOT_IMPL(OPERAND_TYPE, OPERAND_VALUE) \
- fprintf (stderr, "%3d: %s ", oldpc, opname); \
- fprintf (stderr, "(not implemented)\n")
-#define NOT_IMPL1(OPERAND_VALUE) \
- fprintf (stderr, "%3d: %s ", oldpc, opname); \
- fprintf (stderr, "(not implemented)\n")
-
-#define BRANCH_RETURN(OPERAND_VALUE) NOT_IMPL1(OPERAND_VALUE)
-
-#define STACK(SUBOP, COUNT) STACK_##SUBOP (COUNT)
-
-#define STACK_POP(COUNT) java_stack_pop (COUNT)
-
-#define STACK_SWAP(COUNT) java_stack_swap()
-
-#define STACK_DUP(COUNT) java_stack_dup (COUNT, 0)
-#define STACK_DUPx1(COUNT) java_stack_dup (COUNT, 1)
-#define STACK_DUPx2(COUNT) java_stack_dup (COUNT, 2)
-
-#define SWITCH(OPERAND_TYPE, TABLE_OR_LOOKUP) \
- PC = (PC + 3) / 4 * 4; TABLE_OR_LOOKUP##_SWITCH
-
-#define LOOKUP_SWITCH \
- { jint default_offset = IMMEDIATE_s4; jint npairs = IMMEDIATE_s4; \
- tree selector = pop_value (INT_type_node); \
- tree duplicate, label; \
- tree type = TREE_TYPE (selector); \
- flush_quick_stack (); \
- expand_start_case (0, selector, type, "switch statement");\
- push_momentary (); \
- while (--npairs >= 0) \
- { \
- jint match = IMMEDIATE_s4; jint offset = IMMEDIATE_s4; \
- tree value = build_int_2 (match, match < 0 ? -1 : 0); \
- TREE_TYPE (value) = type; \
- label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \
- pushcase (value, convert, label, &duplicate); \
- expand_java_goto (oldpc + offset); \
- } \
- label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \
- pushcase (NULL_TREE, 0, label, &duplicate); \
- expand_java_goto (oldpc + default_offset); \
- pop_momentary (); \
- expand_end_case (selector); \
- }
-
-#define TABLE_SWITCH \
- { jint default_offset = IMMEDIATE_s4; \
- jint low = IMMEDIATE_s4; jint high = IMMEDIATE_s4; \
- tree selector = pop_value (INT_type_node); \
- tree duplicate, label; \
- tree type = TREE_TYPE (selector); \
- flush_quick_stack (); \
- expand_start_case (0, selector, type, "switch statement");\
- push_momentary (); \
- for (; low <= high; low++) \
- { \
- jint offset = IMMEDIATE_s4; \
- tree value = build_int_2 (low, low < 0 ? -1 : 0); \
- TREE_TYPE (value) = type; \
- label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \
- pushcase (value, convert, label, &duplicate); \
- expand_java_goto (oldpc + offset); \
- } \
- label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \
- pushcase (NULL_TREE, 0, label, &duplicate); \
- expand_java_goto (oldpc + default_offset); \
- pop_momentary (); \
- expand_end_case (selector); \
- }
-
-#define INVOKE(MAYBE_STATIC, IS_INTERFACE) \
- { int opcode = byte_ops[PC-1]; \
- int method_ref_index = IMMEDIATE_u2; \
- int nargs; \
- if (IS_INTERFACE) { nargs = IMMEDIATE_u1; (void) IMMEDIATE_u1; } \
- else nargs = -1; \
- expand_invoke (opcode, method_ref_index, nargs); \
- }
-
-/* Handle new, checkcast, instanceof */
-#define OBJECT(TYPE, OP) \
- expand_java_##OP (get_class_constant (current_jcf, IMMEDIATE_u2))
-
-#define ARRAY(OPERAND_TYPE, SUBOP) ARRAY_##SUBOP(OPERAND_TYPE)
-
-#define ARRAY_LOAD(OPERAND_TYPE) \
- { \
- expand_java_arrayload( OPERAND_TYPE##_type_node ); \
- }
-
-#define ARRAY_STORE(OPERAND_TYPE) \
- { \
- expand_java_arraystore( OPERAND_TYPE##_type_node ); \
- }
-
-#define ARRAY_LENGTH(OPERAND_TYPE) expand_java_array_length();
-#define ARRAY_NEW(OPERAND_TYPE) ARRAY_NEW_##OPERAND_TYPE()
-#define ARRAY_NEW_PTR() \
- push_value (build_anewarray (get_class_constant (current_jcf, \
- IMMEDIATE_u2), \
- pop_value (int_type_node)));
-#define ARRAY_NEW_NUM() \
- { \
- int atype = IMMEDIATE_u1; \
- push_value (build_newarray (atype, pop_value (int_type_node)));\
- }
-#define ARRAY_NEW_MULTI() \
- { \
- tree class = get_class_constant (current_jcf, IMMEDIATE_u2 ); \
- int ndims = IMMEDIATE_u1; \
- expand_java_multianewarray( class, ndims ); \
- }
-
-#define UNOP(OPERAND_TYPE, OPERAND_VALUE) \
- push_value (fold (build1 (NEGATE_EXPR, OPERAND_TYPE##_type_node, \
- pop_value (OPERAND_TYPE##_type_node))));
-
-#define CONVERT2(FROM_TYPE, TO_TYPE) \
- { \
- push_value (build1 (NOP_EXPR, int_type_node, \
- (convert (TO_TYPE##_type_node, \
- pop_value (FROM_TYPE##_type_node))))); \
- }
-
-#define CONVERT(FROM_TYPE, TO_TYPE) \
- { \
- push_value (convert (TO_TYPE##_type_node, \
- pop_value (FROM_TYPE##_type_node))); \
- }
-
-/* internal macro added for use by the WIDE case
- Added TREE_TYPE (decl) assignment, apbianco */
-#define STORE_INTERNAL(OPTYPE, OPVALUE) \
- { \
- tree decl, value; \
- int var = OPVALUE; \
- tree type = OPTYPE; \
- value = pop_value (type); \
- type = TREE_TYPE (value); \
- decl = find_local_variable (var, type, oldpc); \
- set_local_type (var, type ); \
- expand_assignment (decl, value, 0, 0); \
- }
-
-#define STORE(OPERAND_TYPE, OPERAND_VALUE) \
- { \
- /* have to do this since OPERAND_VALUE may have side-effects */ \
- int opvalue = OPERAND_VALUE; \
- STORE_INTERNAL(OPERAND_TYPE##_type_node, opvalue); \
- }
-
-#define SPECIAL(OPERAND_TYPE, INSTRUCTION) \
- SPECIAL_##INSTRUCTION(OPERAND_TYPE)
-
-#define SPECIAL_ENTER(IGNORED) MONITOR_OPERATION (soft_monitorenter_node)
-#define SPECIAL_EXIT(IGNORED) MONITOR_OPERATION (soft_monitorexit_node)
-
-#define MONITOR_OPERATION(call) \
- { \
- tree o = pop_value (ptr_type_node); \
- tree c; \
- flush_quick_stack (); \
- c = build_java_monitor (call, o); \
- TREE_SIDE_EFFECTS (c) = 1; \
- expand_expr_stmt (c); \
- }
-
-#define SPECIAL_IINC(IGNORED) \
- { \
- unsigned int local_var_index = IMMEDIATE_u1; \
- int ival = IMMEDIATE_s1; \
- expand_iinc(local_var_index, ival, oldpc); \
- }
-
-#define SPECIAL_WIDE(IGNORED) \
- { \
- int modified_opcode = IMMEDIATE_u1; \
- unsigned int local_var_index = IMMEDIATE_u2; \
- switch (modified_opcode) \
- { \
- case OPCODE_iinc: \
- { \
- int ival = IMMEDIATE_s2; \
- expand_iinc (local_var_index, ival, oldpc); \
- break; \
- } \
- case OPCODE_iload: \
- case OPCODE_lload: \
- case OPCODE_fload: \
- case OPCODE_dload: \
- case OPCODE_aload: \
- { \
- /* duplicate code from LOAD macro */ \
- LOAD_INTERNAL(operand_type[modified_opcode], local_var_index); \
- break; \
- } \
- case OPCODE_istore: \
- case OPCODE_lstore: \
- case OPCODE_fstore: \
- case OPCODE_dstore: \
- case OPCODE_astore: \
- { \
- STORE_INTERNAL(operand_type[modified_opcode], local_var_index); \
- break; \
- } \
- default: \
- error ("unrecogized wide sub-instruction"); \
- } \
- }
-
-#define SPECIAL_THROW(IGNORED) \
- build_java_athrow (pop_value (throwable_type_node))
-
-#define SPECIAL_BREAK NOT_IMPL1
-#define IMPL NOT_IMPL
-
-#include "javaop.def"
-#undef JAVAOP
- default:
- fprintf (stderr, "%3d: unknown(%3d)\n", oldpc, byte_ops[PC]);
- }
- return PC;
-}
-
-/* Force the (direct) sub-operands of NODE to be evaluated in left-to-right
- order, as specified by Java Language Specification.
-
- The problem is that while expand_expr will evaluate its sub-operands in
- left-to-right order, for variables it will just return an rtx (i.e.
- an lvalue) for the variable (rather than an rvalue). So it is possible
- that a later sub-operand will change the register, and when the
- actual operation is done, it will use the new value, when it should
- have used the original value.
-
- We fix this by using save_expr. This forces the sub-operand to be
- copied into a fresh virtual register,
-*/
-
-tree
-force_evaluation_order (node)
- tree node;
-{
- if (flag_syntax_only)
- return node;
- if (TREE_CODE_CLASS (TREE_CODE (node)) == '2')
- {
- if (TREE_SIDE_EFFECTS (TREE_OPERAND (node, 1)))
- TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0));
- }
- else if (TREE_CODE (node) == CALL_EXPR || TREE_CODE (node) == NEW_CLASS_EXPR)
- {
- tree last_side_effecting_arg = NULL_TREE;
- tree arg = TREE_OPERAND (node, 1);
- for (; arg != NULL_TREE; arg = TREE_CHAIN (arg))
- {
- if (TREE_SIDE_EFFECTS (TREE_VALUE (arg)))
- last_side_effecting_arg = arg;
- }
- arg = TREE_OPERAND (node, 1);
- for (; arg != NULL_TREE; arg = TREE_CHAIN (arg))
- {
- if (arg == last_side_effecting_arg)
- break;
- TREE_VALUE (arg) = save_expr (TREE_VALUE (arg));
- }
- }
- return node;
-}
diff --git a/gnu/dist/toolchain/gcc/java/gjavah.c b/gnu/dist/toolchain/gcc/java/gjavah.c
deleted file mode 100644
index f99ad5b2910..00000000000
--- a/gnu/dist/toolchain/gcc/java/gjavah.c
+++ /dev/null
@@ -1,1610 +0,0 @@
-/* Program to write C++-suitable header files from a Java(TM) .class
- file. This is similar to SUN's javah.
-
-Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, February 1996. */
-
-#include "config.h"
-#include "system.h"
-#include <math.h>
-
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "java-opcodes.h"
-
-/* The output file. */
-FILE *out = NULL;
-
-/* Nonzero on failure. */
-static int found_error = 0;
-
-/* Directory to place resulting files in. Set by -d option. */
-const char *output_directory = "";
-
-/* Directory to place temporary file. Set by -td option. Currently unused. */
-const char *temp_directory = "/tmp";
-
-/* Number of friend functions we have to declare. */
-static int friend_count;
-
-/* A class can optionally have a `friend' function declared. If
- non-NULL, this is that function. */
-static char **friend_specs = NULL;
-
-/* Number of lines we are prepending before the class. */
-static int prepend_count;
-
-/* We can prepend extra lines before the class's start. */
-static char **prepend_specs = NULL;
-
-/* Number of lines we are appending at the end of the class. */
-static int add_count;
-
-/* We can append extra lines just before the class's end. */
-static char **add_specs = NULL;
-
-/* Number of lines we are appending after the class. */
-static int append_count;
-
-/* We can append extra lines after the class's end. */
-static char **append_specs = NULL;
-
-int verbose = 0;
-
-int stubs = 0;
-
-struct JCF *current_jcf;
-
-/* This holds access information for the last field we examined. They
- let us generate "private:", "public:", and "protected:" properly.
- If 0 then we haven't previously examined any field. */
-static JCF_u2 last_access;
-
-#define ACC_VISIBILITY (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED)
-
-/* Pass this macro the flags for a class and for a method. It will
- return true if the method should be considered `final'. */
-#define METHOD_IS_FINAL(Class, Method) \
- (((Class) & ACC_FINAL) || ((Method) & (ACC_FINAL | ACC_PRIVATE)))
-
-/* We keep a linked list of all method names we have seen. This lets
- us determine if a method name and a field name are in conflict. */
-struct method_name
-{
- unsigned char *name;
- int length;
- struct method_name *next;
-};
-
-/* List of method names we've seen. */
-static struct method_name *method_name_list;
-
-static void print_field_info PROTO ((FILE *, JCF*, int, int, JCF_u2));
-static void print_method_info PROTO ((FILE *, JCF*, int, int, JCF_u2));
-static void print_c_decl PROTO ((FILE*, JCF*, int, int, int, const char *));
-static void decompile_method PROTO ((FILE *, JCF *, int));
-static void add_class_decl PROTO ((FILE *, JCF *, JCF_u2));
-
-static int java_float_finite PROTO ((jfloat));
-static int java_double_finite PROTO ((jdouble));
-
-JCF_u2 current_field_name;
-JCF_u2 current_field_value;
-JCF_u2 current_field_signature;
-JCF_u2 current_field_flags;
-
-#define HANDLE_START_FIELD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
-( current_field_name = (NAME), current_field_signature = (SIGNATURE), \
- current_field_flags = (ACCESS_FLAGS), current_field_value = 0)
-
-/* We pass over fields twice. The first time we just note the types
- of the fields and then the start of the methods. Then we go back
- and parse the fields for real. This is ugly. */
-static int field_pass;
-/* Likewise we pass over methods twice. The first time we generate
- class decl information; the second time we generate actual method
- decls. */
-static int method_pass;
-
-#define HANDLE_END_FIELD() \
- if (field_pass) \
- { \
- if (out) \
- print_field_info (out, jcf, current_field_name, \
- current_field_signature, \
- current_field_flags); \
- } \
- else \
- add_class_decl (out, jcf, current_field_signature);
-
-#define HANDLE_CONSTANTVALUE(VALUEINDEX) current_field_value = (VALUEINDEX)
-
-static int method_declared = 0;
-static int method_access = 0;
-static int method_printed = 0;
-#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
- if (method_pass) \
- { \
- decompiled = 0; method_printed = 0; \
- if (out) \
- print_method_info (out, jcf, NAME, SIGNATURE, ACCESS_FLAGS); \
- } \
- else \
- add_class_decl (out, jcf, SIGNATURE);
-
-#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
- if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH);
-
-static int decompiled = 0;
-#define HANDLE_END_METHOD() \
- if (out && method_printed) fputs (decompiled ? "\n" : ";\n", out);
-
-#include "jcf-reader.c"
-
-/* Some useful constants. */
-#define F_NAN_MASK 0x7f800000
-#define D_NAN_MASK 0x7ff0000000000000LL
-
-/* Return 1 if F is not Inf or NaN. */
-static int
-java_float_finite (f)
- jfloat f;
-{
- union {
- jfloat f;
- int32 i;
- } u;
- u.f = f;
-
- /* We happen to know that F_NAN_MASK will match all NaN values, and
- also positive and negative infinity. That's why we only need one
- test here. See The Java Language Specification, section 20.9. */
- return (u.i & F_NAN_MASK) != F_NAN_MASK;
-}
-
-/* Return 1 if D is not Inf or NaN. */
-static int
-java_double_finite (d)
- jdouble d;
-{
- union {
- jdouble d;
- int64 i;
- } u;
- u.d = d;
-
- /* Now check for all NaNs. */
- return (u.i & D_NAN_MASK) != D_NAN_MASK;
-}
-
-void
-DEFUN(print_name, (stream, jcf, name_index),
- FILE* stream AND JCF* jcf AND int name_index)
-{
- if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
- fprintf (stream, "<not a UTF8 constant>");
- else
- jcf_print_utf8 (stream, JPOOL_UTF_DATA (jcf, name_index),
- JPOOL_UTF_LENGTH (jcf, name_index));
-}
-
-/* Print base name of class. The base name is everything after the
- final separator. */
-
-static void
-print_base_classname (stream, jcf, index)
- FILE *stream;
- JCF *jcf;
- int index;
-{
- int name_index = JPOOL_USHORT1 (jcf, index);
- int len;
- unsigned char *s, *p, *limit;
-
- s = JPOOL_UTF_DATA (jcf, name_index);
- len = JPOOL_UTF_LENGTH (jcf, name_index);
- limit = s + len;
- p = s;
- while (s < limit)
- {
- int c = UTF8_GET (s, limit);
- if (c == '/')
- p = s;
- }
-
- while (p < limit)
- {
- int ch = UTF8_GET (p, limit);
- if (ch == '/')
- fputs ("::", stream);
- else
- jcf_print_char (stream, ch);
- }
-}
-
-/* Return 0 if NAME is equal to STR, nonzero otherwise. */
-
-static int
-utf8_cmp (str, length, name)
- unsigned char *str;
- int length;
- char *name;
-{
- unsigned char *limit = str + length;
- int i;
-
- for (i = 0; name[i]; ++i)
- {
- int ch = UTF8_GET (str, limit);
- if (ch != name[i])
- return 1;
- }
-
- return str != limit;
-}
-
-/* If NAME is the name of a C++ keyword, then return an override name.
- This is a name that can be used in place of the keyword.
- Otherwise, return NULL. FIXME: for now, we only handle those
- keywords we know to be a problem for libgcj. */
-
-static char *
-cxx_keyword_subst (str, length)
- unsigned char *str;
- int length;
-{
- if (! utf8_cmp (str, length, "delete"))
- return "__dummy_delete";
- else if (! utf8_cmp (str, length, "enum"))
- return "__dummy_enum";
- return NULL;
-}
-
-/* Generate an access control keyword based on FLAGS. Returns 0 if
- FLAGS matches the saved access information, nonzero otherwise. */
-
-static void
-generate_access (stream, flags)
- FILE *stream;
- JCF_u2 flags;
-{
- if ((flags & ACC_VISIBILITY) == last_access)
- return;
- last_access = (flags & ACC_VISIBILITY);
-
- switch (last_access)
- {
- case 0:
- fputs ("public: // actually package-private\n", stream);
- break;
- case ACC_PUBLIC:
- fputs ("public:\n", stream);
- break;
- case ACC_PRIVATE:
- fputs ("private:\n", stream);
- break;
- case ACC_PROTECTED:
- fputs ("public: // actually protected\n", stream);
- break;
- default:
- found_error = 1;
- fprintf (stream, "#error unrecognized visibility %d\n",
- (flags & ACC_VISIBILITY));
- break;
- }
-}
-
-/* See if NAME is already the name of a method. */
-static int
-name_is_method_p (name, length)
- unsigned char *name;
- int length;
-{
- struct method_name *p;
-
- for (p = method_name_list; p != NULL; p = p->next)
- {
- if (p->length == length && ! memcmp (p->name, name, length))
- return 1;
- }
- return 0;
-}
-
-/* Get name of a field. This handles renamings due to C++ clash. */
-static char *
-get_field_name (jcf, name_index, flags)
- JCF *jcf;
- int name_index;
- JCF_u2 flags;
-{
- unsigned char *name = JPOOL_UTF_DATA (jcf, name_index);
- int length = JPOOL_UTF_LENGTH (jcf, name_index);
- char *override;
-
- if (name_is_method_p (name, length))
- {
- /* This field name matches a method. So override the name with
- a dummy name. This is yucky, but it isn't clear what else to
- do. FIXME: if the field is static, then we'll be in real
- trouble. */
- if ((flags & ACC_STATIC))
- {
- fprintf (stderr, "static field has same name as method\n");
- found_error = 1;
- return NULL;
- }
-
- override = (char *) malloc (length + 3);
- memcpy (override, name, length);
- strcpy (override + length, "__");
- }
- else if ((override = cxx_keyword_subst (name, length)) != NULL)
- {
- /* Must malloc OVERRIDE. */
- char *o2 = (char *) malloc (strlen (override) + 1);
- strcpy (o2, override);
- override = o2;
- }
-
- return override;
-}
-
-/* Print a field name. Convenience function for use with
- get_field_name. */
-static void
-print_field_name (stream, jcf, name_index, flags)
- FILE *stream;
- JCF *jcf;
- int name_index;
- JCF_u2 flags;
-{
- char *override = get_field_name (jcf, name_index, flags);
-
- if (override)
- {
- fputs (override, stream);
- free (override);
- }
- else
- jcf_print_utf8 (stream, JPOOL_UTF_DATA (jcf, name_index),
- JPOOL_UTF_LENGTH (jcf, name_index));
-}
-
-static void
-DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags),
- FILE *stream AND JCF* jcf
- AND int name_index AND int sig_index AND JCF_u2 flags)
-{
- char *override = NULL;
-
- generate_access (stream, flags);
- if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
- {
- fprintf (stream, "<not a UTF8 constant>");
- found_error = 1;
- return;
- }
-
- if (flags & ACC_FINAL)
- {
- if (current_field_value > 0)
- {
- char buffer[25];
- int done = 1;
-
- switch (JPOOL_TAG (jcf, current_field_value))
- {
- case CONSTANT_Integer:
- {
- jint num;
- int most_negative = 0;
- fputs (" static const jint ", out);
- print_field_name (out, jcf, name_index);
- fputs (" = ", out);
- num = JPOOL_INT (jcf, current_field_value);
- /* We single out the most negative number to print
- specially. This avoids later warnings from g++. */
- if (num == (jint) 0x80000000)
- {
- most_negative = 1;
- ++num;
- }
- format_int (buffer, (jlong) num, 10);
- fprintf (out, "%sL%s;\n", buffer, most_negative ? " - 1" : "");
- }
- break;
- case CONSTANT_Long:
- {
- jlong num;
- int most_negative = 0;
- fputs (" static const jlong ", out);
- print_field_name (out, jcf, name_index);
- fputs (" = ", out);
- num = JPOOL_LONG (jcf, current_field_value);
- /* We single out the most negative number to print
- specially.. This avoids later warnings from g++. */
- if (num == (jlong) 0x8000000000000000LL)
- {
- most_negative = 1;
- ++num;
- }
- format_int (buffer, num, 10);
- fprintf (out, "%sLL%s;\n", buffer, most_negative ? " - 1" :"");
- }
- break;
- case CONSTANT_Float:
- {
- jfloat fnum = JPOOL_FLOAT (jcf, current_field_value);
- fputs (" static const jfloat ", out);
- print_field_name (out, jcf, name_index);
- if (! java_float_finite (fnum))
- fputs (";\n", out);
- else
- fprintf (out, " = %.10g;\n", fnum);
- }
- break;
- case CONSTANT_Double:
- {
- jdouble dnum = JPOOL_DOUBLE (jcf, current_field_value);
- fputs (" static const jdouble ", out);
- print_field_name (out, jcf, name_index);
- if (! java_double_finite (dnum))
- fputs (";\n", out);
- else
- fprintf (out, " = %.17g;\n", dnum);
- }
- break;
- default:
- /* We can't print this as a constant, but we can still
- print something sensible. */
- done = 0;
- break;
- }
-
- if (done)
- return;
- }
- }
-
- fputs (" ", out);
- if ((flags & ACC_STATIC))
- fputs ("static ", out);
-
- override = get_field_name (jcf, name_index, flags);
- print_c_decl (out, jcf, name_index, sig_index, 0, override);
- fputs (";\n", out);
-
- if (override)
- free (override);
-}
-
-static void
-DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags),
- FILE *stream AND JCF* jcf
- AND int name_index AND int sig_index AND JCF_u2 flags)
-{
- unsigned char *str;
- int length, is_init = 0;
- const char *override = NULL;
-
- method_declared = 0;
- method_access = flags;
- if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
- fprintf (stream, "<not a UTF8 constant>");
- str = JPOOL_UTF_DATA (jcf, name_index);
- length = JPOOL_UTF_LENGTH (jcf, name_index);
- if (str[0] == '<' || str[0] == '$')
- {
- /* Ignore internally generated methods like <clinit> and
- $finit$. However, treat <init> as a constructor. */
- if (! utf8_cmp (str, length, "<init>"))
- is_init = 1;
- else if (! METHOD_IS_FINAL (jcf->access_flags, flags)
- && ! (flags & ACC_STATIC))
- {
- /* FIXME: i18n bug here. Order of prints should not be
- fixed. */
- fprintf (stderr, "ignored method `");
- jcf_print_utf8 (stderr, str, length);
- fprintf (stderr, "' marked virtual\n");
- found_error = 1;
- return;
- }
- else
- return;
- }
- else
- {
- struct method_name *nn;
-
- nn = (struct method_name *) malloc (sizeof (struct method_name));
- nn->name = (char *) malloc (length);
- memcpy (nn->name, str, length);
- nn->length = length;
- nn->next = method_name_list;
- method_name_list = nn;
- }
-
- /* We can't generate a method whose name is a C++ reserved word. We
- can't just ignore the function, because that will cause incorrect
- code to be generated if the function is virtual (not only for
- calls to this function for for other functions after it in the
- vtbl). So we give it a dummy name instead. */
- override = cxx_keyword_subst (str, length);
- if (override)
- {
- /* If the method is static or final, we can safely skip it. If
- we don't skip it then we'll have problems since the mangling
- will be wrong. FIXME. */
- if (METHOD_IS_FINAL (jcf->access_flags, flags)
- || (flags & ACC_STATIC))
- return;
- }
-
- method_printed = 1;
- generate_access (stream, flags);
-
- fputs (" ", out);
- if ((flags & ACC_STATIC))
- fputs ("static ", out);
- else if (! METHOD_IS_FINAL (jcf->access_flags, flags))
- {
- /* Don't print `virtual' if we have a constructor. */
- if (! is_init)
- fputs ("virtual ", out);
- }
- print_c_decl (out, jcf, name_index, sig_index, is_init, override);
-
- if ((flags & ACC_ABSTRACT))
- fputs (" = 0", out);
- else
- method_declared = 1;
-}
-
-/* Try to decompile a method body. Right now we just try to handle a
- simple case that we can do. Expand as desired. */
-static void
-decompile_method (out, jcf, code_len)
- FILE *out;
- JCF *jcf;
- int code_len;
-{
- unsigned char *codes = jcf->read_ptr;
- int index;
- uint16 name_and_type, name;
-
- /* If the method is synchronized, don't touch it. */
- if ((method_access & ACC_SYNCHRONIZED))
- return;
-
- if (code_len == 5
- && codes[0] == OPCODE_aload_0
- && codes[1] == OPCODE_getfield
- && (codes[4] == OPCODE_areturn
- || codes[4] == OPCODE_dreturn
- || codes[4] == OPCODE_freturn
- || codes[4] == OPCODE_ireturn
- || codes[4] == OPCODE_lreturn))
- {
- /* Found code like `return FIELD'. */
- fputs (" { return ", out);
- index = (codes[2] << 8) | codes[3];
- /* FIXME: ensure that tag is CONSTANT_Fieldref. */
- /* FIXME: ensure that the field's class is this class. */
- name_and_type = JPOOL_USHORT2 (jcf, index);
- /* FIXME: ensure that tag is CONSTANT_NameAndType. */
- name = JPOOL_USHORT1 (jcf, name_and_type);
- print_name (out, jcf, name);
- fputs ("; }", out);
- decompiled = 1;
- }
- else if (code_len == 2
- && codes[0] == OPCODE_aload_0
- && codes[1] == OPCODE_areturn)
- {
- /* Found `return this'. */
- fputs (" { return this; }", out);
- decompiled = 1;
- }
- else if (code_len == 1 && codes[0] == OPCODE_return)
- {
- /* Found plain `return'. */
- fputs (" { }", out);
- decompiled = 1;
- }
- else if (code_len == 2
- && codes[0] == OPCODE_aconst_null
- && codes[1] == OPCODE_areturn)
- {
- /* Found `return null'. We don't want to depend on NULL being
- defined. */
- fputs (" { return 0; }", out);
- decompiled = 1;
- }
-}
-
-/* Print one piece of a signature. Returns pointer to next parseable
- character on success, NULL on error. */
-static unsigned char *
-decode_signature_piece (stream, signature, limit, need_space)
- FILE *stream;
- unsigned char *signature, *limit;
- int *need_space;
-{
- const char *ctype;
-
- switch (signature[0])
- {
- case '[':
- for (signature++; (signature < limit
- && *signature >= '0'
- && *signature <= '9'); signature++)
- ;
- switch (*signature)
- {
- case 'B': ctype = "jbyteArray"; goto printit;
- case 'C': ctype = "jcharArray"; goto printit;
- case 'D': ctype = "jdoubleArray"; goto printit;
- case 'F': ctype = "jfloatArray"; goto printit;
- case 'I': ctype = "jintArray"; goto printit;
- case 'S': ctype = "jshortArray"; goto printit;
- case 'J': ctype = "jlongArray"; goto printit;
- case 'Z': ctype = "jbooleanArray"; goto printit;
- case '[': ctype = "jobjectArray"; goto printit;
- case 'L':
- /* We have to generate a reference to JArray here,
- so that our output matches what the compiler
- does. */
- ++signature;
- fputs ("JArray<", stream);
- while (signature < limit && *signature != ';')
- {
- int ch = UTF8_GET (signature, limit);
- if (ch == '/')
- fputs ("::", stream);
- else
- jcf_print_char (stream, ch);
- }
- fputs (" *> *", stream);
- *need_space = 0;
- ++signature;
- break;
- default:
- /* Unparseable signature. */
- return NULL;
- }
- break;
-
- case '(':
- case ')':
- /* This shouldn't happen. */
- return NULL;
-
- case 'B': ctype = "jbyte"; goto printit;
- case 'C': ctype = "jchar"; goto printit;
- case 'D': ctype = "jdouble"; goto printit;
- case 'F': ctype = "jfloat"; goto printit;
- case 'I': ctype = "jint"; goto printit;
- case 'J': ctype = "jlong"; goto printit;
- case 'S': ctype = "jshort"; goto printit;
- case 'Z': ctype = "jboolean"; goto printit;
- case 'V': ctype = "void"; goto printit;
- case 'L':
- ++signature;
- while (*signature && *signature != ';')
- {
- int ch = UTF8_GET (signature, limit);
- /* `$' is the separator for an inner class. */
- if (ch == '/' || ch == '$')
- fputs ("::", stream);
- else
- jcf_print_char (stream, ch);
- }
- fputs (" *", stream);
- if (*signature == ';')
- signature++;
- *need_space = 0;
- break;
- default:
- *need_space = 1;
- jcf_print_char (stream, *signature++);
- break;
- printit:
- signature++;
- *need_space = 1;
- fputs (ctype, stream);
- break;
- }
-
- return signature;
-}
-
-static void
-DEFUN(print_c_decl, (stream, jcf, name_index, signature_index, is_init,
- name_override),
- FILE* stream AND JCF* jcf
- AND int name_index AND int signature_index
- AND int is_init AND const char *name_override)
-{
- if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8)
- {
- fprintf (stream, "<not a UTF8 constant>");
- found_error = 1;
- }
- else
- {
- int length = JPOOL_UTF_LENGTH (jcf, signature_index);
- unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
- register unsigned char *str = str0;
- unsigned char *limit = str + length;
- int need_space = 0;
- int is_method = str[0] == '(';
- unsigned char *next;
-
- /* If printing a method, skip to the return signature and print
- that first. However, there is no return value if this is a
- constructor. */
- if (is_method && ! is_init)
- {
- while (str < limit)
- {
- int ch = *str++;
- if (ch == ')')
- break;
- }
- }
-
- /* If printing a field or an ordinary method, then print the
- "return value" now. */
- if (! is_method || ! is_init)
- {
- next = decode_signature_piece (stream, str, limit, &need_space);
- if (! next)
- {
- fprintf (stderr, "unparseable signature: `%s'\n", str0);
- found_error = 1;
- return;
- }
- }
-
- /* Now print the name of the thing. */
- if (need_space)
- fputs (" ", stream);
- if (name_override)
- fputs (name_override, stream);
- else if (name_index)
- {
- /* Declare constructors specially. */
- if (is_init)
- print_base_classname (stream, jcf, jcf->this_class);
- else
- print_name (stream, jcf, name_index);
- }
-
- if (is_method)
- {
- /* Have a method or a constructor. Print signature pieces
- until done. */
- fputs (" (", stream);
- str = str0 + 1;
- while (str < limit && *str != ')')
- {
- next = decode_signature_piece (stream, str, limit, &need_space);
- if (! next)
- {
- fprintf (stderr, "unparseable signature: `%s'\n", str0);
- found_error = 1;
- return;
- }
-
- if (next < limit && *next != ')')
- fputs (", ", stream);
- str = next;
- }
-
- fputs (")", stream);
- }
- }
-}
-
-void
-DEFUN(print_mangled_classname, (stream, jcf, prefix, index),
- FILE *stream AND JCF *jcf AND const char *prefix AND int index)
-{
- int name_index = JPOOL_USHORT1 (jcf, index);
- fputs (prefix, stream);
- jcf_print_utf8_replace (out,
- JPOOL_UTF_DATA (jcf, name_index),
- JPOOL_UTF_LENGTH (jcf, name_index),
- '/', '_');
-}
-
-/* Print PREFIX, then a class name in C++ format. If the name refers
- to an array, ignore it and don't print PREFIX. Returns 1 if
- something was printed, 0 otherwise. */
-static int
-print_cxx_classname (stream, prefix, jcf, index)
- FILE *stream;
- char *prefix;
- JCF *jcf;
- int index;
-{
- int name_index = JPOOL_USHORT1 (jcf, index);
- int len, c;
- unsigned char *s, *p, *limit;
-
- s = JPOOL_UTF_DATA (jcf, name_index);
- len = JPOOL_UTF_LENGTH (jcf, name_index);
- limit = s + len;
-
- /* Explicitly omit arrays here. */
- p = s;
- c = UTF8_GET (p, limit);
- if (c == '[')
- return 0;
-
- fputs (prefix, stream);
- while (s < limit)
- {
- c = UTF8_GET (s, limit);
- if (c == '/')
- fputs ("::", stream);
- else
- jcf_print_char (stream, c);
- }
-
- return 1;
-}
-
-int written_class_count = 0;
-
-/* Return name of superclass. If LEN is not NULL, fill it with length
- of name. */
-static unsigned char *
-super_class_name (derived_jcf, len)
- JCF *derived_jcf;
- int *len;
-{
- int supername_index = JPOOL_USHORT1 (derived_jcf, derived_jcf->super_class);
- int supername_length = JPOOL_UTF_LENGTH (derived_jcf, supername_index);
- unsigned char *supername = JPOOL_UTF_DATA (derived_jcf, supername_index);
-
- if (len)
- *len = supername_length;
-
- return supername;
-}
-
-
-
-/* We keep track of all the `#include's we generate, so we can avoid
- duplicates. */
-struct include
-{
- char *name;
- struct include *next;
-};
-
-/* List of all includes. */
-static struct include *all_includes = NULL;
-
-/* Generate a #include. */
-static void
-print_include (out, utf8, len)
- FILE *out;
- unsigned char *utf8;
- int len;
-{
- struct include *incl;
-
- if (! out)
- return;
-
- if (len == -1)
- len = strlen (utf8);
-
- for (incl = all_includes; incl; incl = incl->next)
- {
- /* We check the length because we might have a proper prefix. */
- if (len == (int) strlen (incl->name)
- && ! strncmp (incl->name, utf8, len))
- return;
- }
-
- incl = (struct include *) malloc (sizeof (struct include));
- incl->name = malloc (len + 1);
- strncpy (incl->name, utf8, len);
- incl->name[len] = '\0';
- incl->next = all_includes;
- all_includes = incl;
-
- fputs ("#include <", out);
- jcf_print_utf8 (out, utf8, len);
- fputs (".h>\n", out);
-}
-
-
-
-/* This is used to represent part of a package or class name. */
-struct namelet
-{
- /* The text of this part of the name. */
- char *name;
- /* True if this represents a class. */
- int is_class;
- /* Linked list of all classes and packages inside this one. */
- struct namelet *subnamelets;
- /* Pointer to next sibling. */
- struct namelet *next;
-};
-
-/* The special root namelet. */
-static struct namelet root =
-{
- NULL,
- 0,
- NULL,
- NULL
-};
-
-/* This extracts the next name segment from the full UTF-8 encoded
- package or class name and links it into the tree. It does this
- recursively. */
-static void
-add_namelet (name, name_limit, parent)
- unsigned char *name, *name_limit;
- struct namelet *parent;
-{
- unsigned char *p;
- struct namelet *n = NULL, *np;
-
- /* We want to skip the standard namespaces that we assume the
- runtime already knows about. We only do this at the top level,
- though, hence the check for `root'. */
- if (parent == &root)
- {
-#define JAVALANG "java/lang/"
-#define JAVAIO "java/io/"
-#define JAVAUTIL "java/util/"
- if ((name_limit - name >= (int) sizeof (JAVALANG) - 1
- && ! strncmp (name, JAVALANG, sizeof (JAVALANG) - 1))
- || (name_limit - name >= (int) sizeof (JAVAUTIL) - 1
- && ! strncmp (name, JAVAUTIL, sizeof (JAVAUTIL) - 1))
- || (name_limit - name >= (int) sizeof (JAVAIO) - 1
- && ! strncmp (name, JAVAIO, sizeof (JAVAIO) - 1)))
- return;
- }
-
- for (p = name; p < name_limit && *p != '/' && *p != '$'; ++p)
- ;
-
- /* Search for this name beneath the PARENT node. */
- for (np = parent->subnamelets; np != NULL; np = np->next)
- {
- /* We check the length because we might have a proper prefix. */
- if ((int) strlen (np->name) == p - name &&
- ! strncmp (name, np->name, p - name))
- {
- n = np;
- break;
- }
- }
-
- if (n == NULL)
- {
- n = (struct namelet *) malloc (sizeof (struct namelet));
- n->name = malloc (p - name + 1);
- strncpy (n->name, name, p - name);
- n->name[p - name] = '\0';
- n->is_class = (p == name_limit || *p == '$');
- n->subnamelets = NULL;
- n->next = parent->subnamelets;
- parent->subnamelets = n;
- }
-
- /* We recurse if there is more text, and if the trailing piece does
- not represent an inner class. */
- if (p < name_limit && *p != '$')
- add_namelet (p + 1, name_limit, n);
-}
-
-/* Print a single namelet. Destroys namelets while printing. */
-static void
-print_namelet (out, name, depth)
- FILE *out;
- struct namelet *name;
- int depth;
-{
- int i, term = 0;
- struct namelet *c;
-
- if (name->name)
- {
- for (i = 0; i < depth; ++i)
- fputc (' ', out);
- fprintf (out, "%s %s", name->is_class ? "class" : "namespace",
- name->name);
- if (name->is_class && name->subnamelets == NULL)
- fputs (";\n", out);
- else
- {
- term = 1;
- fputs ("\n", out);
- for (i = 0; i < depth; ++i)
- fputc (' ', out);
- fputs ("{\n", out);
- }
- }
-
- c = name->subnamelets;
- while (c != NULL)
- {
- struct namelet *next = c->next;
- print_namelet (out, c, depth + 2);
- c = next;
- }
-
- if (name->name)
- {
- if (term)
- {
- for (i = 0; i < depth; ++i)
- fputc (' ', out);
- fputs ("};\n", out);
- }
-
- free (name->name);
- free (name);
- }
-}
-
-/* This is called to add some classes to the list of classes for which
- we need decls. The signature argument can be a function
- signature. */
-static void
-add_class_decl (out, jcf, signature)
- FILE *out;
- JCF *jcf;
- JCF_u2 signature;
-{
- unsigned char *s = JPOOL_UTF_DATA (jcf, signature);
- int len = JPOOL_UTF_LENGTH (jcf, signature);
- int i;
- /* Name of class we are processing. */
- int name_index = JPOOL_USHORT1 (jcf, jcf->this_class);
- int tlen = JPOOL_UTF_LENGTH (jcf, name_index);
- char *tname = JPOOL_UTF_DATA (jcf, name_index);
-
- for (i = 0; i < len; ++i)
- {
- int start, saw_dollar;
-
- /* If we see an array, then we include the array header. */
- if (s[i] == '[')
- {
- print_include (out, "java-array", -1);
- continue;
- }
-
- /* We're looking for `L<stuff>;' -- everything else is
- ignorable. */
- if (s[i] != 'L')
- continue;
-
- saw_dollar = 0;
- for (start = ++i; i < len && s[i] != ';'; ++i)
- {
- if (! saw_dollar && s[i] == '$' && out)
- {
- saw_dollar = 1;
- /* If this class represents an inner class, then
- generate a `#include' for the outer class. However,
- don't generate the include if the outer class is the
- class we are processing. */
- if (i - start < tlen || strncmp (&s[start], tname, i - start))
- print_include (out, &s[start], i - start);
- break;
- }
- }
-
- /* If we saw an inner class, then the generated #include will
- declare the class. So in this case we needn't bother. */
- if (! saw_dollar)
- add_namelet (&s[start], &s[i], &root);
- }
-}
-
-/* Print declarations for all classes required by this class. Any
- class or package in the `java' package is assumed to be handled
- statically in libjava; we don't generate declarations for these.
- This makes the generated headers a bit easier to read. */
-static void
-print_class_decls (out, jcf, self)
- FILE *out;
- JCF *jcf;
- int self;
-{
- /* Make sure to always add the current class to the list of things
- that should be declared. */
- int name_index = JPOOL_USHORT1 (jcf, self);
- int len;
- unsigned char *s;
-
- s = JPOOL_UTF_DATA (jcf, name_index);
- len = JPOOL_UTF_LENGTH (jcf, name_index);
- add_namelet (s, s + len, &root);
-
- if (root.subnamelets)
- {
- fputs ("extern \"Java\"\n{\n", out);
- /* We use an initial offset of 0 because the root namelet
- doesn't cause anything to print. */
- print_namelet (out, &root, 0);
- fputs ("};\n\n", out);
- }
-}
-
-
-
-static void
-DEFUN(process_file, (jcf, out),
- JCF *jcf AND FILE *out)
-{
- int code, i;
- uint32 field_start, method_end, method_start;
-
- current_jcf = jcf;
-
- last_access = -1;
-
- if (jcf_parse_preamble (jcf) != 0)
- {
- fprintf (stderr, "Not a valid Java .class file.\n");
- found_error = 1;
- return;
- }
-
- /* Parse and possibly print constant pool */
- code = jcf_parse_constant_pool (jcf);
- if (code != 0)
- {
- fprintf (stderr, "error while parsing constant pool\n");
- found_error = 1;
- return;
- }
- code = verify_constant_pool (jcf);
- if (code > 0)
- {
- fprintf (stderr, "error in constant pool entry #%d\n", code);
- found_error = 1;
- return;
- }
-
- jcf_parse_class (jcf);
-
- if (written_class_count++ == 0 && out)
- fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n",
- out);
-
- if (out)
- {
- print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class);
- fprintf (out, "__\n");
-
- print_mangled_classname (out, jcf, "#define __", jcf->this_class);
- fprintf (out, "__\n\n");
-
- /* We do this to ensure that inline methods won't be `outlined'
- by g++. This works as long as method and fields are not
- added by the user. */
- fprintf (out, "#pragma interface\n");
- }
-
- if (jcf->super_class && out)
- {
- int super_length;
- unsigned char *supername = super_class_name (jcf, &super_length);
-
- fputs ("\n", out);
- print_include (out, supername, super_length);
- }
-
- /* We want to parse the methods first. But we need to find where
- they start. So first we skip the fields, then parse the methods.
- Then we parse the fields and skip the methods. This is ugly, but
- not too bad since we need two full passes to get class decl
- information anyway. */
- field_pass = 0;
- field_start = JCF_TELL (jcf);
- jcf_parse_fields (jcf);
-
- method_start = JCF_TELL (jcf);
- method_pass = 0;
- jcf_parse_methods (jcf);
-
- if (out)
- {
- fputs ("\n", out);
- print_class_decls (out, jcf, jcf->this_class);
-
- for (i = 0; i < prepend_count; ++i)
- fprintf (out, "%s\n", prepend_specs[i]);
- if (prepend_count > 0)
- fputc ('\n', out);
- }
-
- if (out && ! print_cxx_classname (out, "class ", jcf, jcf->this_class))
- {
- fprintf (stderr, "class is of array type\n");
- found_error = 1;
- return;
- }
- if (out && jcf->super_class)
- {
- if (! print_cxx_classname (out, " : public ", jcf, jcf->super_class))
- {
- fprintf (stderr, "base class is of array type\n");
- found_error = 1;
- return;
- }
- }
- if (out)
- fputs ("\n{\n", out);
-
- /* Now go back for second pass over methods and fields. */
- JCF_SEEK (jcf, method_start);
- method_pass = 1;
- jcf_parse_methods (jcf);
- method_end = JCF_TELL (jcf);
-
- field_pass = 1;
- JCF_SEEK (jcf, field_start);
- jcf_parse_fields (jcf);
- JCF_SEEK (jcf, method_end);
-
- jcf_parse_final_attributes (jcf);
-
- if (out)
- {
- /* Generate friend decl if we still must. */
- for (i = 0; i < friend_count; ++i)
- fprintf (out, " friend %s\n", friend_specs[i]);
-
- /* Generate extra declarations. */
- if (add_count > 0)
- fputc ('\n', out);
- for (i = 0; i < add_count; ++i)
- fprintf (out, " %s\n", add_specs[i]);
-
- fputs ("};\n", out);
-
- if (append_count > 0)
- fputc ('\n', out);
- for (i = 0; i < append_count; ++i)
- fprintf (out, "%s\n", append_specs[i]);
-
- print_mangled_classname (out, jcf, "\n#endif /* __", jcf->this_class);
- fprintf (out, "__ */\n");
- }
-}
-
-static void
-usage ()
-{
- fprintf (stderr, "gcjh: no classes specified\n");
- exit (1);
-}
-
-static void
-help ()
-{
- printf ("Usage: gcjh [OPTION]... CLASS...\n\n");
- printf ("Generate C++ header files from .class files\n\n");
- printf (" --classpath PATH Set path to find .class files\n");
- printf (" --CLASSPATH PATH Set path to find .class files\n");
- printf (" -IDIR Append directory to class path\n");
- printf (" -d DIRECTORY Set output directory name\n");
- printf (" --help Print this help, then exit\n");
- printf (" -o FILE Set output file name\n");
- printf (" -td DIRECTORY Set temporary directory name\n");
- printf (" -v, --verbose Print extra information while running\n");
- printf (" --version Print version number, then exit\n");
- /* FIXME: print bug-report information. */
- exit (0);
-}
-
-static void
-java_no_argument (opt)
- char *opt;
-{
- fprintf (stderr, "gcjh: no argument given for option `%s'\n", opt);
- exit (1);
-}
-
-static void
-version ()
-{
- /* FIXME: use version.c? */
- printf ("gcjh (GNU gcc) 0.0\n\n");
- printf ("Copyright (C) 1998 Free Software Foundation, Inc.\n");
- printf ("This is free software; see the source for copying conditions. There is NO\n");
- printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
- exit (0);
-}
-
-int
-DEFUN(main, (argc, argv),
- int argc AND char** argv)
-{
- JCF jcf;
- int argi;
- char *output_file = NULL;
- int emit_dependencies = 0, suppress_output = 0;
-
- if (argc <= 1)
- usage ();
-
- jcf_path_init ();
-
- for (argi = 1; argi < argc; argi++)
- {
- char *arg = argv[argi];
-
- if (arg[0] != '-' || ! strcmp (arg, "--"))
- break;
-
- /* Just let all arguments be given in either "-" or "--" form. */
- if (arg[1] == '-')
- ++arg;
-
- if (strcmp (arg, "-o") == 0)
- {
- if (argi + 1 < argc)
- output_file = argv[++argi];
- else
- java_no_argument (argv[argi]);
- }
- else if (strcmp (arg, "-d") == 0)
- {
- if (argi + 1 < argc)
- output_directory = argv[++argi];
- else
- java_no_argument (argv[argi]);
- }
- else if (strcmp (arg, "-td") == 0)
- {
- if (argi + 1 < argc)
- temp_directory = argv[++argi];
- else
- java_no_argument (argv[argi]);
- }
- else if (strcmp (arg, "-prepend") == 0)
- {
- if (argi + 1 < argc)
- {
- if (prepend_count == 0)
- prepend_specs = (char**) ALLOC ((argc-argi) * sizeof (char*));
- prepend_specs[prepend_count++] = argv[++argi];
- }
- else
- java_no_argument (argv[argi]);
- }
- else if (strcmp (arg, "-friend") == 0)
- {
- if (argi + 1 < argc)
- {
- if (friend_count == 0)
- friend_specs = (char**) ALLOC ((argc-argi) * sizeof (char*));
- friend_specs[friend_count++] = argv[++argi];
- }
- else
- java_no_argument (argv[argi]);
- }
- else if (strcmp (arg, "-add") == 0)
- {
- if (argi + 1 < argc)
- {
- if (add_count == 0)
- add_specs = (char**) ALLOC ((argc-argi) * sizeof (char*));
- add_specs[add_count++] = argv[++argi];
- }
- else
- java_no_argument (argv[argi]);
- }
- else if (strcmp (arg, "-append") == 0)
- {
- if (argi + 1 < argc)
- {
- if (append_count == 0)
- append_specs = (char**) ALLOC ((argc-argi) * sizeof (char*));
- append_specs[append_count++] = argv[++argi];
- }
- else
- java_no_argument (argv[argi]);
- }
- else if (strcmp (arg, "-classpath") == 0)
- {
- if (argi + 1 < argc)
- jcf_path_classpath_arg (argv[++argi]);
- else
- java_no_argument (argv[argi]);
- }
- else if (strcmp (arg, "-CLASSPATH") == 0)
- {
- if (argi + 1 < argc)
- jcf_path_CLASSPATH_arg (argv[++argi]);
- else
- java_no_argument (argv[argi]);
- }
- else if (strncmp (arg, "-I", 2) == 0)
- jcf_path_include_arg (arg + 2);
- else if (strcmp (arg, "-verbose") == 0 || strcmp (arg, "-v") == 0)
- verbose++;
- else if (strcmp (arg, "-stubs") == 0)
- stubs++;
- else if (strcmp (arg, "-help") == 0)
- help ();
- else if (strcmp (arg, "-version") == 0)
- version ();
- else if (strcmp (arg, "-M") == 0)
- {
- emit_dependencies = 1;
- suppress_output = 1;
- jcf_dependency_init (1);
- }
- else if (strcmp (arg, "-MM") == 0)
- {
- emit_dependencies = 1;
- suppress_output = 1;
- jcf_dependency_init (0);
- }
- else if (strcmp (arg, "-MG") == 0)
- {
- fprintf (stderr, "gcjh: `%s' option is unimplemented\n", argv[argi]);
- exit (1);
- }
- else if (strcmp (arg, "-MD") == 0)
- {
- emit_dependencies = 1;
- jcf_dependency_init (1);
- }
- else if (strcmp (arg, "-MMD") == 0)
- {
- emit_dependencies = 1;
- jcf_dependency_init (0);
- }
- else
- {
- fprintf (stderr, "%s: illegal argument\n", argv[argi]);
- exit (1);
- }
- }
-
- if (argi == argc)
- usage ();
-
- jcf_path_seal ();
-
- if (output_file && emit_dependencies)
- {
- fprintf (stderr, "gcjh: can't specify both -o and -MD\n");
- exit (1);
- }
-
- for (; argi < argc; argi++)
- {
- char *classname = argv[argi];
- char *classfile_name, *current_output_file;
-
- if (verbose)
- fprintf (stderr, "Processing %s\n", classname);
- if (! output_file)
- jcf_dependency_reset ();
- classfile_name = find_class (classname, strlen (classname), &jcf, 0);
- if (classfile_name == NULL)
- {
- fprintf (stderr, "%s: no such class\n", classname);
- exit (1);
- }
- if (verbose)
- fprintf (stderr, "Found in %s\n", classfile_name);
- if (output_file)
- {
- if (strcmp (output_file, "-") == 0)
- out = stdout;
- else if (out == NULL)
- {
- out = fopen (output_file, "w");
- }
- if (out == NULL)
- {
- perror (output_file);
- exit (1);
- }
- current_output_file = output_file;
- }
- else
- {
- int dir_len = strlen (output_directory);
- int i, classname_length = strlen (classname);
- current_output_file = (char*) ALLOC (dir_len + classname_length + 4);
- strcpy (current_output_file, output_directory);
- if (dir_len > 0 && output_directory[dir_len-1] != '/')
- current_output_file[dir_len++] = '/';
- for (i = 0; classname[i] != '\0'; i++)
- {
- char ch = classname[i];
- if (ch == '.')
- ch = '/';
- current_output_file[dir_len++] = ch;
- }
- if (emit_dependencies)
- {
- if (suppress_output)
- {
- jcf_dependency_set_dep_file ("-");
- out = NULL;
- }
- else
- {
- /* We use `.hd' and not `.d' to avoid clashes with
- dependency tracking from straight compilation. */
- strcpy (current_output_file + dir_len, ".hd");
- jcf_dependency_set_dep_file (current_output_file);
- }
- }
- strcpy (current_output_file + dir_len, ".h");
- jcf_dependency_set_target (current_output_file);
- if (! suppress_output)
- {
- out = fopen (current_output_file, "w");
- if (out == NULL)
- {
- perror (current_output_file);
- exit (1);
- }
- }
- }
- process_file (&jcf, out);
- JCF_FINISH (&jcf);
- if (current_output_file != output_file)
- free (current_output_file);
- jcf_dependency_write ();
- }
-
- if (out != NULL && out != stdout)
- fclose (out);
-
- return found_error;
-}
-
-/* TODO:
-
- * Do whatever the javah -stubs flag does.
-
- * Emit "structure forward declarations" when needed.
-
- * Generate C headers, like javah
-
- */
diff --git a/gnu/dist/toolchain/gcc/java/java-except.h b/gnu/dist/toolchain/gcc/java/java-except.h
deleted file mode 100644
index 07b3feb3046..00000000000
--- a/gnu/dist/toolchain/gcc/java/java-except.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Definitions for exception handling for use by the GNU compiler
- for the Java(TM) language compiler.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-struct eh_range
- {
- /* The (byte-code PC) range of the handled block. */
- int start_pc;
- int end_pc;
-
- /* A list of handlers. For each element in the list,
- the TREE_PURPOSE is the handled class (NULL_EXPR for a finally block),
- and the TREE_VALUE is the LABEL_DECL of the handler. */
- tree handlers;
-
- /* Surrunding handler, if any. */
- struct eh_range *outer;
-
- /* The first child range. It is is nested inside this range
- (i.e. this.start_pc <= first_child.end_pc
- && this.end_pc >= first_child.end_pc).
- The children are linked together using next_sibling, and are sorted
- by increasing start_pc and end_pc (we do not support non-nested
- overlapping ranges). */
- struct eh_range *first_child;
-
- /* The next child of outer, in address order. */
- struct eh_range *next_sibling;
- };
-
-/* A dummy range that represents the entire method. */
-extern struct eh_range whole_range;
-
-#define NULL_EH_RANGE (&whole_range)
-
-extern struct eh_range * find_handler PROTO ((int));
-
-extern void method_init_exceptions PROTO ((void));
-
-extern void emit_handlers PROTO ((void));
-
-extern void maybe_start_try PROTO ((int));
-
-extern void maybe_end_try PROTO ((int));
-
-extern void add_handler PROTO ((int, int, tree, tree));
-
-extern void handle_nested_ranges PROTO ((void));
-
-extern void expand_resume_after_catch PROTO ((void));
diff --git a/gnu/dist/toolchain/gcc/java/java-opcodes.h b/gnu/dist/toolchain/gcc/java/java-opcodes.h
deleted file mode 100644
index 8fbe55cb708..00000000000
--- a/gnu/dist/toolchain/gcc/java/java-opcodes.h
+++ /dev/null
@@ -1,5 +0,0 @@
-enum java_opcode {
-#define JAVAOP(NAME, CODE, KIND, TYPE, VALUE) OPCODE_##NAME = CODE,
-#include "javaop.def"
-#undef JAVAOP
-};
diff --git a/gnu/dist/toolchain/gcc/java/java-tree.def b/gnu/dist/toolchain/gcc/java/java-tree.def
deleted file mode 100644
index ead192476f6..00000000000
--- a/gnu/dist/toolchain/gcc/java/java-tree.def
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Shift right, logical. */
-
-DEFTREECODE (URSHIFT_EXPR, "urshift_expr", '2', 2)
-
-/* Return -1, 0, 1 depending on whether the first argument is
- less, equal, or greater to the second argument. */
-DEFTREECODE (COMPARE_EXPR, "compare_expr", '2', 2)
-
-/* Same as COMPARE_EXPR, but if either value is NaN, the result is -1. */
-DEFTREECODE (COMPARE_L_EXPR, "compare_l_expr", '2', 2)
-/* Same as COMPARE_EXPR, but if either value is NaN, the result is 1. */
-DEFTREECODE (COMPARE_G_EXPR, "compare_g_expr", '2', 2)
-
-/* Unary plus. Operand 0 is the expression the unary plus is applied
- to */
-DEFTREECODE (UNARY_PLUS_EXPR, "unary_plus_expr", '1', 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", 'e', 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", 'e', 3)
-
-/* Defines `this' as an expression. */
-DEFTREECODE (THIS_EXPR, "this", '1', 0)
-
-/* Case statement expression.
- Operand 1 is the case value. */
-DEFTREECODE (CASE_EXPR, "case", 'x', 1)
-
-/* Default statement expression. */
-DEFTREECODE (DEFAULT_EXPR, "default", 'x', 0)
-
-/* Try expression
- Operand 0 is the tried block,
- Operand 1 contains chained catch nodes. */
-DEFTREECODE (TRY_EXPR, "try-catch-finally", 'e', 2)
-
-/* Catch clause.
- Operand 0 is the catch clause block, which contains the declaration of
- the catch clause parameter. */
-DEFTREECODE (CATCH_EXPR, "catch", '1', 1)
-
-/* Synchronized statement.
- Operand 0 is the expression on which we whish to synchronize,
- Operand 1 is the synchronized expression block. */
-DEFTREECODE (SYNCHRONIZED_EXPR, "synchronized", 'e', 2)
-
-/* Throw statement.
- Operand 0 is the throw expresion. */
-DEFTREECODE (THROW_EXPR, "throw", '1', 1)
-
-/* Conditional operator.
- Operand 0 is the condition expression
- Operand 1 is the then-value
- Operand 2 is the else-value. */
-DEFTREECODE (CONDITIONAL_EXPR, "?:", 'e', 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", 'e', 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", '1', 1)
diff --git a/gnu/dist/toolchain/gcc/java/java-tree.h b/gnu/dist/toolchain/gcc/java/java-tree.h
deleted file mode 100644
index be1f14375c0..00000000000
--- a/gnu/dist/toolchain/gcc/java/java-tree.h
+++ /dev/null
@@ -1,939 +0,0 @@
-/* Definitions for parsing and type checking for the GNU compiler for
- the Java(TM) language.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
-
-/* Java language-specific tree codes. */
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
-enum java_tree_code {
- __DUMMY = LAST_AND_UNUSED_TREE_CODE,
-#include "java-tree.def"
- LAST_JAVA_TREE_CODE
-};
-#undef DEFTREECODE
-
-struct JCF;
-
-/* Usage of TREE_LANG_FLAG_?:
- 0: IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (in IDENTIFIER_NODE)
- RESOLVE_EXPRESSION_NAME_P (in EXPR_WITH_FILE_LOCATION)
- IS_FOR_LOOP_P (in LOOP_EXPR)
- 1: CLASS_HAS_SUPER_FLAG (in TREE_VEC).
- IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
- COMPOUND_ASSIGN_P (in EXPR (binop_*))
- 2: RETURN_MAP_ADJUSTED (in TREE_VEC).
- QUALIFIED_P (in IDENTIFIER_NODE)
- PRIMARY_P (in EXPR_WITH_FILE_LOCATION)
- MODIFY_EXPR_FROM_INITIALIZATION_P (in MODIFY_EXPR)
- 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)
- 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)
- 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)
- 6: CAN_COMPLETE_NORMALLY (in statement nodes).
-
- Usage of TYPE_LANG_FLAG_?:
- 1: TYPE_ARRAY_P (in RECORD_TYPE).
- 2: CLASS_LOADED_P (in RECORD_TYPE).
- 3: CLASS_FROM_SOURCE_P (in RECORD_TYPE).
- 4: CLASS_P (in RECORD_TYPE).
- 5: CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (in RECORD_TYPE)
- 6: CLASS_HAS_FINIT_P (in RECORD_TYPE)
-
- Usage of DECL_LANG_FLAG_?:
- 0: METHOD_DEPRECATED (in FUNCTION_DECL).
- FIELD_DEPRECATED (in FIELD_DECL).
- CLASS_DEPRECATED (in TYPE_DECL).
- 1: METHOD_PUBLIC (in FUNCTION_DECL).
- FIELD_PUBLIC (in FIELD_DECL).
- CLASS_PUBLIC (in TYPE_DECL).
- 2: METHOD_STATIC (in FUNCTION_DECL).
- (But note that FIELD_STATIC uses TREE_STATIC!)
- CLASS_COMPLETE_P (in TYPE_DECL)
- 3: METHOD_FINAL (in FUNCTION_DECL)
- FIELD_FINAL (in FIELD_DECL)
- CLASS_FINAL (in TYPE_DECL)
- 4: METHOD_SYNCHRONIZED (in FUNCTION_DECL).
- LABEL_IN_SUBR (in LABEL_DECL)
- CLASS_INTERFACE (in TYPE_DECL)
- FIELD_VOLATILE (int FIELD_DECL)
- 5: METHOD_ABSTRACT (in FUNCTION_DECL).
- LABEL_IS_SUBR_START (in LABEL_DECL)
- CLASS_ABSTRACT (in TYPE_DECL)
- FIELD_TRANSIENT (in FIELD_DECL)
- 6: METHOD_TRANSIENT (in FUNCTION_DECL)
- LABEL_CHANGED (in LABEL_DECL)
- CLASS_SUPER (in TYPE_DECL, ACC_SUPER flag)
- 7: DECL_CONSTRUCTOR_P (in FUNCTION_DECL).
-*/
-
-/* True if the class whose TYPE_BINFO this is has a superclass.
- (True of all classes except Object.) */
-#define CLASS_HAS_SUPER_FLAG(BINFO) TREE_LANG_FLAG_1(BINFO)
-#define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE))
-
-/* Return the supertype of class TYPE, or NULL_TREE is it has none. */
-#define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) ? \
- BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (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. */
-extern tree main_class;
-
-/* The class we are currently processing. */
-extern tree current_class;
-
-/* List of all class DECLs seen so far. */
-extern tree all_class_list;
-
-/* Nonzero if we want to automatically do array bounds checking;
- on by default. Use -fno-bounds-check to disable. */
-
-extern int flag_bounds_check;
-
-/* Nonzero if we should make is_compiled_class always return 1 for
- appropriate classes that we're referencing. */
-
-extern int flag_assume_compiled;
-
-extern int flag_emit_class_files;
-
-/* When non zero, we emit xref strings. Values of the flag for xref
- backends are defined in xref.h. */
-
-extern int flag_emit_xref;
-
-/* When doing xrefs, tell when not to fold. */
-extern int do_not_fold;
-
-/* Turned to 1 if -Wall was encountered. See lang.c for their meanings. */
-extern int flag_wall;
-extern int flag_redundant;
-extern int flag_not_overriding;
-extern int flag_static_local_jdk1_1;
-
-/* The Java .class file that provides main_class; the main input file. */
-extern struct JCF *current_jcf;
-
-typedef struct CPool constant_pool;
-
-#define CONSTANT_ResolvedFlag 16
-
-/* The cpool->data[i] for a ResolvedString points to a STRING_CST. */
-#define CONSTANT_ResolvedString (CONSTANT_String+CONSTANT_ResolvedFlag)
-
-/* The cpool->data[i] for a ResolvedClass points to a RECORD_TYPE. */
-#define CONSTANT_ResolvedClass (CONSTANT_Class+CONSTANT_ResolvedFlag)
-
-#define CPOOL_UTF(CPOOL, INDEX) ((tree) (CPOOL)->data[INDEX])
-
-/* A NameAndType constant is represented as a TREE_LIST.
- The type is the signature string (as an IDENTIFIER_NODE). */
-
-#define NAME_AND_TYPE_NAME(CPOOL, IDX) \
- CPOOL_UTF(CPOOL, CPOOL_USHORT1(CPOOL, IDX))
-#define NAME_AND_TYPE_SIGNATURE(CPOOL, IDX) \
- CPOOL_UTF(CPOOL, CPOOL_USHORT2(CPOOL, IDX))
-
-/* A FieldRef, MethodRef or InterfaceMethodRef constant
- is represented as a TREE_LIST. */
-
-#define COMPONENT_REF_CLASS_INDEX(CPOOL, IDX) CPOOL_USHORT1(CPOOL, IDX)
-#define COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX) CPOOL_USHORT2(CPOOL, IDX)
-#define COMPONENT_REF_NAME(CPOOL, IDX) \
- NAME_AND_TYPE_NAME (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
-#define COMPONENT_REF_SIGNATURE(CPOOL, IDX) \
- NAME_AND_TYPE_SIGNATURE (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
-
-/* "Promoted types" that are used for primitive types smaller
- than int. We could use int_type_node, but then we would lose
- type information (such as needed for debugging). */
-extern tree promoted_byte_type_node;
-extern tree promoted_short_type_node;
-extern tree promoted_char_type_node;
-extern tree promoted_boolean_type_node;
-
-extern tree byte_type_node;
-extern tree short_type_node;
-extern tree int_type_node;
-extern tree long_type_node;
-
-extern tree unsigned_byte_type_node;
-extern tree unsigned_short_type_node;
-extern tree unsigned_int_type_node;
-extern tree unsigned_long_type_node;
-
-extern tree boolean_type_node;
-extern tree char_type_node;
-extern tree float_type_node;
-extern tree double_type_node;
-
-extern tree object_type_node;
-extern tree unqualified_object_id_node;
-extern tree object_ptr_type_node;
-extern tree string_type_node;
-extern tree string_ptr_type_node;
-extern tree throwable_type_node;
-extern tree runtime_exception_type_node;
-extern tree error_exception_type_node;
-
-extern tree *predef_filenames;
-extern int predef_filenames_size;
-
-extern tree byte_array_type_node;
-extern tree short_array_type_node;
-extern tree int_array_type_node;
-extern tree long_array_type_node;
-extern tree boolean_array_type_node;
-extern tree char_array_type_node;
-extern tree double_array_type_node;
-extern tree float_array_type_node;
-extern tree array_array_type_node;
-extern tree object_array_type_node;
-extern tree string_array_type_node;
-extern tree TYPE_identifier_node; /* "TYPE" */
-extern tree init_identifier_node; /* "<init>" */
-extern tree clinit_identifier_node; /* "<clinit>" */
-extern tree finit_identifier_node; /* "$finit$" */
-extern tree void_signature_node; /* "()V" */
-extern tree length_identifier_node; /* "length" */
-extern tree this_identifier_node; /* "this" */
-extern tree super_identifier_node; /* "super" */
-extern tree continue_identifier_node; /* "continue" */
-extern tree one_elt_array_domain_type;
-extern tree void_type_node;
-extern tree ptr_type_node;
-/* The type of the return address of a subroutine. */
-extern tree return_address_type_node;
-
-/* Nodes for boolean constants TRUE and FALSE. */
-extern tree boolean_true_node, boolean_false_node;
-
-/* Integer constants not declared in tree.h. */
-extern tree long_zero_node;
-extern tree float_zero_node;
-extern tree double_zero_node;
-extern tree integer_negative_one_node;
-extern tree integer_two_node;
-extern tree integer_four_node;
-extern tree empty_stmt_node;
-
-/* The type for struct methodtable. */
-extern tree methodtable_type;
-extern tree methodtable_ptr_type;
-
-extern tree utf8const_type;
-extern tree utf8const_ptr_type;
-
-extern tree class_type_node;
-extern tree class_ptr_type;
-extern tree field_type_node;
-extern tree constants_type_node;
-extern tree dtable_type, dtable_ptr_type;
-extern tree field_ptr_type_node;
-extern tree field_info_union_node;
-extern tree method_type_node;
-extern tree method_ptr_type_node;
-#define nativecode_ptr_type_node ptr_type_node
-
-extern tree end_params_node;
-
-/* References to internal libjava functions we use. */
-extern tree alloc_object_node;
-extern tree soft_instanceof_node;
-extern tree soft_checkcast_node;
-extern tree soft_initclass_node;
-extern tree soft_newarray_node;
-extern tree soft_anewarray_node;
-extern tree soft_multianewarray_node;
-extern tree soft_badarrayindex_node;
-extern tree throw_node;
-extern tree soft_checkarraystore_node;
-extern tree soft_monitorenter_node;
-extern tree soft_monitorexit_node;
-extern tree soft_lookupinterfacemethod_node;
-extern tree soft_fmod_node;
-extern tree soft_exceptioninfo_call_node;
-
-extern tree access_flags_type_node;
-
-extern tree class_dtable_decl;
-
-/* They need to be reset before processing each class */
-extern struct CPool *outgoing_cpool;
-extern tree current_constant_pool_data_ref;
-
-extern tree wfl_operator;
-
-struct lang_identifier
-{
- struct tree_identifier ignore;
- tree global_value, local_value;
-
- /* If non-NULL: An ADDR_REF to a VAR_DECL that contains
- * the Utf8Const representation of the identifier. */
- tree utf8_ref;
-};
-
-/* Macros for access to language-specific slots in an identifier. */
-/* UNless specifide, each of these slots contains a DECL node or null. */
-
-/* This represents the value which the identifier has in the
- file-scope namespace. */
-#define IDENTIFIER_GLOBAL_VALUE(NODE) \
- (((struct lang_identifier *)(NODE))->global_value)
-/* This represents the value which the identifier has in the current
- scope. */
-#define IDENTIFIER_LOCAL_VALUE(NODE) \
- (((struct lang_identifier *)(NODE))->local_value)
-
-/* Given an identifier NODE, get the corresponding (non-handle) class.
- For get_identifier ("java.lang.Number"), the result is
- the struct whose DECL_ASSEMBLER_NAME is "Classjava_lang_Number". */
-#define IDENTIFIER_CLASS_VALUE(NODE) IDENTIFIER_GLOBAL_VALUE(NODE)
-
-/* Given an identifier NODE, get the corresponding handle class.
- For get_identifier ("java.lang.Number"), the result is
- the struct whose DECL_ASSEMBLER_NAME is "Hjava_lang_Number". */
-#define IDENTIFIER_HANDLECLASS_VALUE(NODE) ???
-
-/* Given a signature of a reference (or array) type, or a method, return the
- corresponding type (if one has been allocated).
- Do not use for primitive types, since they may be ambiguous.
- (E.g. is "I" a signature or a class name?) */
-#define IDENTIFIER_SIGNATURE_TYPE(NODE) IDENTIFIER_GLOBAL_VALUE(NODE)
-
-/* If non-NULL: An ADDR_REF to a VAR_DECL that contains
- the Utf8Const representation of the identifier. */
-#define IDENTIFIER_UTF8_REF(NODE) \
- (((struct lang_identifier *)(NODE))->utf8_ref)
-
-#define IDENTIFIER_UTF8_DECL(NODE) \
- TREE_OPERAND((((struct lang_identifier *)(NODE))->utf8_ref), 0)
-
-/* For a FUNCTION_DECL, if we are compiling a .class file, then this is
- the position in the .class file of the method code.
- Specifically, this is the code itself, not the code attribute. */
-#define DECL_CODE_OFFSET(DECL) (DECL_LANG_SPECIFIC(DECL)->code_offset)
-/* Similarly, the length of the bytecode. */
-#define DECL_CODE_LENGTH(DECL) (DECL_LANG_SPECIFIC(DECL)->code_length)
-/* Similarly, the position of the LineNumberTable attribute. */
-#define DECL_LINENUMBERS_OFFSET(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->linenumbers_offset)
-/* Similarly, the position of the LocalVariableTable attribute
- (following the standard attribute header). */
-#define DECL_LOCALVARIABLES_OFFSET(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->localvariables_offset)
-
-#define DECL_MAX_LOCALS(DECL) (DECL_LANG_SPECIFIC(DECL)->max_locals)
-#define DECL_MAX_STACK(DECL) (DECL_LANG_SPECIFIC(DECL)->max_stack)
-/* Number of local variable slots needed for the arguments of this function. */
-#define DECL_ARG_SLOT_COUNT(DECL) (DECL_LANG_SPECIFIC(DECL)->arg_slot_count)
-/* List of checked thrown exceptions, as specified with the `throws'
- keyword */
-#define DECL_FUNCTION_THROWS(DECL) (DECL_LANG_SPECIFIC(DECL)->throws_list)
-/* List of other constructors of the same class that this constructor
- calls */
-#define DECL_CONSTRUCTOR_CALLS(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->called_constructor)
-/* Pointer to the function's current's COMPOUND_EXPR tree (while
- completing its body) or the function's block */
-#define DECL_FUNCTION_BODY(DECL) (DECL_LANG_SPECIFIC(DECL)->function_decl_body)
-/* How specific the function is (for method selection - Java source
- code front-end */
-#define DECL_SPECIFIC_COUNT(DECL) DECL_ARG_SLOT_COUNT(DECL)
-
-/* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
-#define LABEL_TYPE_STATE(NODE) (DECL_INITIAL (NODE))
-
-/* In the label of a subroutine, a dummy label that records the
- state following a merge of all the ret instructions in this subroutine. */
-#define LABEL_RETURN_LABEL(DECL) DECL_ARGUMENTS(DECL)
-
-/* In the label of a sub-routine, records the type state at return.
- * A local may be TYPE_UNUSED, which means that the local is not
- * used (stored to or loaded from) in this subroutine - at least for
- * code that we have verified so far. */
-#define LABEL_RETURN_TYPE_STATE(NODE) LABEL_TYPE_STATE (LABEL_RETURN_LABEL (NODE))
-
-/* In a TREE_VEC for a LABEL_RETURN_TYPE_STATE, notes that
- TREE_VEC_LENGTH has been adjust to the correct stack size. */
-#define RETURN_MAP_ADJUSTED(NODE) TREE_LANG_FLAG_2(NODE)
-
-/* In the label of a sub-routine, a chain of the return location labels. */
-#define LABEL_RETURN_LABELS(node) DECL_RESULT (LABEL_RETURN_LABEL(node))
-
-/* In a LABEL_DECL, the next pending label.
- See pending_blocks in expr.c. */
-#define LABEL_PENDING_CHAIN(NODE) DECL_RESULT(NODE)
-
-/* In a LABEL_DECL, the corresponding bytecode program counter. */
-#define LABEL_PC(NODE) ((NODE)->decl.saved_insns.i)
-
-/* Used during verification to mark the label has "changed". (See JVM Spec). */
-#define LABEL_CHANGED(NODE) DECL_LANG_FLAG_6(NODE)
-
-/* In a LABEL_DECL, true if we have verified instructions starting here. */
-#define LABEL_VERIFIED(NODE) (instruction_bits[LABEL_PC(NODE)]&BCODE_VERIFIED)
-
-/* True if this code is within a subroutine (target of a jsr). */
-#define LABEL_IN_SUBR(NODE) DECL_LANG_FLAG_4(NODE)
-/* True if this code is the start of a subroutine (target of a jsr). */
-#define LABEL_IS_SUBR_START(NODE) DECL_LANG_FLAG_5(NODE)
-
-/* In a LABEL_DECL, if LABEL_IN_SUBR(NODE), points to start of subroutine. */
-#define LABEL_SUBR_START(NODE) DECL_ABSTRACT_ORIGIN(NODE)
-
-/* In a LABEL_DECL that has LABEL_IS_SUBR_START, this points to the start
- of surrounding subroutine in the case of a nested subroutine,
- and NULL_TREE otherwise. */
-#define LABEL_SUBR_CONTEXT(NODE) DECL_CONTEXT (LABEL_RETURN_LABEL (NODE))
-
-/* The slot number for this local variable. */
-#define DECL_LOCAL_SLOT_NUMBER(NODE) \
- (((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->slot_number)
-/* The start (bytecode) pc for the valid range of this local variable. */
-#define DECL_LOCAL_START_PC(NODE) \
- (((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->start_pc)
-/* The end (bytecode) pc for the valid range of this local variable. */
-#define DECL_LOCAL_END_PC(NODE) \
- (((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->end_pc)
-/* For a VAR_DECLor PARM_DECL, used to chain decls with the same
- slot_number in decl_map. */
-#define DECL_LOCAL_SLOT_CHAIN(NODE) \
- (((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->slot_chain)
-
-/* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
-struct lang_decl
-{
- /* tree chain; not yet used. */
- long code_offset;
- int code_length;
- long linenumbers_offset;
- long localvariables_offset;
- int arg_slots;
- int max_locals, max_stack, arg_slot_count;
- tree throws_list; /* Exception specified by `throws' */
- tree function_decl_body; /* Hold all function's statements */
- tree called_constructor; /* When decl is a constructor, the
- list of other constructor it calls. */
-};
-
-/* DECL_LANG_SPECIFIC for VAR_DECL and PARM_DECL. */
-struct lang_decl_var
-{
- int slot_number;
- int start_pc;
- int end_pc;
- tree slot_chain;
-};
-
-struct lang_type
-{
- tree signature;
- struct JCF *jcf;
-};
-
-#ifdef JAVA_USE_HANDLES
-/* TYPE_BINFO_HANDLE points from a handle-class to its corresponding
- non-handle-class, and vice verse. */
-
-#define BINFO_HANDLE(NODE) TREE_VEC_ELT ((NODE), 6)
-
-/* Given a RECORD_TYPE for a handle type, return the corresponding class. */
-#define HANDLE_TO_CLASS_TYPE(HTYPE) BINFO_HANDLE (TYPE_BINFO (HTYPE))
-
-/* Given a RECORD_TYPE for a class, return the corresponding handle type. */
-#define CLASS_TO_HANDLE_TYPE(TYPE) BINFO_HANDLE (TYPE_BINFO (TYPE))
-#else
-#define HANDLE_TO_CLASS_TYPE(HTYPE) (HTYPE)
-#define CLASS_TO_HANDLE_TYPE(TYPE) (TYPE)
-#endif
-
-#define JCF_u4 unsigned long
-#define JCF_u2 unsigned short
-
-extern tree lookup_class PROTO ((tree));
-extern tree lookup_java_constructor PROTO ((tree, tree));
-extern tree lookup_java_method PROTO ((tree, tree, tree));
-extern tree lookup_argument_method PROTO ((tree, tree, tree));
-extern tree promote_type PROTO ((tree));
-extern tree get_constant PROTO ((struct JCF*, int));
-extern tree get_name_constant PROTO ((struct JCF*, int));
-extern tree get_class_constant PROTO ((struct JCF*, int));
-extern tree parse_signature PROTO ((struct JCF *jcf, int sig_index));
-extern void jcf_parse PROTO ((struct JCF*));
-extern tree add_field PROTO ((tree, tree, tree, int));
-extern tree add_method PROTO ((tree, int, tree, tree));
-extern tree add_method_1 PROTO ((tree, int, tree, tree));
-extern tree make_class PROTO ((void));
-extern tree push_class PROTO ((tree, tree));
-extern tree unmangle_classname PROTO ((const char *name, int name_length));
-extern tree parse_signature_string PROTO ((const unsigned char *, int));
-extern tree get_type_from_signature PROTO ((tree));
-extern void layout_class PROTO ((tree));
-extern tree layout_class_method PROTO ((tree, tree, tree, tree));
-extern void layout_class_methods PROTO ((tree));
-extern tree build_class_ref PROTO ((tree));
-extern tree build_dtable_decl PROTO ((tree));
-extern tree build_internal_class_name PROTO ((tree));
-extern tree build_constants_constructor PROTO ((void));
-extern tree build_ref_from_constant_pool PROTO ((int));
-extern tree build_utf8_ref PROTO ((tree));
-extern tree ident_subst PROTO ((const char*, int,
- const char*, int, int, const char*));
-extern tree identifier_subst PROTO ((const tree,
- const char *, int, int, const char *));
-extern tree build_java_signature PROTO ((tree));
-extern tree build_java_argument_signature PROTO ((tree));
-extern void set_java_signature PROTO ((tree, tree));
-extern tree build_static_field_ref PROTO ((tree));
-extern tree build_address_of PROTO ((tree));
-extern tree find_local_variable PROTO ((int index, tree type, int pc));
-extern tree find_stack_slot PROTO ((int index, tree type));
-extern tree build_prim_array_type PROTO ((tree, HOST_WIDE_INT));
-extern tree build_java_array_type PROTO ((tree, HOST_WIDE_INT));
-extern int is_compiled_class PROTO ((tree));
-extern tree mangled_classname PROTO ((const char*, tree));
-extern tree lookup_label PROTO ((int));
-extern tree pop_type_0 PROTO ((tree));
-extern tree pop_type PROTO ((tree));
-extern void pop_argument_types PROTO ((tree));
-extern tree decode_newarray_type PROTO ((int));
-extern tree lookup_field PROTO ((tree*, tree));
-extern int is_array_type_p PROTO ((tree));
-extern HOST_WIDE_INT java_array_type_length PROTO ((tree));
-extern int read_class PROTO ((tree));
-extern void load_class PROTO ((tree, int));
-
-extern tree lookup_name PROTO ((tree));
-extern tree build_known_method_ref PROTO ((tree, tree, tree, tree, tree));
-extern tree build_class_init PROTO ((tree, tree));
-extern tree build_invokevirtual PROTO ((tree, tree));
-extern tree build_invokeinterface PROTO ((tree, tree, tree));
-extern tree invoke_build_dtable PROTO ((int, tree));
-extern tree build_field_ref PROTO ((tree, tree, tree));
-extern void pushdecl_force_head PROTO ((tree));
-extern tree build_java_binop PROTO ((enum tree_code, tree, tree, tree));
-extern tree binary_numeric_promotion PROTO ((tree, tree, tree *, tree *));
-extern tree build_java_arrayaccess PROTO ((tree, tree, tree));
-extern tree build_newarray PROTO ((int, tree));
-extern tree build_anewarray PROTO ((tree, tree));
-extern tree build_new_array PROTO ((tree, tree));
-extern tree build_java_array_length_access PROTO ((tree));
-extern tree build_java_arraynull_check PROTO ((tree, tree, tree));
-extern tree create_label_decl PROTO ((tree));
-extern void push_labeled_block PROTO ((tree));
-extern tree prepare_eh_table_type PROTO ((tree));
-extern void java_set_exception_lang_code PROTO ((void));
-extern tree generate_name PROTO ((void));
-extern void pop_labeled_block PROTO ((void));
-extern char *lang_printable_name PROTO ((tree, int));
-extern tree maybe_add_interface PROTO ((tree, tree));
-extern void set_super_info PROTO ((int, tree, tree, int));
-extern int get_access_flags_from_decl PROTO ((tree));
-extern int interface_of_p PROTO ((tree, tree));
-extern int inherits_from_p PROTO ((tree, tree));
-extern void complete_start_java_method PROTO ((tree));
-extern tree build_result_decl PROTO ((tree));
-extern void emit_handlers PROTO ((void));
-extern void init_outgoing_cpool PROTO ((void));
-extern void make_class_data PROTO ((tree));
-extern void register_class PROTO ((void));
-extern int alloc_name_constant PROTO ((int, tree));
-extern void emit_register_classes PROTO ((void));
-extern void lang_init_source PROTO ((int));
-extern void write_classfile PROTO ((tree));
-extern char *print_int_node PROTO ((tree));
-extern void parse_error_context PVPROTO ((tree cl, const char *, ...))
- ATTRIBUTE_PRINTF_2;
-extern tree build_primtype_type_ref PROTO ((char *));
-extern tree java_get_real_method_name PROTO ((tree));
-extern void finish_class PROTO ((tree));
-extern void java_layout_seen_class_methods PROTO ((void));
-extern void check_for_initialization PROTO ((tree));
-
-extern tree pushdecl_top_level PROTO ((tree));
-extern int alloc_class_constant PROTO ((tree));
-extern int unicode_mangling_length PROTO ((const char *, int));
-extern void init_expr_processing PROTO ((void));
-extern void push_super_field PROTO ((tree, tree));
-extern void init_class_processing PROTO ((void));
-extern int can_widen_reference_to PROTO ((tree, tree));
-extern int class_depth PROTO ((tree));
-extern int verify_jvm_instructions PROTO ((struct JCF *, unsigned char *, long));
-extern void maybe_pushlevels PROTO ((int));
-extern void maybe_poplevels PROTO ((int));
-extern int process_jvm_instruction PROTO ((int, unsigned char *, long));
-extern void set_local_type PROTO ((int, tree));
-extern int merge_type_state PROTO ((tree));
-extern void push_type PROTO ((tree));
-extern void load_type_state PROTO ((tree));
-extern void add_interface PROTO ((tree, tree));
-extern void append_gpp_mangled_name PROTO ((struct obstack *, const char *, int));
-extern void append_gpp_mangled_classtype PROTO ((struct obstack *, const char *));
-extern void emit_unicode_mangled_name PROTO ((struct obstack *, const char *, int));
-extern tree force_evaluation_order PROTO ((tree));
-extern int verify_constant_pool PROTO ((struct JCF *));
-extern void start_java_method PROTO ((tree));
-extern void end_java_method PROTO ((void));
-extern void give_name_to_locals PROTO ((struct JCF *));
-extern void expand_byte_code PROTO ((struct JCF *, tree));
-extern int open_in_zip PROTO ((struct JCF *, const char *, const char *, int));
-extern void set_constant_value PROTO ((tree, tree));
-#ifdef jword
-extern int find_constant1 PROTO ((struct CPool *, int, jword));
-extern int find_constant2 PROTO ((struct CPool *, int, jword, jword));
-#endif
-extern int find_utf8_constant PROTO ((struct CPool *, tree));
-extern int find_string_constant PROTO ((struct CPool *, tree));
-extern int find_class_constant PROTO ((struct CPool *, tree));
-extern int find_fieldref_index PROTO ((struct CPool *, tree));
-extern int find_methodref_index PROTO ((struct CPool *, tree));
-extern void write_constant_pool PROTO ((struct CPool *, unsigned char *, int));
-extern int count_constant_pool_bytes PROTO ((struct CPool *));
-extern int encode_newarray_type PROTO ((tree));
-#ifdef uint64
-extern void format_int PROTO ((char *, jlong, int));
-extern void format_uint PROTO ((char *, uint64, int));
-#endif
-extern void jcf_trim_old_input PROTO ((struct JCF *));
-#ifdef BUFSIZ
-extern void jcf_print_utf8 PROTO ((FILE *, const unsigned char *, int));
-extern void jcf_print_char PROTO ((FILE *, int));
-extern void jcf_print_utf8_replace PROTO ((FILE *, const unsigned char *,
- int, int, int));
-# if JCF_USE_STDIO
-extern char* open_class PROTO ((char *, struct JCF *, FILE *, const char *));
-# else
-extern char* open_class PROTO ((char *, struct JCF *, int, const char *));
-# endif /* JCF_USE_STDIO */
-#endif
-
-/* Access flags etc for a method (a FUNCTION_DECL): */
-
-#define METHOD_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
-#define METHOD_PRIVATE(DECL) TREE_PRIVATE (DECL)
-#define METHOD_PROTECTED(DECL) TREE_PROTECTED (DECL)
-#define METHOD_STATIC(DECL) DECL_LANG_FLAG_2 (DECL)
-#define METHOD_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
-#define METHOD_SYNCHRONIZED(DECL) DECL_LANG_FLAG_4 (DECL)
-#define METHOD_NATIVE(DECL) DECL_EXTERNAL(DECL)
-#define METHOD_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
-#define METHOD_TRANSIENT(DECL) DECL_LANG_FLAG_6 (DECL)
-
-#define DECL_CONSTRUCTOR_P(DECL) DECL_LANG_FLAG_7(DECL)
-
-/* Access flags etc for a variable/field (a FIELD_DECL): */
-
-#define FIELD_PRIVATE(DECL) TREE_PRIVATE (DECL)
-#define FIELD_PROTECTED(DECL) TREE_PROTECTED (DECL)
-#define FIELD_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
-#define FIELD_STATIC(DECL) TREE_STATIC (DECL)
-#define FIELD_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
-#define FIELD_VOLATILE(DECL) DECL_LANG_FLAG_4 (DECL)
-#define FIELD_TRANSIENT(DECL) DECL_LANG_FLAG_5 (DECL)
-
-/* Access flags etc for a class (a TYPE_DECL): */
-
-#define CLASS_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
-#define CLASS_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
-#define CLASS_INTERFACE(DECL) DECL_LANG_FLAG_4 (DECL)
-#define CLASS_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
-#define CLASS_SUPER(DECL) DECL_LANG_FLAG_6 (DECL)
-
-/* @deprecated marker flag on methods, fields and classes */
-
-#define METHOD_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
-#define FIELD_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
-#define CLASS_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
-#define DECL_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
-
-/* The number of virtual methods in this class's dispatch table.
- Does not include initial two dummy entries (one points to the
- Class object, and the other is for G++ -fvtable-thunks compatibility). */
-#define TYPE_NVIRTUALS(TYPE) TYPE_BINFO_VIRTUALS (TYPE)
-
-/* A TREE_VEC (indexed by DECL_VINDEX) containing this class's
- virtual methods. */
-#define TYPE_VTABLE(TYPE) TYPE_BINFO_VTABLE(TYPE)
-
-/* Use CLASS_LOADED_P? FIXME */
-#define CLASS_COMPLETE_P(DECL) DECL_LANG_FLAG_2 (DECL)
-
-/* This maps a bytecode offset (PC) to various flags,
- listed below (starting with BCODE_). */
-extern char *instruction_bits;
-
-/* True iff the byte is the start of an instruction. */
-#define BCODE_INSTRUCTION_START 1
-
-/* True iff there is a jump to this location. */
-#define BCODE_JUMP_TARGET 2
-
-/* True iff there is a return to this location.
- (I.e. the preceedng instruction was a call.) */
-#define BCODE_RETURN_TARGET 4
-
-/* True iff this is the start of an exception handler. */
-#define BCODE_EXCEPTION_TARGET 16
-
-/* True iff there is a jump to this location (and it needs a label). */
-#define BCODE_TARGET \
- (BCODE_JUMP_TARGET|BCODE_RETURN_TARGET \
- | BCODE_EXCEPTION_TARGET)
-
-/* True iff there is an entry in the linenumber table for this location. */
-#define BCODE_HAS_LINENUMBER 32
-
-/* True iff there is more than one entry in the linenumber table for
- this location. (This probably does not make much sense.) */
-#define BCODE_HAS_MULTI_LINENUMBERS 64
-
-/* True if this instruction has been verified. */
-#define BCODE_VERIFIED 8
-
-/* A pointer to the line number table of the current method. */
-extern unsigned char *linenumber_table;
-/* The length (in items) of the line number table. */
-extern int linenumber_count;
-
-/* In type_map, means that slot is uninitialized or otherwise unusable. */
-#define TYPE_UNKNOWN NULL_TREE
-
-/* In type_map, means the second half of a 64-bit double or long. */
-#define TYPE_SECOND void_type_node
-
-/* In type_map, means the null type (i.e. type of a null reference). */
-#define TYPE_NULL ptr_type_node
-
-/* 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
-
-/* 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. */
-extern tree *type_map;
-
-/* Map a stack index to the type currently in that slot. */
-#define stack_type_map (type_map+DECL_MAX_LOCALS(current_function_decl))
-
-/* True iff TYPE takes two variable/stack slots. */
-#define TYPE_IS_WIDE(TYPE) \
- ((TYPE) == double_type_node || (TYPE) == long_type_node)
-
-/* True iff TYPE is a Java array type. */
-#define TYPE_ARRAY_P(TYPE) TYPE_LANG_FLAG_1 (TYPE)
-
-/* If FUNCTION_TYPE or METHOD_TYPE: cache for build_java_argument_signature. */
-#define TYPE_ARGUMENT_SIGNATURE(TYPE) TYPE_VFIELD(TYPE)
-
-/* Given an array type, give the type of the elements. */
-/* FIXME this use of TREE_TYPE conflicts with something or other. */
-#define TYPE_ARRAY_ELEMENT(ATYPE) TREE_TYPE(ATYPE)
-
-/* True if class TYPE has been loaded. */
-#define CLASS_LOADED_P(TYPE) TYPE_LANG_FLAG_2 (TYPE)
-
-/* True if class TYPE was defined in Java source code. */
-#define CLASS_FROM_SOURCE_P(TYPE) TYPE_LANG_FLAG_3 (TYPE)
-
-/* True of a RECORD_TYPE of a class/interface type (not array type) */
-#define CLASS_P(TYPE) TYPE_LANG_FLAG_4 (TYPE)
-
-/* True if class TYPE was defined in a Java source file compiled. */
-#define CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P(TYPE) \
- TYPE_LANG_FLAG_5 (TYPE)
-
-/* True if class TYPE has a field initializer $finit$ function */
-#define CLASS_HAS_FINIT_P(TYPE) TYPE_LANG_FLAG_6 (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 (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)
-
-/* 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 (EXPR)
-
-/* True if EXPR (a WFL in that case) resolves into an expression name */
-#define RESOLVE_EXPRESSION_NAME_P(WFL) TREE_LANG_FLAG_0 (WFL)
-
-/* True if EXPR (a LOOP_EXPR in that case) is part of a for statement */
-#define IS_FOR_LOOP_P(EXPR) TREE_LANG_FLAG_0 (EXPR)
-
-/* True if EXPR (a WFL in that case) resolves into a package name */
-#define RESOLVE_PACKAGE_NAME_P(WFL) TREE_LANG_FLAG_3 (WFL)
-
-/* True if EXPR (a WFL in that case) resolves into a type name */
-#define RESOLVE_TYPE_NAME_P(WFL) TREE_LANG_FLAG_4 (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)
-
-/* If set in CALL_EXPR, the receiver is 'super'. */
-#define CALL_USING_SUPER(EXPR) TREE_LANG_FLAG_4 (EXPR)
-
-/* True if NODE (a statement) can complete normally. */
-#define CAN_COMPLETE_NORMALLY(NODE) TREE_LANG_FLAG_6(NODE)
-
-/* Add a FIELD_DECL to RECORD_TYPE RTYPE.
- The field has name NAME (a char*), and type FTYPE.
- Unless this is the first field, FIELD most hold the previous field.
- FIELD is set to the newly created FIELD_DECL.
-
- We set DECL_ARTIFICIAL so these fields get skipped by make_class_data
- if compiling java.lang.Object or java.lang.Class. */
-
-#define PUSH_FIELD(RTYPE, FIELD, NAME, FTYPE) \
-{ tree tmp_field = build_decl (FIELD_DECL, get_identifier(NAME), FTYPE); \
- if (TYPE_FIELDS (RTYPE) == NULL_TREE) TYPE_FIELDS (RTYPE) = tmp_field; \
- else TREE_CHAIN(FIELD) = tmp_field; \
- DECL_CONTEXT (tmp_field) = RTYPE; \
- DECL_ARTIFICIAL (tmp_field) = 1; \
- FIELD = tmp_field; }
-
-#define FINISH_RECORD(RTYPE) layout_type (RTYPE)
-
-/* Start building a RECORD_TYPE constructor with a given TYPE in CONS. */
-#define START_RECORD_CONSTRUCTOR(CONS, CTYPE) { \
- CONS = build (CONSTRUCTOR, CTYPE, NULL_TREE, NULL_TREE);\
- TREE_CHAIN(CONS) = TYPE_FIELDS (CTYPE); }
-
-/* Append a field initializer to CONS for the dummy field for the inherited
- fields. The dummy field has the given VALUE, and the same type as the
- super-class. Must be specified before calls to PUSH_FIELD_VALUE. */
-
-#define PUSH_SUPER_VALUE(CONS, VALUE) {\
- tree field = TREE_CHAIN(CONS);\
- if (DECL_NAME (field) != NULL_TREE) abort();\
- CONSTRUCTOR_ELTS(CONS) = tree_cons (field, VALUE, CONSTRUCTOR_ELTS(CONS));\
- TREE_CHAIN(CONS) = TREE_CHAIN (field); }
-
-/* Append a field initializer to CONS for a field with the given VALUE.
- NAME is a char* string used for error checking;
- the initializer must be specified in order. */
-#define PUSH_FIELD_VALUE(CONS, NAME, VALUE) {\
- tree field = TREE_CHAIN(CONS);\
- if (strcmp (IDENTIFIER_POINTER (DECL_NAME (field)), NAME) != 0) abort();\
- CONSTRUCTOR_ELTS(CONS) = tree_cons (field, VALUE, CONSTRUCTOR_ELTS(CONS));\
- TREE_CHAIN(CONS) = TREE_CHAIN (field); }
-
-/* Finish creating a record CONSTRUCTOR CONS. */
-#define FINISH_RECORD_CONSTRUCTOR(CONS) \
- CONSTRUCTOR_ELTS(CONS) = nreverse (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 ((NODE), 0)
-#define FINALLY_EXPR_BLOCK(NODE) TREE_OPERAND ((NODE), 1)
-
-#define BLOCK_EXPR_DECLS(NODE) BLOCK_VARS(NODE)
-#define BLOCK_EXPR_BODY(NODE) BLOCK_SUBBLOCKS(NODE)
-
-#define BUILD_MONITOR_ENTER(WHERE, ARG) \
- { \
- (WHERE) = build (CALL_EXPR, int_type_node, \
- build_address_of (soft_monitorenter_node), \
- build_tree_list (NULL_TREE, (ARG)), \
- NULL_TREE); \
- TREE_SIDE_EFFECTS (WHERE) = 1; \
- }
-
-#define BUILD_MONITOR_EXIT(WHERE, ARG) \
- { \
- (WHERE) = build (CALL_EXPR, int_type_node, \
- build_address_of (soft_monitorexit_node), \
- build_tree_list (NULL_TREE, (ARG)), \
- NULL_TREE); \
- TREE_SIDE_EFFECTS (WHERE) = 1; \
- }
-
-/* Non zero 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))
-
-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; \
- }
diff --git a/gnu/dist/toolchain/gcc/java/javaop.def b/gnu/dist/toolchain/gcc/java/javaop.def
deleted file mode 100644
index a722a8b69f9..00000000000
--- a/gnu/dist/toolchain/gcc/java/javaop.def
+++ /dev/null
@@ -1,314 +0,0 @@
-/* Table of opcodes for byte codes defined by the Java(TM) virtual
- machine specification.
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc.
-
-Written by Per Bothner <bothner@cygnus.com>, February 1996.
-*/
-
-/* JAVAOP (OPNAME, OPCODE, OPKIND, OPERAND_TYPE, OPERAND_VALUE), where:
- OPNAME is the name of the opcode.
- OPCODE is the 1-byte opcode value.
- OPKIND is the kind of operation.
- OPERAND_TYPE is the type operands affected.
- OPERAND_VALUE tells where to get the value. (Its meaning
- depends on OPKIND.) */
-
-/* Various macro used in OPERAND_VALUE:
-IMMEDIATE_s1: An immediate signed 1-byte value in the byte-code stream.
-IMMEDIATE_s2: An immediate signed 2-byte value in the byte-code stream.
-IMMEDIATE_u1: An immediate unsigned 1-byte value in the byte-code stream.
-IMMEDIATE_u2: An immediate unsigned 2-byte value in the byte-code stream.
-
-CONST_INDEX_1: An immediate unsigned 1-byte index into the constant pool.
-CONST_INDEX_2: An immediate unsigned 2-byte index into the constant pool.
-*/
-
-/* More specifically, this is the meaning of the various OPKINDs:
-
-BINOP: binary operation
- OPERAND_TYPE is the argument type.
- OPERAND_VALUE is PLUS, MINUS, MULT, TRUNC_DIV, RDIV, REM,
- LSHIFT, RSHIFT, URSHIFT, BIT_AND, BIT_IOR, BIT_XOR,
- COMPARE, COMPARE_L, or COMPARE_G.
-
-UNOP: unary operation
- OPERAND_TYPE is the argument type.
- OPERAND_VALUE is NEG.
-
-INVOKE: invoke operations
- OPERAND_TYPE is VIRTUAL, SPECIAL, STATIC, or INTERFACE.
- OPERAND_VALUE is 1 if interface, 0 otherwise.
-
-OBJECT: new, checkcast, instanceof
- OPERAND_TYPE is PTR.
- OPERAND_VALUE is NEW, CHECKCAST, or INSTANCEOF.
-
-BRANCH: branch operations
- OPERAND_TYPE is GOTO, CALL, or RETURN.
- OPERAND_VALUE is IMMEDIATE_s2, VAR_INDEX_1, IMMEDIATE_s4,
- or VAR_INDEX_2.
-
-STACK: Various stack operations.
-
-PUSHC: Push a constant onto the operand stack.
- OPERAND_VALUE maybe be the value to push,
- or IMMEDIATE_s1 or IMMEDIATE_s2 if the constant is immediate,
- or CONST_INDEX_1 or CONST_INDEX_2 for a constant pool index.
-
-LOAD: Push a value from a local variable onto the operand stack.
- OPERAND_VALUE is the index of the local variable in the current
- Java frame. It can be a literal, or IMMEDIATE_i2.
-
-CONVERT: Convert top of stack value from one type to another.
- OPERAND_TYPE is the argument type.
- OPERAND_VALUE is the result type.
-
-TEST: Compares an integer (popped from the stack) against zero.
- If the test (in OPERAND_VALUE) is true, goto a relative
- offset given by the next two bytes.
-
-COND: Compares two values (popped from the stack) againt each other.
- If the test (in OPERAND_VALUE) is true, goto a relative
- offset given by the next two bytes.
-
-SWITCH:
- OPERAND_VALUE is either TABLE or LOOKUP.
-
-ARRAY:
- OPERAND_VALUE is LOAD, STORE, LENGTH, or NEW.
-
-FIELD: Extracts from or stores into a field.
- OPERAND_TYPE is 1 for a static field, 0 for a regular field.
- OPERAND_VALUE is 1 for a put operation, 0 for a get operation.
-
-SPECIAL:
- Random bunch of opcodes.
-
-*/
-
-JAVAOP (nop, 0, STACK, POP, 0)
-JAVAOP (aconst_null, 1, PUSHC, PTR, 0)
-JAVAOP (iconst_m1, 2, PUSHC, INT, -1)
-JAVAOP (iconst_0, 3, PUSHC, INT, 0)
-JAVAOP (iconst_1, 4, PUSHC, INT, 1)
-JAVAOP (iconst_2, 5, PUSHC, INT, 2)
-JAVAOP (iconst_3, 6, PUSHC, INT, 3)
-JAVAOP (iconst_4, 7, PUSHC, INT, 4)
-JAVAOP (iconst_5, 8, PUSHC, INT, 5)
-JAVAOP (lconst_0, 9, PUSHC, LONG, 0)
-JAVAOP (lconst_1, 10, PUSHC, LONG, 1)
-JAVAOP (fconst_0, 11, PUSHC, FLOAT, 0)
-JAVAOP (fconst_1, 12, PUSHC, FLOAT, 1)
-JAVAOP (fconst_2, 13, PUSHC, FLOAT, 2)
-JAVAOP (dconst_0, 14, PUSHC, DOUBLE, 0)
-JAVAOP (dconst_1, 15, PUSHC, DOUBLE, 1)
-JAVAOP (bipush, 16, PUSHC, INT, IMMEDIATE_s1)
-JAVAOP (sipush, 17, PUSHC, INT, IMMEDIATE_s2)
-JAVAOP (ldc, 18, PUSHC, INT, CONST_INDEX_1)
-JAVAOP (ldc_w, 19, PUSHC, INT, CONST_INDEX_2)
-JAVAOP (ldc2_w, 20, PUSHC, LONG, CONST_INDEX_2)
-JAVAOP (iload, 21, LOAD, INT, IMMEDIATE_u1)
-JAVAOP (lload, 22, LOAD, LONG, IMMEDIATE_u1)
-JAVAOP (fload, 23, LOAD, FLOAT, IMMEDIATE_u1)
-JAVAOP (dload, 24, LOAD, DOUBLE, IMMEDIATE_u1)
-JAVAOP (aload, 25, LOAD, PTR, IMMEDIATE_u1)
-JAVAOP (iload_0, 26, LOAD, INT, 0)
-JAVAOP (iload_1, 27, LOAD, INT, 1)
-JAVAOP (iload_2, 28, LOAD, INT, 2)
-JAVAOP (iload_3, 29, LOAD, INT, 3)
-JAVAOP (lload_0, 30, LOAD, LONG, 0)
-JAVAOP (lload_1, 31, LOAD, LONG, 1)
-JAVAOP (lload_2, 32, LOAD, LONG, 2)
-JAVAOP (lload_3, 33, LOAD, LONG, 3)
-JAVAOP (fload_0, 34, LOAD, FLOAT, 0)
-JAVAOP (fload_1, 35, LOAD, FLOAT, 1)
-JAVAOP (fload_2, 36, LOAD, FLOAT, 2)
-JAVAOP (fload_3, 37, LOAD, FLOAT, 3)
-JAVAOP (dload_0, 38, LOAD, DOUBLE, 0)
-JAVAOP (dload_1, 39, LOAD, DOUBLE, 1)
-JAVAOP (dload_2, 40, LOAD, DOUBLE, 2)
-JAVAOP (dload_3, 41, LOAD, DOUBLE, 3)
-JAVAOP (aload_0, 42, LOAD, PTR, 0)
-JAVAOP (aload_1, 43, LOAD, PTR, 1)
-JAVAOP (aload_2, 44, LOAD, PTR, 2)
-JAVAOP (aload_3, 45, LOAD, PTR, 3)
-JAVAOP (iaload, 46, ARRAY, INT, LOAD)
-JAVAOP (laload, 47, ARRAY, LONG, LOAD)
-JAVAOP (faload, 48, ARRAY, FLOAT, LOAD)
-JAVAOP (daload, 49, ARRAY, DOUBLE, LOAD)
-JAVAOP (aaload, 50, ARRAY, PTR, LOAD)
-JAVAOP (baload, 51, ARRAY, BYTE, LOAD)
-JAVAOP (caload, 52, ARRAY, CHAR, LOAD)
-JAVAOP (saload, 53, ARRAY, SHORT, LOAD)
-JAVAOP (istore, 54, STORE, INT, IMMEDIATE_u1)
-JAVAOP (lstore, 55, STORE, LONG, IMMEDIATE_u1)
-JAVAOP (fstore, 56, STORE, FLOAT, IMMEDIATE_u1)
-JAVAOP (dstore, 57, STORE, DOUBLE, IMMEDIATE_u1)
-JAVAOP (astore, 58, STORE, PTR, IMMEDIATE_u1)
-JAVAOP (istore_0, 59, STORE, INT, 0)
-JAVAOP (istore_1, 60, STORE, INT, 1)
-JAVAOP (istore_2, 61, STORE, INT, 2)
-JAVAOP (istore_3, 62, STORE, INT, 3)
-JAVAOP (lstore_0, 63, STORE, LONG, 0)
-JAVAOP (lstore_1, 64, STORE, LONG, 1)
-JAVAOP (lstore_2, 65, STORE, LONG, 2)
-JAVAOP (lstore_3, 66, STORE, LONG, 3)
-JAVAOP (fstore_0, 67, STORE, FLOAT, 0)
-JAVAOP (fstore_1, 68, STORE, FLOAT, 1)
-JAVAOP (fstore_2, 69, STORE, FLOAT, 2)
-JAVAOP (fstore_3, 70, STORE, FLOAT, 3)
-JAVAOP (dstore_0, 71, STORE, DOUBLE, 0)
-JAVAOP (dstore_1, 72, STORE, DOUBLE, 1)
-JAVAOP (dstore_2, 73, STORE, DOUBLE, 2)
-JAVAOP (dstore_3, 74, STORE, DOUBLE, 3)
-JAVAOP (astore_0, 75, STORE, PTR, 0)
-JAVAOP (astore_1, 76, STORE, PTR, 1)
-JAVAOP (astore_2, 77, STORE, PTR, 2)
-JAVAOP (astore_3, 78, STORE, PTR, 3)
-JAVAOP (iastore, 79, ARRAY, INT, STORE)
-JAVAOP (lastore, 80, ARRAY, LONG, STORE)
-JAVAOP (fastore, 81, ARRAY, FLOAT, STORE)
-JAVAOP (dastore, 82, ARRAY, DOUBLE, STORE)
-JAVAOP (aastore, 83, ARRAY, PTR, STORE)
-JAVAOP (bastore, 84, ARRAY, BYTE, STORE)
-JAVAOP (castore, 85, ARRAY, CHAR, STORE)
-JAVAOP (sastore, 86, ARRAY, SHORT, STORE)
-JAVAOP (pop, 87, STACK, POP, 1)
-JAVAOP (pop2, 88, STACK, POP, 2)
-JAVAOP (dup, 89, STACK, DUP, 1)
-JAVAOP (dup_x1, 90, STACK, DUPx1, 1)
-JAVAOP (dup_x2, 91, STACK, DUPx2, 1)
-JAVAOP (dup2, 92, STACK, DUP, 2)
-JAVAOP (dup2_x1, 93, STACK, DUPx1, 2)
-JAVAOP (dup2_x2, 94, STACK, DUPx2, 2)
-JAVAOP (swap, 95, STACK, SWAP, 0)
-JAVAOP (iadd, 96, BINOP, INT, PLUS)
-JAVAOP (ladd, 97, BINOP, LONG, PLUS)
-JAVAOP (fadd, 98, BINOP, FLOAT, PLUS)
-JAVAOP (dadd, 99, BINOP, DOUBLE, PLUS)
-JAVAOP (isub, 100, BINOP, INT, MINUS)
-JAVAOP (lsub, 101, BINOP, LONG, MINUS)
-JAVAOP (fsub, 102, BINOP, FLOAT, MINUS)
-JAVAOP (dsub, 103, BINOP, DOUBLE, MINUS)
-JAVAOP (imul, 104, BINOP, INT, MULT)
-JAVAOP (lmul, 105, BINOP, LONG, MULT)
-JAVAOP (fmul, 106, BINOP, FLOAT, MULT)
-JAVAOP (dmul, 107, BINOP, DOUBLE, MULT)
-JAVAOP (idiv, 108, BINOP, INT, TRUNC_DIV)
-JAVAOP (ldiv, 109, BINOP, LONG, TRUNC_DIV)
-JAVAOP (fdiv, 110, BINOP, FLOAT, RDIV)
-JAVAOP (ddiv, 111, BINOP, DOUBLE, RDIV)
-JAVAOP (irem, 112, BINOP, INT, REM)
-JAVAOP (lrem, 113, BINOP, LONG, REM)
-JAVAOP (frem, 114, BINOP, FLOAT, REM)
-JAVAOP (drem, 115, BINOP, DOUBLE, REM)
-JAVAOP (ineg, 116, UNOP, INT, NEG)
-JAVAOP (lneg, 117, UNOP, LONG, NEG)
-JAVAOP (fneg, 118, UNOP, FLOAT, NEG)
-JAVAOP (dneg, 119, UNOP, DOUBLE, NEG)
-JAVAOP (ishl, 120, BINOP, INT, LSHIFT)
-JAVAOP (lshl, 121, BINOP, LONG, LSHIFT)
-JAVAOP (ishr, 122, BINOP, INT, RSHIFT)
-JAVAOP (lshr, 123, BINOP, LONG, RSHIFT)
-JAVAOP (iushr, 124, BINOP, INT, URSHIFT)
-JAVAOP (lushr, 125, BINOP, LONG, URSHIFT)
-JAVAOP (iand, 126, BINOP, INT, BIT_AND)
-JAVAOP (land, 127, BINOP, LONG, BIT_AND)
-JAVAOP (ior, 128, BINOP, INT, BIT_IOR)
-JAVAOP (lor, 129, BINOP, LONG, BIT_IOR)
-JAVAOP (ixor, 130, BINOP, INT, BIT_XOR)
-JAVAOP (lxor, 131, BINOP, LONG, BIT_XOR)
-JAVAOP (iinc, 132, SPECIAL, INT, IINC)
-JAVAOP (i2l, 133, CONVERT, INT, LONG)
-JAVAOP (i2f, 134, CONVERT, INT, FLOAT)
-JAVAOP (i2d, 135, CONVERT, INT, DOUBLE)
-JAVAOP (l2i, 136, CONVERT, LONG, INT)
-JAVAOP (l2f, 137, CONVERT, LONG, FLOAT)
-JAVAOP (l2d, 138, CONVERT, LONG, DOUBLE)
-JAVAOP (f2i, 139, CONVERT, FLOAT, INT)
-JAVAOP (f2l, 140, CONVERT, FLOAT, LONG)
-JAVAOP (f2d, 141, CONVERT, FLOAT, DOUBLE)
-JAVAOP (d2i, 142, CONVERT, DOUBLE, INT)
-JAVAOP (d2l, 143, CONVERT, DOUBLE, LONG)
-JAVAOP (d2f, 144, CONVERT, DOUBLE, FLOAT)
-JAVAOP (i2b, 145, CONVERT2, INT, BYTE)
-JAVAOP (i2c, 146, CONVERT2, INT, CHAR)
-JAVAOP (i2s, 147, CONVERT2, INT, SHORT)
-JAVAOP (lcmp, 148, BINOP, LONG, COMPARE)
-JAVAOP (fcmpl, 149, BINOP, FLOAT, COMPARE_L)
-JAVAOP (fcmpg, 150, BINOP, FLOAT, COMPARE_G)
-JAVAOP (dcmpl, 151, BINOP, DOUBLE, COMPARE_L)
-JAVAOP (dcmpg, 152, BINOP, DOUBLE, COMPARE_G)
-JAVAOP (ifeq, 153, TEST, INT, EQ)
-JAVAOP (ifne, 154, TEST, INT, NE)
-JAVAOP (iflt, 155, TEST, INT, LT)
-JAVAOP (ifge, 156, TEST, INT, GE)
-JAVAOP (ifgt, 157, TEST, INT, GT)
-JAVAOP (ifle, 158, TEST, INT, LE)
-JAVAOP (if_icmpeq, 159, COND, INT, EQ)
-JAVAOP (if_icmpne, 160, COND, INT, NE)
-JAVAOP (if_icmplt, 161, COND, INT, LT)
-JAVAOP (if_icmpge, 162, COND, INT, GE)
-JAVAOP (if_icmpgt, 163, COND, INT, GT)
-JAVAOP (if_icmple, 164, COND, INT, LE)
-JAVAOP (if_acmpeq, 165, COND, PTR, EQ)
-JAVAOP (if_acmpne, 166, COND, PTR, NE)
-JAVAOP (goto, 167, BRANCH, GOTO, IMMEDIATE_s2)
-JAVAOP (jsr, 168, JSR, CALL, IMMEDIATE_s2)
-JAVAOP (ret, 169, RET, RETURN, VAR_INDEX_1)
-JAVAOP (tableswitch, 170, SWITCH, INT, TABLE)
-JAVAOP (lookupswitch, 171, SWITCH, INT, LOOKUP)
-JAVAOP (ireturn, 172, RETURN, INT, 0)
-JAVAOP (lreturn, 173, RETURN, LONG, 0)
-JAVAOP (freturn, 174, RETURN, FLOAT, 0)
-JAVAOP (dreturn, 175, RETURN, DOUBLE, 0)
-JAVAOP (areturn, 176, RETURN, PTR, 0)
-JAVAOP (return, 177, RETURN, VOID, 0)
-JAVAOP (getstatic, 178, FIELD, 1, 0)
-JAVAOP (putstatic, 179, FIELD, 1, 1)
-JAVAOP (getfield, 180, FIELD, 0, 0)
-JAVAOP (putfield, 181, FIELD, 0, 1)
-JAVAOP (invokevirtual, 182, INVOKE, VIRTUAL,0)
-JAVAOP (invokespecial, 183, INVOKE, SPECIAL, 0)
-JAVAOP (invokestatic, 184, INVOKE, STATIC, 0)
-JAVAOP (invokeinterface,185, INVOKE, INTERFACE, 1)
-JAVAOP (new, 187, OBJECT, PTR, NEW)
-JAVAOP (newarray, 188, ARRAY, NUM, NEW)
-JAVAOP (anewarray, 189, ARRAY, PTR, NEW)
-JAVAOP (arraylength, 190, ARRAY, INT, LENGTH)
-JAVAOP (athrow, 191, SPECIAL, ANY, THROW)
-JAVAOP (checkcast, 192, OBJECT, PTR, CHECKCAST)
-JAVAOP (instanceof, 193, OBJECT, PTR, INSTANCEOF)
-JAVAOP (monitorenter, 194, SPECIAL, MONITOR, ENTER)
-JAVAOP (monitorexit, 195, SPECIAL, MONITOR, EXIT)
-JAVAOP (wide, 196, SPECIAL, ANY, WIDE)
-JAVAOP (multianewarray,197, ARRAY, MULTI, NEW)
-JAVAOP (ifnull, 198, TEST, PTR, EQ)
-JAVAOP (ifnonnull, 199, TEST, PTR, NE)
-JAVAOP (goto_w, 200, BRANCH, GOTO, IMMEDIATE_s4)
-JAVAOP (jsr_w, 201, JSR, CALL, IMMEDIATE_s4)
-JAVAOP (breakpoint, 202, SPECIAL, ANY, BREAK)
-JAVAOP (ret_w, 209, RET, RETURN, VAR_INDEX_2)
-JAVAOP (impdep1, 254, IMPL, ANY, 1)
-JAVAOP (impdep2, 255, IMPL, ANY, 2)
diff --git a/gnu/dist/toolchain/gcc/java/javaop.h b/gnu/dist/toolchain/gcc/java/javaop.h
deleted file mode 100644
index cce0a61ea49..00000000000
--- a/gnu/dist/toolchain/gcc/java/javaop.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Utility macros to handle Java(TM) byte codes.
-
- Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, February 1996. */
-
-#ifndef JAVAOP_H
-#define JAVAOP_H
-
-typedef unsigned char uint8;
-#ifndef int16
-#define int16 short
-#endif
-typedef unsigned int16 uint16;
-
-#ifndef int32
-#define int32 long
-#endif
-typedef unsigned int32 uint32;
-
-/* A signed 64-bit (or more) integral type, suiteable for Java's 'long'. */
-#ifndef int64
-#define int64 long long
-#endif
-/* An unsigned 64-bit (or more) integral type, same length as int64. */
-#ifndef uint64
-#define uint64 unsigned int64
-#endif
-
-typedef uint16 jchar;
-#ifdef __STDC__
-typedef signed char jbyte;
-#else
-typedef char jbyte;
-#endif
-typedef int16 jshort;
-typedef int32 jint;
-typedef int64 jlong;
-typedef void* jref;
-
-/* A 32-bit IEEE single-precision float. */
-#ifndef jfloat
-#define jfloat float
-#endif
-
-/* A 32-bit IEEE double-precision float. */
-#ifndef jdouble
-#define jdouble double
-#endif
-
-union Word {
- jint i;
- jfloat f;
- void *p;
-};
-
-/* A jword is an unsigned integral type big enough for a 32-bit jint
- or jfloat *or* a pointer. It is the type appropriate for stack
- locations and local variables in a Java interpreter. */
-
-
-#ifndef jword
-#define jword uint32
-#endif
-
-#ifndef IMMEDIATE_u1
-#define IMMEDIATE_u1 (PC++, CHECK_PC_IN_RANGE(PC), BCODE[PC-1])
-#endif
-#ifndef IMMEDIATE_s1
-#define IMMEDIATE_s1 (PC++, CHECK_PC_IN_RANGE(PC), (signed char)BCODE[PC-1])
-#endif
-#ifndef IMMEDIATE_s2
-#define IMMEDIATE_s2 (PC+=2, CHECK_PC_IN_RANGE(PC), \
- (signed char) BCODE[PC-2] * 256 + BCODE[PC-1])
-#endif
-#ifndef IMMEDIATE_u2
-#define IMMEDIATE_u2 (PC+=2, CHECK_PC_IN_RANGE(PC),\
- (BCODE[PC-2] * 256 + BCODE[PC-1]))
-#endif
-#ifndef IMMEDIATE_s4
-#define IMMEDIATE_s4 (PC+=4, CHECK_PC_IN_RANGE(PC), \
- ((jint)((BCODE[PC-4] << 24) | (BCODE[PC-3] << 16) \
- | (BCODE[PC-2] << 8) | (BCODE[PC-1]))))
-#endif
-
-static inline jfloat
-WORD_TO_FLOAT(jword w)
-{ union Word wu;
- wu.i = w;
- return wu.f;
-}
-
-static inline jlong
-WORDS_TO_LONG(jword hi, jword lo)
-{
- return ((jlong) hi << 32) | ((jlong)lo & (((jlong)1 << 32) -1));
-}
-
-union DWord {
- jdouble d;
- jlong l;
- jword w[2];
-};
-
-static inline jdouble
-WORDS_TO_DOUBLE(jword hi, jword lo)
-{ union DWord wu;
- wu.l = WORDS_TO_LONG(hi, lo);
- return wu.d;
-}
-
-/* If PREFIX_CHAR is the first character of the Utf8 encoding of a character,
- return the number of bytes taken by the encoding.
- Return -1 for a continuation character. */
-#define UT8_CHAR_LENGTH(PREFIX_CHAR) \
- ((unsigned char)(PREFIX_CHAR) < 128 ? 1 \
- : ((PREFIX_CHAR) & 0x40) == 0 ? -1 \
- : ((PREFIX_CHAR) & 0x20) == 0 ? 2 \
- : ((PREFIX_CHAR) & 0x10) == 0 ? 3 \
- : ((PREFIX_CHAR) & 0x08) == 0 ? 4 : 5)
-
-#endif /* !JAVAOP_H */
diff --git a/gnu/dist/toolchain/gcc/java/jcf-depend.c b/gnu/dist/toolchain/gcc/java/jcf-depend.c
deleted file mode 100644
index 86b9d7722fe..00000000000
--- a/gnu/dist/toolchain/gcc/java/jcf-depend.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* Functions for handling dependency tracking when reading .class files.
-
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Tom Tromey <tromey@cygnus.com>, October 1998. */
-
-#include "config.h"
-#include "system.h"
-
-#include <assert.h>
-
-#include "jcf.h"
-
-
-
-/* We keep a linked list of all the files we've already read. */
-struct entry
-{
- char *file;
- struct entry *next;
-};
-
-/* List of files. */
-static struct entry *dependencies = NULL;
-
-/* Name of targets. We support multiple targets when writing .class
- files. */
-static struct entry *targets = NULL;
-
-/* Number of columns in output. */
-#define MAX_OUTPUT_COLUMNS 72
-
-/* The output file, or NULL if we aren't doing dependency tracking. */
-static FILE *dep_out = NULL;
-
-/* Nonzero if system files should be added. */
-static int system_files;
-
-
-
-/* Helper to free an entry list. */
-static void
-free_entry (entp)
- struct entry **entp;
-{
- struct entry *ent, *next;
-
- for (ent = *entp; ent != NULL; ent = next)
- {
- next = ent->next;
- free (ent->file);
- free (ent);
- }
- *entp = NULL;
-}
-
-/* Helper to add to entry list. */
-static void
-add_entry (entp, name)
- struct entry **entp;
- char *name;
-{
- struct entry *ent;
-
- for (ent = *entp; ent != NULL; ent = ent->next)
- if (! strcmp (ent->file, name))
- return;
-
- ent = (struct entry *) malloc (sizeof (struct entry));
- ent->file = strdup (name);
- ent->next = *entp;
- *entp = ent;
-}
-
-/* Call this to reset the dependency module. This is required if
- multiple dependency files are being generated from a single tool
- invocation. */
-void
-jcf_dependency_reset ()
-{
- free_entry (&dependencies);
- free_entry (&targets);
-
- if (dep_out != NULL)
- {
- if (dep_out != stdout)
- fclose (dep_out);
- dep_out = NULL;
- }
-}
-
-void
-jcf_dependency_set_target (name)
- char *name;
-{
- free_entry (&targets);
- if (name != NULL)
- add_entry (&targets, name);
-}
-
-void
-jcf_dependency_add_target (name)
- char *name;
-{
- add_entry (&targets, name);
-}
-
-void
-jcf_dependency_set_dep_file (name)
- const char *name;
-{
- assert (dep_out != stdout);
- if (dep_out)
- fclose (dep_out);
- if (! strcmp (name, "-"))
- dep_out = stdout;
- else
- dep_out = fopen (name, "w");
-}
-
-void
-jcf_dependency_add_file (filename, system_p)
- const char *filename;
- int system_p;
-{
- /* Just omit system files. */
- if (system_p && ! system_files)
- return;
-
- add_entry (&dependencies, filename);
-}
-
-void
-jcf_dependency_init (system_p)
- int system_p;
-{
- system_files = system_p;
-}
-
-/* FIXME: this is taken almost directly from cccp.c. Such duplication
- is bad. */
-static char *
-munge (filename)
- char *filename;
-{
- static char *buffer = NULL;
- static int buflen = 0;
-
- int len = 2 * strlen (filename) + 1;
- char *p, *dst;
-
- if (buflen < len)
- {
- buflen = len;
- if (buffer == NULL)
- buffer = malloc (buflen);
- else
- buffer = realloc (buffer, buflen);
- }
-
- dst = buffer;
- for (p = filename; *p; ++p)
- {
- switch (*p)
- {
- case ' ':
- case '\t':
- {
- /* GNU make uses a weird quoting scheme for white space.
- A space or tab preceded by 2N+1 backslashes represents
- N backslashes followed by space; a space or tab
- preceded by 2N backslashes represents N backslashes at
- the end of a file name; and backslashes in other
- contexts should not be doubled. */
- char *q;
- for (q = p - 1; filename < q && q[-1] == '\\'; q--)
- *dst++ = '\\';
- }
- *dst++ = '\\';
- goto ordinary_char;
-
- case '$':
- *dst++ = '$';
- /* Fall through. This can mishandle things like "$(" but
- there's no easy fix. */
- default:
- ordinary_char:
- /* This can mishandle characters in the string "\0\n%*?[\\~";
- exactly which chars are mishandled depends on the `make' version.
- We know of no portable solution for this;
- even GNU make 3.76.1 doesn't solve the problem entirely.
- (Also, '\0' is mishandled due to our calling conventions.) */
- *dst++ = *p;
- break;
- }
- }
-
- *dst++ = '\0';
- return buffer;
-}
-
-/* Helper to print list of files. */
-static int
-print_ents (ent, column)
- struct entry *ent;
- int column;
-{
- int first = 1;
-
- for (; ent != NULL; ent = ent->next)
- {
- char *depname = munge (ent->file);
- int len = strlen (depname);
-
- if (column + len + 2 > MAX_OUTPUT_COLUMNS)
- {
- fprintf (dep_out, " \\\n ");
- column = 1;
- }
-
- if (! first)
- fputs (" ", dep_out);
- fputs (depname, dep_out);
- first = 0;
- column += len + 1;
- }
-
- return column;
-}
-
-void
-jcf_dependency_write ()
-{
- int column = 0;
-
- if (! dep_out)
- return;
-
- assert (targets);
- column = print_ents (targets, 0);
- fputs (" : ", dep_out);
-
- print_ents (dependencies, column);
- fputs ("\n", dep_out);
- fflush (dep_out);
-}
diff --git a/gnu/dist/toolchain/gcc/java/jcf-dump.c b/gnu/dist/toolchain/gcc/java/jcf-dump.c
deleted file mode 100644
index 6d3e37253b3..00000000000
--- a/gnu/dist/toolchain/gcc/java/jcf-dump.c
+++ /dev/null
@@ -1,1101 +0,0 @@
-/* Program to dump out a Java(TM) .class file.
- Functionally similar to Sun's javap.
-
- Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, February 1996. */
-
-/*
- jcf-dump is a program to print out the contents of class files.
- Usage: jcf-dump [FLAGS] CLASS
- Each CLASS is either:
- + the name of a class in the CLASSPATH (e.g "java.lang.String"), or
- + the name of a class *file* (e.g. "/home/me/work/package/Foo.class").
- + The name of a .zip or .jar file (which prints all the classes in the
- archive).
-
- OPTIONS:
- -c
- Dis-assemble each method.
- -classpath PATH
- Overrides $CLASSPATH.
- --print-main
- Print nothing if there is no valid "main" method;
- otherwise, print only the class name.
- --javap
- Print output in the style of Sun's javap program. VERY UNFINISHED.
- */
-
-
-#include "config.h"
-#include "system.h"
-
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-
-/* Outout file. */
-FILE *out;
-/* Name of output file, if NULL if stdout. */
-char *output_file = NULL;
-
-int verbose = 0;
-
-int flag_disassemble_methods = 0;
-int flag_print_class_info = 1;
-int flag_print_constant_pool = 1;
-int flag_print_fields = 1;
-int flag_print_methods = 1;
-int flag_print_attributes = 1;
-
-/* Print names of classes that have a "main" method. */
-int flag_print_main = 0;
-
-/* Index in constant pool of this class. */
-int this_class_index = 0;
-
-int class_access_flags = 0;
-
-/* Print in format similar to javap. VERY IMCOMPLETE. */
-int flag_javap_compatible = 0;
-
-static int print_access_flags PROTO ((FILE *, uint16, char));
-static void print_constant_terse PROTO ((FILE*, JCF*, int, int));
-static void print_constant PROTO ((FILE *, JCF *, int, int));
-static void print_constant_ref PROTO ((FILE *, JCF *, int));
-static void disassemble_method PROTO ((JCF*, unsigned char *, int));
-static void print_name PROTO ((FILE*, JCF*, int));
-static void print_signature PROTO ((FILE*, JCF*, int, int));
-static int utf8_equal_string PROTO ((struct JCF*, int, const char *));
-static int usage PROTO ((void));
-static void process_class PROTO ((struct JCF *));
-
-#define PRINT_SIGNATURE_RESULT_ONLY 1
-#define PRINT_SIGNATURE_ARGS_ONLY 2
-
-static int
-DEFUN(utf8_equal_string, (jcf, index, value),
- JCF *jcf AND int index AND const char * value)
-{
- if (CPOOL_INDEX_IN_RANGE (&jcf->cpool, index)
- && JPOOL_TAG (jcf, index) == CONSTANT_Utf8)
- {
- int len = strlen (value);
- if (JPOOL_UTF_LENGTH (jcf, index) == len
- && memcmp (JPOOL_UTF_DATA (jcf, index), value, len) == 0)
- return 1;
- }
- return 0;
-}
-
-#define HANDLE_MAGIC(MAGIC, MINOR, MAJOR) \
- this_class_index = 0; \
- if (flag_print_class_info) \
- fprintf (out, \
- "Magic number: 0x%0lx, minor_version: %ld, major_version: %ld.\n",\
- (long) MAGIC, (long) MINOR, (long) MAJOR)
-
-#define HANDLE_START_CONSTANT_POOL(COUNT) \
- if (flag_print_constant_pool) \
- fprintf (out, "\nConstant pool (count: %d):\n", COUNT)
-
-#define HANDLE_SOURCEFILE(INDEX) \
-{ fprintf (out, "Attribute "); \
- print_constant_terse (out, jcf, attribute_name, CONSTANT_Utf8); \
- fprintf (out, ", length:%ld, #%d=", (long) attribute_length, INDEX); \
- print_constant_terse (out, jcf, INDEX, CONSTANT_Utf8); fputc ('\n', out); }
-
-#define HANDLE_CLASS_INFO(ACCESS_FLAGS, THIS, SUPER, INTERFACES_COUNT) \
- this_class_index = THIS; \
- class_access_flags = ACCESS_FLAGS; \
- if (flag_print_class_info) \
- { fprintf (out, "\nAccess flags: 0x%x", ACCESS_FLAGS); \
- print_access_flags (out, ACCESS_FLAGS, 'c'); \
- fputc ('\n', out); \
- fprintf (out, "This class: "); \
- if (flag_print_constant_pool) \
- fprintf (out, "%d=", THIS); \
- print_constant_terse (out, jcf, THIS, CONSTANT_Class); \
- if (flag_print_constant_pool || SUPER != 0) \
- fprintf (out, ", super: "); \
- if (flag_print_constant_pool) \
- { \
- fprintf (out, "%d", SUPER); \
- if (SUPER != 0) \
- fputc ('=', out); \
- } \
- if (SUPER != 0) \
- print_constant_terse (out, jcf, SUPER, CONSTANT_Class); \
- fprintf (out, "\nInterfaces (count: %d):\n", INTERFACES_COUNT); \
- }
-
-#define IGNORE_ATTRIBUTE(JCF, NAME, NAME_LENGTH) \
- (flag_print_attributes <= 0)
-
-#define HANDLE_CLASS_INTERFACE(INDEX) \
- if (flag_print_class_info) \
- { fprintf (out, "- Implements: %d=", INDEX); \
- print_constant_terse (out, jcf, INDEX, CONSTANT_Class); \
- fputc ('\n', out); }
-
-#define HANDLE_START_FIELDS(FIELDS_COUNT) \
- if (flag_print_fields) \
- fprintf (out, "\nFields (count: %d):\n", FIELDS_COUNT)
-
-#define HANDLE_START_FIELD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
- if (flag_print_fields) \
- { fprintf (out, "Field name:"); \
- print_constant_terse (out, jcf, NAME, CONSTANT_Utf8); \
- print_access_flags (out, ACCESS_FLAGS, 'f'); \
- fprintf (out, " Signature: "); \
- if (flag_print_constant_pool) \
- fprintf (out, "%d=", SIGNATURE); \
- print_signature (out, jcf, SIGNATURE, 0); \
- fputc ('\n', out); } \
- else \
- flag_print_attributes--;
-
-#define HANDLE_END_FIELD() \
- if (! flag_print_fields) \
- flag_print_attributes++;
-
-#define HANDLE_START_METHODS(METHODS_COUNT) \
- if (flag_print_methods) \
- fprintf (out, "\nMethods (count: %d):\n", METHODS_COUNT); \
- else \
- flag_print_attributes--;
-
-
-#define HANDLE_END_METHODS() \
- if (! flag_print_methods) \
- flag_print_attributes++;
-
-#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
-{ \
- if (flag_print_methods) \
- { \
- if (flag_javap_compatible) \
- { \
- fprintf (out, " "); \
- print_access_flags (out, ACCESS_FLAGS, 'm'); \
- fputc (' ', out); \
- print_signature (out, jcf, SIGNATURE, PRINT_SIGNATURE_RESULT_ONLY); \
- fputc (' ', out); \
- print_constant_terse (out, jcf, NAME, CONSTANT_Utf8); \
- print_signature (out, jcf, SIGNATURE, PRINT_SIGNATURE_ARGS_ONLY); \
- fputc ('\n', out); \
- } \
- else \
- { \
- fprintf (out, "\nMethod name:"); \
- print_constant_terse (out, jcf, NAME, CONSTANT_Utf8); \
- print_access_flags (out, ACCESS_FLAGS, 'm'); \
- fprintf (out, " Signature: "); \
- if (flag_print_constant_pool) \
- fprintf (out, "%d=", SIGNATURE); \
- print_signature (out, jcf, SIGNATURE, 0); \
- fputc ('\n', out); \
- } \
- } \
- if (flag_print_main && ACCESS_FLAGS == (ACC_STATIC|ACC_PUBLIC) \
- && utf8_equal_string (jcf, NAME, "main") \
- && utf8_equal_string (jcf, SIGNATURE, "([Ljava/lang/String;)V") \
- && this_class_index > 0 \
- && (class_access_flags & ACC_PUBLIC)) \
- { \
- print_constant_terse(out, jcf, this_class_index, CONSTANT_Class); \
- fputc ('\n', out); \
- } \
-}
-
-#define COMMON_HANDLE_ATTRIBUTE(JCF, INDEX, LENGTH) \
-( fprintf (out, "Attribute "), \
- print_constant_terse (out, jcf, INDEX, CONSTANT_Utf8), \
- fprintf (out, ", length:%ld", (long) LENGTH) )
-
-#define HANDLE_CONSTANTVALUE(VALUE_INDEX) \
-( COMMON_HANDLE_ATTRIBUTE(JCF, attribute_name, attribute_length), \
- fprintf (out, ", value: "), \
- print_constant_ref (out, jcf, VALUE_INDEX), \
- fprintf (out, "\n") )
-
-#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
-{ COMMON_HANDLE_ATTRIBUTE(JCF, attribute_name, attribute_length); \
- fprintf (out, ", max_stack:%ld, max_locals:%ld, code_length:%ld\n", \
- (long) MAX_STACK, (long) MAX_LOCALS, (long) CODE_LENGTH); \
- disassemble_method (jcf, jcf->read_ptr, CODE_LENGTH); }
-
-#define HANDLE_EXCEPTION_TABLE(ENTRIES, COUNT) \
- print_exception_table (jcf, ENTRIES, COUNT)
-
-#define HANDLE_EXCEPTIONS_ATTRIBUTE(COUNT) \
-{ int n = (COUNT); int i; \
- COMMON_HANDLE_ATTRIBUTE(JCF, attribute_name, attribute_length); \
- fprintf (out, ", count: %d\n", n); \
- for (i = 0; i < n; i++) {\
- int ex_index = JCF_readu2 (jcf); \
- fprintf (out, "%3d: ", i); \
- print_constant_ref (out, jcf, ex_index); \
- fputc ('\n', out); } }
-
-#define HANDLE_LOCALVARIABLETABLE_ATTRIBUTE(COUNT) \
-{ int n = (COUNT); int i; \
- COMMON_HANDLE_ATTRIBUTE(JCF, attribute_name, attribute_length); \
- fprintf (out, ", count: %d\n", n); \
- for (i = 0; i < n; i++) {\
- int start_pc = JCF_readu2 (jcf); \
- int length = JCF_readu2 (jcf); \
- int name_index = JCF_readu2 (jcf); \
- int signature_index = JCF_readu2 (jcf); \
- int slot = JCF_readu2 (jcf); \
- fprintf (out, " slot#%d: name: %d=", slot, name_index); \
- print_name (out, jcf, name_index); \
- fprintf (out, ", type: %d=", signature_index); \
- print_signature (out, jcf, signature_index, 0); \
- fprintf (out, " (pc: %d length: %d)\n", start_pc, length); }}
-
-#define HANDLE_LINENUMBERTABLE_ATTRIBUTE(COUNT) \
-{ int n = (COUNT); int i; \
- COMMON_HANDLE_ATTRIBUTE(jcf, attribute_name, attribute_length); \
- fprintf (out, ", count: %d\n", n); \
- if (flag_disassemble_methods) \
- for (i = 0; i < n; i++) {\
- int start_pc = JCF_readu2 (jcf); \
- int line_number = JCF_readu2 (jcf); \
- fprintf (out, " line: %d at pc: %d\n", line_number, start_pc); }\
- else \
- JCF_SKIP (jcf, 4 * n); }
-
-#define PROCESS_OTHER_ATTRIBUTE(JCF, INDEX, LENGTH) \
-{ COMMON_HANDLE_ATTRIBUTE(JCF, INDEX, LENGTH); \
- fputc ('\n', out); JCF_SKIP (JCF, LENGTH); }
-
-#define START_FINAL_ATTRIBUTES(ATTRIBUTES_COUNT) \
- if (flag_print_attributes > 0) \
- fprintf (out, "\nAttributes (count: %d):\n", attributes_count);
-
-#include "javaop.h"
-
-static void
-DEFUN(print_constant_ref, (stream, jcf, index),
- FILE *stream AND JCF *jcf AND int index)
-{
- fprintf (stream, "#%d=<", index);
- if (index <= 0 || index >= JPOOL_SIZE(jcf))
- fprintf (stream, "out of range");
- else
- print_constant (stream, jcf, index, 1);
- fprintf (stream, ">");
-}
-
-/* Print the access flags given by FLAGS.
- The CONTEXT is one of 'c' (class flags), 'f' (field flags),
- or 'm' (method flags). */
-
-static int
-DEFUN (print_access_flags, (stream, flags, context),
- FILE *stream AND uint16 flags AND char context)
-{
- if (flags & ACC_PUBLIC) fprintf (stream, " public");
- if (flags & ACC_PRIVATE) fprintf (stream, " private");
- if (flags & ACC_PROTECTED) fprintf (stream, " protected");
- if (flags & ACC_STATIC) fprintf (stream, " static");
- if (flags & ACC_FINAL) fprintf (stream, " final");
- if (flags & ACC_SYNCHRONIZED)
- {
- if (context == 'c')
- fprintf (stream, " super");
- else
- fprintf (stream, " synchronized");
- }
- if (flags & ACC_VOLATILE) fprintf (stream, " volatile");
- if (flags & ACC_TRANSIENT) fprintf (stream, " transient");
- if (flags & ACC_NATIVE) fprintf (stream, " native");
- if (flags & ACC_INTERFACE) fprintf (stream, " interface");
- if (flags & ACC_ABSTRACT) fprintf (stream, " abstract");
-}
-
-
-static void
-DEFUN(print_name, (stream, jcf, name_index),
- FILE* stream AND JCF* jcf AND int name_index)
-{
- if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
- fprintf (stream, "<not a UTF8 constant>");
- else
- jcf_print_utf8 (stream, JPOOL_UTF_DATA (jcf,name_index),
- JPOOL_UTF_LENGTH (jcf, name_index));
-}
-
-/* If the type of the constant at INDEX matches EXPECTED,
- print it tersely, otherwise more verbosely. */
-
-static void
-DEFUN(print_constant_terse, (out, jcf, index, expected),
- FILE *out AND JCF *jcf AND int index AND int expected)
-{
- if (! CPOOL_INDEX_IN_RANGE (&jcf->cpool, index))
- fprintf (out, "<constant pool index %d not in range>", index);
- else if (JPOOL_TAG (jcf, index) != expected)
- {
- fprintf (out, "<Unexpected constant type ");
- print_constant (out, jcf, index, 1);
- fprintf (out, ">");
- }
- else
- print_constant (out, jcf, index, 0);
-}
-
-/* Print the constant at INDEX in JCF's constant pool.
- If verbosity==0, print very tersely (no extraneous text).
- If verbosity==1, prefix the type of the constant.
- If verbosity==2, add more descriptive text. */
-
-static void
-DEFUN(print_constant, (out, jcf, index, verbosity),
- FILE *out AND JCF *jcf AND int index AND int verbosity)
-{
- int j, n;
- jlong num;
- const char *str;
- int kind = JPOOL_TAG (jcf, index);
- switch (kind)
- {
- case CONSTANT_Class:
- n = JPOOL_USHORT1 (jcf, index);
- if (verbosity > 0)
- fprintf (out, verbosity > 1 ? "Class name: %d=" : "Class ", n);
- if (! CPOOL_INDEX_IN_RANGE (&jcf->cpool, n))
- fprintf (out, "<out of range>");
- else if (verbosity < 2 && JPOOL_TAG (jcf, n) == CONSTANT_Utf8)
- {
- int len = JPOOL_UTF_LENGTH (jcf, n);
- jcf_print_utf8_replace (out, JPOOL_UTF_DATA(jcf,n), len, '/', '.');
- }
- else
- print_constant_terse (out, jcf, n, CONSTANT_Utf8);
- break;
- case CONSTANT_Fieldref:
- str = "Field"; goto field_or_method;
- case CONSTANT_Methodref:
- str = "Method"; goto field_or_method;
- case CONSTANT_InterfaceMethodref:
- str = "InterfaceMethod"; goto field_or_method;
- field_or_method:
- {
- uint16 tclass = JPOOL_USHORT1 (jcf, index);
- uint16 name_and_type = JPOOL_USHORT2 (jcf, index);
- if (verbosity == 2)
- fprintf (out, "%sref class: %d=", str, tclass);
- else if (verbosity > 0)
- fprintf (out, "%s ", str);
- print_constant_terse (out, jcf, tclass, CONSTANT_Class);
- fprintf (out, verbosity < 2 ? "." : " name_and_type: %d=<",
- name_and_type);
- print_constant_terse (out, jcf, name_and_type, CONSTANT_NameAndType);
- if (verbosity == 2)
- fputc ('>', out);
- }
- break;
- case CONSTANT_String:
- j = JPOOL_USHORT1 (jcf, index);
- if (verbosity > 0)
- fprintf (out, verbosity > 1 ? "String %d=" : "String ", j);
- print_constant_terse (out, jcf, j, CONSTANT_Utf8);
- break;
- case CONSTANT_Integer:
- if (verbosity > 0)
- fprintf (out, "Integer ");
- num = JPOOL_INT (jcf, index);
- goto integer;
- case CONSTANT_Long:
- if (verbosity > 0)
- fprintf (out, "Long ");
- num = JPOOL_LONG (jcf, index);
- goto integer;
- integer:
- {
- char buffer[25];
- format_int (buffer, num, 10);
- fprintf (out, "%s", buffer);
- if (verbosity > 1)
- {
- format_uint (buffer, (uint64)num, 16);
- fprintf (out, "=0x%s", buffer);
- }
- }
- break;
- case CONSTANT_Float:
- {
- jfloat fnum = JPOOL_FLOAT (jcf, index);
- fprintf (out, "%s%.10g", verbosity > 1 ? "Float " : "", (double) fnum);
- if (verbosity > 1)
- fprintf (out, ", bits = 0x%08lx", (long) (* (int32 *) &fnum));
- break;
- }
- case CONSTANT_Double:
- {
- jdouble dnum = JPOOL_DOUBLE (jcf, index);
- fprintf (out, "%s%.20g", verbosity > 1 ? "Double " : "", dnum);
- if (verbosity > 1)
- {
- int32 hi, lo;
- hi = JPOOL_UINT (jcf, index);
- lo = JPOOL_UINT (jcf, index + 1);
- fprintf (out, ", bits = 0x%08lx%08lx", (long) hi, (long) lo);
- }
- break;
- }
- case CONSTANT_NameAndType:
- {
- uint16 name = JPOOL_USHORT1 (jcf, index);
- uint16 sig = JPOOL_USHORT2 (jcf, index);
- if (verbosity > 0)
- fprintf (out, verbosity > 1 ? "%s name: %d=" : "%s ",
- "NameAndType", name);
- print_name (out, jcf, name);
- if (verbosity <= 1)
- fputc (' ', out);
- else
- fprintf (out, ", signature: %d=", sig);
- print_signature (out, jcf, sig, 0);
- }
- break;
- case CONSTANT_Utf8:
- {
- register unsigned char *str = JPOOL_UTF_DATA (jcf, index);
- int length = JPOOL_UTF_LENGTH (jcf, index);
- if (verbosity > 0)
- { /* Print as 8-bit bytes. */
- fputs ("Utf8: \"", out);
- while (--length >= 0)
- jcf_print_char (out, *str++);
- }
- else
- { /* Print as Unicode. */
- fputc ('\"', out);
- jcf_print_utf8 (out, str, length);
- }
- fputc ('\"', out);
- }
- break;
- default:
- fprintf (out, "(Unknown constant type %d)", kind);
- }
-}
-
-void
-DEFUN(print_constant_pool, (jcf),
- JCF *jcf)
-{
- int i;
- for (i = 1; i < JPOOL_SIZE(jcf); i++)
- {
- int kind = JPOOL_TAG (jcf, i);
- fprintf (out, "#%d: ", i);
- print_constant (out, jcf, i, 2);
- fprintf (out, "\n");
- if (kind == CONSTANT_Double || kind == CONSTANT_Long)
- i++; /* These take up two slots in the constant table */
- }
-}
-
-static void
-DEFUN(print_signature_type, (stream, ptr, limit),
- FILE* stream AND const unsigned char **ptr AND const unsigned char *limit)
-{
- int array_size;
- if ((*ptr) >= limit)
- return;
- switch (*(*ptr))
- {
- case '[':
- array_size = -1;
- for ((*ptr)++; (*ptr) < limit && ISDIGIT (**ptr); (*ptr)++)
- {
- array_size = (array_size < 0 ? 0 : 10 * array_size) + *(*ptr) - '0';
- }
- print_signature_type (stream, ptr, limit);
- if (array_size == -1)
- fprintf (stream, "[]");
- else
- fprintf (stream, "[%d]", array_size);
- break;
- case '(':
- {
- int nargs = 0;
- fputc (*(*ptr)++, stream);
- for (; **ptr != ')' && *ptr < limit; nargs++)
- {
- if (nargs > 0)
- fputc (',', stream);
- print_signature_type (stream, ptr, limit);
- }
- if (*ptr < limit)
- {
- fputc (*(*ptr)++, stream);
- print_signature_type (stream, ptr, limit);
- }
- else
- fprintf (stream, "???");
- }
- break;
-
- case 'B': fprintf (stream, "byte"); (*ptr)++; break;
- case 'C': fprintf (stream, "char"); (*ptr)++; break;
- case 'D': fprintf (stream, "double"); (*ptr)++; break;
- case 'F': fprintf (stream, "float"); (*ptr)++; break;
- case 'S': fprintf (stream, "short"); (*ptr)++; break;
- case 'I': fprintf (stream, "int"); (*ptr)++; break;
- case 'J': fprintf (stream, "long"); (*ptr)++; break;
- case 'Z': fprintf (stream, "boolean"); (*ptr)++; break;
- case 'V': fprintf (stream, "void"); (*ptr)++; break;
-
- case 'L':
- for ((*ptr)++; (*ptr)<limit && *(*ptr) != ';'; (*ptr)++)
- jcf_print_char (stream, *(*ptr) == '/' ? '.' : *(*ptr));
- if (*(*ptr) == ';')
- (*ptr)++;
- break;
- default:
- jcf_print_char (stream, *(*ptr)++);
- }
-}
-
-static void
-DEFUN(print_signature, (stream, jcf, signature_index, int options),
- FILE* stream AND JCF *jcf AND int signature_index AND int options)
-{
- if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8)
- print_constant_terse (out, jcf, signature_index, CONSTANT_Utf8);
- else
- {
- const unsigned char *str = JPOOL_UTF_DATA (jcf, signature_index);
- int length = JPOOL_UTF_LENGTH (jcf, signature_index);
- const unsigned char *limit;
- limit = str + length;
- if (str >= limit)
- fprintf (stream, "<empty signature string>");
- else
- {
- if (options & PRINT_SIGNATURE_RESULT_ONLY)
- {
- while (str < limit && *str++ != ')') ;
- }
- if (options & PRINT_SIGNATURE_ARGS_ONLY)
- {
- str++;
- fputc ('(', stream);
- while (str < limit && *str != ')')
- {
- print_signature_type (stream, &str, limit);
- if (*str != ')')
- fputs (", ", stream);
- }
- fputc (')', stream);
- }
- else
- {
- print_signature_type (stream, &str, limit);
- if (str < limit)
- {
- fprintf (stream, "<junk:");
- jcf_print_utf8 (stream, str, limit - str);
- fputc ('>', stream);
- }
- }
- }
- }
-}
-
-
-static void
-DEFUN(print_exception_table, (jcf, entries, count),
- JCF *jcf AND unsigned char *entries AND int count)
-{
- /* Print exception table. */
- int i = count;
- if (i > 0)
- {
- unsigned char *ptr = entries;
- fprintf (out, "Exceptions (count: %d):\n", i);
- for (; --i >= 0; ptr+= 8)
- {
- int start_pc = GET_u2 (ptr);
- int end_pc = GET_u2 (ptr+2);
- int handler_pc = GET_u2 (ptr+4);
- int catch_type = GET_u2 (ptr+6);
- fprintf (out, " start: %d, end: %d, handler: %d, type: %d",
- start_pc, end_pc, handler_pc, catch_type);
- if (catch_type == 0)
- fputs (" /* finally */", out);
- else
- {
- fputc('=', out);
- print_constant_terse (out, jcf, catch_type, CONSTANT_Class);
- }
- fputc ('\n', out);
- }
- }
-}
-
-#include "jcf-reader.c"
-
-static int
-DEFUN (usage, (), )
-{
- fprintf (stderr, "Usage: jcf-dump [-o outputfile] [-c] classname\n");
- exit(1);
-}
-
-static void
-DEFUN(process_class, (jcf),
- JCF *jcf)
-{
- int code;
- if (jcf_parse_preamble (jcf) != 0)
- fprintf (stderr, "Not a valid Java .class file.\n");
-
- /* Parse and possibly print constant pool */
- code = jcf_parse_constant_pool (jcf);
- if (code != 0)
- {
- fprintf (stderr, "error while parsing constant pool\n");
- exit (FATAL_EXIT_CODE);
- }
- code = verify_constant_pool (jcf);
- if (code > 0)
- {
- fprintf (stderr, "error in constant pool entry #%d\n", code);
- exit (FATAL_EXIT_CODE);
- }
- if (flag_print_constant_pool)
- print_constant_pool (jcf);
-
- jcf_parse_class (jcf);
- code = jcf_parse_fields (jcf);
- if (code != 0)
- {
- fprintf (stderr, "error while parsing fields\n");
- exit (FATAL_EXIT_CODE);
- }
- code = jcf_parse_methods (jcf);
- if (code != 0)
- {
- fprintf (stderr, "error while parsing methods\n");
- exit (FATAL_EXIT_CODE);
- }
- code = jcf_parse_final_attributes (jcf);
- if (code != 0)
- {
- fprintf (stderr, "error while parsing final attributes\n");
- exit (FATAL_EXIT_CODE);
- }
- jcf->filename = NULL;
-}
-
-int
-DEFUN(main, (argc, argv),
- int argc AND char** argv)
-{
- JCF jcf[1];
- int argi;
- if (argc <= 1)
- usage ();
-
- jcf_path_init ();
-
- for (argi = 1; argi < argc; argi++)
- {
- char *arg = argv[argi];
-
- if (arg[0] != '-' || ! strcmp (arg, "--"))
- break;
-
- /* Just let all arguments be given in either "-" or "--" form. */
- if (arg[1] == '-')
- ++arg;
-
- if (strcmp (arg, "-o") == 0 && argi + 1 < argc)
- output_file = argv[++argi];
- else if (strcmp (arg, "-classpath") == 0 && argi + 1 < argc)
- jcf_path_classpath_arg (argv[++argi]);
- else if (strcmp (arg, "-CLASSPATH") == 0 && argi + 1 < argc)
- jcf_path_CLASSPATH_arg (argv[++argi]);
- else if (strncmp (arg, "-I", 2) == 0)
- jcf_path_include_arg (arg + 2);
- else if (strcmp (arg, "-verbose") == 0)
- verbose++;
- else if (strcmp (arg, "-print-main") == 0)
- flag_print_main++;
- else if (strcmp (arg, "-c") == 0)
- flag_disassemble_methods++;
- else if (strcmp (arg, "-javap") == 0)
- {
- flag_javap_compatible++;
- flag_print_constant_pool = 0;
- }
- else
- {
- fprintf (stderr, "%s: illegal argument\n", argv[argi]);
- exit (FATAL_EXIT_CODE);
- }
- }
-
- if (argi == argc)
- usage ();
-
- jcf_path_seal ();
-
- if (flag_print_main)
- {
- flag_print_fields = 0;
- flag_print_methods = 0;
- flag_print_constant_pool = 0;
- flag_print_attributes = 0;
- flag_print_class_info = 0;
- }
-
- if (output_file)
- {
- out = fopen (output_file, "w");
- if (out)
- {
- fprintf (stderr, "Cannot open '%s' for output.\n", output_file);
- exit (FATAL_EXIT_CODE);
- }
- }
- else
- out = stdout;
-
- if (argi >= argc)
- {
- fprintf (out, "Reading .class from <standard input>.\n");
-#if JCF_USE_STDIO
- open_class ("<stdio>", jcf, stdin, NULL);
-#else
- open_class ("<stdio>", jcf, 0, NULL);
-#endif
- process_class (jcf);
- }
- else
- {
- for (; argi < argc; argi++)
- {
- char *arg = argv[argi];
- char* class_filename = find_class (arg, strlen (arg), jcf, 0);
- if (class_filename == NULL)
- class_filename = find_classfile (arg, jcf, NULL);
- if (class_filename == NULL)
- {
- perror ("Could not find class");
- exit (FATAL_EXIT_CODE);
- }
- JCF_FILL (jcf, 4);
- if (GET_u4 (jcf->read_ptr) == ZIPMAGIC)
- {
- long compressed_size, member_size;
- int compression_method, filename_length, extra_length;
- int general_purpose_bits;
- char *filename;
- int total_length;
- if (flag_print_class_info)
- fprintf (out, "Reading classes from archive %s.\n",
- class_filename);
- for (;;)
- {
- int skip = 0;
- jcf_filbuf_t save_filbuf = jcf->filbuf;
- long magic = JCF_readu4_le (jcf);
- if (magic == 0x02014b50 || magic == 0x06054b50)
- break; /* got to central directory */
- if (magic != 0x04034b50) /* ZIPMAGIC (little-endian) */
- {
- fprintf (stderr, "bad format of .zip/.jar archive\n");
- exit (FATAL_EXIT_CODE);
- }
- JCF_FILL (jcf, 26);
- JCF_SKIP (jcf, 2);
- general_purpose_bits = JCF_readu2_le (jcf);
- compression_method = JCF_readu2_le (jcf);
- JCF_SKIP (jcf, 8);
- compressed_size = JCF_readu4_le (jcf);
- member_size = JCF_readu4_le (jcf);
- filename_length = JCF_readu2_le (jcf);
- extra_length = JCF_readu2_le (jcf);
- total_length = filename_length + extra_length
- + compressed_size;
- if (jcf->read_end - jcf->read_ptr < total_length)
- jcf_trim_old_input (jcf);
- JCF_FILL (jcf, total_length);
- filename = jcf->read_ptr;
- JCF_SKIP (jcf, filename_length);
- JCF_SKIP (jcf, extra_length);
- if (filename_length > 0
- && filename[filename_length-1] == '/')
- {
- if (flag_print_class_info)
- fprintf (out, "[Skipping directory %.*s]\n",
- filename_length, filename);
- skip = 1;
- }
- else if (compression_method != 0)
- {
- if (flag_print_class_info)
- fprintf (out, "[Skipping compressed file %.*s]\n",
- filename_length, filename);
- skip = 1;
- }
- else if (member_size < 4
- || GET_u4 (jcf->read_ptr) != 0xcafebabe)
- {
- if (flag_print_class_info)
- fprintf (out, "[Skipping non-.class member %.*s]\n",
- filename_length, filename);
- skip = 1;
- }
- else
- {
- if (flag_print_class_info)
- fprintf (out, "Reading class member: %.*s.\n",
- filename_length, filename);
- }
- if (skip)
- {
- JCF_SKIP (jcf, compressed_size);
- }
- else
- {
- unsigned char *save_end;
- jcf->filbuf = jcf_unexpected_eof;
- save_end = jcf->read_end;
- jcf->read_end = jcf->read_ptr + compressed_size;
- process_class (jcf);
- jcf->filbuf = save_filbuf;
- jcf->read_end = save_end;
- }
- }
- }
- else
- {
- if (flag_print_class_info)
- fprintf (out, "Reading .class from %s.\n", class_filename);
- process_class (jcf);
- }
- JCF_FINISH(jcf);
- }
- }
-
- exit (SUCCESS_EXIT_CODE);
-}
-
-static void
-DEFUN(disassemble_method, (jcf, byte_ops, len),
- JCF* jcf AND unsigned char *byte_ops AND int len)
-{
-#undef AND /* Causes problems with opcodes for iand and land. */
-#undef PTR
- int PC;
- int i;
- int saw_wide = 0;
- if (flag_disassemble_methods == 0)
- return;
-#define BCODE byte_ops
- for (PC = 0; PC < len;)
- {
- int oldpc = PC;
- int saw_index;
- jint INT_temp;
- switch (byte_ops[PC++])
- {
-
-/* This is the actual code emitted for each of opcodes in javaops.def.
- The actual opcode-specific stuff is handled by the OPKIND macro.
- I.e. for an opcode whose OPKIND is BINOP, the BINOP will be called.
- Those macros are defiend below. The OPKINDs that do not have any
- inline parameters (such as BINOP) and therefore do mot need anything
- else to me printed out just use an empty body. */
-
-#define JAVAOP(OPNAME, OPCODE, OPKIND, OPERAND_TYPE, OPERAND_VALUE) \
- case OPCODE: \
- fprintf (out, "%3d: %s", oldpc, #OPNAME); \
- OPKIND(OPERAND_TYPE, OPERAND_VALUE); \
- fputc ('\n', out); \
- break;
-
-#define CONST_INDEX_1 (saw_index = 1, IMMEDIATE_u1)
-#define CONST_INDEX_2 (saw_index = 1, IMMEDIATE_u2)
-#define VAR_INDEX_1 (saw_index = 1, IMMEDIATE_u1)
-#define VAR_INDEX_2 (saw_index = 1, IMMEDIATE_u2)
-
-#define CHECK_PC_IN_RANGE(PC) (PC < 0 || PC > len ? \
- (fprintf(stderr, "Bad byte codes.\n"), exit(-1)) : 1)
-
-/* Print out operand (if not implied by the opcode) for PUSCH opcodes.
- These all push a constant onto the opcode stack. */
-#define PUSHC(OPERAND_TYPE, OPERAND_VALUE) \
- saw_index = 0, i = (OPERAND_VALUE); \
- if (oldpc+1 == PC) /* nothing */; \
- else if (saw_index) fprintf (out, " "), print_constant_ref (out, jcf, i); \
- else fprintf (out, " %d", i);
-
-/* Print out operand (a local variable index) for LOAD opcodes.
- These all push local variable onto the opcode stack. */
-#define LOAD(OPERAND_TYPE, OPERAND_VALUE) \
- INT_temp = saw_wide ? IMMEDIATE_u2 : (OPERAND_VALUE); goto load_store;
-
-/* Handle STORE opcodes same as LOAD opcodes.
- These all store a value from the opcode stack in a local variable. */
-#define STORE LOAD
-
-/* Handle more kind of opcodes. */
-#define STACK(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define UNOP(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define BINOP(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define CONVERT(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define CONVERT2(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define RETURN(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-#define UNKNOWN(OPERAND_TYPE, OPERAND_VALUE) /* nothing */
-
-/* Handle putfield and getfield opcodes, with static versions. */
-#define FIELD(MAYBE_STATIC, PUT_OR_GET) \
- fputc (' ', out); print_constant_ref (out, jcf, IMMEDIATE_u2)
-
-/* Print operand for invoke opcodes. */
-#define INVOKE(OPERAND_TYPE, OPERAND_VALUE) \
- fputc (' ', out); print_constant_ref (out, jcf, IMMEDIATE_u2);\
- if (OPERAND_VALUE) /* for invokeinterface */ \
- { int nargs = IMMEDIATE_u1; PC++; \
- fprintf (out, " nargs:%d", nargs); }
-
-#define OBJECT(OPERAND_TYPE, OPERAND_VALUE) \
- fputc (' ', out); print_constant_ref (out, jcf, IMMEDIATE_u2);
-
-#define ARRAY(OPERAND_TYPE, SUBOP) \
- ARRAY_##SUBOP(OPERAND_TYPE)
-/* Handle sub-categories of ARRAY opcodes. */
-#define ARRAY_LOAD(TYPE) /* nothing */
-#define ARRAY_STORE(TYPE) /* nothing */
-#define ARRAY_LENGTH(TYPE) /* nothing */
-#define ARRAY_NEW(TYPE) ARRAY_NEW_##TYPE
-#define ARRAY_NEW_NUM \
- INT_temp = IMMEDIATE_u1; \
- { char *str; \
- switch (INT_temp) { \
- case 4: str = "boolean"; break; \
- case 5: str = "char"; break; \
- case 6: str = "float"; break; \
- case 7: str = "double"; break; \
- case 8: str = "byte"; break; \
- case 9: str = "short"; break; \
- case 10: str = "int"; break; \
- case 11: str = "long"; break; \
- default: str = "<unknown type code %d>"; break; \
- } \
- fputc (' ', out); fprintf (out, str, INT_temp); }
-
-#define ARRAY_NEW_PTR \
- fputc (' ', out); print_constant_ref (out, jcf, IMMEDIATE_u2);
-
-#define ARRAY_NEW_MULTI \
- fputc (' ', out); print_constant_ref (out, jcf, IMMEDIATE_u2); \
- fprintf (out, " %d", IMMEDIATE_u1); /* number of dimensions */
-
-#define TEST(OPERAND_TYPE, OPERAND_VALUE) \
- fprintf (out, " %d", oldpc + IMMEDIATE_s2)
-
-#define BRANCH(OPERAND_TYPE, OPERAND_VALUE) \
- saw_index = 0, INT_temp = (OPERAND_VALUE); \
- fprintf (out, " %ld", (long) (saw_index ? INT_temp : oldpc + INT_temp))
-
-#define JSR(OPERAND_TYPE, OPERAND_VALUE) \
- saw_index = 0, INT_temp = (OPERAND_VALUE); \
- fprintf (out, " %ld", (long) (saw_index ? INT_temp : oldpc + INT_temp))
-
-#undef RET /* Defined by config/i386/i386.h */
-#define RET(OPERAND_TYPE, OPERAND_VALUE) \
- INT_temp = saw_wide ? IMMEDIATE_u2 : (OPERAND_VALUE); \
- saw_wide = 0; \
- fprintf (out, " %ld", (long) INT_temp);
-
-#define SWITCH(OPERAND_TYPE, TABLE_OR_LOOKUP) \
- PC = (PC + 3) / 4 * 4; TABLE_OR_LOOKUP##_SWITCH
-
-#define LOOKUP_SWITCH \
- { jint default_offset = IMMEDIATE_s4; jint npairs = IMMEDIATE_s4; \
- fprintf (out, " npairs=%ld, default=%ld", (long) npairs, (long) default_offset+oldpc); \
- while (--npairs >= 0) { \
- jint match = IMMEDIATE_s4; jint offset = IMMEDIATE_s4; \
- fprintf (out, "\n%10ld: %ld", (long)match, (long)(offset+oldpc)); } \
- }
-
-#define TABLE_SWITCH \
- { jint default_offset = IMMEDIATE_s4; \
- jint low = IMMEDIATE_s4; jint high = IMMEDIATE_s4; \
- fprintf (out, " low=%ld, high=%ld, default=%ld", \
- (long) low, (long) high, (long) default_offset+oldpc); \
- for (; low <= high; low++) { \
- jint offset = IMMEDIATE_s4; \
- fprintf (out, "\n%10ld: %ld", (long)low, (long)(offset+oldpc)); } \
- }
-
-#define SPECIAL(OPERAND_TYPE, OPERAND_VALUE) \
- SPECIAL_##OPERAND_VALUE(OPERAND_TYPE)
-
-#define SPECIAL_IINC(OPERAND_TYPE) \
- i = saw_wide ? IMMEDIATE_u2 : IMMEDIATE_u1; \
- fprintf (out, " %d", i); \
- INT_temp = saw_wide ? IMMEDIATE_s2 : IMMEDIATE_s1; \
- saw_wide = 0; \
- fprintf (out, " %d", i)
-
-#define SPECIAL_WIDE(OPERAND_TYPE) \
- saw_wide = 1;
-
-#define SPECIAL_EXIT(OPERAND_TYPE) /* nothing */
-#define SPECIAL_ENTER(OPERAND_TYPE) /* nothing */
-#define SPECIAL_BREAK(OPERAND_TYPE) /* nothing */
-#define SPECIAL_THROW(OPERAND_TYPE) /* nothing */
-
-#define IMPL(OPERAND_TYPE, OPERAND_VALUE) \
- fprintf (out, " %d", IMMEDIATE_u##OPERAND_VALUE)
-
-#define COND(OPERAND_TYPE, OPERAND_VALUE) \
- TEST(OPERAND_TYPE, OPERAND_VALUE)
-
-#include "javaop.def"
-
- load_store:
- if (oldpc+1 == PC) /* nothing - local index implied by opcode */;
- else
- {
- saw_wide = 0;
- fprintf (out, " %ld", (long) INT_temp);
- }
- fputc ('\n', out);
- break;
-
- default:
- fprintf (out, "%3d: unknown(%3d)\n", oldpc, byte_ops[PC]);
- }
- }
-}
diff --git a/gnu/dist/toolchain/gcc/java/jcf-io.c b/gnu/dist/toolchain/gcc/java/jcf-io.c
deleted file mode 100644
index 95332186545..00000000000
--- a/gnu/dist/toolchain/gcc/java/jcf-io.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/* Utility routines for finding and reading Java(TM) .class files.
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, February 1996. */
-
-#include "config.h"
-#include "system.h"
-
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-
-/* DOS brain-damage */
-#ifndef O_BINARY
-#define O_BINARY 0 /* MS-DOS brain-damage */
-#endif
-
-int
-DEFUN(jcf_unexpected_eof, (jcf, count),
- JCF *jcf AND int count ATTRIBUTE_UNUSED)
-{
- if (jcf->filename)
- fprintf (stderr, "Premature end of .class file %s.\n", jcf->filename);
- else
- fprintf (stderr, "Premature end of .class file <stdin>.\n");
- exit (-1);
-}
-
-void
-DEFUN(jcf_trim_old_input, (jcf),
- JCF *jcf)
-{
- int count = jcf->read_ptr - jcf->buffer;
- if (count > 0)
- {
- memmove (jcf->buffer, jcf->read_ptr, jcf->read_end - jcf->read_ptr);
- jcf->read_ptr -= count;
- jcf->read_end -= count;
- }
-}
-
-int
-DEFUN(jcf_filbuf_from_stdio, (jcf, count),
- JCF *jcf AND int count)
-{
- FILE *file = (FILE*) (jcf->read_state);
- if (count > jcf->buffer_end - jcf->read_ptr)
- {
- JCF_u4 old_read_ptr = jcf->read_ptr - jcf->buffer;
- JCF_u4 old_read_end = jcf->read_end - jcf->buffer;
- JCF_u4 old_size = jcf->buffer_end - jcf->buffer;
- JCF_u4 new_size = (old_size == 0 ? 2000 : 2 * old_size) + count;
- unsigned char *new_buffer = jcf->buffer == NULL ? ALLOC (new_size)
- : REALLOC (jcf->buffer, new_size);
- jcf->buffer = new_buffer;
- jcf->buffer_end = new_buffer + new_size;
- jcf->read_ptr = new_buffer + old_read_ptr;
- jcf->read_end = new_buffer + old_read_end;
- }
- count -= jcf->read_end - jcf->read_ptr;
- if (count <= 0)
- return 0;
- if ((int) fread (jcf->read_end, 1, count, file) != count)
- jcf_unexpected_eof (jcf, count);
- jcf->read_end += count;
- return 0;
-}
-
-#include "zipfile.h"
-
-struct ZipFileCache *SeenZipFiles = NULL;
-
-/* Open a zip file with the given name, and cache directory and file
- descriptor. If the file is missing, treat it as an empty archive.
- Return NULL if the .zip file is malformed.
-*/
-
-ZipFile *
-DEFUN(opendir_in_zip, (zipfile, is_system),
- const char *zipfile AND int is_system)
-{
- struct ZipFileCache* zipf;
- char magic [4];
- int fd;
- for (zipf = SeenZipFiles; zipf != NULL; zipf = zipf->next)
- {
- if (strcmp (zipf->name, zipfile) == 0)
- return &zipf->z;
- }
-
- zipf = ALLOC (sizeof (struct ZipFileCache) + strlen (zipfile) + 1);
- zipf->next = SeenZipFiles;
- zipf->name = (char*)(zipf+1);
- strcpy (zipf->name, zipfile);
- SeenZipFiles = zipf;
- fd = open (zipfile, O_RDONLY | O_BINARY);
- zipf->z.fd = fd;
- if (fd < 0)
- {
- /* A missing zip file is not considered an error.
- We may want to re-consider that. FIXME. */
- zipf->z.count = 0;
- zipf->z.dir_size = 0;
- zipf->z.central_directory = NULL;
- }
- else
- {
- jcf_dependency_add_file (zipfile, is_system);
- if (read (fd, magic, 4) != 4 || GET_u4 (magic) != (JCF_u4)ZIPMAGIC)
- return NULL;
- lseek (fd, 0L, SEEK_SET);
- if (read_zip_archive (&zipf->z) != 0)
- return NULL;
- }
- return &zipf->z;
-}
-
-/* Returns:
- 0: OK - zipmember found.
- -1: Not found.
- -2: Malformed archive.
-*/
-
-int
-DEFUN(open_in_zip, (jcf, zipfile, zipmember, is_system),
- JCF *jcf AND const char *zipfile AND const char *zipmember
- AND int is_system)
-{
- ZipDirectory *zipd;
- int i, len;
- ZipFile *zipf = opendir_in_zip (zipfile, is_system);
-
- if (zipf == NULL)
- return -2;
-
- if (!zipmember)
- return 0;
-
- len = strlen (zipmember);
-
- zipd = (struct ZipDirectory*) zipf->central_directory;
- for (i = 0; i < zipf->count; i++, zipd = ZIPDIR_NEXT (zipd))
- {
- if (len == zipd->filename_length &&
- strncmp (ZIPDIR_FILENAME (zipd), zipmember, len) == 0)
- {
- JCF_ZERO (jcf);
- jcf->buffer = ALLOC (zipd->size);
- jcf->buffer_end = jcf->buffer + zipd->size;
- jcf->read_ptr = jcf->buffer;
- jcf->read_end = jcf->buffer_end;
- jcf->filbuf = jcf_unexpected_eof;
- jcf->filename = strdup (zipfile);
- jcf->classname = strdup (zipmember);
- jcf->zipd = (void *)zipd;
- if (lseek (zipf->fd, zipd->filestart, 0) < 0
- || read (zipf->fd, jcf->buffer, zipd->size) != zipd->size)
- return -2;
- return 0;
- }
- }
- return -1;
-}
-
-#if JCF_USE_STDIO
-char*
-DEFUN(open_class, (filename, jcf, stream, dep_name),
- char *filename AND JCF *jcf AND FILE* stream AND const char *dep_name)
-{
- if (jcf)
- {
- if (dep_name != NULL)
- jcf_dependency_add_file (dep_name, 0);
- JCF_ZERO (jcf);
- jcf->buffer = NULL;
- jcf->buffer_end = NULL;
- jcf->read_ptr = NULL;
- jcf->read_end = NULL;
- jcf->read_state = stream;
- jcf->filbuf = jcf_filbuf_from_stdio;
- }
- else
- fclose (stream);
- return filename;
-}
-#else
-char*
-DEFUN(open_class, (filename, jcf, fd, dep_name),
- char *filename AND JCF *jcf AND int fd AND const char *dep_name)
-{
- if (jcf)
- {
- struct stat stat_buf;
- if (fstat (fd, &stat_buf) != 0
- || ! S_ISREG (stat_buf.st_mode))
- {
- perror ("Could not figure length of .class file");
- return NULL;
- }
- if (dep_name != NULL)
- jcf_dependency_add_file (dep_name, 0);
- JCF_ZERO (jcf);
- jcf->buffer = ALLOC (stat_buf.st_size);
- jcf->buffer_end = jcf->buffer + stat_buf.st_size;
- jcf->read_ptr = jcf->buffer;
- jcf->read_end = jcf->buffer_end;
- jcf->read_state = NULL;
- jcf->filename = filename;
- if (read (fd, jcf->buffer, stat_buf.st_size) != stat_buf.st_size)
- {
- perror ("Failed to read .class file");
- return NULL;
- }
- close (fd);
- jcf->filbuf = jcf_unexpected_eof;
- }
- else
- close (fd);
- return filename;
-}
-#endif
-
-
-char *
-DEFUN(find_classfile, (filename, jcf, dep_name),
- char *filename AND JCF *jcf AND const char *dep_name)
-{
-#if JCF_USE_STDIO
- FILE *stream = fopen (filename, "rb");
- if (stream == NULL)
- return NULL;
- return open_class (arg, jcf, stream, dep_name);
-#else
- int fd = open (filename, O_RDONLY | O_BINARY);
- if (fd < 0)
- return NULL;
- return open_class (filename, jcf, fd, dep_name);
-#endif
-}
-
-/* Returns a freshly malloc'd string with the fully qualified pathname
- of the .class file for the class CLASSNAME. Returns NULL on
- failure. If JCF != NULL, it is suitably initialized.
- SOURCE_OK is true if we should also look for .java file. */
-
-char *
-DEFUN(find_class, (classname, classname_length, jcf, source_ok),
- const char *classname AND int classname_length AND JCF *jcf AND int source_ok)
-
-{
-#if JCF_USE_STDIO
- FILE *stream;
-#else
- int fd;
-#endif
- int i, k, java = -1, class = -1;
- struct stat java_buf, class_buf;
- char *dep_file;
- void *entry;
- char *java_buffer;
-
- /* Allocate and zero out the buffer, since we don't explicitly put a
- null pointer when we're copying it below. */
- int buflen = jcf_path_max_len () + classname_length + 10;
- char *buffer = (char *) ALLOC (buflen);
- bzero (buffer, buflen);
-
- java_buffer = (char *) alloca (buflen);
-
- jcf->java_source = jcf->outofsynch = 0;
-
- for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
- {
- char *path_name = jcf_path_name (entry);
- if (class != 0)
- {
- int dir_len;
-
- strcpy (buffer, path_name);
- i = strlen (buffer);
-
- /* This is right because we know that `.zip' entries will have a
- trailing slash. See jcf-path.c. */
- dir_len = i - 1;
-
- for (k = 0; k < classname_length; k++, i++)
- {
- char ch = classname[k];
- buffer[i] = ch == '.' ? '/' : ch;
- }
- strcpy (buffer+i, ".class");
-
- if (jcf_path_is_zipfile (entry))
- {
- int err_code;
- JCF _jcf;
- buffer[dir_len] = '\0';
- SOURCE_FRONTEND_DEBUG
- (("Trying [...%s]:%s",
- &buffer[dir_len-(dir_len > 15 ? 15 : dir_len)],
- buffer+dir_len+1));
- if (jcf == NULL)
- jcf = &_jcf;
- err_code = open_in_zip (jcf, buffer, buffer+dir_len+1,
- jcf_path_is_system (entry));
- if (err_code == 0)
- {
- /* Should we check if .zip is out-of-date wrt .java? */
- buffer[dir_len] = '(';
- strcpy (buffer+i, ".class)");
- if (jcf == &_jcf)
- JCF_FINISH (jcf);
- return buffer;
- }
- else
- continue;
- }
- class = stat (buffer, &class_buf);
- }
-
- if (source_ok)
- {
- /* Compute name of .java file. */
- int l, m;
- strcpy (java_buffer, path_name);
- l = strlen (java_buffer);
- for (m = 0; m < classname_length; ++m)
- java_buffer[m + l] = (classname[m] == '.' ? '/' : classname[m]);
- strcpy (java_buffer + m + l, ".java");
- java = stat (java_buffer, &java_buf);
- if (java == 0)
- break;
- }
- }
-
- if (! java && ! class && java_buf.st_mtime >= class_buf.st_mtime)
- jcf->outofsynch = 1;
-
- if (! java)
- dep_file = java_buffer;
- else
- dep_file = buffer;
-#if JCF_USE_STDIO
- if (!class)
- {
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
- stream = fopen (buffer, "rb");
- if (stream)
- goto found;
- }
- /* Give .java a try, if necessary */
- if (!java)
- {
- strcpy (buffer, java_buffer);
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
- stream = fopen (buffer, "r");
- if (stream)
- {
- jcf->java_source = 1;
- goto found;
- }
- }
-#else
- if (!class)
- {
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
- fd = open (buffer, O_RDONLY | O_BINARY);
- if (fd >= 0)
- goto found;
- }
- /* Give .java a try, if necessary */
- if (!java)
- {
- strcpy (buffer, java_buffer);
- SOURCE_FRONTEND_DEBUG (("Trying %s", buffer));
- fd = open (buffer, O_RDONLY);
- if (fd >= 0)
- {
- jcf->java_source = 1;
- goto found;
- }
- }
-#endif
-
- free (buffer);
- return NULL;
- found:
-#if JCF_USE_STDIO
- if (jcf->java_source)
- return NULL; /* FIXME */
- else
- return open_class (buffer, jcf, stream, dep_file);
-#else
- if (jcf->java_source)
- {
- JCF_ZERO (jcf); /* JCF_FINISH relies on this */
- jcf->java_source = 1;
- jcf->filename = (char *) strdup (buffer);
- close (fd); /* We use STDIO for source file */
- }
- else
- buffer = open_class (buffer, jcf, fd, dep_file);
- jcf->classname = (char *) ALLOC (classname_length + 1);
- strncpy (jcf->classname, classname, classname_length + 1);
- jcf->classname = (char *) strdup (classname);
- return buffer;
-#endif
-}
-
-void
-DEFUN(jcf_print_char, (stream, ch),
- FILE *stream AND int ch)
-{
- switch (ch)
- {
- case '\'':
- case '\\':
- case '\"':
- fprintf (stream, "\\%c", ch);
- break;
- case '\n':
- fprintf (stream, "\\n");
- break;
- case '\t':
- fprintf (stream, "\\t");
- break;
- case '\r':
- fprintf (stream, "\\r");
- break;
- default:
- if (ch >= ' ' && ch < 127)
- putc (ch, stream);
- else if (ch < 256)
- fprintf (stream, "\\%03x", ch);
- else
- fprintf (stream, "\\u%04x", ch);
- }
-}
-
-/* Print UTF8 string at STR of length LENGTH bytes to STREAM. */
-
-void
-DEFUN(jcf_print_utf8, (stream, str, length),
- FILE *stream AND register const unsigned char *str AND int length)
-{
- const unsigned char * limit = str + length;
- while (str < limit)
- {
- int ch = UTF8_GET (str, limit);
- if (ch < 0)
- {
- fprintf (stream, "\\<invalid>");
- return;
- }
- jcf_print_char (stream, ch);
- }
-}
-
-/* Same as jcf_print_utf8, but print IN_CHAR as OUT_CHAR. */
-
-void
-DEFUN(jcf_print_utf8_replace, (stream, str, length, in_char, out_char),
- FILE *stream AND const unsigned char *str AND int length
- AND int in_char AND int out_char)
-{
-
- int i;/* FIXME - actually handle Unicode! */
- for (i = 0; i < length; i++)
- {
- int ch = str[i];
- jcf_print_char (stream, ch == in_char ? out_char : ch);
- }
-}
-
-/* Check that all the cross-references in the constant pool are
- valid. Returns 0 on success.
- Otherwise, returns the index of the (first) invalid entry. */
-
-int
-DEFUN(verify_constant_pool, (jcf),
- JCF *jcf)
-{
- int i, n;
- for (i = 1; i < JPOOL_SIZE (jcf); i++)
- {
- switch (JPOOL_TAG (jcf, i))
- {
- case CONSTANT_NameAndType:
- n = JPOOL_USHORT2 (jcf, i);
- if (n <= 0 || n >= JPOOL_SIZE(jcf)
- || JPOOL_TAG (jcf, n) != CONSTANT_Utf8)
- return i;
- /* ... fall through ... */
- case CONSTANT_Class:
- case CONSTANT_String:
- n = JPOOL_USHORT1 (jcf, i);
- if (n <= 0 || n >= JPOOL_SIZE(jcf)
- || JPOOL_TAG (jcf, n) != CONSTANT_Utf8)
- return i;
- break;
- case CONSTANT_Fieldref:
- case CONSTANT_Methodref:
- case CONSTANT_InterfaceMethodref:
- n = JPOOL_USHORT1 (jcf, i);
- if (n <= 0 || n >= JPOOL_SIZE(jcf)
- || JPOOL_TAG (jcf, n) != CONSTANT_Class)
- return i;
- n = JPOOL_USHORT2 (jcf, i);
- if (n <= 0 || n >= JPOOL_SIZE(jcf)
- || JPOOL_TAG (jcf, n) != CONSTANT_NameAndType)
- return i;
- break;
- case CONSTANT_Long:
- case CONSTANT_Double:
- i++;
- break;
- case CONSTANT_Float:
- case CONSTANT_Integer:
- case CONSTANT_Utf8:
- case CONSTANT_Unicode:
- break;
- default:
- return i;
- }
- }
- return 0;
-}
-
-void
-DEFUN(format_uint, (buffer, value, base),
- char *buffer AND uint64 value AND int base)
-{
-#define WRITE_BUF_SIZE (4 + sizeof(uint64) * 8)
- char buf[WRITE_BUF_SIZE];
- register char *buf_ptr = buf+WRITE_BUF_SIZE; /* End of buf. */
- int chars_written;
- int i;
-
- /* Now do the actual conversion, placing the result at the *end* of buf. */
- /* Note this code does not pretend to be optimized. */
- do {
- int digit = value % base;
- static char digit_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz";
- *--buf_ptr = digit_chars[digit];
- value /= base;
- } while (value != 0);
-
- chars_written = buf+WRITE_BUF_SIZE - buf_ptr;
- for (i = 0; i < chars_written; i++)
- buffer[i] = *buf_ptr++;
- buffer[i] = 0;
-}
-
-void
-DEFUN(format_int, (buffer, value, base),
- char *buffer AND jlong value AND int base)
-{
- uint64 abs_value;
- if (value < 0)
- {
- abs_value = -(uint64)value;
- *buffer++ = '-';
- }
- else
- abs_value = (uint64) value;
- format_uint (buffer, abs_value, base);
-}
diff --git a/gnu/dist/toolchain/gcc/java/jcf-parse.c b/gnu/dist/toolchain/gcc/java/jcf-parse.c
deleted file mode 100644
index 054c239ff72..00000000000
--- a/gnu/dist/toolchain/gcc/java/jcf-parse.c
+++ /dev/null
@@ -1,1061 +0,0 @@
-/* Parser for Java(TM) .class files.
- Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com> */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "obstack.h"
-#include "flags.h"
-#include "java-except.h"
-#include "input.h"
-#include "java-tree.h"
-#include "toplev.h"
-#include "parse.h"
-
-/* A CONSTANT_Utf8 element is converted to an IDENTIFIER_NODE at parse time. */
-#define JPOOL_UTF(JCF, INDEX) CPOOL_UTF(&(JCF)->cpool, INDEX)
-#define JPOOL_UTF_LENGTH(JCF, INDEX) IDENTIFIER_LENGTH (JPOOL_UTF (JCF, INDEX))
-#define JPOOL_UTF_DATA(JCF, INDEX) \
- ((unsigned char*) IDENTIFIER_POINTER (JPOOL_UTF (JCF, INDEX)))
-#define HANDLE_CONSTANT_Utf8(JCF, INDEX, LENGTH) \
- do { \
- unsigned char save; unsigned char *text; \
- JCF_FILL (JCF, (LENGTH)+1); /* Make sure we read 1 byte beyond string. */ \
- text = (JCF)->read_ptr; \
- save = text[LENGTH]; \
- text[LENGTH] = 0; \
- (JCF)->cpool.data[INDEX] = (jword) get_identifier (text); \
- text[LENGTH] = save; \
- JCF_SKIP (JCF, LENGTH); } while (0)
-
-#include "jcf.h"
-
-extern struct obstack *saveable_obstack;
-extern struct obstack temporary_obstack;
-extern struct obstack permanent_obstack;
-
-/* This is true if the user specified a `.java' file on the command
- line. Otherwise it is 0. FIXME: this is temporary, until our
- .java parser is fully working. */
-int saw_java_source = 0;
-
-/* The class we are currently processing. */
-tree current_class = NULL_TREE;
-
-/* The class we started with. */
-tree main_class = NULL_TREE;
-
-/* List of all class DECL seen so far. */
-tree all_class_list = NULL_TREE;
-
-/* The FIELD_DECL for the current field. */
-static tree current_field = NULL_TREE;
-
-/* The METHOD_DECL for the current method. */
-static tree current_method = NULL_TREE;
-
-/* The Java .class file that provides main_class; the main input file. */
-static struct JCF main_jcf[1];
-
-/* Declarations of some functions used here. */
-static tree give_name_to_class PROTO ((JCF *jcf, int index));
-static void parse_zip_file_entries PROTO ((void));
-static void process_zip_dir PROTO ((void));
-static void parse_source_file PROTO ((tree));
-static void jcf_parse_source PROTO ((void));
-static int jcf_figure_file_type PROTO ((JCF *));
-static int find_in_current_zip PROTO ((char *, struct JCF **));
-static void parse_class_file PROTO ((void));
-
-/* Handle "SourceFile" attribute. */
-
-void
-set_source_filename (jcf, index)
- JCF *jcf;
- int index;
-{
- tree sfname_id = get_name_constant (jcf, index);
- char *sfname = IDENTIFIER_POINTER (sfname_id);
- if (input_filename != NULL)
- {
- int old_len = strlen (input_filename);
- int new_len = IDENTIFIER_LENGTH (sfname_id);
- /* Use the current input_filename (derived from the class name)
- if it has a directory prefix, but otherwise matches sfname. */
- if (old_len > new_len
- && strcmp (sfname, input_filename + old_len - new_len) == 0
- && (input_filename[old_len - new_len - 1] == '/'
- || input_filename[old_len - new_len - 1] == '\\'))
- return;
- }
- input_filename = sfname;
- DECL_SOURCE_FILE (TYPE_NAME (current_class)) = sfname;
- if (current_class == main_class) main_input_filename = input_filename;
-}
-
-#define HANDLE_SOURCEFILE(INDEX) set_source_filename (jcf, INDEX)
-
-#define HANDLE_CLASS_INFO(ACCESS_FLAGS, THIS, SUPER, INTERFACES_COUNT) \
-{ tree super_class = SUPER==0 ? NULL_TREE : get_class_constant (jcf, SUPER); \
- current_class = give_name_to_class (jcf, THIS); \
- set_super_info (ACCESS_FLAGS, current_class, super_class, INTERFACES_COUNT);}
-
-#define HANDLE_CLASS_INTERFACE(INDEX) \
- add_interface (current_class, get_class_constant (jcf, INDEX))
-
-#define HANDLE_START_FIELD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
-{ int sig_index = SIGNATURE; \
- current_field = add_field (current_class, get_name_constant (jcf, NAME), \
- parse_signature (jcf, sig_index), ACCESS_FLAGS); \
- set_java_signature (TREE_TYPE (current_field), JPOOL_UTF (jcf, sig_index)); }
-
-#define HANDLE_END_FIELDS() \
- (current_field = NULL_TREE)
-
-#define HANDLE_CONSTANTVALUE(INDEX) \
-{ tree constant; int index = INDEX; \
- if (! flag_emit_class_files && JPOOL_TAG (jcf, index) == CONSTANT_String) { \
- tree name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index)); \
- constant = build_utf8_ref (name); \
- } \
- else \
- constant = get_constant (jcf, index); \
- set_constant_value (current_field, constant); }
-
-#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
- (current_method = add_method (current_class, ACCESS_FLAGS, \
- get_name_constant (jcf, NAME), \
- get_name_constant (jcf, SIGNATURE)), \
- DECL_LOCALVARIABLES_OFFSET (current_method) = 0, \
- DECL_LINENUMBERS_OFFSET (current_method) = 0)
-
-#define HANDLE_END_METHODS() \
-{ tree handle_type = CLASS_TO_HANDLE_TYPE (current_class); \
- if (handle_type != current_class) layout_type (handle_type); }
-
-#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
-{ DECL_MAX_STACK (current_method) = (MAX_STACK); \
- DECL_MAX_LOCALS (current_method) = (MAX_LOCALS); \
- DECL_CODE_LENGTH (current_method) = (CODE_LENGTH); \
- DECL_CODE_OFFSET (current_method) = JCF_TELL (jcf); }
-
-#define HANDLE_LOCALVARIABLETABLE_ATTRIBUTE(COUNT) \
-{ int n = (COUNT); \
- DECL_LOCALVARIABLES_OFFSET (current_method) = JCF_TELL (jcf) - 2; \
- JCF_SKIP (jcf, n * 10); }
-
-#define HANDLE_LINENUMBERTABLE_ATTRIBUTE(COUNT) \
-{ int n = (COUNT); \
- DECL_LINENUMBERS_OFFSET (current_method) = JCF_TELL (jcf) - 2; \
- JCF_SKIP (jcf, n * 4); }
-
-#define HANDLE_EXCEPTIONS_ATTRIBUTE(COUNT) \
-{ \
- int n = COUNT; \
- tree list = DECL_FUNCTION_THROWS (current_method); \
- while (--n >= 0) \
- { \
- tree thrown_class = get_class_constant (jcf, JCF_readu2 (jcf)); \
- list = tree_cons (NULL_TREE, thrown_class, list); \
- } \
- DECL_FUNCTION_THROWS (current_method) = nreverse (list); \
-}
-
-#include "jcf-reader.c"
-
-static int yydebug;
-
-tree
-parse_signature (jcf, sig_index)
- JCF *jcf;
- int sig_index;
-{
- if (sig_index <= 0 || sig_index >= JPOOL_SIZE(jcf)
- || JPOOL_TAG (jcf, sig_index) != CONSTANT_Utf8)
- fatal ("invalid field/method signature");
- else
- {
- return parse_signature_string (JPOOL_UTF_DATA (jcf, sig_index),
- JPOOL_UTF_LENGTH (jcf, sig_index));
- }
-}
-
-void
-init_lex ()
-{
- /* Make identifier nodes long enough for the language-specific slots. */
- set_identifier_size (sizeof (struct lang_identifier));
-}
-
-void
-set_yydebug (value)
- int value;
-{
- yydebug = value;
-}
-
-tree
-get_constant (jcf, index)
- JCF *jcf;
- int index;
-{
- tree value;
- int tag;
- if (index <= 0 || index >= JPOOL_SIZE(jcf))
- goto bad;
- tag = JPOOL_TAG (jcf, index);
- if ((tag & CONSTANT_ResolvedFlag) || tag == CONSTANT_Utf8)
- return (tree) jcf->cpool.data[index];
- push_obstacks (&permanent_obstack, &permanent_obstack);
- switch (tag)
- {
- case CONSTANT_Integer:
- {
- jint num = JPOOL_INT(jcf, index);
- value = build_int_2 (num, num < 0 ? -1 : 0);
- TREE_TYPE (value) = int_type_node;
- break;
- }
- case CONSTANT_Long:
- {
- jint num = JPOOL_INT (jcf, index);
- HOST_WIDE_INT lo, hi;
- lshift_double (num, 0, 32, 64, &lo, &hi, 0);
- num = JPOOL_INT (jcf, index+1);
- add_double (lo, hi, num, 0, &lo, &hi);
- value = build_int_2 (lo, hi);
- TREE_TYPE (value) = long_type_node;
- force_fit_type (value, 0);
- break;
- }
-#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
- case CONSTANT_Float:
- {
- jint num = JPOOL_INT(jcf, index);
- REAL_VALUE_TYPE d;
-#ifdef REAL_ARITHMETIC
- d = REAL_VALUE_FROM_TARGET_SINGLE (num);
-#else
- union { float f; jint i; } u;
- u.i = num;
- d = u.f;
-#endif
- value = build_real (float_type_node, d);
- break;
- }
- case CONSTANT_Double:
- {
- HOST_WIDE_INT num[2];
- REAL_VALUE_TYPE d;
- HOST_WIDE_INT lo, hi;
- num[0] = JPOOL_INT (jcf, index);
- lshift_double (num[0], 0, 32, 64, &lo, &hi, 0);
- num[0] = JPOOL_INT (jcf, index+1);
- add_double (lo, hi, num[0], 0, &lo, &hi);
- if (FLOAT_WORDS_BIG_ENDIAN)
- {
- num[0] = hi;
- num[1] = lo;
- }
- else
- {
- num[0] = lo;
- num[1] = hi;
- }
-#ifdef REAL_ARITHMETIC
- d = REAL_VALUE_FROM_TARGET_DOUBLE (num);
-#else
- {
- union { double d; jint i[2]; } u;
- u.i[0] = (jint) num[0];
- u.i[1] = (jint) num[1];
- d = u.d;
- }
-#endif
- value = build_real (double_type_node, d);
- break;
- }
-#endif /* TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT */
- case CONSTANT_String:
- {
- extern struct obstack *expression_obstack;
- tree name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index));
- char *utf8_ptr = IDENTIFIER_POINTER (name);
- unsigned char *str_ptr;
- int utf8_len = IDENTIFIER_LENGTH (name);
- unsigned char *str = (unsigned char*)utf8_ptr;
- int i = utf8_len;
- int str_len;
-
- /* Count the number of Unicode characters in the string,
- while checking for a malformed Utf8 string. */
- for (str_len = 0; i > 0; str_len++)
- {
- int char_len = UT8_CHAR_LENGTH (*str);
- if (char_len < 0 || char_len > 2 || char_len > i)
- fatal ("bad string constant");
- str += char_len;
- i -= char_len;
- }
-
- value = make_node (STRING_CST);
- TREE_TYPE (value) = build_pointer_type (string_type_node);
- TREE_STRING_LENGTH (value) = 2 * str_len;
- TREE_STRING_POINTER (value)
- = obstack_alloc (expression_obstack, 2 * str_len);
- str_ptr = (unsigned char *) TREE_STRING_POINTER (value);
- str = (unsigned char*)utf8_ptr;
- for (i = 0; i < str_len; i++)
- {
- int char_value;
- int char_len = UT8_CHAR_LENGTH (*str);
- switch (char_len)
- {
- case 1:
- char_value = *str++;
- break;
- case 2:
- char_value = *str++ & 0x1F;
- char_value = (char_value << 6) | (*str++ & 0x3F);
- break;
- case 3:
- char_value = *str_ptr++ & 0x0F;
- char_value = (char_value << 6) | (*str++ & 0x3F);
- char_value = (char_value << 6) | (*str++ & 0x3F);
- break;
- default:
- goto bad;
- }
- if (BYTES_BIG_ENDIAN)
- {
- *str_ptr++ = char_value >> 8;
- *str_ptr++ = char_value & 0xFF;
- }
- else
- {
- *str_ptr++ = char_value & 0xFF;
- *str_ptr++ = char_value >> 8;
- }
- }
- }
- break;
- default:
- goto bad;
- }
- pop_obstacks ();
- JPOOL_TAG(jcf, index) = tag | CONSTANT_ResolvedFlag;
- jcf->cpool.data [index] = (jword) value;
- return value;
- bad:
- fatal ("bad value constant type %d, index %d",
- JPOOL_TAG( jcf, index ), index);
-}
-
-tree
-get_name_constant (jcf, index)
- JCF *jcf;
- int index;
-{
- tree name = get_constant (jcf, index);
- if (TREE_CODE (name) != IDENTIFIER_NODE)
- fatal ("bad nameandtype index %d", index);
- return name;
-}
-
-static tree
-give_name_to_class (jcf, i)
- JCF *jcf;
- int i;
-{
- if (i <= 0 || i >= JPOOL_SIZE(jcf)
- || JPOOL_TAG (jcf, i) != CONSTANT_Class)
- fatal ("bad class index %d", i);
- else
- {
- tree this_class;
- int j = JPOOL_USHORT1 (jcf, i);
- /* verify_constant_pool confirmed that j is a CONSTANT_Utf8. */
- tree class_name = unmangle_classname (JPOOL_UTF_DATA (jcf, j),
- JPOOL_UTF_LENGTH (jcf, j));
- this_class = lookup_class (class_name);
- input_filename = DECL_SOURCE_FILE (TYPE_NAME (this_class));
- lineno = 0;
- if (main_input_filename == NULL && jcf == main_jcf)
- main_input_filename = input_filename;
-
- jcf->cpool.data[i] = (jword) this_class;
- JPOOL_TAG (jcf, i) = CONSTANT_ResolvedClass;
- return this_class;
- }
-}
-
-/* Get the class of the CONSTANT_Class whose constant pool index is I. */
-
-tree
-get_class_constant (JCF *jcf , int i)
-{
- tree type;
- if (i <= 0 || i >= JPOOL_SIZE(jcf)
- || (JPOOL_TAG (jcf, i) & ~CONSTANT_ResolvedFlag) != CONSTANT_Class)
- fatal ("bad class index %d", i);
-
- if (JPOOL_TAG (jcf, i) != CONSTANT_ResolvedClass)
- {
- int name_index = JPOOL_USHORT1 (jcf, i);
- /* verify_constant_pool confirmed that name_index is a CONSTANT_Utf8. */
- char *name = JPOOL_UTF_DATA (jcf, name_index);
- int nlength = JPOOL_UTF_LENGTH (jcf, name_index);
- if (name[0] == '[') /* Handle array "classes". */
- type = TREE_TYPE (parse_signature_string (name, nlength));
- else
- {
- tree cname = unmangle_classname (name, nlength);
- type = lookup_class (cname);
- }
- jcf->cpool.data[i] = (jword) type;
- JPOOL_TAG (jcf, i) = CONSTANT_ResolvedClass;
- }
- else
- type = (tree) jcf->cpool.data[i];
- return type;
-}
-
-void
-DEFUN(jcf_out_of_synch, (jcf),
- JCF *jcf)
-{
- char *source = strdup (jcf->filename);
- int i = strlen (source);
-
- while (source[i] != '.')
- i--;
-
- source [i] = '\0';
- warning ("Class file `%s' out of synch with `%s.java'",
- jcf->filename, source);
- free (source);
-}
-
-/* Read a class with the fully qualified-name NAME.
- Return 1 iff we read the requested file.
- (It is still possible we failed if the file did not
- define the class it is supposed to.) */
-
-int
-read_class (name)
- tree name;
-{
- JCF this_jcf, *jcf;
- tree save_current_class = current_class;
- char *save_input_filename = input_filename;
- JCF *save_current_jcf = current_jcf;
- long saved_pos = 0;
- if (current_jcf->read_state)
- saved_pos = ftell (current_jcf->read_state);
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- /* Search in current zip first. */
- if (find_in_current_zip (IDENTIFIER_POINTER (name), &jcf) == 0)
- /* FIXME: until the `.java' parser is fully working, we only
- look for a .java file when one was mentioned on the
- command line. This lets us test the .java parser fairly
- easily, without compromising our ability to use the
- .class parser without fear. */
- if (find_class (IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name),
- &this_jcf, saw_java_source) == 0)
- {
- pop_obstacks (); /* FIXME: one pop_obstack() per function */
- return 0;
- }
- else
- {
- this_jcf.seen_in_zip = 0;
- current_jcf = &this_jcf;
- if (this_jcf.outofsynch)
- jcf_out_of_synch (current_jcf);
- }
- else
- current_jcf = jcf;
-
- if (current_jcf->java_source)
- jcf_parse_source ();
- else {
- java_parser_context_save_global ();
- java_push_parser_context ();
- input_filename = current_jcf->filename;
- jcf_parse (current_jcf);
- java_pop_parser_context (0);
- java_parser_context_restore_global ();
- }
-
- if (!current_jcf->seen_in_zip)
- JCF_FINISH (current_jcf);
- pop_obstacks ();
-
- current_class = save_current_class;
- input_filename = save_input_filename;
- current_jcf = save_current_jcf;
- if (current_jcf->read_state)
- fseek (current_jcf->read_state, saved_pos, SEEK_SET);
- return 1;
-}
-
-/* Load CLASS_OR_NAME. CLASS_OR_NAME can be a mere identifier if
- called from the parser, otherwise it's a RECORD_TYPE node. If
- VERBOSE is 1, print error message on failure to load a class. */
-
-/* Replace calls to load_class by having callers call read_class directly
- - and then perhaps rename read_class to load_class. FIXME */
-
-void
-load_class (class_or_name, verbose)
- tree class_or_name;
- int verbose;
-{
- tree name;
-
- /* class_or_name can be the name of the class we want to load */
- if (TREE_CODE (class_or_name) == IDENTIFIER_NODE)
- name = class_or_name;
- /* In some cases, it's a dependency that we process earlier that
- we though */
- else if (TREE_CODE (class_or_name) == TREE_LIST)
- name = TYPE_NAME (TREE_PURPOSE (class_or_name));
- /* Or it's a type in the making */
- else
- name = DECL_NAME (TYPE_NAME (class_or_name));
-
- if (read_class (name) == 0 && verbose)
- {
- error ("Cannot find file for class %s.",
- IDENTIFIER_POINTER (name));
- if (TREE_CODE (class_or_name) == RECORD_TYPE)
- TYPE_SIZE (class_or_name) = error_mark_node;
-#if 0
- /* FIXME: what to do here? */
- if (!strcmp (classpath, DEFAULT_CLASS_PATH))
- fatal ("giving up");
-#endif
- return;
- }
-}
-
-/* Parse a source file when JCF refers to a source file. */
-
-static void
-jcf_parse_source ()
-{
- tree file;
-
- java_parser_context_save_global ();
- java_push_parser_context ();
- input_filename = current_jcf->filename;
- file = get_identifier (input_filename);
- if (!HAS_BEEN_ALREADY_PARSED_P (file))
- {
- if (!(finput = fopen (input_filename, "r")))
- fatal ("input file `%s' just disappeared - jcf_parse_source",
- input_filename);
- parse_source_file (file);
- if (fclose (finput))
- fatal ("can't close input file `%s' stream - jcf_parse_source",
- input_filename);
- }
- java_pop_parser_context (IS_A_COMMAND_LINE_FILENAME_P (file));
- java_parser_context_restore_global ();
-}
-
-/* Parse the .class file JCF. */
-
-void
-jcf_parse (jcf)
- JCF* jcf;
-{
- int i, code;
-
- if (jcf_parse_preamble (jcf) != 0)
- fatal ("Not a valid Java .class file.\n");
- code = jcf_parse_constant_pool (jcf);
- if (code != 0)
- fatal ("error while parsing constant pool");
- code = verify_constant_pool (jcf);
- if (code > 0)
- fatal ("error in constant pool entry #%d\n", code);
-
- jcf_parse_class (jcf);
- if (main_class == NULL_TREE)
- main_class = current_class;
- if (! quiet_flag && TYPE_NAME (current_class))
- fprintf (stderr, " class %s",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- if (CLASS_LOADED_P (current_class))
- return;
- CLASS_LOADED_P (current_class) = 1;
-
- for (i = 1; i < JPOOL_SIZE(jcf); i++)
- {
- switch (JPOOL_TAG (jcf, i))
- {
- case CONSTANT_Class:
- get_class_constant (jcf, i);
- break;
- }
- }
-
- code = jcf_parse_fields (jcf);
- if (code != 0)
- fatal ("error while parsing fields");
- code = jcf_parse_methods (jcf);
- if (code != 0)
- fatal ("error while parsing methods");
- code = jcf_parse_final_attributes (jcf);
- if (code != 0)
- fatal ("error while parsing final attributes");
-
- /* The fields of class_type_node are already in correct order. */
- if (current_class != class_type_node && current_class != object_type_node)
- TYPE_FIELDS (current_class) = nreverse (TYPE_FIELDS (current_class));
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- layout_class (current_class);
- if (current_class == object_type_node)
- layout_class_methods (object_type_node);
- else
- all_class_list = tree_cons (NULL_TREE,
- TYPE_NAME (current_class), all_class_list );
- pop_obstacks ();
-}
-
-void
-init_outgoing_cpool ()
-{
- current_constant_pool_data_ref = NULL_TREE;
- if (outgoing_cpool == NULL)
- {
- static CPool outgoing_cpool_buffer;
- outgoing_cpool = &outgoing_cpool_buffer;
- CPOOL_INIT(outgoing_cpool);
- }
- else
- {
- CPOOL_REINIT(outgoing_cpool);
- }
-}
-
-static void
-parse_class_file ()
-{
- tree method;
- char *save_input_filename = input_filename;
- int save_lineno = lineno;
-
- java_layout_seen_class_methods ();
-
- input_filename = DECL_SOURCE_FILE (TYPE_NAME (current_class));
- lineno = 0;
- debug_start_source_file (input_filename);
- init_outgoing_cpool ();
-
- for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- JCF *jcf = current_jcf;
-
- if (METHOD_NATIVE (method) || METHOD_ABSTRACT (method))
- continue;
-
- if (DECL_CODE_OFFSET (method) == 0)
- {
- error ("missing Code attribute");
- continue;
- }
-
- lineno = 0;
- if (DECL_LINENUMBERS_OFFSET (method))
- {
- register int i;
- register unsigned char *ptr;
- JCF_SEEK (jcf, DECL_LINENUMBERS_OFFSET (method));
- linenumber_count = i = JCF_readu2 (jcf);
- linenumber_table = ptr = jcf->read_ptr;
-
- for (ptr += 2; --i >= 0; ptr += 4)
- {
- int line = GET_u2 (ptr);
- /* Set initial lineno lineno to smallest linenumber.
- * Needs to be set before init_function_start. */
- if (lineno == 0 || line < lineno)
- lineno = line;
- }
- }
- else
- {
- linenumber_table = NULL;
- linenumber_count = 0;
- }
-
- start_java_method (method);
-
- give_name_to_locals (jcf);
-
- /* Actually generate code. */
- expand_byte_code (jcf, method);
-
- end_java_method ();
- }
-
- if (flag_emit_class_files)
- write_classfile (current_class);
-
- finish_class (current_class);
-
- debug_end_source_file (save_lineno);
- input_filename = save_input_filename;
- lineno = save_lineno;
-}
-
-/* Parse a source file, as pointed by the current value of INPUT_FILENAME. */
-
-static void
-parse_source_file (file)
- tree file;
-{
- int save_error_count = java_error_count;
- /* Mark the file as parsed */
- HAS_BEEN_ALREADY_PARSED_P (file) = 1;
-
- lang_init_source (1); /* Error msgs have no method prototypes */
-
- java_init_lex (); /* Initialize the parser */
- java_parse_abort_on_error ();
-
- java_parse (); /* Parse and build partial tree nodes. */
- java_parse_abort_on_error ();
- java_complete_class (); /* Parse unsatisfied class decl. */
- java_parse_abort_on_error ();
- java_check_circular_reference (); /* Check on circular references */
- java_parse_abort_on_error ();
-}
-
-static int
-predefined_filename_p (node)
- tree node;
-{
- int i;
- for (i = 0; i < predef_filenames_size; i++)
- if (predef_filenames [i] == node)
- return 1;
- return 0;
-}
-
-int
-yyparse ()
-{
- int several_files = 0;
- char *list = strdup (input_filename), *next;
- tree node, current_file_list = NULL_TREE;
-
- do
- {
- next = strchr (list, '&');
- if (next)
- {
- *next++ = '\0';
- several_files = 1;
- }
-
- if (list[0])
- {
- char *value;
- tree id;
- int twice = 0;
-
- int len = strlen (list);
- /* FIXME: this test is only needed until our .java parser is
- fully capable. */
- if (len > 5 && ! strcmp (&list[len - 5], ".java"))
- saw_java_source = 1;
-
- if (*list != '/' && several_files)
- obstack_grow (&temporary_obstack, "./", 2);
-
- obstack_grow0 (&temporary_obstack, list, len);
- value = obstack_finish (&temporary_obstack);
-
- /* Exclude file that we see twice on the command line. For
- all files except {Class,Error,Object,RuntimeException,String,
- Throwable}.java we can rely on maybe_get_identifier. For
- these files, we need to do a linear search of
- current_file_list. This search happens only for these
- files, presumably only when we're recompiling libgcj. */
-
- if ((id = maybe_get_identifier (value)))
- {
- if (predefined_filename_p (id))
- {
- tree c;
- for (c = current_file_list; c; c = TREE_CHAIN (c))
- if (TREE_VALUE (c) == id)
- twice = 1;
- }
- else
- twice = 1;
- }
-
- if (twice)
- {
- char *saved_input_filename = input_filename;
- input_filename = value;
- warning ("source file seen twice on command line and will be "
- "compiled only once.");
- input_filename = saved_input_filename;
- }
- else
- {
- node = get_identifier (value);
- IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
- current_file_list = tree_cons (NULL_TREE, node,
- current_file_list);
- }
- }
- list = next;
- }
- while (next);
-
- current_jcf = main_jcf;
- current_file_list = nreverse (current_file_list);
- for (node = current_file_list; node; node = TREE_CHAIN (node))
- {
- tree name = TREE_VALUE (node);
-
- /* Skip already parsed files */
- if (HAS_BEEN_ALREADY_PARSED_P (name))
- continue;
-
- /* Close previous descriptor, if any */
- if (main_jcf->read_state && fclose (main_jcf->read_state))
- fatal ("failed to close input file `%s' - yyparse",
- (main_jcf->filename ? main_jcf->filename : "<unknown>"));
-
- /* Set jcf up and open a new file */
- JCF_ZERO (main_jcf);
- main_jcf->read_state = fopen (IDENTIFIER_POINTER (name), "rb");
- if (main_jcf->read_state == NULL)
- pfatal_with_name (IDENTIFIER_POINTER (name));
-
- /* Set new input_filename and finput */
- finput = main_jcf->read_state;
-#ifdef IO_BUFFER_SIZE
- setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE),
- _IOFBF, IO_BUFFER_SIZE);
-#endif
- input_filename = IDENTIFIER_POINTER (name);
- main_jcf->filbuf = jcf_filbuf_from_stdio;
-
- switch (jcf_figure_file_type (current_jcf))
- {
- case JCF_ZIP:
- parse_zip_file_entries ();
- break;
- case JCF_CLASS:
- jcf_parse (current_jcf);
- parse_class_file ();
- break;
- case JCF_SOURCE:
- java_push_parser_context ();
- java_parser_context_save_global ();
- parse_source_file (name);
- java_parser_context_restore_global ();
- java_pop_parser_context (1);
- break;
- }
- }
-
- java_expand_classes ();
- if (!java_report_errors () && !flag_syntax_only)
- emit_register_classes ();
- return 0;
-}
-
-static struct ZipFileCache *localToFile;
-
-/* Process all class entries found in the zip file. */
-static void
-parse_zip_file_entries (void)
-{
- struct ZipDirectory *zdir;
- int i;
-
- for (i = 0, zdir = (ZipDirectory *)localToFile->z.central_directory;
- i < localToFile->z.count; i++, zdir = ZIPDIR_NEXT (zdir))
- {
- tree class;
-
- /* We don't need to consider those files. */
- if (!zdir->size || !zdir->filename_offset)
- continue;
-
- class = lookup_class (get_identifier (ZIPDIR_FILENAME (zdir)));
- current_jcf = TYPE_LANG_SPECIFIC (class)->jcf;
- current_class = class;
-
- if ( !CLASS_LOADED_P (class))
- {
- fseek (current_jcf->read_state, current_jcf->zip_offset, SEEK_SET);
- jcf_parse (current_jcf);
- }
-
- if (TYPE_SIZE (current_class) != error_mark_node)
- {
- input_filename = current_jcf->filename;
- parse_class_file ();
- FREE (current_jcf->buffer); /* No longer necessary */
- /* Note: there is a way to free this buffer right after a
- class seen in a zip file has been parsed. The idea is the
- set its jcf in such a way that buffer will be reallocated
- the time the code for the class will be generated. FIXME. */
- }
- }
-}
-
-/* Read all the entries of the zip file, creates a class and a JCF. Sets the
- jcf up for further processing and link it to the created class. */
-
-static void process_zip_dir()
-{
- int i;
- ZipDirectory *zdir;
-
- for (i = 0, zdir = (ZipDirectory *)localToFile->z.central_directory;
- i < localToFile->z.count; i++, zdir = ZIPDIR_NEXT (zdir))
- {
- char *class_name, *file_name, *class_name_in_zip_dir;
- tree class;
- JCF *jcf;
- int j;
-
- class_name_in_zip_dir = ZIPDIR_FILENAME (zdir);
-
- /* We choose to not to process entries with a zero size or entries
- not bearing the .class extention. */
- if (!zdir->size || !zdir->filename_offset ||
- strncmp (&class_name_in_zip_dir[zdir->filename_length-6],
- ".class", 6))
- {
- /* So it will be skipped in parse_zip_file_entries */
- zdir->size = 0;
- continue;
- }
-
- class_name = ALLOC (zdir->filename_length+1-6);
- file_name = ALLOC (zdir->filename_length+1);
- jcf = ALLOC (sizeof (JCF));
- JCF_ZERO (jcf);
-
- strncpy (class_name, class_name_in_zip_dir, zdir->filename_length-6);
- class_name [zdir->filename_length-6] = '\0';
- strncpy (file_name, class_name_in_zip_dir, zdir->filename_length);
- file_name [zdir->filename_length] = '\0';
-
- for (j=0; class_name[j]; j++)
- class_name [j] = (class_name [j] == '/' ? '.' : class_name [j]);
-
- /* Yes, we write back the true class name into the zip directory. */
- strcpy (class_name_in_zip_dir, class_name);
- zdir->filename_length = j;
- class = lookup_class (get_identifier (class_name));
-
- jcf->read_state = finput;
- jcf->filbuf = jcf_filbuf_from_stdio;
- jcf->seen_in_zip = 1;
- jcf->java_source = 0;
- jcf->zip_offset = zdir->filestart;
- jcf->classname = class_name;
- jcf->filename = file_name;
-
- TYPE_LANG_SPECIFIC (class) =
- (struct lang_type *) perm_calloc (1, sizeof (struct lang_type));
- TYPE_LANG_SPECIFIC (class)->jcf = jcf;
- }
-}
-
-/* Lookup class NAME and figure whether is a class already found in the current
- zip file. */
-static int
-DEFUN(find_in_current_zip, (name, length, jcf),
- char *name AND JCF **jcf)
-{
- JCF *local_jcf;
- tree class_name = maybe_get_identifier (name), class, icv;
-
- if (!class_name)
- return 0;
-
- if (!(icv = IDENTIFIER_CLASS_VALUE (class_name)))
- return 0;
-
- class = TREE_TYPE (icv);
-
- /* Doesn't have jcf specific info ? It's not ours */
- if (!TYPE_LANG_SPECIFIC (class) || !TYPE_LANG_SPECIFIC (class)->jcf)
- return 0;
-
- *jcf = local_jcf = TYPE_LANG_SPECIFIC (class)->jcf;
- fseek (local_jcf->read_state, local_jcf->zip_offset, SEEK_SET);
- return 1;
-}
-
-/* Figure what kind of file we're dealing with */
-static int
-DEFUN(jcf_figure_file_type, (jcf),
- JCF *jcf)
-{
- unsigned char magic_string[4];
- uint32 magic;
-
- if (fread (magic_string, 1, 4, jcf->read_state) != 4)
- jcf_unexpected_eof (jcf, 4);
-
- fseek (jcf->read_state, 0L, SEEK_SET);
- magic = GET_u4 (magic_string);
-
- if (magic == 0xcafebabe)
- return JCF_CLASS;
-
- /* FIXME: is it a system file? */
- if (magic == (JCF_u4)ZIPMAGIC
- && !open_in_zip (jcf, input_filename, NULL, 0))
- {
- localToFile = ALLOC (sizeof (struct ZipFileCache));
- bcopy ((PTR) SeenZipFiles, (PTR) localToFile, sizeof (struct ZipFileCache));
- process_zip_dir (); /* Register all the class defined there */
- return JCF_ZIP;
- }
-
- return JCF_SOURCE;
-}
-
diff --git a/gnu/dist/toolchain/gcc/java/jcf-path.c b/gnu/dist/toolchain/gcc/java/jcf-path.c
deleted file mode 100644
index 67dd02e2fff..00000000000
--- a/gnu/dist/toolchain/gcc/java/jcf-path.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/* Handle CLASSPATH, -classpath, and path searching.
-
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Tom Tromey <tromey@cygnus.com>, October 1998. */
-
-#include "config.h"
-#include "system.h"
-
-#include "jcf.h"
-
-/* Some boilerplate that really belongs in a header. */
-
-#ifndef GET_ENV_PATH_LIST
-#define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0)
-#endif
-
-/* By default, colon separates directories in a path. */
-#ifndef PATH_SEPARATOR
-#define PATH_SEPARATOR ':'
-#endif
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-
-
-/* Possible flag values. */
-#define FLAG_SYSTEM 1
-#define FLAG_ZIP 2
-
-/* We keep linked lists of directory names. A ``directory'' can be
- either an ordinary directory or a .zip file. */
-struct entry
-{
- char *name;
- int flags;
- struct entry *next;
-};
-
-/* We support several different ways to set the class path.
-
- built-in system directory (only libgcj.zip)
- CLASSPATH environment variable
- -CLASSPATH overrides CLASSPATH
- -classpath option - overrides CLASSPATH, -CLASSPATH, and built-in
- -I prepends path to list
-
- We implement this by keeping several path lists, and then simply
- ignoring the ones which are not relevant. */
-
-/* This holds all the -I directories. */
-static struct entry *include_dirs;
-
-/* This holds the CLASSPATH environment variable. */
-static struct entry *classpath_env;
-
-/* This holds the -CLASSPATH command-line option. */
-static struct entry *classpath_u;
-
-/* This holds the -classpath command-line option. */
-static struct entry *classpath_l;
-
-/* This holds the default directories. Some of these will have the
- "system" flag set. */
-static struct entry *sys_dirs;
-
-/* This is the sealed list. It is just a combination of other lists. */
-static struct entry *sealed;
-
-/* We keep track of the longest path we've seen. */
-static int longest_path = 0;
-
-
-
-static void
-free_entry (entp)
- struct entry **entp;
-{
- struct entry *e, *n;
-
- for (e = *entp; e; e = n)
- {
- n = e->next;
- free (e->name);
- free (e);
- }
- *entp = NULL;
-}
-
-static void
-append_entry (entp, ent)
- struct entry **entp;
- struct entry *ent;
-{
- /* It doesn't matter if this is slow, since it is run only at
- startup, and then infrequently. */
- struct entry *e;
-
- /* Find end of list. */
- for (e = *entp; e && e->next; e = e->next)
- ;
-
- if (e)
- e->next = ent;
- else
- *entp = ent;
-}
-
-static void
-add_entry (entp, filename, is_system)
- struct entry **entp;
- char *filename;
- int is_system;
-{
- int len;
- struct entry *n;
-
- n = (struct entry *) ALLOC (sizeof (struct entry));
- n->flags = is_system ? FLAG_SYSTEM : 0;
- n->next = NULL;
-
- len = strlen (filename);
- if (len > 4 && (strcmp (filename + len - 4, ".zip") == 0
- || strcmp (filename + len - 4, ".jar") == 0))
- {
- n->flags |= FLAG_ZIP;
- /* If the user uses -classpath then he'll have to include
- libgcj.zip in the value. We check for this in a simplistic
- way. Symlinks will fool this test. This is only used for
- -MM and -MMD, so it probably isn't terribly important. */
- if (! strcmp (filename, LIBGCJ_ZIP_FILE))
- n->flags |= FLAG_SYSTEM;
- }
-
- /* Note that we add a trailing separator to `.zip' names as well.
- This is a little hack that lets the searching code in jcf-io.c
- work more easily. Eww. */
- if (filename[len - 1] != '/' && filename[len - 1] != DIR_SEPARATOR)
- {
- char *f2 = (char *) alloca (len + 2);
- strcpy (f2, filename);
- f2[len] = DIR_SEPARATOR;
- f2[len + 1] = '\0';
- n->name = strdup (f2);
- ++len;
- }
- else
- n->name = strdup (filename);
-
- if (len > longest_path)
- longest_path = len;
-
- append_entry (entp, n);
-}
-
-static void
-add_path (entp, cp, is_system)
- struct entry **entp;
- char *cp;
- int is_system;
-{
- char *startp, *endp;
-
- if (cp)
- {
- char *buf = (char *) alloca (strlen (cp) + 3);
- startp = endp = cp;
- while (1)
- {
- if (! *endp || *endp == PATH_SEPARATOR)
- {
- if (endp == startp)
- {
- buf[0] = '.';
- buf[1] = DIR_SEPARATOR;
- buf[2] = '\0';
- }
- else
- {
- strncpy (buf, startp, endp - startp);
- buf[endp - startp] = '\0';
- }
- add_entry (entp, buf, is_system);
- if (! *endp)
- break;
- ++endp;
- startp = endp;
- }
- else
- ++endp;
- }
- }
-}
-
-/* Initialize the path module. */
-void
-jcf_path_init ()
-{
- char *cp;
-
- add_entry (&sys_dirs, ".", 0);
- add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1);
-
- GET_ENV_PATH_LIST (cp, "CLASSPATH");
- add_path (&classpath_env, cp, 0);
-}
-
-/* Call this when -classpath is seen on the command line. */
-void
-jcf_path_classpath_arg (path)
- char *path;
-{
- free_entry (&classpath_l);
- add_path (&classpath_l, path, 0);
-}
-
-/* Call this when -CLASSPATH is seen on the command line. */
-void
-jcf_path_CLASSPATH_arg (path)
- char *path;
-{
- free_entry (&classpath_u);
- add_path (&classpath_u, path, 0);
-}
-
-/* Call this when -I is seen on the command line. */
-void
-jcf_path_include_arg (path)
- char *path;
-{
- add_entry (&include_dirs, path, 0);
-}
-
-/* We `seal' the path by linking everything into one big list. Then
- we provide a way to iterate through the sealed list. */
-void
-jcf_path_seal ()
-{
- int do_system = 1;
- struct entry *secondary;
-
- sealed = include_dirs;
- include_dirs = NULL;
-
- if (classpath_l)
- {
- secondary = classpath_l;
- classpath_l = NULL;
- do_system = 0;
- }
- else if (classpath_u)
- {
- secondary = classpath_u;
- classpath_u = NULL;
- }
- else
- {
- secondary = classpath_env;
- classpath_env = NULL;
- }
-
- free_entry (&classpath_l);
- free_entry (&classpath_u);
- free_entry (&classpath_env);
-
- append_entry (&sealed, secondary);
-
- if (do_system)
- {
- append_entry (&sealed, sys_dirs);
- sys_dirs = NULL;
- }
- else
- free_entry (&sys_dirs);
-}
-
-void *
-jcf_path_start ()
-{
- return (void *) sealed;
-}
-
-void *
-jcf_path_next (x)
- void *x;
-{
- struct entry *ent = (struct entry *) x;
- return (void *) ent->next;
-}
-
-/* We guarantee that the return path will either be a zip file, or it
- will end with a directory separator. */
-char *
-jcf_path_name (x)
- void *x;
-{
- struct entry *ent = (struct entry *) x;
- return ent->name;
-}
-
-int
-jcf_path_is_zipfile (x)
- void *x;
-{
- struct entry *ent = (struct entry *) x;
- return (ent->flags & FLAG_ZIP);
-}
-
-int
-jcf_path_is_system (x)
- void *x;
-{
- struct entry *ent = (struct entry *) x;
- return (ent->flags & FLAG_SYSTEM);
-}
-
-int
-jcf_path_max_len ()
-{
- return longest_path;
-}
diff --git a/gnu/dist/toolchain/gcc/java/jcf-reader.c b/gnu/dist/toolchain/gcc/java/jcf-reader.c
deleted file mode 100644
index c6207a235c9..00000000000
--- a/gnu/dist/toolchain/gcc/java/jcf-reader.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* This file read a Java(TM) .class file.
- It is not stand-alone: It depends on tons of macros, and the
- intent is you #include this file after you've defined the macros.
-
- Copyright (C) 1996 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#include "jcf.h"
-#include "zipfile.h"
-
-int
-DEFUN(get_attribute, (jcf),
- JCF *jcf)
-{
- uint16 attribute_name = (JCF_FILL (jcf, 6), JCF_readu2 (jcf));
- uint32 attribute_length = JCF_readu4 (jcf);
- uint32 start_pos = JCF_TELL(jcf);
- int name_length;
- unsigned char *name_data;
- JCF_FILL (jcf, (long) attribute_length);
- if (attribute_name <= 0 || attribute_name >= JPOOL_SIZE(jcf))
- return -2;
- if (JPOOL_TAG (jcf, attribute_name) != CONSTANT_Utf8)
- return -2;
- name_length = JPOOL_UTF_LENGTH (jcf, attribute_name);
- name_data = JPOOL_UTF_DATA (jcf, attribute_name);
-
-#ifdef IGNORE_ATTRIBUTE
- if (IGNORE_ATTRIBUTE (jcf, attribute_name, attribute_length))
- {
- JCF_SKIP (jcf, attribute_length);
- }
- else
-#endif
-#ifdef HANDLE_SOURCEFILE
- if (name_length == 10 && memcmp (name_data, "SourceFile", 10) == 0)
- {
- uint16 sourcefile_index = JCF_readu2 (jcf);
- HANDLE_SOURCEFILE(sourcefile_index);
- }
- else
-#endif
-#ifdef HANDLE_CONSTANTVALUE
- if (name_length == 13 && memcmp (name_data, "ConstantValue", 13) == 0)
- {
- uint16 constantvalue_index = JCF_readu2 (jcf);
- if (constantvalue_index <= 0 || constantvalue_index >= JPOOL_SIZE(jcf))
- return -2;
- HANDLE_CONSTANTVALUE(constantvalue_index);
- }
- else
-#endif
-#ifdef HANDLE_CODE_ATTRIBUTE
- if (name_length == 4 && memcmp (name_data, "Code", 4) == 0)
- {
- uint16 j;
- uint16 max_stack ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
- uint16 max_locals ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
- uint32 code_length = JCF_readu4 (jcf);
- uint16 exception_table_length, attributes_count;
- if (code_length + 12 > attribute_length)
- return -1;
- HANDLE_CODE_ATTRIBUTE(max_stack, max_locals, code_length);
- JCF_SKIP (jcf, code_length);
- exception_table_length = JCF_readu2 (jcf);
- if (code_length + 8 * exception_table_length + 12 > attribute_length)
- return -1;
-#ifdef HANDLE_EXCEPTION_TABLE
- HANDLE_EXCEPTION_TABLE (jcf->read_ptr, exception_table_length);
-#endif
- JCF_SKIP (jcf, 2 * 4 * exception_table_length);
- attributes_count = JCF_readu2 (jcf);
- for (j = 0; j < attributes_count; j++)
- {
- int code = get_attribute (jcf);
- if (code != 0)
- return code;
- }
- }
- else
-#endif /* HANDLE_CODE_ATTRIBUTE */
-#ifdef HANDLE_EXCEPTIONS_ATTRIBUTE
- if (name_length == 10 && memcmp (name_data, "Exceptions", 10) == 0)
- {
- uint16 count = JCF_readu2 (jcf);
- HANDLE_EXCEPTIONS_ATTRIBUTE (count);
- }
- else
-#endif
-#ifdef HANDLE_LINENUMBERTABLE_ATTRIBUTE
- if (name_length == 15 && memcmp (name_data, "LineNumberTable", 15) == 0)
- {
- uint16 count = JCF_readu2 (jcf);
- HANDLE_LINENUMBERTABLE_ATTRIBUTE (count);
- }
- else
-#endif
-#ifdef HANDLE_LOCALVARIABLETABLE_ATTRIBUTE
- if (name_length == 18 && memcmp (name_data, "LocalVariableTable", 18) == 0)
- {
- uint16 count = JCF_readu2 (jcf);
- HANDLE_LOCALVARIABLETABLE_ATTRIBUTE (count);
- }
- else
-#endif
- {
-#ifdef PROCESS_OTHER_ATTRIBUTE
- PROCESS_OTHER_ATTRIBUTE(jcf, attribute_name, attribute_length);
-#else
- JCF_SKIP (jcf, attribute_length);
-#endif
- }
- if ((long) (start_pos + attribute_length) != JCF_TELL(jcf))
- return -1;
- return 0;
-}
-
-/* Read and handle the pre-amble. */
-int
-DEFUN(jcf_parse_preamble, (jcf),
- JCF* jcf)
-{
- uint32 magic = (JCF_FILL (jcf, 8), JCF_readu4 (jcf));
- uint16 minor_version ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
- uint16 major_version ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
-#ifdef HANDLE_MAGIC
- HANDLE_MAGIC (magic, minor_version, major_version);
-#endif
- if (magic != 0xcafebabe)
- return -1;
- else
- return 0;
-}
-
-/* Read and handle the constant pool.
-
- Return 0 if OK.
- Return -2 if a bad cross-reference (index of other constant) was seen.
-*/
-int
-DEFUN(jcf_parse_constant_pool, (jcf),
- JCF* jcf)
-{
- int i, n;
- JPOOL_SIZE (jcf) = (JCF_FILL (jcf, 2), JCF_readu2 (jcf));
- jcf->cpool.tags = ALLOC (JPOOL_SIZE (jcf));
- jcf->cpool.data = ALLOC (sizeof (jword) * JPOOL_SIZE (jcf));
- jcf->cpool.tags[0] = 0;
-#ifdef HANDLE_START_CONSTANT_POOL
- HANDLE_START_CONSTANT_POOL (JPOOL_SIZE (jcf));
-#endif
- for (i = 1; i < (int) JPOOL_SIZE (jcf); i++)
- {
- int constant_kind;
-
- /* Make sure at least 9 bytes are available. This is enough
- for all fixed-sized constant pool entries (so we don't need many
- more JCF_FILL calls below), but is is small enough that
- we are guaranteed to not hit EOF (in a valid .class file). */
- JCF_FILL (jcf, 9);
- constant_kind = JCF_readu (jcf);
- jcf->cpool.tags[i] = constant_kind;
- switch (constant_kind)
- {
- case CONSTANT_String:
- case CONSTANT_Class:
- jcf->cpool.data[i] = JCF_readu2 (jcf);
- break;
- case CONSTANT_Fieldref:
- case CONSTANT_Methodref:
- case CONSTANT_InterfaceMethodref:
- case CONSTANT_NameAndType:
- jcf->cpool.data[i] = JCF_readu2 (jcf);
- jcf->cpool.data[i] |= JCF_readu2 (jcf) << 16;
- break;
- case CONSTANT_Integer:
- case CONSTANT_Float:
- jcf->cpool.data[i] = JCF_readu4 (jcf);
- break;
- case CONSTANT_Long:
- case CONSTANT_Double:
- jcf->cpool.data[i] = JCF_readu4 (jcf);
- i++; /* These take up two spots in the constant pool */
- jcf->cpool.tags[i] = 0;
- jcf->cpool.data[i] = JCF_readu4 (jcf);
- break;
- case CONSTANT_Utf8:
- n = JCF_readu2 (jcf);
- JCF_FILL (jcf, n);
-#ifdef HANDLE_CONSTANT_Utf8
- HANDLE_CONSTANT_Utf8(jcf, i, n);
-#else
- jcf->cpool.data[i] = JCF_TELL(jcf) - 2;
- JCF_SKIP (jcf, n);
-#endif
- break;
- default:
- return i;
- }
- }
- return 0;
-}
-
-/* Read various class flags and numbers. */
-
-void
-DEFUN(jcf_parse_class, (jcf),
- JCF* jcf)
-{
- int i;
- uint16 interfaces_count;
- JCF_FILL (jcf, 8);
- jcf->access_flags = JCF_readu2 (jcf);
- jcf->this_class = JCF_readu2 (jcf);
- jcf->super_class = JCF_readu2 (jcf);
- interfaces_count = JCF_readu2 (jcf);
-
-#ifdef HANDLE_CLASS_INFO
- HANDLE_CLASS_INFO(jcf->access_flags, jcf->this_class, jcf->super_class, interfaces_count);
-#endif
-
- JCF_FILL (jcf, 2 * interfaces_count);
-
- /* Read interfaces. */
- for (i = 0; i < interfaces_count; i++)
- {
- uint16 index ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
-#ifdef HANDLE_CLASS_INTERFACE
- HANDLE_CLASS_INTERFACE (index);
-#endif
- }
-}
-
-/* Read fields. */
-int
-DEFUN(jcf_parse_fields, (jcf),
- JCF* jcf)
-{
- int i, j;
- uint16 fields_count;
- JCF_FILL (jcf, 2);
- fields_count = JCF_readu2 (jcf);
-
-#ifdef HANDLE_START_FIELDS
- HANDLE_START_FIELDS (fields_count);
-#endif
- for (i = 0; i < fields_count; i++)
- {
- uint16 access_flags = (JCF_FILL (jcf, 8), JCF_readu2 (jcf));
- uint16 name_index = JCF_readu2 (jcf);
- uint16 signature_index = JCF_readu2 (jcf);
- uint16 attribute_count = JCF_readu2 (jcf);
-#ifdef HANDLE_START_FIELD
- HANDLE_START_FIELD (access_flags, name_index, signature_index,
- attribute_count);
-#endif
- for (j = 0; j < attribute_count; j++)
- {
- int code = get_attribute (jcf);
- if (code != 0)
- return code;
- }
-#ifdef HANDLE_END_FIELD
- HANDLE_END_FIELD ();
-#endif
- }
-#ifdef HANDLE_END_FIELDS
- HANDLE_END_FIELDS ();
-#endif
- return 0;
-}
-
-/* Read methods. */
-
-int
-DEFUN(jcf_parse_one_method, (jcf),
- JCF* jcf)
-{
- int i;
- uint16 access_flags = (JCF_FILL (jcf, 8), JCF_readu2 (jcf));
- uint16 name_index = JCF_readu2 (jcf);
- uint16 signature_index = JCF_readu2 (jcf);
- uint16 attribute_count = JCF_readu2 (jcf);
-#ifdef HANDLE_METHOD
- HANDLE_METHOD(access_flags, name_index, signature_index, attribute_count);
-#endif
- for (i = 0; i < attribute_count; i++)
- {
- int code = get_attribute (jcf);
- if (code != 0)
- return code;
- }
-#ifdef HANDLE_END_METHOD
- HANDLE_END_METHOD ();
-#endif
- return 0;
-}
-
-int
-DEFUN(jcf_parse_methods, (jcf),
- JCF* jcf)
-{
- int i;
- uint16 methods_count;
- JCF_FILL (jcf, 2);
- methods_count = JCF_readu2 (jcf);
-#ifdef HANDLE_START_METHODS
- HANDLE_START_METHODS (methods_count);
-#endif
- for (i = 0; i < methods_count; i++)
- {
- int code = jcf_parse_one_method (jcf);
- if (code != 0)
- return code;
- }
-#ifdef HANDLE_END_METHODS
- HANDLE_END_METHODS ();
-#endif
- return 0;
-}
-
-/* Read attributes. */
-int
-DEFUN(jcf_parse_final_attributes, (jcf),
- JCF *jcf)
-{
- int i;
- uint16 attributes_count = (JCF_FILL (jcf, 2), JCF_readu2 (jcf));
-#ifdef START_FINAL_ATTRIBUTES
- START_FINAL_ATTRIBUTES (attributes_count)
-#endif
- for (i = 0; i < attributes_count; i++)
- {
- int code = get_attribute (jcf);
- if (code != 0)
- return code;
- }
- return 0;
-}
-
diff --git a/gnu/dist/toolchain/gcc/java/jcf-write.c b/gnu/dist/toolchain/gcc/java/jcf-write.c
deleted file mode 100644
index 71560e60616..00000000000
--- a/gnu/dist/toolchain/gcc/java/jcf-write.c
+++ /dev/null
@@ -1,3070 +0,0 @@
-/* Write out a Java(TM) class file.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#include "config.h"
-#include "system.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "obstack.h"
-#undef AND
-#include "rtl.h"
-#include "flags.h"
-#include "java-opcodes.h"
-#include "parse.h" /* for BLOCK_EXPR_BODY */
-#include "buffer.h"
-#include "toplev.h"
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-extern struct obstack temporary_obstack;
-
-/* Base directory in which `.class' files should be written.
- NULL means to put the file into the same directory as the
- corresponding .java file. */
-char *jcf_write_base_directory = NULL;
-
-/* Make sure bytecode.data is big enough for at least N more bytes. */
-
-#define RESERVE(N) \
- do { CHECK_OP(state); \
- if (state->bytecode.ptr + (N) > state->bytecode.limit) \
- buffer_grow (&state->bytecode, N); } while (0)
-
-/* Add a 1-byte instruction/operand I to bytecode.data,
- assuming space has already been RESERVE'd. */
-
-#define OP1(I) (*state->bytecode.ptr++ = (I), CHECK_OP(state))
-
-/* Like OP1, but I is a 2-byte big endian integer. */
-
-#define OP2(I) \
- do { int _i = (I); OP1 (_i >> 8); OP1 (_i); CHECK_OP(state); } while (0)
-
-/* Like OP1, but I is a 4-byte big endian integer. */
-
-#define OP4(I) \
- do { int _i = (I); OP1 (_i >> 24); OP1 (_i >> 16); \
- OP1 (_i >> 8); OP1 (_i); CHECK_OP(state); } while (0)
-
-/* Macro to call each time we push I words on the JVM stack. */
-
-#define NOTE_PUSH(I) \
- do { state->code_SP += (I); \
- if (state->code_SP > state->code_SP_max) \
- state->code_SP_max = state->code_SP; } while (0)
-
-/* Macro to call each time we pop I words from the JVM stack. */
-
-#define NOTE_POP(I) \
- do { state->code_SP -= (I); if (state->code_SP < 0) abort(); } while (0)
-
-/* A chunk or segment of a .class file. */
-
-struct chunk
-{
- /* The next segment of this .class file. */
- struct chunk *next;
-
- /* The actual data in this segment to be written to the .class file. */
- unsigned char *data;
-
- /* The size of the segment to be written to the .class file. */
- int size;
-};
-
-#define PENDING_CLEANUP_PC (-3)
-#define PENDING_EXIT_PC (-2)
-#define UNDEFINED_PC (-1)
-
-/* Each "block" represents a label plus the bytecode instructions following.
- There may be branches out of the block, but no incoming jumps, except
- to the beginning of the block.
-
- If (pc < 0), the jcf_block is not an actual block (i.e. it has no
- assocated code yet), but it is an undefined label.
-*/
-
-struct jcf_block
-{
- /* For blocks that that are defined, the next block (in pc order).
- For blocks that are the not-yet-defined end label of a LABELED_BLOCK_EXPR
- or a cleanup expression (from a WITH_CLEANUP_EXPR),
- this is the next (outer) such end label, in a stack headed by
- labeled_blocks in jcf_partial. */
- struct jcf_block *next;
-
- /* In the not-yet-defined end label for an unfinished EXIT_BLOCK_EXPR.
- pc is PENDING_EXIT_PC.
- In the not-yet-defined end label for pending cleanup subroutine,
- pc is PENDING_CLEANUP_PC.
- For other not-yet-defined labels, pc is UNDEFINED_PC.
-
- If the label has been defined:
- Until perform_relocations is finished, this is the maximum possible
- value of the bytecode offset at the begnning of this block.
- After perform_relocations, it is the actual offset (pc). */
- int pc;
-
- int linenumber;
-
- /* After finish_jcf_block is called, The actual instructions contained in this block.
- Before than NULL, and the instructions are in state->bytecode. */
- union {
- struct chunk *chunk;
-
- /* If pc==PENDING_CLEANUP_PC, start_label is the start of the region
- coveed by the cleanup. */
- struct jcf_block *start_label;
- } v;
-
- union {
- /* Set of relocations (in reverse offset order) for this block. */
- struct jcf_relocation *relocations;
-
- /* If this block is that of the not-yet-defined end label of
- a LABELED_BLOCK_EXPR, where LABELED_BLOCK is that LABELED_BLOCK_EXPR.
- If pc==PENDING_CLEANUP_PC, the cleanup that needs to be run. */
- tree labeled_block;
- } u;
-};
-
-/* A "relocation" type for the 0-3 bytes of padding at the start
- of a tableswitch or a lookupswitch. */
-#define SWITCH_ALIGN_RELOC 4
-
-/* A relocation type for the labels in a tableswitch or a lookupswitch;
- these are relative to the start of the instruction, but (due to
- th 0-3 bytes of padding), we don't know the offset before relocation. */
-#define BLOCK_START_RELOC 1
-
-struct jcf_relocation
-{
- /* Next relocation for the current jcf_block. */
- struct jcf_relocation *next;
-
- /* The (byte) offset within the current block that needs to be relocated. */
- HOST_WIDE_INT offset;
-
- /* 0 if offset is a 4-byte relative offset.
- 4 (SWITCH_ALIGN_RELOC) if offset points to 0-3 padding bytes inserted
- for proper alignment in tableswitch/lookupswitch instructions.
- 1 (BLOCK_START_RELOC) if offset points to a 4-byte offset relative
- to the start of the containing block.
- -1 if offset is a 2-byte relative offset.
- < -1 if offset is the address of an instruction with a 2-byte offset
- that does not have a corresponding 4-byte offset version, in which
- case the absolute value of kind is the inverted opcode.
- > 4 if offset is the address of an instruction (such as jsr) with a
- 2-byte offset that does have a corresponding 4-byte offset version,
- in which case kind is the opcode of the 4-byte version (such as jsr_w). */
- int kind;
-
- /* The label the relocation wants to actually transfer to. */
- struct jcf_block *label;
-};
-
-/* State for single catch clause. */
-
-struct jcf_handler
-{
- struct jcf_handler *next;
-
- struct jcf_block *start_label;
- struct jcf_block *end_label;
- struct jcf_block *handler_label;
-
- /* The sub-class of Throwable handled, or NULL_TREE (for finally). */
- tree type;
-};
-
-/* State for the current switch statement. */
-
-struct jcf_switch_state
-{
- struct jcf_switch_state *prev;
- struct jcf_block *default_label;
-
- struct jcf_relocation *cases;
- int num_cases;
- HOST_WIDE_INT min_case, max_case;
-};
-
-/* This structure is used to contain the various pieces that will
- become a .class file. */
-
-struct jcf_partial
-{
- struct chunk *first;
- struct chunk *chunk;
- struct obstack *chunk_obstack;
- tree current_method;
-
- /* List of basic blocks for the current method. */
- struct jcf_block *blocks;
- struct jcf_block *last_block;
-
- struct localvar_info *first_lvar;
- struct localvar_info *last_lvar;
- int lvar_count;
-
- CPool cpool;
-
- int linenumber_count;
-
- /* Until perform_relocations, this is a upper bound on the number
- of bytes (so far) in the instructions for the current method. */
- int code_length;
-
- /* Stack of undefined ending labels for LABELED_BLOCK_EXPR. */
- struct jcf_block *labeled_blocks;
-
- /* The current stack size (stack pointer) in the current method. */
- int code_SP;
-
- /* The largest extent of stack size (stack pointer) in the current method. */
- int code_SP_max;
-
- /* Contains a mapping from local var slot number to localvar_info. */
- struct buffer localvars;
-
- /* The buffer allocated for bytecode for the current jcf_block. */
- struct buffer bytecode;
-
- /* Chain of exception handlers for the current method. */
- struct jcf_handler *handlers;
-
- /* Last element in handlers chain. */
- struct jcf_handler *last_handler;
-
- /* Number of exception handlers for the current method. */
- int num_handlers;
-
- /* Number of finalizers we are currently nested within. */
- int num_finalizers;
-
- /* If non-NULL, use this for the return value. */
- tree return_value_decl;
-
- /* Information about the current switch statemenet. */
- struct jcf_switch_state *sw_state;
-};
-
-static void generate_bytecode_insns PROTO ((tree, int, struct jcf_partial *));
-static struct chunk * alloc_chunk PROTO ((struct chunk *, unsigned char *,
- int, struct obstack *));
-static unsigned char * append_chunk PROTO ((unsigned char *, int,
- struct jcf_partial *));
-static void append_chunk_copy PROTO ((unsigned char *, int,
- struct jcf_partial *));
-static struct jcf_block * gen_jcf_label PROTO ((struct jcf_partial *));
-static void finish_jcf_block PROTO ((struct jcf_partial *));
-static void define_jcf_label PROTO ((struct jcf_block *,
- struct jcf_partial *));
-static struct jcf_block * get_jcf_label_here PROTO ((struct jcf_partial *));
-static void put_linenumber PROTO ((int, struct jcf_partial *));
-static void localvar_alloc PROTO ((tree, struct jcf_partial *));
-static int localvar_free PROTO ((tree, struct jcf_partial *));
-static int get_access_flags PROTO ((tree));
-static void write_chunks PROTO ((FILE *, struct chunk *));
-static int adjust_typed_op PROTO ((tree, int));
-static void generate_bytecode_conditional PROTO ((tree, struct jcf_block *,
- struct jcf_block *, int,
- struct jcf_partial *));
-static void generate_bytecode_return PROTO ((tree, struct jcf_partial *));
-static void perform_relocations PROTO ((struct jcf_partial *));
-static void init_jcf_state PROTO ((struct jcf_partial *, struct obstack *));
-static void init_jcf_method PROTO ((struct jcf_partial *, tree));
-static void release_jcf_state PROTO ((struct jcf_partial *));
-static struct chunk * generate_classfile PROTO ((tree, struct jcf_partial *));
-
-
-/* Utility macros for appending (big-endian) data to a buffer.
- We assume a local variable 'ptr' points into where we want to
- write next, and we assume enoygh space has been allocated. */
-
-#ifdef ENABLE_CHECKING
-int
-CHECK_PUT(ptr, state, i)
- void *ptr;
- struct jcf_partial *state;
- int i;
-{
- if (ptr < state->chunk->data
- || (char*)ptr + i > state->chunk->data + state->chunk->size)
- fatal ("internal error - CHECK_PUT failed");
- return 0;
-}
-#else
-#define CHECK_PUT(PTR, STATE, I) ((void)0)
-#endif
-
-#define PUT1(X) (CHECK_PUT(ptr, state, 1), *ptr++ = (X))
-#define PUT2(X) (PUT1((X) >> 8), PUT1((X) & 0xFF))
-#define PUT4(X) (PUT2((X) >> 16), PUT2((X) & 0xFFFF))
-#define PUTN(P, N) (CHECK_PUT(ptr, state, N), memcpy(ptr, P, N), ptr += (N))
-
-
-/* Allocate a new chunk on obstack WORK, and link it in after LAST.
- Set the data and size fields to DATA and SIZE, respectively.
- However, if DATA is NULL and SIZE>0, allocate a buffer as well. */
-
-static struct chunk *
-alloc_chunk (last, data, size, work)
- struct chunk *last;
- unsigned char *data;
- int size;
- struct obstack *work;
-{
- struct chunk *chunk = (struct chunk *)
- obstack_alloc (work, sizeof(struct chunk));
-
- if (data == NULL && size > 0)
- data = obstack_alloc (work, size);
-
- chunk->next = NULL;
- chunk->data = data;
- chunk->size = size;
- if (last != NULL)
- last->next = chunk;
- return chunk;
-}
-
-#ifdef ENABLE_CHECKING
-int
-CHECK_OP(struct jcf_partial *state)
-{
- if (state->bytecode.ptr > state->bytecode.limit)
- {
- fatal("internal error - CHECK_OP failed");
- }
- return 0;
-}
-#else
-#define CHECK_OP(STATE) ((void)0)
-#endif
-
-static unsigned char *
-append_chunk (data, size, state)
- unsigned char *data;
- int size;
- struct jcf_partial *state;
-{
- state->chunk = alloc_chunk (state->chunk, data, size, state->chunk_obstack);
- if (state->first == NULL)
- state->first = state->chunk;
- return state->chunk->data;
-}
-
-static void
-append_chunk_copy (data, size, state)
- unsigned char *data;
- int size;
- struct jcf_partial *state;
-{
- unsigned char *ptr = append_chunk (NULL, size, state);
- memcpy (ptr, data, size);
-}
-
-static struct jcf_block *
-gen_jcf_label (state)
- struct jcf_partial *state;
-{
- struct jcf_block *block = (struct jcf_block *)
- obstack_alloc (state->chunk_obstack, sizeof (struct jcf_block));
- block->next = NULL;
- block->linenumber = -1;
- block->pc = UNDEFINED_PC;
- return block;
-}
-
-static void
-finish_jcf_block (state)
- struct jcf_partial *state;
-{
- struct jcf_block *block = state->last_block;
- struct jcf_relocation *reloc;
- int code_length = BUFFER_LENGTH (&state->bytecode);
- int pc = state->code_length;
- append_chunk_copy (state->bytecode.data, code_length, state);
- BUFFER_RESET (&state->bytecode);
- block->v.chunk = state->chunk;
-
- /* Calculate code_length to the maximum value it can have. */
- pc += block->v.chunk->size;
- for (reloc = block->u.relocations; reloc != NULL; reloc = reloc->next)
- {
- int kind = reloc->kind;
- if (kind == SWITCH_ALIGN_RELOC)
- pc += 3;
- else if (kind > BLOCK_START_RELOC)
- pc += 2; /* 2-byte offset may grow to 4-byte offset */
- else if (kind < -1)
- pc += 5; /* May need to add a goto_w. */
- }
- state->code_length = pc;
-}
-
-static void
-define_jcf_label (label, state)
- struct jcf_block *label;
- struct jcf_partial *state;
-{
- if (state->last_block != NULL)
- finish_jcf_block (state);
- label->pc = state->code_length;
- if (state->blocks == NULL)
- state->blocks = label;
- else
- state->last_block->next = label;
- state->last_block = label;
- label->next = NULL;
- label->u.relocations = NULL;
-}
-
-static struct jcf_block *
-get_jcf_label_here (state)
- struct jcf_partial *state;
-{
- if (state->last_block != NULL && BUFFER_LENGTH (&state->bytecode) == 0)
- return state->last_block;
- else
- {
- struct jcf_block *label = gen_jcf_label (state);
- define_jcf_label (label, state);
- return label;
- }
-}
-
-/* Note a line number entry for the current PC and given LINE. */
-
-static void
-put_linenumber (line, state)
- int line;
- struct jcf_partial *state;
-{
- struct jcf_block *label = get_jcf_label_here (state);
- if (label->linenumber > 0)
- {
- label = gen_jcf_label (state);
- define_jcf_label (label, state);
- }
- label->linenumber = line;
- state->linenumber_count++;
-}
-
-/* Allocate a new jcf_handler, for a catch clause that catches exceptions
- in the range (START_LABEL, END_LABEL). */
-
-static struct jcf_handler *
-alloc_handler (start_label, end_label, state)
- struct jcf_block *start_label;
- struct jcf_block *end_label;
- struct jcf_partial *state;
-{
- struct jcf_handler *handler = (struct jcf_handler *)
- obstack_alloc (state->chunk_obstack, sizeof (struct jcf_handler));
- handler->start_label = start_label;
- handler->end_label = end_label;
- handler->handler_label = get_jcf_label_here (state);
- if (state->handlers == NULL)
- state->handlers = handler;
- else
- state->last_handler->next = handler;
- state->last_handler = handler;
- handler->next = NULL;
- state->num_handlers++;
- return handler;
-}
-
-
-/* The index of jvm local variable allocated for this DECL.
- This is assigned when generating .class files;
- contrast DECL_LOCAL_SLOT_NUMBER which is set when *reading* a .class file.
- (We don't allocate DECL_LANG_SPECIFIC for locals from Java sourc code.) */
-
-#define DECL_LOCAL_INDEX(DECL) DECL_ALIGN(DECL)
-
-struct localvar_info
-{
- struct localvar_info *next;
-
- tree decl;
- struct jcf_block *start_label;
- struct jcf_block *end_label;
-};
-
-#define localvar_buffer ((struct localvar_info**) state->localvars.data)
-#define localvar_max \
- ((struct localvar_info**) state->localvars.ptr - localvar_buffer)
-
-static void
-localvar_alloc (decl, state)
- tree decl;
- struct jcf_partial *state;
-{
- struct jcf_block *start_label = get_jcf_label_here (state);
- int wide = TYPE_IS_WIDE (TREE_TYPE (decl));
- int index;
- register struct localvar_info *info;
- register struct localvar_info **ptr = localvar_buffer;
- register struct localvar_info **limit
- = (struct localvar_info**) state->localvars.ptr;
- for (index = 0; ptr < limit; index++, ptr++)
- {
- if (ptr[0] == NULL
- && (! wide || ((ptr+1) < limit && ptr[1] == NULL)))
- break;
- }
- if (ptr == limit)
- {
- buffer_grow (&state->localvars, 2 * sizeof (struct localvar_info*));
- ptr = (struct localvar_info**) state->localvars.data + index;
- state->localvars.ptr = (unsigned char *) (ptr + 1 + wide);
- }
- info = (struct localvar_info *)
- obstack_alloc (state->chunk_obstack, sizeof (struct localvar_info));
- ptr[0] = info;
- if (wide)
- ptr[1] = (struct localvar_info *)(~0);
- DECL_LOCAL_INDEX (decl) = index;
- info->decl = decl;
- info->start_label = start_label;
-
- if (debug_info_level > DINFO_LEVEL_TERSE
- && DECL_NAME (decl) != NULL_TREE)
- {
- /* Generate debugging info. */
- info->next = NULL;
- if (state->last_lvar != NULL)
- state->last_lvar->next = info;
- else
- state->first_lvar = info;
- state->last_lvar = info;
- state->lvar_count++;
- }
-}
-
-static int
-localvar_free (decl, state)
- tree decl;
- struct jcf_partial *state;
-{
- struct jcf_block *end_label = get_jcf_label_here (state);
- int index = DECL_LOCAL_INDEX (decl);
- register struct localvar_info **ptr = &localvar_buffer [index];
- register struct localvar_info *info = *ptr;
- int wide = TYPE_IS_WIDE (TREE_TYPE (decl));
-
- info->end_label = end_label;
-
- if (info->decl != decl)
- abort ();
- ptr[0] = NULL;
- if (wide)
- {
- if (ptr[1] != (struct localvar_info *)(~0))
- abort ();
- ptr[1] = NULL;
- }
-}
-
-
-#define STACK_TARGET 1
-#define IGNORE_TARGET 2
-
-/* Get the access flags of a class (TYPE_DECL), a method (FUNCTION_DECL), or
- a field (FIELD_DECL or VAR_DECL, if static), as encoded in a .class file. */
-
-static int
-get_access_flags (decl)
- tree decl;
-{
- int flags = 0;
- int isfield = TREE_CODE (decl) == FIELD_DECL || TREE_CODE (decl) == VAR_DECL;
- if (CLASS_PUBLIC (decl)) /* same as FIELD_PUBLIC and METHOD_PUBLIC */
- flags |= ACC_PUBLIC;
- if (CLASS_FINAL (decl)) /* same as FIELD_FINAL and METHOD_FINAL */
- flags |= ACC_FINAL;
- if (isfield || TREE_CODE (decl) == FUNCTION_DECL)
- {
- if (TREE_PROTECTED (decl))
- flags |= ACC_PROTECTED;
- if (TREE_PRIVATE (decl))
- flags |= ACC_PRIVATE;
- }
- else if (TREE_CODE (decl) == TYPE_DECL)
- {
- if (CLASS_SUPER (decl))
- flags |= ACC_SUPER;
- if (CLASS_ABSTRACT (decl))
- flags |= ACC_ABSTRACT;
- if (CLASS_INTERFACE (decl))
- flags |= ACC_INTERFACE;
- }
- else
- fatal ("internal error - bad argument to get_access_flags");
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- if (METHOD_NATIVE (decl))
- flags |= ACC_NATIVE;
- if (METHOD_STATIC (decl))
- flags |= ACC_STATIC;
- if (METHOD_SYNCHRONIZED (decl))
- flags |= ACC_SYNCHRONIZED;
- if (METHOD_ABSTRACT (decl))
- flags |= ACC_ABSTRACT;
- }
- if (isfield)
- {
- if (FIELD_STATIC (decl))
- flags |= ACC_STATIC;
- if (FIELD_VOLATILE (decl))
- flags |= ACC_VOLATILE;
- if (FIELD_TRANSIENT (decl))
- flags |= ACC_TRANSIENT;
- }
- return flags;
-}
-
-/* Write the list of segments starting at CHUNKS to STREAM. */
-
-static void
-write_chunks (stream, chunks)
- FILE* stream;
- struct chunk *chunks;
-{
- for (; chunks != NULL; chunks = chunks->next)
- fwrite (chunks->data, chunks->size, 1, stream);
-}
-
-/* Push a 1-word constant in the constant pool at the given INDEX.
- (Caller is responsible for doing NOTE_PUSH.) */
-
-static void
-push_constant1 (index, state)
- int index;
- struct jcf_partial *state;
-{
- RESERVE (3);
- if (index < 256)
- {
- OP1 (OPCODE_ldc);
- OP1 (index);
- }
- else
- {
- OP1 (OPCODE_ldc_w);
- OP2 (index);
- }
-}
-
-/* Push a 2-word constant in the constant pool at the given INDEX.
- (Caller is responsible for doing NOTE_PUSH.) */
-
-static void
-push_constant2 (index, state)
- int index;
- struct jcf_partial *state;
-{
- RESERVE (3);
- OP1 (OPCODE_ldc2_w);
- OP2 (index);
-}
-
-/* Push 32-bit integer constant on VM stack.
- Caller is responsible for doing NOTE_PUSH. */
-
-static void
-push_int_const (i, state)
- HOST_WIDE_INT i;
- struct jcf_partial *state;
-{
- RESERVE(3);
- if (i >= -1 && i <= 5)
- OP1(OPCODE_iconst_0 + i);
- else if (i >= -128 && i < 128)
- {
- OP1(OPCODE_bipush);
- OP1(i);
- }
- else if (i >= -32768 && i < 32768)
- {
- OP1(OPCODE_sipush);
- OP2(i);
- }
- else
- {
- i = find_constant1 (&state->cpool, CONSTANT_Integer, i & 0xFFFFFFFF);
- push_constant1 (i, state);
- }
-}
-
-static int
-find_constant_wide (lo, hi, state)
- HOST_WIDE_INT lo, hi;
- struct jcf_partial *state;
-{
- HOST_WIDE_INT w1, w2;
- lshift_double (lo, hi, -32, 64, &w1, &w2, 1);
- return find_constant2 (&state->cpool, CONSTANT_Long,
- w1 & 0xFFFFFFFF, lo & 0xFFFFFFFF);
-}
-
-/* Find or allocate a constant pool entry for the given VALUE.
- Return the index in the constant pool. */
-
-static int
-find_constant_index (value, state)
- tree value;
- struct jcf_partial *state;
-{
- if (TREE_CODE (value) == INTEGER_CST)
- {
- if (TYPE_PRECISION (TREE_TYPE (value)) <= 32)
- return find_constant1 (&state->cpool, CONSTANT_Integer,
- TREE_INT_CST_LOW (value) & 0xFFFFFFFF);
- else
- return find_constant_wide (TREE_INT_CST_LOW (value),
- TREE_INT_CST_HIGH (value), state);
- }
- else if (TREE_CODE (value) == REAL_CST)
- {
- long words[2];
- if (TYPE_PRECISION (TREE_TYPE (value)) == 32)
- {
- words[0] = etarsingle (TREE_REAL_CST (value)) & 0xFFFFFFFF;
- return find_constant1 (&state->cpool, CONSTANT_Float, words[0]);
- }
- else
- {
- etardouble (TREE_REAL_CST (value), words);
- return find_constant2 (&state->cpool, CONSTANT_Double,
- words[1-FLOAT_WORDS_BIG_ENDIAN] & 0xFFFFFFFF,
- words[FLOAT_WORDS_BIG_ENDIAN] & 0xFFFFFFFF);
- }
- }
- else if (TREE_CODE (value) == STRING_CST)
- {
- return find_string_constant (&state->cpool, value);
- }
- else
- fatal ("find_constant_index - bad type");
-}
-
-/* Push 64-bit long constant on VM stack.
- Caller is responsible for doing NOTE_PUSH. */
-
-static void
-push_long_const (lo, hi, state)
- HOST_WIDE_INT lo, hi;
- struct jcf_partial *state;
-{
- if (hi == 0 && lo >= 0 && lo <= 1)
- {
- RESERVE(1);
- OP1(OPCODE_lconst_0 + lo);
- }
- else if ((hi == 0 && lo < 32768) || (hi == -1 && lo >= -32768))
- {
- push_int_const (lo, state);
- RESERVE (1);
- OP1 (OPCODE_i2l);
- }
- else
- push_constant2 (find_constant_wide (lo, hi, state), state);
-}
-
-static void
-field_op (field, opcode, state)
- tree field;
- int opcode;
- struct jcf_partial *state;
-{
- int index = find_fieldref_index (&state->cpool, field);
- RESERVE (3);
- OP1 (opcode);
- OP2 (index);
-}
-
-/* Returns an integer in the range 0 (for 'int') through 4 (for object
- reference) to 7 (for 'short') which matches the pattern of how JVM
- opcodes typically depend on the operand type. */
-
-static int
-adjust_typed_op (type, max)
- tree type;
- int max;
-{
- switch (TREE_CODE (type))
- {
- case POINTER_TYPE:
- case RECORD_TYPE: return 4;
- case BOOLEAN_TYPE:
- return TYPE_PRECISION (type) == 32 || max < 5 ? 0 : 5;
- case CHAR_TYPE:
- return TYPE_PRECISION (type) == 32 || max < 6 ? 0 : 6;
- case INTEGER_TYPE:
- switch (TYPE_PRECISION (type))
- {
- case 8: return max < 5 ? 0 : 5;
- case 16: return max < 7 ? 0 : 7;
- case 32: return 0;
- case 64: return 1;
- }
- break;
- case REAL_TYPE:
- switch (TYPE_PRECISION (type))
- {
- case 32: return 2;
- case 64: return 3;
- }
- break;
- default:
- break;
- }
- abort ();
-}
-
-static void
-maybe_wide (opcode, index, state)
- int opcode, index;
- struct jcf_partial *state;
-{
- if (index >= 256)
- {
- RESERVE (4);
- OP1 (OPCODE_wide);
- OP1 (opcode);
- OP2 (index);
- }
- else
- {
- RESERVE (2);
- OP1 (opcode);
- OP1 (index);
- }
-}
-
-/* Compile code to duplicate with offset, where
- SIZE is the size of the stack item to duplicate (1 or 2), abd
- OFFSET is where to insert the result (must be 0, 1, or 2).
- (The new words get inserted at stack[SP-size-offset].) */
-
-static void
-emit_dup (size, offset, state)
- int size, offset;
- struct jcf_partial *state;
-{
- int kind;
- if (size == 0)
- return;
- RESERVE(1);
- if (offset == 0)
- kind = size == 1 ? OPCODE_dup : OPCODE_dup2;
- else if (offset == 1)
- kind = size == 1 ? OPCODE_dup_x1 : OPCODE_dup2_x1;
- else if (offset == 2)
- kind = size == 1 ? OPCODE_dup_x2 : OPCODE_dup2_x2;
- else
- abort();
- OP1 (kind);
- NOTE_PUSH (size);
-}
-
-static void
-emit_pop (size, state)
- int size;
- struct jcf_partial *state;
-{
- RESERVE (1);
- OP1 (OPCODE_pop - 1 + size);
-}
-
-static void
-emit_iinc (var, value, state)
- tree var;
- int value;
- struct jcf_partial *state;
-{
- int slot = DECL_LOCAL_INDEX (var);
-
- if (value < -128 || value > 127 || slot >= 256)
- {
- RESERVE (6);
- OP1 (OPCODE_wide);
- OP1 (OPCODE_iinc);
- OP2 (slot);
- OP2 (value);
- }
- else
- {
- RESERVE (3);
- OP1 (OPCODE_iinc);
- OP1 (slot);
- OP1 (value);
- }
-}
-
-static void
-emit_load_or_store (var, opcode, state)
- tree var; /* Variable to load from or store into. */
- int opcode; /* Either OPCODE_iload or OPCODE_istore. */
- struct jcf_partial *state;
-{
- tree type = TREE_TYPE (var);
- int kind = adjust_typed_op (type, 4);
- int index = DECL_LOCAL_INDEX (var);
- if (index <= 3)
- {
- RESERVE (1);
- OP1 (opcode + 5 + 4 * kind + index); /* [ilfda]{load,store}_[0123] */
- }
- else
- maybe_wide (opcode + kind, index, state); /* [ilfda]{load,store} */
-}
-
-static void
-emit_load (var, state)
- tree var;
- struct jcf_partial *state;
-{
- emit_load_or_store (var, OPCODE_iload, state);
- NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (var)) ? 2 : 1);
-}
-
-static void
-emit_store (var, state)
- tree var;
- struct jcf_partial *state;
-{
- emit_load_or_store (var, OPCODE_istore, state);
- NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (var)) ? 2 : 1);
-}
-
-static void
-emit_unop (opcode, type, state)
- enum java_opcode opcode;
- tree type ATTRIBUTE_UNUSED;
- struct jcf_partial *state;
-{
- RESERVE(1);
- OP1 (opcode);
-}
-
-static void
-emit_binop (opcode, type, state)
- enum java_opcode opcode;
- tree type;
- struct jcf_partial *state;
-{
- int size = TYPE_IS_WIDE (type) ? 2 : 1;
- RESERVE(1);
- OP1 (opcode);
- NOTE_POP (size);
-}
-
-static void
-emit_reloc (value, kind, target, state)
- HOST_WIDE_INT value;
- int kind;
- struct jcf_block *target;
- struct jcf_partial *state;
-{
- struct jcf_relocation *reloc = (struct jcf_relocation *)
- obstack_alloc (state->chunk_obstack, sizeof (struct jcf_relocation));
- struct jcf_block *block = state->last_block;
- reloc->next = block->u.relocations;
- block->u.relocations = reloc;
- reloc->offset = BUFFER_LENGTH (&state->bytecode);
- reloc->label = target;
- reloc->kind = kind;
- if (kind == 0 || kind == BLOCK_START_RELOC)
- OP4 (value);
- else if (kind != SWITCH_ALIGN_RELOC)
- OP2 (value);
-}
-
-static void
-emit_switch_reloc (label, state)
- struct jcf_block *label;
- struct jcf_partial *state;
-{
- emit_reloc (0, BLOCK_START_RELOC, label, state);
-}
-
-/* Similar to emit_switch_reloc,
- but re-uses an existing case reloc. */
-
-static void
-emit_case_reloc (reloc, state)
- struct jcf_relocation *reloc;
- struct jcf_partial *state;
-{
- struct jcf_block *block = state->last_block;
- reloc->next = block->u.relocations;
- block->u.relocations = reloc;
- reloc->offset = BUFFER_LENGTH (&state->bytecode);
- reloc->kind = BLOCK_START_RELOC;
- OP4 (0);
-}
-
-/* Emit a conditional jump to TARGET with a 2-byte relative jump offset
- The opcode is OPCODE, the inverted opcode is INV_OPCODE. */
-
-static void
-emit_if (target, opcode, inv_opcode, state)
- struct jcf_block *target;
- int opcode, inv_opcode;
- struct jcf_partial *state;
-{
- OP1 (opcode);
- // value is 1 byte from reloc back to start of instruction.
- emit_reloc (1, - inv_opcode, target, state);
-}
-
-static void
-emit_goto (target, state)
- struct jcf_block *target;
- struct jcf_partial *state;
-{
- OP1 (OPCODE_goto);
- // Value is 1 byte from reloc back to start of instruction.
- emit_reloc (1, OPCODE_goto_w, target, state);
-}
-
-static void
-emit_jsr (target, state)
- struct jcf_block *target;
- struct jcf_partial *state;
-{
- OP1 (OPCODE_jsr);
- // Value is 1 byte from reloc back to start of instruction.
- emit_reloc (1, OPCODE_jsr_w, target, state);
-}
-
-/* Generate code to evaluate EXP. If the result is true,
- branch to TRUE_LABEL; otherwise, branch to FALSE_LABEL.
- TRUE_BRANCH_FIRST is a code geneation hint that the
- TRUE_LABEL may follow right after this. (The idea is that we
- may be able to optimize away GOTO TRUE_LABEL; TRUE_LABEL:) */
-
-static void
-generate_bytecode_conditional (exp, true_label, false_label,
- true_branch_first, state)
- tree exp;
- struct jcf_block *true_label;
- struct jcf_block *false_label;
- int true_branch_first;
- struct jcf_partial *state;
-{
- tree exp0, exp1, type;
- int save_SP = state->code_SP;
- enum java_opcode op, negop;
- switch (TREE_CODE (exp))
- {
- case INTEGER_CST:
- emit_goto (integer_zerop (exp) ? false_label : true_label, state);
- break;
- case COND_EXPR:
- {
- struct jcf_block *then_label = gen_jcf_label (state);
- struct jcf_block *else_label = gen_jcf_label (state);
- int save_SP_before, save_SP_after;
- generate_bytecode_conditional (TREE_OPERAND (exp, 0),
- then_label, else_label, 1, state);
- define_jcf_label (then_label, state);
- save_SP_before = state->code_SP;
- generate_bytecode_conditional (TREE_OPERAND (exp, 1),
- true_label, false_label, 1, state);
- save_SP_after = state->code_SP;
- state->code_SP = save_SP_before;
- define_jcf_label (else_label, state);
- generate_bytecode_conditional (TREE_OPERAND (exp, 2),
- true_label, false_label,
- true_branch_first, state);
- if (state->code_SP != save_SP_after)
- fatal ("internal error non-matching SP");
- }
- break;
- case TRUTH_NOT_EXPR:
- generate_bytecode_conditional (TREE_OPERAND (exp, 0), false_label, true_label,
- ! true_branch_first, state);
- break;
- case TRUTH_ANDIF_EXPR:
- {
- struct jcf_block *next_label = gen_jcf_label (state);
- generate_bytecode_conditional (TREE_OPERAND (exp, 0),
- next_label, false_label, 1, state);
- define_jcf_label (next_label, state);
- generate_bytecode_conditional (TREE_OPERAND (exp, 1),
- true_label, false_label, 1, state);
- }
- break;
- case TRUTH_ORIF_EXPR:
- {
- struct jcf_block *next_label = gen_jcf_label (state);
- generate_bytecode_conditional (TREE_OPERAND (exp, 0),
- true_label, next_label, 1, state);
- define_jcf_label (next_label, state);
- generate_bytecode_conditional (TREE_OPERAND (exp, 1),
- true_label, false_label, 1, state);
- }
- break;
- compare_1:
- /* Assuming op is one of the 2-operand if_icmp<COND> instructions,
- set it to the corresponding 1-operand if<COND> instructions. */
- op = op - 6;
- /* FALLTHROUGH */
- compare_2:
- /* The opcodes with their inverses are allocated in pairs.
- E.g. The inverse of if_icmplt (161) is if_icmpge (162). */
- negop = (op & 1) ? op + 1 : op - 1;
- compare_2_ptr:
- if (true_branch_first)
- {
- emit_if (false_label, negop, op, state);
- emit_goto (true_label, state);
- }
- else
- {
- emit_if (true_label, op, negop, state);
- emit_goto (false_label, state);
- }
- break;
- case EQ_EXPR:
- op = OPCODE_if_icmpeq;
- goto compare;
- case NE_EXPR:
- op = OPCODE_if_icmpne;
- goto compare;
- case GT_EXPR:
- op = OPCODE_if_icmpgt;
- goto compare;
- case LT_EXPR:
- op = OPCODE_if_icmplt;
- goto compare;
- case GE_EXPR:
- op = OPCODE_if_icmpge;
- goto compare;
- case LE_EXPR:
- op = OPCODE_if_icmple;
- goto compare;
- compare:
- exp0 = TREE_OPERAND (exp, 0);
- exp1 = TREE_OPERAND (exp, 1);
- type = TREE_TYPE (exp0);
- switch (TREE_CODE (type))
- {
- int opf;
- case POINTER_TYPE: case RECORD_TYPE:
- switch (TREE_CODE (exp))
- {
- case EQ_EXPR: op = OPCODE_if_acmpeq; break;
- case NE_EXPR: op = OPCODE_if_acmpne; break;
- default: abort();
- }
- if (integer_zerop (exp1) || integer_zerop (exp0))
- {
- generate_bytecode_insns (integer_zerop (exp1) ? exp0 : exp0,
- STACK_TARGET, state);
- op = op + (OPCODE_ifnull - OPCODE_if_acmpeq);
- negop = (op & 1) ? op - 1 : op + 1;
- NOTE_POP (1);
- goto compare_2_ptr;
- }
- generate_bytecode_insns (exp0, STACK_TARGET, state);
- generate_bytecode_insns (exp1, STACK_TARGET, state);
- NOTE_POP (2);
- goto compare_2;
- case REAL_TYPE:
- generate_bytecode_insns (exp0, STACK_TARGET, state);
- generate_bytecode_insns (exp1, STACK_TARGET, state);
- if (op == OPCODE_if_icmplt || op == OPCODE_if_icmple)
- opf = OPCODE_fcmpg;
- else
- opf = OPCODE_fcmpl;
- if (TYPE_PRECISION (type) > 32)
- {
- opf += 2;
- NOTE_POP (4);
- }
- else
- NOTE_POP (2);
- RESERVE (1);
- OP1 (opf);
- goto compare_1;
- case INTEGER_TYPE:
- if (TYPE_PRECISION (type) > 32)
- {
- generate_bytecode_insns (exp0, STACK_TARGET, state);
- generate_bytecode_insns (exp1, STACK_TARGET, state);
- NOTE_POP (4);
- RESERVE (1);
- OP1 (OPCODE_lcmp);
- goto compare_1;
- }
- /* FALLTHOUGH */
- default:
- if (integer_zerop (exp1))
- {
- generate_bytecode_insns (exp0, STACK_TARGET, state);
- NOTE_POP (1);
- goto compare_1;
- }
- if (integer_zerop (exp0))
- {
- switch (op)
- {
- case OPCODE_if_icmplt:
- case OPCODE_if_icmpge:
- op += 2;
- break;
- case OPCODE_if_icmpgt:
- case OPCODE_if_icmple:
- op -= 2;
- break;
- default:
- break;
- }
- generate_bytecode_insns (exp1, STACK_TARGET, state);
- NOTE_POP (1);
- goto compare_1;
- }
- generate_bytecode_insns (exp0, STACK_TARGET, state);
- generate_bytecode_insns (exp1, STACK_TARGET, state);
- NOTE_POP (2);
- goto compare_2;
- }
-
- default:
- generate_bytecode_insns (exp, STACK_TARGET, state);
- NOTE_POP (1);
- if (true_branch_first)
- {
- emit_if (false_label, OPCODE_ifeq, OPCODE_ifne, state);
- emit_goto (true_label, state);
- }
- else
- {
- emit_if (true_label, OPCODE_ifne, OPCODE_ifeq, state);
- emit_goto (false_label, state);
- }
- break;
- }
- if (save_SP != state->code_SP)
- fatal ("internal error - SP mismatch");
-}
-
-/* Call pending cleanups i.e. those for surrounding CLEANUP_POINT_EXPRs
- but only as far out as LIMIT (since we are about to jump to the
- emit label that is LIMIT). */
-
-static void
-call_cleanups (limit, state)
- struct jcf_block *limit;
- struct jcf_partial *state;
-{
- struct jcf_block *block = state->labeled_blocks;
- for (; block != limit; block = block->next)
- {
- if (block->pc == PENDING_CLEANUP_PC)
- emit_jsr (block, state);
- }
-}
-
-static void
-generate_bytecode_return (exp, state)
- tree exp;
- struct jcf_partial *state;
-{
- tree return_type = TREE_TYPE (TREE_TYPE (state->current_method));
- int returns_void = TREE_CODE (return_type) == VOID_TYPE;
- int op;
- again:
- if (exp != NULL)
- {
- switch (TREE_CODE (exp))
- {
- case COMPOUND_EXPR:
- generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET,
- state);
- exp = TREE_OPERAND (exp, 1);
- goto again;
- case COND_EXPR:
- {
- struct jcf_block *then_label = gen_jcf_label (state);
- struct jcf_block *else_label = gen_jcf_label (state);
- generate_bytecode_conditional (TREE_OPERAND (exp, 0),
- then_label, else_label, 1, state);
- define_jcf_label (then_label, state);
- generate_bytecode_return (TREE_OPERAND (exp, 1), state);
- define_jcf_label (else_label, state);
- generate_bytecode_return (TREE_OPERAND (exp, 2), state);
- }
- return;
- default:
- generate_bytecode_insns (exp,
- returns_void ? IGNORE_TARGET
- : STACK_TARGET, state);
- }
- }
- if (returns_void)
- {
- op = OPCODE_return;
- call_cleanups (NULL_TREE, state);
- }
- else
- {
- op = OPCODE_ireturn + adjust_typed_op (return_type, 4);
- if (state->num_finalizers > 0)
- {
- if (state->return_value_decl == NULL_TREE)
- {
- state->return_value_decl
- = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (exp));
- localvar_alloc (state->return_value_decl, state);
- }
- emit_store (state->return_value_decl, state);
- call_cleanups (NULL_TREE, state);
- emit_load (state->return_value_decl, state);
- /* If we call localvar_free (state->return_value_decl, state),
- then we risk the save decl erroneously re-used in the
- finalizer. Instead, we keep the state->return_value_decl
- allocated through the rest of the method. This is not
- the greatest solution, but it is at least simple and safe. */
- }
- }
- RESERVE (1);
- OP1 (op);
-}
-
-/* Generate bytecode for sub-expression EXP of METHOD.
- TARGET is one of STACK_TARGET or IGNORE_TARGET. */
-
-static void
-generate_bytecode_insns (exp, target, state)
- tree exp;
- int target;
- struct jcf_partial *state;
-{
- tree type;
- enum java_opcode jopcode;
- int op;
- HOST_WIDE_INT value;
- int post_op;
- int size;
- int offset;
-
- if (exp == NULL && target == IGNORE_TARGET)
- return;
-
- type = TREE_TYPE (exp);
-
- switch (TREE_CODE (exp))
- {
- case BLOCK:
- if (BLOCK_EXPR_BODY (exp))
- {
- tree local;
- tree body = BLOCK_EXPR_BODY (exp);
- for (local = BLOCK_EXPR_DECLS (exp); local; )
- {
- tree next = TREE_CHAIN (local);
- localvar_alloc (local, state);
- local = next;
- }
- /* Avoid deep recursion for long blocks. */
- while (TREE_CODE (body) == COMPOUND_EXPR)
- {
- generate_bytecode_insns (TREE_OPERAND (body, 0), target, state);
- body = TREE_OPERAND (body, 1);
- }
- generate_bytecode_insns (body, target, state);
- for (local = BLOCK_EXPR_DECLS (exp); local; )
- {
- tree next = TREE_CHAIN (local);
- localvar_free (local, state);
- local = next;
- }
- }
- break;
- case COMPOUND_EXPR:
- generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET, state);
- generate_bytecode_insns (TREE_OPERAND (exp, 1), target, state);
- break;
- case EXPR_WITH_FILE_LOCATION:
- {
- char *saved_input_filename = input_filename;
- tree body = EXPR_WFL_NODE (exp);
- int saved_lineno = lineno;
- if (body == empty_stmt_node)
- break;
- input_filename = EXPR_WFL_FILENAME (exp);
- lineno = EXPR_WFL_LINENO (exp);
- if (EXPR_WFL_EMIT_LINE_NOTE (exp) && lineno > 0
- && debug_info_level > DINFO_LEVEL_NONE)
- put_linenumber (lineno, state);
- generate_bytecode_insns (body, target, state);
- input_filename = saved_input_filename;
- lineno = saved_lineno;
- }
- break;
- case INTEGER_CST:
- if (target == IGNORE_TARGET) ; /* do nothing */
- else if (TREE_CODE (type) == POINTER_TYPE)
- {
- if (! integer_zerop (exp))
- abort();
- RESERVE(1);
- OP1 (OPCODE_aconst_null);
- NOTE_PUSH (1);
- }
- else if (TYPE_PRECISION (type) <= 32)
- {
- push_int_const (TREE_INT_CST_LOW (exp), state);
- NOTE_PUSH (1);
- }
- else
- {
- push_long_const (TREE_INT_CST_LOW (exp), TREE_INT_CST_HIGH (exp),
- state);
- NOTE_PUSH (2);
- }
- break;
- case REAL_CST:
- {
- int prec = TYPE_PRECISION (type) >> 5;
- RESERVE(1);
- if (real_zerop (exp))
- OP1 (prec == 1 ? OPCODE_fconst_0 : OPCODE_dconst_0);
- else if (real_onep (exp))
- OP1 (prec == 1 ? OPCODE_fconst_1 : OPCODE_dconst_1);
- /* FIXME Should also use fconst_2 for 2.0f.
- Also, should use iconst_2/ldc followed by i2f/i2d
- for other float/double when the value is a small integer. */
- else
- {
- offset = find_constant_index (exp, state);
- if (prec == 1)
- push_constant1 (offset, state);
- else
- push_constant2 (offset, state);
- }
- NOTE_PUSH (prec);
- }
- break;
- case STRING_CST:
- push_constant1 (find_string_constant (&state->cpool, exp), state);
- NOTE_PUSH (1);
- break;
- case VAR_DECL:
- if (TREE_STATIC (exp))
- {
- field_op (exp, OPCODE_getstatic, state);
- NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 2 : 1);
- break;
- }
- /* ... fall through ... */
- case PARM_DECL:
- emit_load (exp, state);
- break;
- case NON_LVALUE_EXPR:
- case INDIRECT_REF:
- generate_bytecode_insns (TREE_OPERAND (exp, 0), target, state);
- break;
- case ARRAY_REF:
- generate_bytecode_insns (TREE_OPERAND (exp, 0), target, state);
- generate_bytecode_insns (TREE_OPERAND (exp, 1), target, state);
- if (target != IGNORE_TARGET)
- {
- jopcode = OPCODE_iaload + adjust_typed_op (type, 7);
- RESERVE(1);
- OP1 (jopcode);
- if (! TYPE_IS_WIDE (type))
- NOTE_POP (1);
- }
- break;
- case COMPONENT_REF:
- {
- tree obj = TREE_OPERAND (exp, 0);
- tree field = TREE_OPERAND (exp, 1);
- int is_static = FIELD_STATIC (field);
- generate_bytecode_insns (obj,
- is_static ? IGNORE_TARGET : target, state);
- if (target != IGNORE_TARGET)
- {
- if (DECL_NAME (field) == length_identifier_node && !is_static
- && TYPE_ARRAY_P (TREE_TYPE (obj)))
- {
- RESERVE (1);
- OP1 (OPCODE_arraylength);
- }
- else
- {
- field_op (field, is_static ? OPCODE_getstatic : OPCODE_getfield,
- state);
- if (! is_static)
- NOTE_POP (1);
- NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (field)) ? 2 : 1);
- }
- }
- }
- break;
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case GT_EXPR:
- case LT_EXPR:
- case GE_EXPR:
- case LE_EXPR:
- {
- struct jcf_block *then_label = gen_jcf_label (state);
- struct jcf_block *else_label = gen_jcf_label (state);
- struct jcf_block *end_label = gen_jcf_label (state);
- generate_bytecode_conditional (exp,
- then_label, else_label, 1, state);
- define_jcf_label (then_label, state);
- push_int_const (1, state);
- emit_goto (end_label, state);
- define_jcf_label (else_label, state);
- push_int_const (0, state);
- define_jcf_label (end_label, state);
- NOTE_PUSH (1);
- }
- break;
- case COND_EXPR:
- {
- struct jcf_block *then_label = gen_jcf_label (state);
- struct jcf_block *else_label = gen_jcf_label (state);
- struct jcf_block *end_label = gen_jcf_label (state);
- generate_bytecode_conditional (TREE_OPERAND (exp, 0),
- then_label, else_label, 1, state);
- define_jcf_label (then_label, state);
- generate_bytecode_insns (TREE_OPERAND (exp, 1), target, state);
- if (CAN_COMPLETE_NORMALLY (TREE_OPERAND (exp, 1))
- /* Not all expressions have CAN_COMPLETE_NORMALLY set properly. */
- || TREE_CODE (TREE_TYPE (exp)) != VOID_TYPE)
- emit_goto (end_label, state);
- define_jcf_label (else_label, state);
- generate_bytecode_insns (TREE_OPERAND (exp, 2), target, state);
- define_jcf_label (end_label, state);
- }
- break;
- case CASE_EXPR:
- {
- struct jcf_switch_state *sw_state = state->sw_state;
- struct jcf_relocation *reloc = (struct jcf_relocation *)
- obstack_alloc (state->chunk_obstack, sizeof (struct jcf_relocation));
- HOST_WIDE_INT case_value = TREE_INT_CST_LOW (TREE_OPERAND (exp, 0));
- reloc->kind = 0;
- reloc->label = get_jcf_label_here (state);
- reloc->offset = case_value;
- reloc->next = sw_state->cases;
- sw_state->cases = reloc;
- if (sw_state->num_cases == 0)
- {
- sw_state->min_case = case_value;
- sw_state->max_case = case_value;
- }
- else
- {
- if (case_value < sw_state->min_case)
- sw_state->min_case = case_value;
- if (case_value > sw_state->max_case)
- sw_state->max_case = case_value;
- }
- sw_state->num_cases++;
- }
- break;
- case DEFAULT_EXPR:
- state->sw_state->default_label = get_jcf_label_here (state);
- break;
-
- case SWITCH_EXPR:
- {
- /* The SWITCH_EXPR has three parts, generated in the following order:
- 1. the switch_expression (the value used to select the correct case);
- 2. the switch_body;
- 3. the switch_instruction (the tableswitch/loopupswitch instruction.).
- After code generation, we will re-order then in the order 1, 3, 2.
- This is to avoid an extra GOTOs. */
- struct jcf_switch_state sw_state;
- struct jcf_block *expression_last; /* Last block of the switch_expression. */
- struct jcf_block *body_last; /* Last block of the switch_body. */
- struct jcf_block *switch_instruction; /* First block of switch_instruction. */
- struct jcf_block *instruction_last; /* Last block of the switch_instruction. */
- struct jcf_block *body_block;
- int switch_length;
- sw_state.prev = state->sw_state;
- state->sw_state = &sw_state;
- sw_state.cases = NULL;
- sw_state.num_cases = 0;
- sw_state.default_label = NULL;
- generate_bytecode_insns (TREE_OPERAND (exp, 0), STACK_TARGET, state);
- expression_last = state->last_block;
- body_block = get_jcf_label_here (state); /* Force a new block here. */
- generate_bytecode_insns (TREE_OPERAND (exp, 1), IGNORE_TARGET, state);
- body_last = state->last_block;
-
- switch_instruction = gen_jcf_label (state);
- define_jcf_label (switch_instruction, state);
- if (sw_state.default_label == NULL)
- sw_state.default_label = gen_jcf_label (state);
-
- if (sw_state.num_cases <= 1)
- {
- if (sw_state.num_cases == 0)
- {
- emit_pop (1, state);
- NOTE_POP (1);
- }
- else
- {
- push_int_const (sw_state.cases->offset, state);
- emit_if (sw_state.cases->label,
- OPCODE_ifeq, OPCODE_ifne, state);
- }
- emit_goto (sw_state.default_label, state);
- }
- else
- {
- HOST_WIDE_INT i;
- /* Copy the chain of relocs into a sorted array. */
- struct jcf_relocation **relocs = (struct jcf_relocation **)
- xmalloc (sw_state.num_cases * sizeof (struct jcf_relocation *));
- /* The relocs arrays is a buffer with a gap.
- The assumption is that cases will normally come in "runs". */
- int gap_start = 0;
- int gap_end = sw_state.num_cases;
- struct jcf_relocation *reloc;
- for (reloc = sw_state.cases; reloc != NULL; reloc = reloc->next)
- {
- HOST_WIDE_INT case_value = reloc->offset;
- while (gap_end < sw_state.num_cases)
- {
- struct jcf_relocation *end = relocs[gap_end];
- if (case_value <= end->offset)
- break;
- relocs[gap_start++] = end;
- gap_end++;
- }
- while (gap_start > 0)
- {
- struct jcf_relocation *before = relocs[gap_start-1];
- if (case_value >= before->offset)
- break;
- relocs[--gap_end] = before;
- gap_start--;
- }
- relocs[gap_start++] = reloc;
- /* Note we don't check for duplicates. FIXME! */
- }
-
- if (2 * sw_state.num_cases
- >= sw_state.max_case - sw_state.min_case)
- { /* Use tableswitch. */
- int index = 0;
- RESERVE (13 + 4 * (sw_state.max_case - sw_state.min_case + 1));
- OP1 (OPCODE_tableswitch);
- emit_reloc (0, SWITCH_ALIGN_RELOC, NULL, state);
- emit_switch_reloc (sw_state.default_label, state);
- OP4 (sw_state.min_case);
- OP4 (sw_state.max_case);
- for (i = sw_state.min_case; ; )
- {
- reloc = relocs[index];
- if (i == reloc->offset)
- {
- emit_case_reloc (reloc, state);
- if (i == sw_state.max_case)
- break;
- index++;
- }
- else
- emit_switch_reloc (sw_state.default_label, state);
- i++;
- }
- }
- else
- { /* Use lookupswitch. */
- RESERVE(9 + 8 * sw_state.num_cases);
- OP1 (OPCODE_lookupswitch);
- emit_reloc (0, SWITCH_ALIGN_RELOC, NULL, state);
- emit_switch_reloc (sw_state.default_label, state);
- OP4 (sw_state.num_cases);
- for (i = 0; i < sw_state.num_cases; i++)
- {
- struct jcf_relocation *reloc = relocs[i];
- OP4 (reloc->offset);
- emit_case_reloc (reloc, state);
- }
- }
- free (relocs);
- }
-
- instruction_last = state->last_block;
- if (sw_state.default_label->pc < 0)
- define_jcf_label (sw_state.default_label, state);
- else /* Force a new block. */
- sw_state.default_label = get_jcf_label_here (state);
- /* Now re-arrange the blocks so the switch_instruction
- comes before the switch_body. */
- switch_length = state->code_length - switch_instruction->pc;
- switch_instruction->pc = body_block->pc;
- instruction_last->next = body_block;
- instruction_last->v.chunk->next = body_block->v.chunk;
- expression_last->next = switch_instruction;
- expression_last->v.chunk->next = switch_instruction->v.chunk;
- body_last->next = sw_state.default_label;
- body_last->v.chunk->next = NULL;
- state->chunk = body_last->v.chunk;
- for (; body_block != sw_state.default_label; body_block = body_block->next)
- body_block->pc += switch_length;
-
- state->sw_state = sw_state.prev;
- break;
- }
-
- case RETURN_EXPR:
- exp = TREE_OPERAND (exp, 0);
- if (exp == NULL_TREE)
- exp = empty_stmt_node;
- else if (TREE_CODE (exp) != MODIFY_EXPR)
- abort ();
- else
- exp = TREE_OPERAND (exp, 1);
- generate_bytecode_return (exp, state);
- break;
- case LABELED_BLOCK_EXPR:
- {
- struct jcf_block *end_label = gen_jcf_label (state);
- end_label->next = state->labeled_blocks;
- state->labeled_blocks = end_label;
- end_label->pc = PENDING_EXIT_PC;
- end_label->u.labeled_block = exp;
- if (LABELED_BLOCK_BODY (exp))
- generate_bytecode_insns (LABELED_BLOCK_BODY (exp), target, state);
- if (state->labeled_blocks != end_label)
- abort();
- state->labeled_blocks = end_label->next;
- define_jcf_label (end_label, state);
- }
- break;
- case LOOP_EXPR:
- {
- tree body = TREE_OPERAND (exp, 0);
-#if 0
- if (TREE_CODE (body) == COMPOUND_EXPR
- && TREE_CODE (TREE_OPERAND (body, 0)) == EXIT_EXPR)
- {
- /* Optimize: H: if (TEST) GOTO L; BODY; GOTO H; L:
- to: GOTO L; BODY; L: if (!TEST) GOTO L; */
- struct jcf_block *head_label;
- struct jcf_block *body_label;
- struct jcf_block *end_label = gen_jcf_label (state);
- struct jcf_block *exit_label = state->labeled_blocks;
- head_label = gen_jcf_label (state);
- emit_goto (head_label, state);
- body_label = get_jcf_label_here (state);
- generate_bytecode_insns (TREE_OPERAND (body, 1), target, state);
- define_jcf_label (head_label, state);
- generate_bytecode_conditional (TREE_OPERAND (body, 0),
- end_label, body_label, 1, state);
- define_jcf_label (end_label, state);
- }
- else
-#endif
- {
- struct jcf_block *head_label = get_jcf_label_here (state);
- generate_bytecode_insns (body, IGNORE_TARGET, state);
- emit_goto (head_label, state);
- }
- }
- break;
- case EXIT_EXPR:
- {
- struct jcf_block *label = state->labeled_blocks;
- struct jcf_block *end_label = gen_jcf_label (state);
- generate_bytecode_conditional (TREE_OPERAND (exp, 0),
- label, end_label, 0, state);
- define_jcf_label (end_label, state);
- }
- break;
- case EXIT_BLOCK_EXPR:
- {
- struct jcf_block *label = state->labeled_blocks;
- if (TREE_OPERAND (exp, 1) != NULL) goto notimpl;
- while (label->u.labeled_block != TREE_OPERAND (exp, 0))
- label = label->next;
- call_cleanups (label, state);
- emit_goto (label, state);
- }
- break;
-
- case PREDECREMENT_EXPR: value = -1; post_op = 0; goto increment;
- case PREINCREMENT_EXPR: value = 1; post_op = 0; goto increment;
- case POSTDECREMENT_EXPR: value = -1; post_op = 1; goto increment;
- case POSTINCREMENT_EXPR: value = 1; post_op = 1; goto increment;
- increment:
-
- exp = TREE_OPERAND (exp, 0);
- type = TREE_TYPE (exp);
- size = TYPE_IS_WIDE (type) ? 2 : 1;
- if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == PARM_DECL)
- && ! TREE_STATIC (exp)
- && TREE_CODE (type) == INTEGER_TYPE
- && TYPE_PRECISION (type) == 32)
- {
- if (target != IGNORE_TARGET && post_op)
- emit_load (exp, state);
- emit_iinc (exp, value, state);
- if (target != IGNORE_TARGET && ! post_op)
- emit_load (exp, state);
- break;
- }
- if (TREE_CODE (exp) == COMPONENT_REF)
- {
- generate_bytecode_insns (TREE_OPERAND (exp, 0), STACK_TARGET, state);
- emit_dup (1, 0, state);
- /* Stack: ..., objectref, objectref. */
- field_op (TREE_OPERAND (exp, 1), OPCODE_getfield, state);
- NOTE_PUSH (size-1);
- /* Stack: ..., objectref, oldvalue. */
- offset = 1;
- }
- else if (TREE_CODE (exp) == ARRAY_REF)
- {
- generate_bytecode_insns (TREE_OPERAND (exp, 0), STACK_TARGET, state);
- generate_bytecode_insns (TREE_OPERAND (exp, 1), STACK_TARGET, state);
- emit_dup (2, 0, state);
- /* Stack: ..., array, index, array, index. */
- jopcode = OPCODE_iaload + adjust_typed_op (TREE_TYPE (exp), 7);
- RESERVE(1);
- OP1 (jopcode);
- NOTE_POP (2-size);
- /* Stack: ..., array, index, oldvalue. */
- offset = 2;
- }
- else if (TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == PARM_DECL)
- {
- generate_bytecode_insns (exp, STACK_TARGET, state);
- /* Stack: ..., oldvalue. */
- offset = 0;
- }
- else
- abort ();
-
- if (target != IGNORE_TARGET && post_op)
- emit_dup (size, offset, state);
- /* Stack, if ARRAY_REF: ..., [result, ] array, index, oldvalue. */
- /* Stack, if COMPONENT_REF: ..., [result, ] objectref, oldvalue. */
- /* Stack, otherwise: ..., [result, ] oldvalue. */
- if (size == 1)
- push_int_const (value, state);
- else
- push_long_const (value, value >= 0 ? 0 : -1, state);
- NOTE_PUSH (size);
- emit_binop (OPCODE_iadd + adjust_typed_op (type, 3), type, state);
- if (target != IGNORE_TARGET && ! post_op)
- emit_dup (size, offset, state);
- /* Stack, if ARRAY_REF: ..., [result, ] array, index, newvalue. */
- /* Stack, if COMPONENT_REF: ..., [result, ] objectref, newvalue. */
- /* Stack, otherwise: ..., [result, ] newvalue. */
- goto finish_assignment;
-
- case MODIFY_EXPR:
- {
- tree lhs = TREE_OPERAND (exp, 0);
- tree rhs = TREE_OPERAND (exp, 1);
- int offset = 0;
-
- /* See if we can use the iinc instruction. */
- if ((TREE_CODE (lhs) == VAR_DECL || TREE_CODE (lhs) == PARM_DECL)
- && ! TREE_STATIC (lhs)
- && TREE_CODE (TREE_TYPE (lhs)) == INTEGER_TYPE
- && TYPE_PRECISION (TREE_TYPE (lhs)) == 32
- && (TREE_CODE (rhs) == PLUS_EXPR || TREE_CODE (rhs) == MINUS_EXPR))
- {
- tree arg0 = TREE_OPERAND (rhs, 0);
- tree arg1 = TREE_OPERAND (rhs, 1);
- HOST_WIDE_INT min_value = -32768;
- HOST_WIDE_INT max_value = 32767;
- if (TREE_CODE (rhs) == MINUS_EXPR)
- {
- min_value++;
- max_value++;
- }
- else if (arg1 == lhs)
- {
- arg0 = arg1;
- arg1 = TREE_OPERAND (rhs, 0);
- }
- if (lhs == arg0 && TREE_CODE (arg1) == INTEGER_CST)
- {
- HOST_WIDE_INT hi_value = TREE_INT_CST_HIGH (arg1);
- value = TREE_INT_CST_LOW (arg1);
- if ((hi_value == 0 && value <= max_value)
- || (hi_value == -1 && value >= min_value))
- {
- if (TREE_CODE (rhs) == MINUS_EXPR)
- value = -value;
- emit_iinc (lhs, value, state);
- break;
- }
- }
- }
-
- if (TREE_CODE (lhs) == COMPONENT_REF)
- {
- generate_bytecode_insns (TREE_OPERAND (lhs, 0),
- STACK_TARGET, state);
- offset = 1;
- }
- else if (TREE_CODE (lhs) == ARRAY_REF)
- {
- generate_bytecode_insns (TREE_OPERAND(lhs, 0),
- STACK_TARGET, state);
- generate_bytecode_insns (TREE_OPERAND(lhs, 1),
- STACK_TARGET, state);
- offset = 2;
- }
- else
- offset = 0;
- generate_bytecode_insns (rhs, STACK_TARGET, state);
- if (target != IGNORE_TARGET)
- emit_dup (TYPE_IS_WIDE (type) ? 2 : 1 , offset, state);
- exp = lhs;
- }
- /* FALLTHOUGH */
-
- finish_assignment:
- if (TREE_CODE (exp) == COMPONENT_REF)
- {
- tree field = TREE_OPERAND (exp, 1);
- if (! FIELD_STATIC (field))
- NOTE_POP (1);
- field_op (field,
- FIELD_STATIC (field) ? OPCODE_putstatic : OPCODE_putfield,
- state);
-
- NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (field)) ? 2 : 1);
- }
- else if (TREE_CODE (exp) == VAR_DECL
- || TREE_CODE (exp) == PARM_DECL)
- {
- if (FIELD_STATIC (exp))
- {
- field_op (exp, OPCODE_putstatic, state);
- NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 2 : 1);
- }
- else
- emit_store (exp, state);
- }
- else if (TREE_CODE (exp) == ARRAY_REF)
- {
- jopcode = OPCODE_iastore + adjust_typed_op (TREE_TYPE (exp), 7);
- RESERVE(1);
- OP1 (jopcode);
- NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 4 : 3);
- }
- else
- fatal ("internal error (bad lhs to MODIFY_EXPR)");
- break;
- case PLUS_EXPR:
- jopcode = OPCODE_iadd;
- goto binop;
- case MINUS_EXPR:
- jopcode = OPCODE_isub;
- goto binop;
- case MULT_EXPR:
- jopcode = OPCODE_imul;
- goto binop;
- case TRUNC_DIV_EXPR:
- case RDIV_EXPR:
- jopcode = OPCODE_idiv;
- goto binop;
- case TRUNC_MOD_EXPR:
- jopcode = OPCODE_irem;
- goto binop;
- case LSHIFT_EXPR: jopcode = OPCODE_ishl; goto binop;
- case RSHIFT_EXPR: jopcode = OPCODE_ishr; goto binop;
- case URSHIFT_EXPR: jopcode = OPCODE_iushr; goto binop;
- case TRUTH_AND_EXPR:
- case BIT_AND_EXPR: jopcode = OPCODE_iand; goto binop;
- case TRUTH_OR_EXPR:
- case BIT_IOR_EXPR: jopcode = OPCODE_ior; goto binop;
- case TRUTH_XOR_EXPR:
- case BIT_XOR_EXPR: jopcode = OPCODE_ixor; goto binop;
- binop:
- {
- tree arg0 = TREE_OPERAND (exp, 0);
- tree arg1 = TREE_OPERAND (exp, 1);
- jopcode += adjust_typed_op (type, 3);
- if (arg0 == arg1 && TREE_CODE (arg0) == SAVE_EXPR)
- {
- /* fold may (e.g) convert 2*x to x+x. */
- generate_bytecode_insns (TREE_OPERAND (arg0, 0), target, state);
- emit_dup (TYPE_PRECISION (TREE_TYPE (arg0)) > 32 ? 2 : 1, 0, state);
- }
- else
- {
- generate_bytecode_insns (arg0, target, state);
- generate_bytecode_insns (arg1, target, state);
- }
- /* For most binary operations, both operands and the result have the
- same type. Shift operations are different. Using arg1's type
- gets us the correct SP adjustment in all casesd. */
- if (target == STACK_TARGET)
- emit_binop (jopcode, TREE_TYPE (arg1), state);
- break;
- }
- case TRUTH_NOT_EXPR:
- case BIT_NOT_EXPR:
- generate_bytecode_insns (TREE_OPERAND (exp, 0), target, state);
- if (target == STACK_TARGET)
- {
- int is_long = TYPE_PRECISION (TREE_TYPE (exp)) > 32;
- push_int_const (TREE_CODE (exp) == BIT_NOT_EXPR ? -1 : 1, state);
- RESERVE (2);
- if (is_long)
- OP1 (OPCODE_i2l);
- NOTE_PUSH (1 + is_long);
- OP1 (OPCODE_ixor + is_long);
- NOTE_POP (1 + is_long);
- }
- break;
- case NEGATE_EXPR:
- jopcode = OPCODE_ineg;
- jopcode += adjust_typed_op (type, 3);
- generate_bytecode_insns (TREE_OPERAND (exp, 0), target, state);
- if (target == STACK_TARGET)
- emit_unop (jopcode, type, state);
- break;
- case INSTANCEOF_EXPR:
- {
- int index = find_class_constant (&state->cpool, TREE_OPERAND (exp, 1));
- generate_bytecode_insns (TREE_OPERAND (exp, 0), target, state);
- RESERVE (3);
- OP1 (OPCODE_instanceof);
- OP2 (index);
- }
- break;
- case CONVERT_EXPR:
- case NOP_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- {
- tree src = TREE_OPERAND (exp, 0);
- tree src_type = TREE_TYPE (src);
- tree dst_type = TREE_TYPE (exp);
- generate_bytecode_insns (TREE_OPERAND (exp, 0), target, state);
- if (target == IGNORE_TARGET || src_type == dst_type)
- break;
- if (TREE_CODE (dst_type) == POINTER_TYPE)
- {
- if (TREE_CODE (exp) == CONVERT_EXPR)
- {
- int index = find_class_constant (&state->cpool, TREE_TYPE (dst_type));
- RESERVE (3);
- OP1 (OPCODE_checkcast);
- OP2 (index);
- }
- }
- else /* Convert numeric types. */
- {
- int wide_src = TYPE_PRECISION (src_type) > 32;
- int wide_dst = TYPE_PRECISION (dst_type) > 32;
- NOTE_POP (1 + wide_src);
- RESERVE (1);
- if (TREE_CODE (dst_type) == REAL_TYPE)
- {
- if (TREE_CODE (src_type) == REAL_TYPE)
- OP1 (wide_dst ? OPCODE_f2d : OPCODE_d2f);
- else if (TYPE_PRECISION (src_type) == 64)
- OP1 (OPCODE_l2f + wide_dst);
- else
- OP1 (OPCODE_i2f + wide_dst);
- }
- else /* Convert to integral type. */
- {
- if (TREE_CODE (src_type) == REAL_TYPE)
- OP1 (OPCODE_f2i + wide_dst + 3 * wide_src);
- else if (wide_dst)
- OP1 (OPCODE_i2l);
- else if (wide_src)
- OP1 (OPCODE_l2i);
- if (TYPE_PRECISION (dst_type) < 32)
- {
- RESERVE (1);
- /* Already converted to int, if needed. */
- if (TYPE_PRECISION (dst_type) <= 8)
- OP1 (OPCODE_i2b);
- else if (TREE_UNSIGNED (dst_type))
- OP1 (OPCODE_i2c);
- else
- OP1 (OPCODE_i2s);
- }
- }
- NOTE_PUSH (1 + wide_dst);
- }
- }
- break;
-
- case CLEANUP_POINT_EXPR:
- {
- struct jcf_block *save_labeled_blocks = state->labeled_blocks;
- int can_complete = CAN_COMPLETE_NORMALLY (TREE_OPERAND (exp, 0));
- generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET, state);
- if (target != IGNORE_TARGET)
- abort ();
- while (state->labeled_blocks != save_labeled_blocks)
- {
- struct jcf_block *finished_label = NULL;
- tree return_link;
- tree exception_type = build_pointer_type (throwable_type_node);
- tree exception_decl = build_decl (VAR_DECL, NULL_TREE,
- exception_type);
- struct jcf_block *end_label = get_jcf_label_here (state);
- struct jcf_block *label = state->labeled_blocks;
- struct jcf_handler *handler;
- tree cleanup = label->u.labeled_block;
- state->labeled_blocks = label->next;
- state->num_finalizers--;
- if (can_complete)
- {
- finished_label = gen_jcf_label (state);
- emit_jsr (label, state);
- emit_goto (finished_label, state);
- if (! CAN_COMPLETE_NORMALLY (cleanup))
- can_complete = 0;
- }
- handler = alloc_handler (label->v.start_label, end_label, state);
- handler->type = NULL_TREE;
- localvar_alloc (exception_decl, state);
- NOTE_PUSH (1);
- emit_store (exception_decl, state);
- emit_jsr (label, state);
- emit_load (exception_decl, state);
- RESERVE (1);
- OP1 (OPCODE_athrow);
- NOTE_POP (1);
-
- /* The finally block. */
- return_link = build_decl (VAR_DECL, NULL_TREE,
- return_address_type_node);
- define_jcf_label (label, state);
- NOTE_PUSH (1);
- localvar_alloc (return_link, state);
- emit_store (return_link, state);
- generate_bytecode_insns (cleanup, IGNORE_TARGET, state);
- maybe_wide (OPCODE_ret, DECL_LOCAL_INDEX (return_link), state);
- localvar_free (return_link, state);
- localvar_free (exception_decl, state);
- if (finished_label != NULL)
- define_jcf_label (finished_label, state);
- }
- }
- break;
-
- case WITH_CLEANUP_EXPR:
- {
- struct jcf_block *label;
- generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET, state);
- label = gen_jcf_label (state);
- label->pc = PENDING_CLEANUP_PC;
- label->next = state->labeled_blocks;
- state->labeled_blocks = label;
- state->num_finalizers++;
- label->u.labeled_block = TREE_OPERAND (exp, 2);
- label->v.start_label = get_jcf_label_here (state);
- if (target != IGNORE_TARGET)
- abort ();
- }
- break;
-
- case TRY_EXPR:
- {
- tree try_clause = TREE_OPERAND (exp, 0);
- struct jcf_block *start_label = get_jcf_label_here (state);
- struct jcf_block *end_label; /* End of try clause. */
- struct jcf_block *finished_label = gen_jcf_label (state);
- tree clause = TREE_OPERAND (exp, 1);
- if (target != IGNORE_TARGET)
- abort ();
- generate_bytecode_insns (try_clause, IGNORE_TARGET, state);
- end_label = get_jcf_label_here (state);
- if (CAN_COMPLETE_NORMALLY (try_clause))
- emit_goto (finished_label, state);
- while (clause != NULL_TREE)
- {
- tree catch_clause = TREE_OPERAND (clause, 0);
- tree exception_decl = BLOCK_EXPR_DECLS (catch_clause);
- struct jcf_handler *handler = alloc_handler (start_label, end_label, state);
- if (exception_decl == NULL_TREE)
- handler->type = NULL_TREE;
- else
- handler->type = TREE_TYPE (TREE_TYPE (exception_decl));
- generate_bytecode_insns (catch_clause, IGNORE_TARGET, state);
- clause = TREE_CHAIN (clause);
- if (CAN_COMPLETE_NORMALLY (catch_clause) && clause != NULL_TREE)
- emit_goto (finished_label, state);
- }
- define_jcf_label (finished_label, state);
- }
- break;
- case TRY_FINALLY_EXPR:
- {
- tree try_block = TREE_OPERAND (exp, 0);
- tree finally = TREE_OPERAND (exp, 1);
- struct jcf_block *finished_label = gen_jcf_label (state);
- struct jcf_block *finally_label = gen_jcf_label (state);
- struct jcf_block *start_label = get_jcf_label_here (state);
- tree return_link = build_decl (VAR_DECL, NULL_TREE,
- return_address_type_node);
- tree exception_type = build_pointer_type (throwable_type_node);
- tree exception_decl = build_decl (VAR_DECL, NULL_TREE, exception_type);
- struct jcf_handler *handler;
-
- finally_label->pc = PENDING_CLEANUP_PC;
- finally_label->next = state->labeled_blocks;
- state->labeled_blocks = finally_label;
- state->num_finalizers++;
-
- generate_bytecode_insns (try_block, target, state);
- if (state->labeled_blocks != finally_label)
- abort();
- state->labeled_blocks = finally_label->next;
- emit_jsr (finally_label, state);
- if (CAN_COMPLETE_NORMALLY (try_block))
- emit_goto (finished_label, state);
-
- /* Handle exceptions. */
- localvar_alloc (return_link, state);
- handler = alloc_handler (start_label, NULL_TREE, state);
- handler->end_label = handler->handler_label;
- handler->type = NULL_TREE;
- localvar_alloc (exception_decl, state);
- NOTE_PUSH (1);
- emit_store (exception_decl, state);
- emit_jsr (finally_label, state);
- emit_load (exception_decl, state);
- RESERVE (1);
- OP1 (OPCODE_athrow);
- NOTE_POP (1);
- localvar_free (exception_decl, state);
-
- /* The finally block. First save return PC into return_link. */
- define_jcf_label (finally_label, state);
- NOTE_PUSH (1);
- emit_store (return_link, state);
-
- generate_bytecode_insns (finally, IGNORE_TARGET, state);
- maybe_wide (OPCODE_ret, DECL_LOCAL_INDEX (return_link), state);
- localvar_free (return_link, state);
- define_jcf_label (finished_label, state);
- }
- break;
- case THROW_EXPR:
- generate_bytecode_insns (TREE_OPERAND (exp, 0), STACK_TARGET, state);
- RESERVE (1);
- OP1 (OPCODE_athrow);
- break;
- case NEW_ARRAY_INIT:
- {
- tree values = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0));
- tree array_type = TREE_TYPE (TREE_TYPE (exp));
- tree element_type = TYPE_ARRAY_ELEMENT (array_type);
- HOST_WIDE_INT length = java_array_type_length (array_type);
- if (target == IGNORE_TARGET)
- {
- for ( ; values != NULL_TREE; values = TREE_CHAIN (values))
- generate_bytecode_insns (TREE_VALUE (values), target, state);
- break;
- }
- push_int_const (length, state);
- NOTE_PUSH (1);
- RESERVE (3);
- if (JPRIMITIVE_TYPE_P (element_type))
- {
- int atype = encode_newarray_type (element_type);
- OP1 (OPCODE_newarray);
- OP1 (atype);
- }
- else
- {
- int index = find_class_constant (&state->cpool,
- TREE_TYPE (element_type));
- OP1 (OPCODE_anewarray);
- OP2 (index);
- }
- offset = 0;
- jopcode = OPCODE_iastore + adjust_typed_op (element_type, 7);
- for ( ; values != NULL_TREE; values = TREE_CHAIN (values), offset++)
- {
- int save_SP = state->code_SP;
- emit_dup (1, 0, state);
- push_int_const (offset, state);
- NOTE_PUSH (1);
- generate_bytecode_insns (TREE_VALUE (values), STACK_TARGET, state);
- RESERVE (1);
- OP1 (jopcode);
- state->code_SP = save_SP;
- }
- }
- break;
- case NEW_CLASS_EXPR:
- {
- tree class = TREE_TYPE (TREE_TYPE (exp));
- int need_result = target != IGNORE_TARGET;
- int index = find_class_constant (&state->cpool, class);
- RESERVE (4);
- OP1 (OPCODE_new);
- OP2 (index);
- if (need_result)
- OP1 (OPCODE_dup);
- NOTE_PUSH (1 + need_result);
- }
- /* ... fall though ... */
- case CALL_EXPR:
- {
- tree f = TREE_OPERAND (exp, 0);
- tree x = TREE_OPERAND (exp, 1);
- int save_SP = state->code_SP;
- int nargs;
- if (TREE_CODE (f) == ADDR_EXPR)
- f = TREE_OPERAND (f, 0);
- if (f == soft_newarray_node)
- {
- int type_code = TREE_INT_CST_LOW (TREE_VALUE (x));
- generate_bytecode_insns (TREE_VALUE (TREE_CHAIN (x)),
- STACK_TARGET, state);
- RESERVE (2);
- OP1 (OPCODE_newarray);
- OP1 (type_code);
- break;
- }
- else if (f == soft_multianewarray_node)
- {
- int ndims;
- int idim;
- int index = find_class_constant (&state->cpool,
- TREE_TYPE (TREE_TYPE (exp)));
- x = TREE_CHAIN (x); /* Skip class argument. */
- ndims = TREE_INT_CST_LOW (TREE_VALUE (x));
- for (idim = ndims; --idim >= 0; )
- {
- x = TREE_CHAIN (x);
- generate_bytecode_insns (TREE_VALUE (x), STACK_TARGET, state);
- }
- RESERVE (4);
- OP1 (OPCODE_multianewarray);
- OP2 (index);
- OP1 (ndims);
- break;
- }
- else if (f == soft_anewarray_node)
- {
- tree cl = TYPE_ARRAY_ELEMENT (TREE_TYPE (TREE_TYPE (exp)));
- int index = find_class_constant (&state->cpool, TREE_TYPE (cl));
- generate_bytecode_insns (TREE_VALUE (x), STACK_TARGET, state);
- RESERVE (3);
- OP1 (OPCODE_anewarray);
- OP2 (index);
- break;
- }
- else if (f == soft_monitorenter_node
- || f == soft_monitorexit_node
- || f == throw_node)
- {
- if (f == soft_monitorenter_node)
- op = OPCODE_monitorenter;
- else if (f == soft_monitorexit_node)
- op = OPCODE_monitorexit;
- else
- op = OPCODE_athrow;
- generate_bytecode_insns (TREE_VALUE (x), STACK_TARGET, state);
- RESERVE (1);
- OP1 (op);
- NOTE_POP (1);
- break;
- }
- else if (exp == soft_exceptioninfo_call_node)
- {
- NOTE_PUSH (1); /* Pushed by exception system. */
- break;
- }
- for ( ; x != NULL_TREE; x = TREE_CHAIN (x))
- {
- generate_bytecode_insns (TREE_VALUE (x), STACK_TARGET, state);
- }
- nargs = state->code_SP - save_SP;
- state->code_SP = save_SP;
- if (f == soft_fmod_node)
- {
- RESERVE (1);
- OP1 (OPCODE_drem);
- NOTE_PUSH (2);
- break;
- }
- if (TREE_CODE (exp) == NEW_CLASS_EXPR)
- NOTE_POP (1); /* Pop implicit this. */
- if (TREE_CODE (f) == FUNCTION_DECL && DECL_CONTEXT (f) != NULL_TREE)
- {
- int index = find_methodref_index (&state->cpool, f);
- int interface = 0;
- RESERVE (5);
- if (METHOD_STATIC (f))
- OP1 (OPCODE_invokestatic);
- else if (DECL_CONSTRUCTOR_P (f) || CALL_USING_SUPER (exp)
- || METHOD_PRIVATE (f))
- OP1 (OPCODE_invokespecial);
- else if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (f))))
- {
- OP1 (OPCODE_invokeinterface);
- interface = 1;
- }
- else
- OP1 (OPCODE_invokevirtual);
- OP2 (index);
- f = TREE_TYPE (TREE_TYPE (f));
- if (TREE_CODE (f) != VOID_TYPE)
- {
- int size = TYPE_IS_WIDE (f) ? 2 : 1;
- if (target == IGNORE_TARGET)
- emit_pop (size, state);
- else
- NOTE_PUSH (size);
- }
- if (interface)
- {
- OP1 (nargs);
- OP1 (0);
- }
- break;
- }
- }
- /* fall through */
- notimpl:
- default:
- error("internal error - tree code not implemented: %s",
- tree_code_name [(int) TREE_CODE (exp)]);
- }
-}
-
-static void
-perform_relocations (state)
- struct jcf_partial *state;
-{
- struct jcf_block *block;
- struct jcf_relocation *reloc;
- int pc;
- int shrink;
-
- /* Before we start, the pc field of each block is an upper bound on
- the block's start pc (it may be less, if previous blocks need less
- than their maximum).
-
- The minimum size of each block is in the block's chunk->size. */
-
- /* First, figure out the actual locations of each block. */
- pc = 0;
- shrink = 0;
- for (block = state->blocks; block != NULL; block = block->next)
- {
- int block_size = block->v.chunk->size;
-
- block->pc = pc;
-
- /* Optimize GOTO L; L: by getting rid of the redundant goto.
- Assumes relocations are in reverse order. */
- reloc = block->u.relocations;
- while (reloc != NULL
- && reloc->kind == OPCODE_goto_w
- && reloc->label->pc == block->next->pc
- && reloc->offset + 2 == block_size)
- {
- reloc = reloc->next;
- block->u.relocations = reloc;
- block->v.chunk->size -= 3;
- block_size -= 3;
- shrink += 3;
- }
-
- for (reloc = block->u.relocations; reloc != NULL; reloc = reloc->next)
- {
- if (reloc->kind == SWITCH_ALIGN_RELOC)
- {
- /* We assume this is the first relocation in this block,
- so we know its final pc. */
- int where = pc + reloc->offset;
- int pad = ((where + 3) & ~3) - where;
- block_size += pad;
- }
- else if (reloc->kind < -1 || reloc->kind > BLOCK_START_RELOC)
- {
- int delta = reloc->label->pc - (pc + reloc->offset - 1);
- int expand = reloc->kind > 0 ? 2 : 5;
-
- if (delta > 0)
- delta -= shrink;
- if (delta >= -32768 && delta <= 32767)
- {
- shrink += expand;
- reloc->kind = -1;
- }
- else
- block_size += expand;
- }
- }
- pc += block_size;
- }
-
- for (block = state->blocks; block != NULL; block = block->next)
- {
- struct chunk *chunk = block->v.chunk;
- int old_size = chunk->size;
- int next_pc = block->next == NULL ? pc : block->next->pc;
- int new_size = next_pc - block->pc;
- unsigned char *new_ptr;
- unsigned char *old_buffer = chunk->data;
- unsigned char *old_ptr = old_buffer + old_size;
- if (new_size != old_size)
- {
- chunk->data = (unsigned char *)
- obstack_alloc (state->chunk_obstack, new_size);
- chunk->size = new_size;
- }
- new_ptr = chunk->data + new_size;
-
- /* We do the relocations from back to front, because
- the relocations are in reverse order. */
- for (reloc = block->u.relocations; ; reloc = reloc->next)
- {
- /* new_ptr and old_ptr point into the old and new buffers,
- respectively. (If no relocations cause the buffer to
- grow, the buffer will be the same buffer, and new_ptr==old_ptr.)
- The bytes at higher adress have been copied and relocations
- handled; those at lower addresses remain to process. */
-
- /* Lower old index of piece to be copied with no relocation.
- I.e. high index of the first piece that does need relocation. */
- int start = reloc == NULL ? 0
- : reloc->kind == SWITCH_ALIGN_RELOC ? reloc->offset
- : (reloc->kind == 0 || reloc->kind == BLOCK_START_RELOC)
- ? reloc->offset + 4
- : reloc->offset + 2;
- int32 value;
- int new_offset;
- int n = (old_ptr - old_buffer) - start;
- new_ptr -= n;
- old_ptr -= n;
- if (n > 0)
- memcpy (new_ptr, old_ptr, n);
- if (old_ptr == old_buffer)
- break;
-
- new_offset = new_ptr - chunk->data;
- new_offset -= (reloc->kind == -1 ? 2 : 4);
- if (reloc->kind == 0)
- {
- old_ptr -= 4;
- value = GET_u4 (old_ptr);
- }
- else if (reloc->kind == BLOCK_START_RELOC)
- {
- old_ptr -= 4;
- value = 0;
- new_offset = 0;
- }
- else if (reloc->kind == SWITCH_ALIGN_RELOC)
- {
- int where = block->pc + reloc->offset;
- int pad = ((where + 3) & ~3) - where;
- while (--pad >= 0)
- *--new_ptr = 0;
- continue;
- }
- else
- {
- old_ptr -= 2;
- value = GET_u2 (old_ptr);
- }
- value += reloc->label->pc - (block->pc + new_offset);
- *--new_ptr = (unsigned char) value; value >>= 8;
- *--new_ptr = (unsigned char) value; value >>= 8;
- if (reloc->kind != -1)
- {
- *--new_ptr = (unsigned char) value; value >>= 8;
- *--new_ptr = (unsigned char) value;
- }
- if (reloc->kind > BLOCK_START_RELOC)
- {
- /* Convert: OP TARGET to: OP_w TARGET; (OP is goto or jsr). */
- --old_ptr;
- *--new_ptr = reloc->kind;
- }
- else if (reloc->kind < -1)
- {
- /* Convert: ifCOND TARGET to: ifNCOND T; goto_w TARGET; T: */
- --old_ptr;
- *--new_ptr = OPCODE_goto_w;
- *--new_ptr = 3;
- *--new_ptr = 0;
- *--new_ptr = - reloc->kind;
- }
- }
- if (new_ptr != chunk->data)
- fatal ("internal error - perform_relocations");
- }
- state->code_length = pc;
-}
-
-static void
-init_jcf_state (state, work)
- struct jcf_partial *state;
- struct obstack *work;
-{
- state->chunk_obstack = work;
- state->first = state->chunk = NULL;
- CPOOL_INIT (&state->cpool);
- BUFFER_INIT (&state->localvars);
- BUFFER_INIT (&state->bytecode);
-}
-
-static void
-init_jcf_method (state, method)
- struct jcf_partial *state;
- tree method;
-{
- state->current_method = method;
- state->blocks = state->last_block = NULL;
- state->linenumber_count = 0;
- state->first_lvar = state->last_lvar = NULL;
- state->lvar_count = 0;
- state->labeled_blocks = NULL;
- state->code_length = 0;
- BUFFER_RESET (&state->bytecode);
- BUFFER_RESET (&state->localvars);
- state->code_SP = 0;
- state->code_SP_max = 0;
- state->handlers = NULL;
- state->last_handler = NULL;
- state->num_handlers = 0;
- state->num_finalizers = 0;
- state->return_value_decl = NULL_TREE;
-}
-
-static void
-release_jcf_state (state)
- struct jcf_partial *state;
-{
- CPOOL_FINISH (&state->cpool);
- obstack_free (state->chunk_obstack, state->first);
-}
-
-/* Generate and return a list of chunks containing the class CLAS
- in the .class file representation. The list can be written to a
- .class file using write_chunks. Allocate chunks from obstack WORK. */
-
-static struct chunk *
-generate_classfile (clas, state)
- tree clas;
- struct jcf_partial *state;
-{
- struct chunk *cpool_chunk;
- char *source_file;
- char *ptr;
- int i;
- char *fields_count_ptr;
- int fields_count = 0;
- char *methods_count_ptr;
- int methods_count = 0;
- static tree SourceFile_node = NULL_TREE;
- tree part;
- int total_supers
- = clas == object_type_node ? 0
- : TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (clas));
-
- ptr = append_chunk (NULL, 8, state);
- PUT4 (0xCafeBabe); /* Magic number */
- PUT2 (3); /* Minor version */
- PUT2 (45); /* Major version */
-
- append_chunk (NULL, 0, state);
- cpool_chunk = state->chunk;
-
- /* Next allocate the chunk containing acces_flags through fields_counr. */
- if (clas == object_type_node)
- i = 10;
- else
- i = 8 + 2 * total_supers;
- ptr = append_chunk (NULL, i, state);
- i = get_access_flags (TYPE_NAME (clas));
- if (! (i & ACC_INTERFACE))
- i |= ACC_SUPER;
- PUT2 (i); /* acces_flags */
- i = find_class_constant (&state->cpool, clas); PUT2 (i); /* this_class */
- if (clas == object_type_node)
- {
- PUT2(0); /* super_class */
- PUT2(0); /* interfaces_count */
- }
- else
- {
- tree basetypes = TYPE_BINFO_BASETYPES (clas);
- tree base = BINFO_TYPE (TREE_VEC_ELT (basetypes, 0));
- int j = find_class_constant (&state->cpool, base);
- PUT2 (j); /* super_class */
- PUT2 (total_supers - 1); /* interfaces_count */
- for (i = 1; i < total_supers; i++)
- {
- base = BINFO_TYPE (TREE_VEC_ELT (basetypes, i));
- j = find_class_constant (&state->cpool, base);
- PUT2 (j);
- }
- }
- fields_count_ptr = ptr;
-
- for (part = TYPE_FIELDS (clas); part; part = TREE_CHAIN (part))
- {
- int have_value;
- if (DECL_NAME (part) == NULL_TREE || DECL_ARTIFICIAL (part))
- continue;
- ptr = append_chunk (NULL, 8, state);
- i = get_access_flags (part); PUT2 (i);
- i = find_utf8_constant (&state->cpool, DECL_NAME (part)); PUT2 (i);
- i = find_utf8_constant (&state->cpool, build_java_signature (TREE_TYPE (part)));
- PUT2(i);
- have_value = DECL_INITIAL (part) != NULL_TREE && FIELD_STATIC (part);
- PUT2 (have_value); /* attributes_count */
- if (have_value)
- {
- tree init = DECL_INITIAL (part);
- static tree ConstantValue_node = NULL_TREE;
- ptr = append_chunk (NULL, 8, state);
- if (ConstantValue_node == NULL_TREE)
- ConstantValue_node = get_identifier ("ConstantValue");
- i = find_utf8_constant (&state->cpool, ConstantValue_node);
- PUT2 (i); /* attribute_name_index */
- PUT4 (2); /* attribute_length */
- i = find_constant_index (init, state); PUT2 (i);
- }
- fields_count++;
- }
- ptr = fields_count_ptr; PUT2 (fields_count);
-
- ptr = methods_count_ptr = append_chunk (NULL, 2, state);
- PUT2 (0);
-
- for (part = TYPE_METHODS (clas); part; part = TREE_CHAIN (part))
- {
- struct jcf_block *block;
- tree function_body = DECL_FUNCTION_BODY (part);
- tree body = function_body == NULL_TREE ? NULL_TREE
- : BLOCK_EXPR_BODY (function_body);
- tree name = DECL_CONSTRUCTOR_P (part) ? init_identifier_node
- : DECL_NAME (part);
- tree type = TREE_TYPE (part);
- tree save_function = current_function_decl;
- current_function_decl = part;
- ptr = append_chunk (NULL, 8, state);
- i = get_access_flags (part); PUT2 (i);
- i = find_utf8_constant (&state->cpool, name); PUT2 (i);
- i = find_utf8_constant (&state->cpool, build_java_signature (type));
- PUT2 (i);
- i = (body != NULL_TREE) + (DECL_FUNCTION_THROWS (part) != NULL_TREE);
- PUT2 (i); /* attributes_count */
- if (body != NULL_TREE)
- {
- int code_attributes_count = 0;
- static tree Code_node = NULL_TREE;
- tree t;
- char *attr_len_ptr;
- struct jcf_handler *handler;
- if (Code_node == NULL_TREE)
- Code_node = get_identifier ("Code");
- ptr = append_chunk (NULL, 14, state);
- i = find_utf8_constant (&state->cpool, Code_node); PUT2 (i);
- attr_len_ptr = ptr;
- init_jcf_method (state, part);
- get_jcf_label_here (state); /* Force a first block. */
- for (t = DECL_ARGUMENTS (part); t != NULL_TREE; t = TREE_CHAIN (t))
- localvar_alloc (t, state);
- generate_bytecode_insns (body, IGNORE_TARGET, state);
- if (CAN_COMPLETE_NORMALLY (body))
- {
- if (TREE_CODE (TREE_TYPE (type)) != VOID_TYPE)
- abort();
- RESERVE (1);
- OP1 (OPCODE_return);
- }
- for (t = DECL_ARGUMENTS (part); t != NULL_TREE; t = TREE_CHAIN (t))
- localvar_free (t, state);
- if (state->return_value_decl != NULL_TREE)
- localvar_free (state->return_value_decl, state);
- finish_jcf_block (state);
- perform_relocations (state);
-
- ptr = attr_len_ptr;
- i = 8 + state->code_length + 4 + 8 * state->num_handlers;
- if (state->linenumber_count > 0)
- {
- code_attributes_count++;
- i += 8 + 4 * state->linenumber_count;
- }
- if (state->lvar_count > 0)
- {
- code_attributes_count++;
- i += 8 + 10 * state->lvar_count;
- }
- PUT4 (i); /* attribute_length */
- PUT2 (state->code_SP_max); /* max_stack */
- PUT2 (localvar_max); /* max_locals */
- PUT4 (state->code_length);
-
- /* Emit the exception table. */
- ptr = append_chunk (NULL, 2 + 8 * state->num_handlers, state);
- PUT2 (state->num_handlers); /* exception_table_length */
- handler = state->handlers;
- for (; handler != NULL; handler = handler->next)
- {
- int type_index;
- PUT2 (handler->start_label->pc);
- PUT2 (handler->end_label->pc);
- PUT2 (handler->handler_label->pc);
- if (handler->type == NULL_TREE)
- type_index = 0;
- else
- type_index = find_class_constant (&state->cpool,
- handler->type);
- PUT2 (type_index);
- }
-
- ptr = append_chunk (NULL, 2, state);
- PUT2 (code_attributes_count);
-
- /* Write the LineNumberTable attribute. */
- if (state->linenumber_count > 0)
- {
- static tree LineNumberTable_node = NULL_TREE;
- ptr = append_chunk (NULL, 8 + 4 * state->linenumber_count, state);
- if (LineNumberTable_node == NULL_TREE)
- LineNumberTable_node = get_identifier ("LineNumberTable");
- i = find_utf8_constant (&state->cpool, LineNumberTable_node);
- PUT2 (i); /* attribute_name_index */
- i = 2+4*state->linenumber_count; PUT4(i); /* attribute_length */
- i = state->linenumber_count; PUT2 (i);
- for (block = state->blocks; block != NULL; block = block->next)
- {
- int line = block->linenumber;
- if (line > 0)
- {
- PUT2 (block->pc);
- PUT2 (line);
- }
- }
- }
-
- /* Write the LocalVariableTable attribute. */
- if (state->lvar_count > 0)
- {
- static tree LocalVariableTable_node = NULL_TREE;
- struct localvar_info *lvar = state->first_lvar;
- ptr = append_chunk (NULL, 8 + 10 * state->lvar_count, state);
- if (LocalVariableTable_node == NULL_TREE)
- LocalVariableTable_node = get_identifier("LocalVariableTable");
- i = find_utf8_constant (&state->cpool, LocalVariableTable_node);
- PUT2 (i); /* attribute_name_index */
- i = 2 + 10 * state->lvar_count; PUT4 (i); /* attribute_length */
- i = state->lvar_count; PUT2 (i);
- for ( ; lvar != NULL; lvar = lvar->next)
- {
- tree name = DECL_NAME (lvar->decl);
- tree sig = build_java_signature (TREE_TYPE (lvar->decl));
- i = lvar->start_label->pc; PUT2 (i);
- i = lvar->end_label->pc - i; PUT2 (i);
- i = find_utf8_constant (&state->cpool, name); PUT2 (i);
- i = find_utf8_constant (&state->cpool, sig); PUT2 (i);
- i = DECL_LOCAL_INDEX (lvar->decl); PUT2 (i);
- }
- }
- }
- if (DECL_FUNCTION_THROWS (part) != NULL_TREE)
- {
- tree t = DECL_FUNCTION_THROWS (part);
- int throws_count = list_length (t);
- static tree Exceptions_node = NULL_TREE;
- if (Exceptions_node == NULL_TREE)
- Exceptions_node = get_identifier ("Exceptions");
- ptr = append_chunk (NULL, 8 + 2 * throws_count, state);
- i = find_utf8_constant (&state->cpool, Exceptions_node);
- PUT2 (i); /* attribute_name_index */
- i = 2 + 2 * throws_count; PUT4(i); /* attribute_length */
- i = throws_count; PUT2 (i);
- for (; t != NULL_TREE; t = TREE_CHAIN (t))
- {
- i = find_class_constant (&state->cpool, TREE_VALUE (t));
- PUT2 (i);
- }
- }
- methods_count++;
- current_function_decl = save_function;
- }
- ptr = methods_count_ptr; PUT2 (methods_count);
-
- source_file = DECL_SOURCE_FILE (TYPE_NAME (clas));
- for (ptr = source_file; ; ptr++)
- {
- char ch = *ptr;
- if (ch == '\0')
- break;
- if (ch == '/' || ch == '\\')
- source_file = ptr+1;
- }
- ptr = append_chunk (NULL, 10, state);
- PUT2 (1); /* attributes_count */
-
- /* generate the SourceFile attribute. */
- if (SourceFile_node == NULL_TREE)
- SourceFile_node = get_identifier ("SourceFile");
- i = find_utf8_constant (&state->cpool, SourceFile_node);
- PUT2 (i); /* attribute_name_index */
- PUT4 (2);
- i = find_utf8_constant (&state->cpool, get_identifier (source_file));
- PUT2 (i);
-
- /* New finally generate the contents of the constant pool chunk. */
- i = count_constant_pool_bytes (&state->cpool);
- ptr = obstack_alloc (state->chunk_obstack, i);
- cpool_chunk->data = ptr;
- cpool_chunk->size = i;
- write_constant_pool (&state->cpool, ptr, i);
- return state->first;
-}
-
-static char *
-make_class_file_name (clas)
- tree clas;
-{
- const char *dname, *slash;
- char *cname, *r;
- struct stat sb;
-
- cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)),
- "", '.', DIR_SEPARATOR,
- ".class"));
- if (jcf_write_base_directory == NULL)
- {
- /* Make sure we put the class file into the .java file's
- directory, and not into some subdirectory thereof. */
- char *t;
- dname = DECL_SOURCE_FILE (TYPE_NAME (clas));
- slash = strrchr (dname, DIR_SEPARATOR);
- if (! slash)
- {
- dname = ".";
- slash = dname + 1;
- }
- t = strrchr (cname, DIR_SEPARATOR);
- if (t)
- cname = t + 1;
- }
- else
- {
- dname = jcf_write_base_directory;
- slash = dname + strlen (dname);
- }
-
- r = xmalloc (slash - dname + strlen (cname) + 2);
- strncpy (r, dname, slash - dname);
- r[slash - dname] = DIR_SEPARATOR;
- strcpy (&r[slash - dname + 1], cname);
-
- /* We try to make new directories when we need them. We only do
- this for directories which "might not" exist. For instance, we
- assume the `-d' directory exists, but we don't assume that any
- subdirectory below it exists. It might be worthwhile to keep
- track of which directories we've created to avoid gratuitous
- stat()s. */
- dname = r + (slash - dname) + 1;
- while (1)
- {
- cname = strchr (dname, DIR_SEPARATOR);
- if (cname == NULL)
- break;
- *cname = '\0';
- if (stat (r, &sb) == -1)
- {
- /* Try to make it. */
- if (mkdir (r, 0755) == -1)
- {
- fatal ("failed to create directory `%s'", r);
- free (r);
- return NULL;
- }
- }
- *cname = DIR_SEPARATOR;
- /* Skip consecutive separators. */
- for (dname = cname + 1; *dname && *dname == DIR_SEPARATOR; ++dname)
- ;
- }
-
- return r;
-}
-
-/* Write out the contens of a class (RECORD_TYPE) CLAS, as a .class file.
- The output .class file name is make_class_file_name(CLAS). */
-
-void
-write_classfile (clas)
- tree clas;
-{
- struct obstack *work = &temporary_obstack;
- struct jcf_partial state[1];
- char *class_file_name = make_class_file_name (clas);
- struct chunk *chunks;
-
- if (class_file_name != NULL)
- {
- FILE* stream = fopen (class_file_name, "wb");
- if (stream == NULL)
- fatal ("failed to open `%s' for writing", class_file_name);
- jcf_dependency_add_target (class_file_name);
- init_jcf_state (state, work);
- chunks = generate_classfile (clas, state);
- write_chunks (stream, chunks);
- if (fclose (stream))
- fatal ("failed to close after writing `%s'", class_file_name);
- free (class_file_name);
- }
- release_jcf_state (state);
-}
-
-/* TODO:
- string concatenation
- synchronized statement
- */
diff --git a/gnu/dist/toolchain/gcc/java/jcf.h b/gnu/dist/toolchain/gcc/java/jcf.h
deleted file mode 100644
index c8ab62b2596..00000000000
--- a/gnu/dist/toolchain/gcc/java/jcf.h
+++ /dev/null
@@ -1,282 +0,0 @@
-/* Utility macros to read Java(TM) .class files and byte codes.
-
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, February 1996. */
-
-#ifndef JCF_H
-#define JCF_H
-#include "javaop.h"
-#ifndef DEFUN
-#if defined (__STDC__)
-#define AND ,
-#define PTR void *
-#define DEFUN(name, arglist, args) name(args)
-#else
-#define PTR char *
-#define AND ;
-#define DEFUN(name, arglist, args) name arglist args;
-#endif
-#endif /* !DEFUN */
-
-#ifndef PROTO
-#if defined (__STDC__)
-#define PROTO(paramlist) paramlist
-#else
-#define PROTO(paramlist) ()
-#endif
-#endif
-
-#ifndef JCF_u4
-#define JCF_u4 unsigned long
-#endif
-#ifndef JCF_u2
-#define JCF_u2 unsigned short
-#endif
-
-#define ALLOC (void*)malloc
-#define REALLOC (void*)realloc
-#ifndef FREE
-#define FREE(PTR) free(PTR)
-#endif
-
-#ifdef JCF_word
-#define JCF_word JCF_u4
-#endif
-
-#define JCF_ZIP 1
-#define JCF_CLASS 2
-#define JCF_SOURCE 3
-
-struct JCF;
-typedef int (*jcf_filbuf_t) PROTO ((struct JCF*, int needed));
-
-typedef struct CPool {
- /* Available number of elements in the constants array, before it
- must be re-allocated. */
- int capacity;
-
- /* The constant_pool_count. */
- int count;
-
- uint8* tags;
-
- jword* data;
-} CPool;
-
-/* JCF encapsulates the state of reading a Java Class File. */
-
-typedef struct JCF {
- unsigned char *buffer;
- unsigned char *buffer_end;
- unsigned char *read_ptr;
- unsigned char *read_end;
- int seen_in_zip;
- int java_source;
- int outofsynch; /* Found a class file out of synch
- with the matching source file. */
- long zip_offset;
- jcf_filbuf_t filbuf;
- void *read_state;
- char *filename;
- char *classname;
- void *zipd; /* Directory entry where it was found */
- JCF_u2 access_flags, this_class, super_class;
- CPool cpool;
-} JCF;
-/*typedef JCF* JCF_FILE;*/
-
-/* The CPOOL macros take a (pointer to a) CPool.
- The JPOOL macros take a (pointer to a) JCF.
- Some of the latter should perhaps be deprecated or removed. */
-
-#define CPOOL_COUNT(CPOOL) ((CPOOL)->count)
-#define JPOOL_SIZE(JCF) CPOOL_COUNT(&(JCF)->cpool)
-#define JPOOL_TAG(JCF, INDEX) ((JCF)->cpool.tags[INDEX])
-/* The INDEX'th constant pool entry as a JCF_u4. */
-#define CPOOL_UINT(CPOOL, INDEX) ((CPOOL)->data[INDEX])
-#define JPOOL_UINT(JCF, INDEX) CPOOL_UINT(&(JCF)->cpool, INDEX) /*deprecated*/
-/* The first uint16 of the INDEX'th constant pool entry. */
-#define CPOOL_USHORT1(CPOOL, INDEX) ((CPOOL)->data[INDEX] & 0xFFFF)
-#define JPOOL_USHORT1(JCF, INDEX) CPOOL_USHORT1(&(JCF)->cpool, INDEX)
-/* The second uint16 of the INDEX'th constant pool entry. */
-#define CPOOL_USHORT2(CPOOL, INDEX) ((CPOOL)->data[INDEX] >> 16)
-#define JPOOL_USHORT2(JCF, INDEX) CPOOL_USHORT2(&(JCF)->cpool, INDEX)
-#define JPOOL_LONG(JCF, INDEX) \
- WORDS_TO_LONG (JPOOL_UINT(JCF, INDEX), JPOOL_UINT(JCF, (INDEX)+1))
-#define JPOOL_DOUBLE(JCF, INDEX) \
- WORDS_TO_DOUBLE (JPOOL_UINT(JCF, INDEX), JPOOL_UINT(JCF, (INDEX)+1))
-#ifndef JPOOL_UTF_LENGTH
-#define JPOOL_UTF_LENGTH(JCF, INDEX) \
- GET_u2 ((JCF)->buffer+JPOOL_UINT(JCF, INDEX))
-#endif
-#ifndef JPOOL_UTF_DATA
-#define JPOOL_UTF_DATA(JCF, INDEX) \
- ((JCF)->buffer+JPOOL_UINT(JCF, INDEX)+2)
-#endif
-#define JPOOL_INT(JCF, INDEX) ((jint) JPOOL_UINT (JCF, INDEX))
-#define JPOOL_FLOAT(JCF, INDEX) WORD_TO_FLOAT (JPOOL_UINT (JCF, INDEX))
-
-#define CPOOL_INDEX_IN_RANGE(CPOOL, INDEX) \
- ((INDEX) > 0 && (INDEX) < CPOOL_COUNT(CPOOL))
-
-#define CPOOL_FINISH(CPOOL) { \
- if ((CPOOL)->tags) FREE ((CPOOL)->tags); \
- if ((CPOOL)->data) FREE ((CPOOL)->data); }
-
-#define JCF_FINISH(JCF) { \
- CPOOL_FINISH(&(JCF)->cpool); \
- if ((JCF)->buffer) FREE ((JCF)->buffer); \
- if ((JCF)->filename) FREE ((JCF)->filename); \
- if ((JCF)->classname) FREE ((JCF)->classname); }
-
-#define CPOOL_INIT(CPOOL) \
- ((CPOOL)->capacity = 0, (CPOOL)->count = 0, (CPOOL)->tags = 0, (CPOOL)->data = 0)
-
-#define CPOOL_REINIT(CPOOL) ((CPOOL)->count = 0)
-
-#define JCF_ZERO(JCF) \
- ((JCF)->buffer = (JCF)->buffer_end = (JCF)->read_ptr = (JCF)->read_end = 0,\
- (JCF)->read_state = 0, (JCF)->filename = (JCF)->classname = 0, \
- CPOOL_INIT(&(JCF)->cpool), (JCF)->java_source = 0)
-
-/* Given that PTR points to a 2-byte unsigned integer in network
- (big-endian) byte-order, return that integer. */
-#define GET_u2(PTR) (((PTR)[0] << 8) | ((PTR)[1]))
-/* Like GET_u2, but for little-endian format. */
-#define GET_u2_le(PTR) (((PTR)[1] << 8) | ((PTR)[0]))
-
-/* Given that PTR points to a 4-byte unsigned integer in network
- (big-endian) byte-order, return that integer. */
-#define GET_u4(PTR) (((JCF_u4)(PTR)[0] << 24) | ((JCF_u4)(PTR)[1] << 16) \
- | ((JCF_u4)(PTR)[2] << 8) | ((JCF_u4)(PTR)[3]))
-/* Like GET_u4, but for little-endian order. */
-#define GET_u4_le(PTR) (((JCF_u4)(PTR)[3] << 24) | ((JCF_u4)(PTR)[2] << 16) \
- | ((JCF_u4)(PTR)[1] << 8) | ((JCF_u4)(PTR)[0]))
-
-/* Make sure there are COUNT bytes readable. */
-#define JCF_FILL(JCF, COUNT) \
- ((JCF)->read_end-(JCF)->read_ptr >= (COUNT) ? 0 : (*(JCF)->filbuf)(JCF, COUNT))
-#define JCF_GETC(JCF) (JCF_FILL(JCF, 1) ? -1 : *(JCF)->read_ptr++)
-#define JCF_READ(JCF, BUFFER, N) \
- (memcpy (BUFFER, (JCF)->read_ptr, N), (JCF)->read_ptr += (N))
-#define JCF_SKIP(JCF,N) ((JCF)->read_ptr += (N))
-#define JCF_readu(JCF) (*(JCF)->read_ptr++)
-
-/* Reads an unsigned 2-byte integer in network (big-endian) byte-order
- from JCF. Returns that integer.
- Does not check for EOF (make sure to call JCF_FILL before-hand). */
-#define JCF_readu2(JCF) ((JCF)->read_ptr += 2, GET_u2 ((JCF)->read_ptr-2))
-#define JCF_readu2_le(JCF) ((JCF)->read_ptr += 2, GET_u2_le((JCF)->read_ptr-2))
-
-/* Like JCF_readu2, but read a 4-byte unsigned integer. */
-#define JCF_readu4(JCF) ((JCF)->read_ptr += 4, GET_u4 ((JCF)->read_ptr-4))
-#define JCF_readu4_le(JCF) ((JCF)->read_ptr += 4, GET_u4_le((JCF)->read_ptr-4))
-
-#define JCF_TELL(JCF) ((JCF)->read_ptr - (JCF)->buffer)
-#define JCF_SEEK(JCF, POS) ((JCF)->read_ptr = (JCF)->buffer + (POS))
-
-#define ACC_PUBLIC 0x0001
-#define ACC_PRIVATE 0x0002
-#define ACC_PROTECTED 0x0004
-#define ACC_STATIC 0x0008
-#define ACC_FINAL 0x0010
-#define ACC_SYNCHRONIZED 0x0020
-#define ACC_SUPER 0x0020
-#define ACC_VOLATILE 0x0040
-#define ACC_TRANSIENT 0x0080
-#define ACC_NATIVE 0x0100
-#define ACC_INTERFACE 0x0200
-#define ACC_ABSTRACT 0x0400
-
-#define CONSTANT_Class 7
-#define CONSTANT_Fieldref 9
-#define CONSTANT_Methodref 10
-#define CONSTANT_InterfaceMethodref 11
-#define CONSTANT_String 8
-#define CONSTANT_Integer 3
-#define CONSTANT_Float 4
-#define CONSTANT_Long 5
-#define CONSTANT_Double 6
-#define CONSTANT_NameAndType 12
-#define CONSTANT_Utf8 1
-#define CONSTANT_Unicode 2
-
-#define DEFAULT_CLASS_PATH "."
-
-extern char *find_class PROTO ((const char *, int, JCF*, int));
-extern char *find_classfile PROTO ((char *, JCF*, const char *));
-extern int jcf_filbuf_from_stdio PROTO ((JCF *jcf, int count));
-extern void jcf_out_of_synch PROTO((JCF *));
-extern int jcf_unexpected_eof PROTO ((JCF*, int));
-
-/* Extract a character from a Java-style Utf8 string.
- * PTR points to the current character.
- * LIMIT points to the end of the Utf8 string.
- * PTR is incremented to point after the character thta gets returns.
- * On an error, -1 is returned. */
-#define UTF8_GET(PTR, LIMIT) \
- ((PTR) >= (LIMIT) ? -1 \
- : *(PTR) < 128 ? *(PTR)++ \
- : (*(PTR)&0xE0) == 0xC0 && ((PTR)+=2)<=(LIMIT) && ((PTR)[-1]&0xC0) == 0x80 \
- ? (((PTR)[-2] & 0x1F) << 6) + ((PTR)[-1] & 0x3F) \
- : (*(PTR) & 0xF0) == 0xE0 && ((PTR) += 3) <= (LIMIT) \
- && ((PTR)[-2] & 0xC0) == 0x80 && ((PTR)[-1] & 0xC0) == 0x80 \
- ? (((PTR)[-3]&0x0F) << 12) + (((PTR)[-2]&0x3F) << 6) + ((PTR)[-1]&0x3F) \
- : ((PTR)++, -1))
-
-extern char *jcf_write_base_directory;
-
-/* Debug macros, for the front end */
-
-extern int quiet_flag;
-#ifdef VERBOSE_SKELETON
-#undef SOURCE_FRONTEND_DEBUG
-#define SOURCE_FRONTEND_DEBUG(X) \
- {if (!quiet_flag) {printf ("* "); printf X; putchar ('\n');} }
-#else
-#define SOURCE_FRONTEND_DEBUG(X)
-#endif
-
-/* Declarations for dependency code. */
-extern void jcf_dependency_reset PROTO ((void));
-extern void jcf_dependency_set_target PROTO ((char *));
-extern void jcf_dependency_add_target PROTO ((char *));
-extern void jcf_dependency_set_dep_file PROTO ((const char *));
-extern void jcf_dependency_add_file PROTO ((const char *, int));
-extern void jcf_dependency_write PROTO ((void));
-extern void jcf_dependency_init PROTO ((int));
-
-/* Declarations for path handling code. */
-extern void jcf_path_init PROTO ((void));
-extern void jcf_path_classpath_arg PROTO ((char *));
-extern void jcf_path_CLASSPATH_arg PROTO ((char *));
-extern void jcf_path_include_arg PROTO ((char *));
-extern void jcf_path_seal PROTO ((void));
-extern void *jcf_path_start PROTO ((void));
-extern void *jcf_path_next PROTO ((void *));
-extern char *jcf_path_name PROTO ((void *));
-extern int jcf_path_is_zipfile PROTO ((void *));
-extern int jcf_path_is_system PROTO ((void *));
-extern int jcf_path_max_len PROTO ((void));
-
-#endif
diff --git a/gnu/dist/toolchain/gcc/java/jv-scan.c b/gnu/dist/toolchain/gcc/java/jv-scan.c
deleted file mode 100644
index 26fc662ed5e..00000000000
--- a/gnu/dist/toolchain/gcc/java/jv-scan.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* Main for jv-scan
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "config.h"
-#include "system.h"
-
-#include "obstack.h" /* We use obstacks in lex.c */
-
-void fatal VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-void warning VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1;
-void gcc_obstack_init PROTO ((struct obstack *obstack));
-
-#define JC1_LITE
-#include "parse.h"
-
-/* Current input file and output file IO streams. */
-FILE *finput, *out;
-
-/* Current input filename. */
-char *input_filename;
-
-/* Executable name. */
-char *exec_name;
-
-/* Flags matching command line options. */
-int flag_find_main = 0;
-int flag_dump_class = 0;
-int flag_list_filename = 0;
-
-/* jc1-lite main entry point */
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int i = 1;
- char *output_file = NULL;
- long ft;
-
- exec_name = argv[0];
-
- /* Default for output */
- out = stdout;
-
- /* Process options first */
- while (argv [i])
- {
- if (argv [i][0] == '-')
- {
- /* Dump result into a file */
- if (!strcmp (argv [i], "-o") && i+1 < argc)
- {
- argv [i] = NULL;
- output_file = argv [++i];
- argv [i] = NULL;
- }
-
- /* Print the name of the class that contains main */
- else if (!strcmp (argv [i], "--print-main"))
- flag_find_main = 1;
-
- else if (!strcmp (argv [i], "--list-filename"))
- flag_list_filename = 1;
-
- /* List all the classes found in a source file */
- else if (!strcmp (argv [i], "--list-class"))
- flag_dump_class = 1;
-
- else
- warning ("Unrecognized argument `%s'", argv[i]);
-
- /* non recognized argument ignored silently */
- argv [i] = NULL; /* Nullify so it's not considered a file */
- }
- i++;
- }
-
- /* No flags? Do nothing */
- if (!flag_find_main && !flag_dump_class)
- exit (0);
-
- /* Check on bad usage */
- if (flag_find_main && flag_dump_class)
- fatal ("Options `--print-main' and `--list-class' can't be turned on "
- "at the same time");
-
- if (output_file && !(out = fopen (output_file, "w")))
- fatal ("Can't open output file `%s'", output_file);
-
- ft = ftell (out);
-
- gcc_obstack_init (&temporary_obstack);
- java_push_parser_context ();
-
- for ( i = 1; i < argc; i++ )
- if (argv [i])
- {
- input_filename = argv [i];
- if ( (finput = fopen (argv [i], "r")) )
- {
- java_init_lex ();
- yyparse ();
- if (ftell (out) != ft)
- fputc ('\n', out);
- ft = ftell (out);
- fclose (finput);
- reset_report ();
- }
- else
- fatal ("File not found `%s'", argv [i]);
- }
-
- /* Flush and close */
- if (ftell (out) != ft)
- fputc ('\n', out);
- if (!output_file)
- fclose (out);
-
- exit (0);
-}
-
-/* Error report, memory, obstack initialization and other utility
- functions */
-
-void
-fatal VPROTO((const char *s, ...))
-{
-#ifndef ANSI_PROTOTYPES
- const char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef ANSI_PROTOTYPES
- s = va_arg (ap, const char *);
-#endif
-
- fprintf (stderr, "%s: error: ", exec_name);
- vfprintf (stderr, s, ap);
- fputc ('\n', stderr);
- va_end (ap);
- exit (1);
-}
-
-void
-warning VPROTO((const char *s, ...))
-{
-#ifndef ANSI_PROTOTYPES
- const char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef ANSI_PROTOTYPES
- s = va_arg (ap, const char *);
-#endif
-
- fprintf (stderr, "%s: warning: ", exec_name);
- vfprintf (stderr, s, ap);
- fputc ('\n', stderr);
- va_end (ap);
-}
-
-void
-gcc_obstack_init (obstack)
- struct obstack *obstack;
-{
- /* Let particular systems override the size of a chunk. */
-#ifndef OBSTACK_CHUNK_SIZE
-#define OBSTACK_CHUNK_SIZE 0
-#endif
- /* Let them override the alloc and free routines too. */
-#ifndef OBSTACK_CHUNK_ALLOC
-#define OBSTACK_CHUNK_ALLOC xmalloc
-#endif
-#ifndef OBSTACK_CHUNK_FREE
-#define OBSTACK_CHUNK_FREE free
-#endif
- _obstack_begin (obstack, OBSTACK_CHUNK_SIZE, 0,
- (void *(*) ()) OBSTACK_CHUNK_ALLOC,
- (void (*) ()) OBSTACK_CHUNK_FREE);
-}
-
-PTR
-xmalloc (size)
- size_t size;
-{
- register PTR val = (PTR) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
- return val;
-}
diff --git a/gnu/dist/toolchain/gcc/java/jvgenmain.c b/gnu/dist/toolchain/gcc/java/jvgenmain.c
deleted file mode 100644
index 4f82847d043..00000000000
--- a/gnu/dist/toolchain/gcc/java/jvgenmain.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Program to generate "main" a Java(TM) class containing a main method.
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com> */
-
-#include "config.h"
-#include "system.h"
-#include "obstack.h"
-#include "gansidecl.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-
-const char main_method_prefix[] = "main__";
-const char main_method_suffix[] = "Pt6JArray1ZPQ34java4lang6String";
-const char class_mangling_prefix[] = "_CL_";
-
-struct obstack name_obstack;
-
-extern void error PVPROTO ((const char *, ...))
- ATTRIBUTE_PRINTF_1;
-
-void
-error VPROTO((const char *msgid, ...))
-{
-#ifndef ANSI_PROTOTYPES
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- msgid = va_arg (ap, const char *);
-#endif
-
- vfprintf (stderr, msgid, ap);
- va_end (ap);
-}
-
-void
-gcc_obstack_init (obstack)
- struct obstack *obstack;
-{
- /* Let particular systems override the size of a chunk. */
-#ifndef OBSTACK_CHUNK_SIZE
-#define OBSTACK_CHUNK_SIZE 0
-#endif
- /* Let them override the alloc and free routines too. */
-#ifndef OBSTACK_CHUNK_ALLOC
-#define OBSTACK_CHUNK_ALLOC xmalloc
-#endif
-#ifndef OBSTACK_CHUNK_FREE
-#define OBSTACK_CHUNK_FREE free
-#endif
- _obstack_begin (obstack, OBSTACK_CHUNK_SIZE, 0,
- (void *(*) ()) OBSTACK_CHUNK_ALLOC,
- (void (*) ()) OBSTACK_CHUNK_FREE);
-}
-
-int
-main (int argc, const char **argv)
-{
- const char *classname;
- FILE *stream;
- char *mangled_classname;
-
- if (argc < 2 || argc > 3)
- {
- fprintf (stderr, "Usage: %s CLASSNAME [OUTFILE]\n", argv[0]);
- exit(-1);
- }
-
- classname = argv[1];
-
- gcc_obstack_init (&name_obstack);
- append_gpp_mangled_classtype (&name_obstack, classname);
- obstack_1grow (&name_obstack, '\0');
- mangled_classname = obstack_finish (&name_obstack);
-
- if (argc > 2 && strcmp (argv[2], "-") != 0)
- {
- const char *outfile = argv[2];
- stream = fopen (outfile, "w");
- if (stream == NULL)
- {
- fprintf (stderr, "%s: Cannot open output file: %s\n",
- argv[0], outfile);
- exit (-1);
- }
- }
- else
- stream = stdout;
- fprintf (stream, "extern struct Class %s%s;\n",
- class_mangling_prefix, mangled_classname);
- fprintf (stream, "int main (int argc, const char **argv)\n");
- fprintf (stream, "{\n");
- fprintf (stream, " JvRunMain (&%s%s, argc, argv);\n",
- class_mangling_prefix, mangled_classname);
- fprintf (stream, "}\n");
- if (stream != stdout && fclose (stream) != 0)
- {
- fprintf (stderr, "%s: Failed to close output file %s\n",
- argv[0], argv[2]);
- exit (-1);
- }
- return 0;
-}
-
-PTR
-xmalloc (size)
- size_t size;
-{
- register PTR val = (PTR) malloc (size);
-
- if (val == 0)
- {
- fprintf(stderr, "jvgenmain: virtual memory exhausted");
- exit(FATAL_EXIT_CODE);
- }
- return val;
-}
diff --git a/gnu/dist/toolchain/gcc/java/jvspec.c b/gnu/dist/toolchain/gcc/java/jvspec.c
deleted file mode 100644
index 61cd89b0d97..00000000000
--- a/gnu/dist/toolchain/gcc/java/jvspec.c
+++ /dev/null
@@ -1,488 +0,0 @@
- /* Specific flags and argument handling of the front-end of the
- GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#include "config.h"
-
-#include "system.h"
-
-#include "gansidecl.h"
-
-/* Name of spec file. */
-#define SPEC_FILE "libgcj.spec"
-
-/* This bit is set if we saw a `-xfoo' language specification. */
-#define LANGSPEC (1<<1)
-/* True if this arg is a parameter to the previous option-taking arg. */
-#define PARAM_ARG (1<<2)
-/* True if this arg is a .java input file name. */
-#define JAVA_FILE_ARG (1<<3)
-/* True if this arg is a .class input file name. */
-#define CLASS_FILE_ARG (1<<4)
-
-extern int do_spec PROTO((char *));
-extern char *input_filename;
-extern size_t input_filename_length;
-
-char *main_class_name = NULL;
-int lang_specific_extra_outfiles = 0;
-
-/* Once we have the proper support in jc1 (and gcc.c) working,
- set COMBINE_INPUTS to one. This enables combining multiple *.java
- and *.class input files to be passed to a single jc1 invocation. */
-#define COMBINE_INPUTS 0
-
-char jvgenmain_spec[] =
- "jvgenmain %i %{!pipe:%umain.i} |\n\
- cc1 %{!pipe:%Umain.i} %1 \
- %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\
- %{g*} %{O*} \
- %{v:-version} %{pg:-p} %{p} %{f*}\
- %{aux-info*}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%Umain.s}} |\n\
- %{!S:as %a %Y -o %d%w%umain%O %{!pipe:%Umain.s} %A\n }";
-
-/* Return full path name of spec file if it is in DIR, or NULL if
- not. */
-static char *
-find_spec_file (dir)
- char *dir;
-{
- char *spec;
- int x;
- struct stat sb;
-
- spec = (char *) xmalloc (strlen (dir) + sizeof (SPEC_FILE)
- + sizeof ("-specs=") + 4);
- strcpy (spec, "-specs=");
- x = strlen (spec);
- strcat (spec, dir);
- strcat (spec, "/");
- strcat (spec, SPEC_FILE);
- if (! stat (spec + x, &sb))
- return spec;
- free (spec);
- return NULL;
-}
-
-void
-lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
- void (*fn)();
- int *in_argc;
- char ***in_argv;
- int *in_added_libraries;
-{
- int i, j;
-
- /* If non-zero, the user gave us the `-v' flag. */
- int saw_verbose_flag = 0;
-
- /* This will be 0 if we encounter a situation where we should not
- link in libgcj. */
- int library = 1;
-
-#if COMBINE_INPUTS
- /* This will be 1 if multiple input files (.class and/or .java)
- should be passed to a single jc1 invocation. */
- int combine_inputs = 0;
-
- /* Index of last .java or .class argument. */
- int last_input_index;
-
- /* A buffer containing the concatenation of the inputs files
- (e.g. "foo.java&bar.class&baz.class"). if combine_inputs. */
- char* combined_inputs_buffer;
-
- /* Next available location in combined_inputs_buffer. */
- int combined_inputs_pos;
-
- /* Number of .java and .class source file arguments seen. */
- int java_files_count = 0;
- int class_files_count = 0;
-
- /* Cumulative length of the .java and .class source file names. */
- int java_files_length = 0;
- int class_files_length = 0;
-#endif
-
- /* The number of arguments being added to what's in argv, other than
- libraries. We use this to track the number of times we've inserted
- -xc++/-xnone. */
- int added = 2;
-
- /* Used to track options that take arguments, so we don't go wrapping
- those with -xc++/-xnone. */
- char *quote = NULL;
-
- /* The new argument list will be contained in this. */
- char **arglist;
-
- /* Non-zero if we saw a `-xfoo' language specification on the
- command line. Used to avoid adding our own -xc++ if the user
- already gave a language for the file. */
- int saw_speclang = 0;
-
- /* "-lm" or "-lmath" if it appears on the command line. */
- char *saw_math ATTRIBUTE_UNUSED = 0;
-
- /* "-lc" if it appears on the command line. */
- char *saw_libc ATTRIBUTE_UNUSED = 0;
-
- /* "-lgcjgc" if it appears on the command line. */
- char *saw_gc ATTRIBUTE_UNUSED = 0;
-
- /* Saw `-l' option for the thread library. */
- char *saw_threadlib ATTRIBUTE_UNUSED = 0;
-
- /* Saw `-lgcj' on command line. */
- int saw_libgcj ATTRIBUTE_UNUSED = 0;
-
- /* Saw -C or -o option, respectively. */
- int saw_C = 0;
- int saw_o = 0;
-
- /* Saw some -O* or -g* option, respectively. */
- int saw_O = 0;
- int saw_g = 0;
-
- /* An array used to flag each argument that needs a bit set for
- LANGSPEC, MATHLIB, WITHLIBC, or GCLIB. */
- int *args;
-
- /* The total number of arguments with the new stuff. */
- int argc;
-
- /* The argument list. */
- char **argv;
-
- /* The number of libraries added in. */
- int added_libraries;
-
- /* The total number of arguments with the new stuff. */
- int num_args = 1;
-
- /* Non-zero if linking is supposed to happen. */
- int will_link = 1;
-
- /* The argument we use to specify the spec file. */
- char *spec_file = NULL;
-
- argc = *in_argc;
- argv = *in_argv;
- added_libraries = *in_added_libraries;
-
- args = (int *) xmalloc (argc * sizeof (int));
- bzero ((char *) args, argc * sizeof (int));
-
- for (i = 1; i < argc; i++)
- {
- /* If the previous option took an argument, we swallow it here. */
- if (quote)
- {
- quote = NULL;
- args[i] |= PARAM_ARG;
- continue;
- }
-
- /* We don't do this anymore, since we don't get them with minus
- signs on them. */
- if (argv[i][0] == '\0' || argv[i][1] == '\0')
- continue;
-
- if (argv[i][0] == '-')
- {
- if (library != 0 && (strcmp (argv[i], "-nostdlib") == 0
- || strcmp (argv[i], "-nodefaultlibs") == 0))
- {
- library = 0;
- }
- else if (strncmp (argv[i], "-fmain=", 7) == 0)
- {
- main_class_name = argv[i] + 7;
- added--;
- }
- else if (strcmp (argv[i], "-fhelp") == 0)
- will_link = 0;
- else if (strcmp (argv[i], "-v") == 0)
- {
- saw_verbose_flag = 1;
- if (argc == 2)
- {
- /* If they only gave us `-v', don't try to link
- in libgcj. */
- library = 0;
- }
- }
- else if (strncmp (argv[i], "-x", 2) == 0)
- saw_speclang = 1;
- else if (strcmp (argv[i], "-C") == 0)
- {
- saw_C = 1;
-#if COMBINE_INPUTS
- combine_inputs = 1;
-#endif
- if (library != 0)
- added -= 2;
- library = 0;
- will_link = 0;
- }
- else if (argv[i][1] == 'g')
- saw_g = 1;
- else if (argv[i][1] == 'O')
- saw_O = 1;
- else if (((argv[i][2] == '\0'
- && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL)
- || strcmp (argv[i], "-Tdata") == 0))
- {
- if (strcmp (argv[i], "-o") == 0)
- saw_o = 1;
- quote = argv[i];
- }
- else if (strcmp(argv[i], "-classpath") == 0
- || strcmp(argv[i], "-CLASSPATH") == 0)
- {
- quote = argv[i];
- added -= 1;
- }
- else if (library != 0
- && ((argv[i][2] == '\0'
- && (char *) strchr ("cSEM", argv[i][1]) != NULL)
- || strcmp (argv[i], "-MM") == 0))
- {
- /* Don't specify libraries if we won't link, since that would
- cause a warning. */
- library = 0;
- added -= 2;
-
- /* Remember this so we can confirm -fmain option. */
- will_link = 0;
- }
- else if (strcmp (argv[i], "-d") == 0)
- {
- /* `-d' option is for javac compatibility. */
- quote = argv[i];
- added -= 1;
- }
- else if (strcmp (argv[i], "-fsyntax-only") == 0
- || strcmp (argv[i], "--syntax-only") == 0)
- {
- library = 0;
- will_link = 0;
- continue;
- }
- else
- /* Pass other options through. */
- continue;
- }
- else
- {
-#if COMBINE_INPUTS
- int len;
-#endif
-
- if (saw_speclang)
- {
- saw_speclang = 0;
- continue;
- }
-
-#if COMBINE_INPUTS
- len = strlen (argv[i]);
- if (len > 5 && strcmp (argv[i] + len - 5, ".java") == 0)
- {
- args[i] |= JAVA_FILE_ARG;
- java_files_count++;
- java_files_length += len;
- last_input_index = i;
- }
- if (len > 6 && strcmp (argv[i] + len - 6, ".class") == 0)
- {
- args[i] |= CLASS_FILE_ARG;
- class_files_count++;
- class_files_length += len;
- last_input_index = i;
- }
-#endif
- }
- }
-
- if (quote)
- (*fn) ("argument to `%s' missing\n", quote);
-
- num_args = argc + added;
- if (saw_C)
- {
- num_args += 3;
-#if COMBINE_INPUTS
- class_files_length = 0;
- num_args -= class_files_count;
- num_args += 2; /* For -o NONE. */
-#endif
- if (saw_o)
- (*fn) ("cannot specify both -C and -o");
- }
-#if COMBINE_INPUTS
- if (saw_o && java_files_count + (saw_C ? 0 : class_files_count) > 1)
- combine_inputs = 1;
-
- if (combine_inputs)
- {
- int len = java_files_length + java_files_count - 1;
- num_args -= java_files_count;
- num_args++; /* Add one for the combined arg. */
- if (class_files_length > 0)
- {
- len += class_files_length + class_files_count - 1;
- num_args -= class_files_count;
- }
- combined_inputs_buffer = (char*) xmalloc (len);
- combined_inputs_pos = 0;
- }
- /* If we know we don't have to do anything, bail now. */
-#endif
-#if 0
- if (! added && ! library && main_class_name == NULL && ! saw_C)
- {
- free (args);
- return;
- }
-#endif
-
- if (main_class_name)
- {
- lang_specific_extra_outfiles++;
- }
- if (saw_g + saw_O == 0)
- num_args++;
- if (will_link)
- num_args++;
- arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *));
-
- for (i = 0, j = 0; i < argc; i++, j++)
- {
- arglist[j] = argv[i];
-
- if ((args[i] & PARAM_ARG) || i == 0)
- continue;
-
- if (strcmp (argv[i], "-classpath") == 0
- || strcmp (argv[i], "-CLASSPATH") == 0)
- {
- char* patharg
- = (char*) xmalloc (strlen (argv[i]) + strlen (argv[i+1]) + 3);
- sprintf (patharg, "-f%s=%s", argv[i]+1, argv[i+1]);
- arglist[j] = patharg;
- i++;
- continue;
- }
-
- if (strcmp (argv[i], "-d") == 0)
- {
- char *patharg = (char *) xmalloc (sizeof ("-foutput-class-dir=")
- + strlen (argv[i + 1]) + 1);
- sprintf (patharg, "-foutput-class-dir=%s", argv[i + 1]);
- arglist[j] = patharg;
- ++i;
- continue;
- }
-
- if (will_link && spec_file == NULL && strncmp (argv[i], "-L", 2) == 0)
- spec_file = find_spec_file (argv[i] + 2);
-
- if (strncmp (argv[i], "-fmain=", 7) == 0)
- {
- if (! will_link)
- (*fn) ("cannot specify `main' class when not linking");
- --j;
- continue;
- }
-
- if ((args[i] & CLASS_FILE_ARG) && saw_C)
- {
- --j;
- continue;
- }
-
-#if COMBINE_INPUTS
- if (combine_inputs && (args[i] & (CLASS_FILE_ARG|JAVA_FILE_ARG)) != 0)
- {
- if (combined_inputs_pos > 0)
- combined_inputs_buffer[combined_inputs_pos++] = '&';
- strcpy (&combined_inputs_buffer[combined_inputs_pos], argv[i]);
- combined_inputs_pos += strlen (argv[i]);
- --j;
- continue;
- }
-#endif
- }
-
-#if COMBINE_INPUTS
- if (combine_inputs)
- {
- combined_inputs_buffer[combined_inputs_pos] = '\0';
-#if 0
- if (! saw_C)
-#endif
- arglist[j++] = combined_inputs_buffer;
- }
-#endif
-
- /* If we saw no -O or -g option, default to -g1, for javac compatibility. */
- if (saw_g + saw_O == 0)
- arglist[j++] = "-g1";
-
- /* Read the specs file corresponding to libgcj, but only if linking.
- If we didn't find the spec file on the -L path, then we hope it
- is somewhere in the standard install areas. */
- if (will_link)
- arglist[j++] = spec_file == NULL ? "-specs=libgcj.spec" : spec_file;
-
- if (saw_C)
- {
- arglist[j++] = "-fsyntax-only";
- arglist[j++] = "-femit-class-files";
- arglist[j++] = "-S";
-#if COMBINE_INPUTS
- arglist[j++] = "-o";
- arglist[j++] = "NONE";
-#endif
- }
-
- arglist[j] = NULL;
-
- *in_argc = j;
- *in_argv = arglist;
- *in_added_libraries = added_libraries;
-}
-
-int
-lang_specific_pre_link ()
-{
- if (main_class_name == NULL)
- return 0;
- input_filename = main_class_name;
- input_filename_length = strlen (main_class_name);
- return do_spec (jvgenmain_spec);
-}
diff --git a/gnu/dist/toolchain/gcc/java/keyword.gperf b/gnu/dist/toolchain/gcc/java/keyword.gperf
deleted file mode 100644
index 0e058762bf5..00000000000
--- a/gnu/dist/toolchain/gcc/java/keyword.gperf
+++ /dev/null
@@ -1,80 +0,0 @@
-%{
-/* Keyword definition for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-%}
-struct java_keyword { const char *name; int token; };
-%%
-abstract, ABSTRACT_TK
-default, DEFAULT_TK
-if, IF_TK
-private, PRIVATE_TK
-throw, THROW_TK
-boolean, BOOLEAN_TK
-do, DO_TK
-implements, IMPLEMENTS_TK
-protected, PROTECTED_TK
-throws, THROWS_TK
-break, BREAK_TK
-double, DOUBLE_TK
-import, IMPORT_TK
-public, PUBLIC_TK
-transient, TRANSIENT_TK
-byte, BYTE_TK
-else, ELSE_TK
-instanceof, INSTANCEOF_TK
-return, RETURN_TK
-try, TRY_TK
-case, CASE_TK
-extends, EXTENDS_TK
-int, INT_TK
-short, SHORT_TK
-void, VOID_TK
-catch, CATCH_TK
-final, FINAL_TK
-interface, INTERFACE_TK
-static, STATIC_TK
-volatile, VOLATILE_TK
-char, CHAR_TK
-finally, FINALLY_TK
-long, LONG_TK
-super, SUPER_TK
-while, WHILE_TK
-class, CLASS_TK
-float, FLOAT_TK
-native, NATIVE_TK
-switch, SWITCH_TK
-const, CONST_TK
-for, FOR_TK
-new, NEW_TK
-synchronized, SYNCHRONIZED_TK
-continue, CONTINUE_TK
-goto, GOTO_TK
-package, PACKAGE_TK
-this, THIS_TK
-# true, false and null aren't keyword. But we match them easily this way
-true, TRUE_TK
-false, FALSE_TK
-null, NULL_TK
diff --git a/gnu/dist/toolchain/gcc/java/keyword.h b/gnu/dist/toolchain/gcc/java/keyword.h
deleted file mode 100644
index 73f01e5ce57..00000000000
--- a/gnu/dist/toolchain/gcc/java/keyword.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* C code produced by gperf version 2.7.1 (19981006 egcs) */
-/* Command-line: gperf -L C -F , 0 -p -t -j1 -i 1 -g -o -N java_keyword -k1,3,$ keyword.gperf */
-/* Keyword definition for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-struct java_keyword { const char *name; int token; };
-
-#define TOTAL_KEYWORDS 50
-#define MIN_WORD_LENGTH 2
-#define MAX_WORD_LENGTH 12
-#define MIN_HASH_VALUE 6
-#define MAX_HASH_VALUE 86
-/* maximum key range = 81, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#endif
-static unsigned int
-hash (str, len)
- register const char *str;
- register unsigned int len;
-{
- static unsigned char asso_values[] =
- {
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 18, 37, 38,
- 27, 1, 30, 3, 12, 8, 87, 2, 11, 87,
- 8, 1, 5, 87, 24, 1, 1, 30, 2, 36,
- 87, 1, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87
- };
- register int hval = len;
-
- switch (hval)
- {
- default:
- case 3:
- hval += asso_values[(unsigned char)str[2]];
- case 2:
- case 1:
- hval += asso_values[(unsigned char)str[0]];
- break;
- }
- return hval + asso_values[(unsigned char)str[len - 1]];
-}
-
-#ifdef __GNUC__
-__inline
-#endif
-struct java_keyword *
-java_keyword (str, len)
- register const char *str;
- register unsigned int len;
-{
- static struct java_keyword wordlist[] =
- {
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"try", TRY_TK},
- {"else", ELSE_TK},
- {"short", SHORT_TK},
- {"goto", GOTO_TK},
- {"extends", EXTENDS_TK},
- {"", 0}, {"", 0},
- {"int", INT_TK},
- {"this", THIS_TK},
- {"", 0},
- {"native", NATIVE_TK},
- {"", 0}, {"", 0},
- {"interface", INTERFACE_TK},
- {"import", IMPORT_TK},
- {"private", PRIVATE_TK},
- {"volatile", VOLATILE_TK},
- {"", 0},
- {"implements", IMPLEMENTS_TK},
- {"", 0},
- {"long", LONG_TK},
- {"switch", SWITCH_TK},
- {"abstract", ABSTRACT_TK},
- {"transient", TRANSIENT_TK},
- {"do", DO_TK},
- {"", 0},
- {"throws", THROWS_TK},
- {"", 0},
- {"null", NULL_TK},
- {"super", SUPER_TK},
- {"true", TRUE_TK},
- {"float", FLOAT_TK},
- {"", 0},
- {"return", RETURN_TK},
- {"if", IF_TK},
- {"void", VOID_TK},
- {"protected", PROTECTED_TK},
- {"byte", BYTE_TK},
- {"case", CASE_TK},
- {"break", BREAK_TK},
- {"finally", FINALLY_TK},
- {"false", FALSE_TK},
- {"synchronized", SYNCHRONIZED_TK},
- {"instanceof", INSTANCEOF_TK},
- {"while", WHILE_TK},
- {"package", PACKAGE_TK},
- {"const", CONST_TK},
- {"boolean", BOOLEAN_TK},
- {"final", FINAL_TK},
- {"continue", CONTINUE_TK},
- {"catch", CATCH_TK},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"class", CLASS_TK},
- {"static", STATIC_TK},
- {"double", DOUBLE_TK},
- {"default", DEFAULT_TK},
- {"throw", THROW_TK},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"for", FOR_TK},
- {"", 0},
- {"new", NEW_TK},
- {"char", CHAR_TK},
- {"", 0},
- {"public", PUBLIC_TK}
- };
-
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register const char *s = wordlist[key].name;
-
- if (*str == *s && !strcmp (str + 1, s + 1))
- return &wordlist[key];
- }
- }
- return 0;
-}
diff --git a/gnu/dist/toolchain/gcc/java/lang-options.h b/gnu/dist/toolchain/gcc/java/lang-options.h
deleted file mode 100644
index db80b01cfc4..00000000000
--- a/gnu/dist/toolchain/gcc/java/lang-options.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Switch definitions for the GNU compiler for the Java(TM) language.
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* This is the contribution to the `lang_options' array in gcc.c for
- java. */
-
-DEFINE_LANG_NAME ("Java")
-
- { "-fbounds-check", "" },
- { "-fno-bounds-check", "Disable automatic array bounds checking" },
- { "-fassume-compiled", "Make is_compiled_class return 1"},
- { "-fno-assume-compiled", "" },
- { "-femit-class-file", "" },
- { "-femit-class-files", "Dump class files to <name>.class" },
-#if ! USE_CPPLIB
- { "-MD", "Print dependencies to FILE.d" },
- { "-MMD", "Print dependencies to FILE.d" },
- { "-M", "Print dependencies to stdout" },
- { "-MM", "Print dependencies to stdout" },
-#endif /* ! USE_CPPLIB */
- { "-fclasspath", "Set class path and suppress system path" },
- { "-fCLASSPATH", "Set class path" },
- { "-I", "Add directory to class path" },
- { "-foutput-class-dir", "Directory where class files should be written" },
- { "-Wredundant-modifiers",
- "Warn if modifiers are specified when not necessary"},
- { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"},
diff --git a/gnu/dist/toolchain/gcc/java/lang-specs.h b/gnu/dist/toolchain/gcc/java/lang-specs.h
deleted file mode 100644
index 93d18859310..00000000000
--- a/gnu/dist/toolchain/gcc/java/lang-specs.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Definitions for specs for the GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* This is the contribution to the `default_compilers' array in gcc.c for
- Java. */
-
- {".java", {"@java"} },
- {".class", {"@java"} },
- {".zip", {"@java"} },
- {".jar", {"@java"} },
- {"@java",
- {"%{!E:jc1 %i %1 %{!Q:-quiet} %{d*} %{m*} %{a}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
- %{traditional} %{v:-version} %{pg:-p} %{p}\
- %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\
- %{I*}\
- %{MD} %{MMD} %{M} %{MM}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}"}},
diff --git a/gnu/dist/toolchain/gcc/java/lang.c b/gnu/dist/toolchain/gcc/java/lang.c
deleted file mode 100644
index cd6fb3bd569..00000000000
--- a/gnu/dist/toolchain/gcc/java/lang.c
+++ /dev/null
@@ -1,600 +0,0 @@
-/* Java(TM) language-specific utility routines.
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "input.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "toplev.h"
-#include "flags.h"
-#include "xref.h"
-
-#ifndef OBJECT_SUFFIX
-# define OBJECT_SUFFIX ".o"
-#endif
-
-/* Table indexed by tree code giving a string containing a character
- classifying the tree code. Possibilities are
- t, d, s, c, r, <, 1 and 2. See java/java-tree.def for details. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-
-char java_tree_code_type[] = {
- 'x',
-#include "java-tree.def"
-};
-#undef DEFTREECODE
-
-/* Table indexed by tree code giving number of expression
- operands beyond the fixed part of the node structure.
- Not used for types or decls. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-
-int java_tree_code_length[] = {
- 0,
-#include "java-tree.def"
-};
-#undef DEFTREECODE
-
-/* Names of tree components.
- Used for printing out the tree and error messages. */
-#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
-
-const char *java_tree_code_name[] = {
- "@@dummy",
-#include "java-tree.def"
-};
-#undef DEFTREECODE
-
-int compiling_from_source;
-
-char *language_string = "GNU Java";
-
-/* Nonzero if we want to automatically do array bounds checking;
- on by default. Use -fno-bounds-check to disable. */
-
-int flag_bounds_check = 1;
-
-/* Nonzero if we should make is_compiled_class always return 1 for
- appropriate classes that we're referencing. */
-
-int flag_assume_compiled = 1;
-
-int flag_emit_class_files = 0;
-
-/* When non zero, we emit xref strings. Values of the flag for xref
- backends are defined in xref_flag_table, xref.c. */
-
-int flag_emit_xref = 0;
-
-/* When non zero, -Wall was turned on. */
-int flag_wall = 0;
-
-/* When non zero, check for redundant modifier uses. */
-int flag_redundant = 0;
-
-/* When non zero, warns about overridings that don't occur. */
-int flag_not_overriding = 0;
-
-/* When non zero, warns that final local are treated as non final. */
-int flag_static_local_jdk1_1 = 0;
-
-/* From gcc/flags.h, and indicates if exceptions are turned on or not. */
-
-extern int flag_new_exceptions;
-extern int flag_exceptions;
-
-/* Table of language-dependent -f options.
- STRING is the option name. VARIABLE is the address of the variable.
- ON_VALUE is the value to store in VARIABLE
- if `-fSTRING' is seen as an option.
- (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
-
-static struct { const char *string; int *variable; int on_value;}
-lang_f_options[] =
-{
- {"bounds-check", &flag_bounds_check, 1},
- {"assume-compiled", &flag_assume_compiled, 1},
- {"emit-class-file", &flag_emit_class_files, 1},
- {"emit-class-files", &flag_emit_class_files, 1},
-};
-
-JCF *current_jcf;
-
-/* Variable controlling how dependency tracking is enabled in
- init_parse. */
-static int dependency_tracking = 0;
-
-/* Flag values for DEPENDENCY_TRACKING. */
-#define DEPEND_SET_FILE 1
-#define DEPEND_ENABLE 2
-
-/*
- * process java-specific compiler command-line options
- */
-int
-lang_decode_option (argc, argv)
- int argc __attribute__ ((__unused__));
- char **argv;
-{
- char *p = argv[0];
-
-#define CLARG "-fclasspath="
- if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
- {
- jcf_path_classpath_arg (p + sizeof (CLARG) - 1);
- return 1;
- }
-#undef CLARG
-#define CLARG "-fCLASSPATH="
- else if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
- {
- jcf_path_CLASSPATH_arg (p + sizeof (CLARG) - 1);
- return 1;
- }
-#undef CLARG
- else if (strncmp (p, "-I", 2) == 0)
- {
- jcf_path_include_arg (p + 2);
- return 1;
- }
-
-#define ARG "-foutput-class-dir="
- if (strncmp (p, ARG, sizeof (ARG) - 1) == 0)
- {
- jcf_write_base_directory = p + sizeof (ARG) - 1;
- return 1;
- }
-#undef ARG
-
- if (p[0] == '-' && p[1] == 'f')
- {
- /* Some kind of -f option.
- P's value is the option sans `-f'.
- Search for it in the table of options. */
- int found = 0, j;
-
- p += 2;
-
- for (j = 0;
- !found
- && j < (int)(sizeof (lang_f_options) / sizeof (lang_f_options[0]));
- j++)
- {
- if (!strcmp (p, lang_f_options[j].string))
- {
- *lang_f_options[j].variable = lang_f_options[j].on_value;
- /* A goto here would be cleaner,
- but breaks the vax pcc. */
- found = 1;
- }
- if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
- && ! strcmp (p+3, lang_f_options[j].string))
- {
- *lang_f_options[j].variable = ! lang_f_options[j].on_value;
- found = 1;
- }
- }
-
- return found;
- }
-
- if (strcmp (p, "-Wall") == 0)
- {
- flag_wall = 1;
- flag_redundant = 1;
- return 1;
- }
-
- if (strcmp (p, "-Wunsupported-jdk11") == 0)
- {
- flag_static_local_jdk1_1 = 1;
- return 1;
- }
-
- if (strcmp (p, "-Wredundant-modifiers") == 0)
- {
- flag_redundant = 1;
- return 1;
- }
-
- if (strcmp (p, "-MD") == 0)
- {
- jcf_dependency_init (1);
- dependency_tracking |= DEPEND_SET_FILE | DEPEND_ENABLE;
- return 1;
- }
- else if (strcmp (p, "-MMD") == 0)
- {
- jcf_dependency_init (0);
- dependency_tracking |= DEPEND_SET_FILE | DEPEND_ENABLE;
- return 1;
- }
- else if (strcmp (p, "-M") == 0)
- {
- jcf_dependency_init (1);
- dependency_tracking |= DEPEND_ENABLE;
- return 1;
- }
- else if (strcmp (p, "-MM") == 0)
- {
- jcf_dependency_init (0);
- dependency_tracking |= DEPEND_ENABLE;
- return 1;
- }
-
- return 0;
-}
-
-FILE *finput;
-char *
-init_parse (filename)
- char *filename;
-{
- /* Open input file. */
-
- if (filename == 0 || !strcmp (filename, "-"))
- {
- finput = stdin;
- filename = "stdin";
-
- if (dependency_tracking)
- error ("can't do dependency tracking with input from stdin");
- }
- else
- {
- if (dependency_tracking)
- {
- char *dot;
- dot = strrchr (filename, '.');
- if (dot == NULL)
- error ("couldn't determine target name for dependency tracking");
- else
- {
- char *buf = (char *) xmalloc (dot - filename +
- 3 + sizeof (OBJECT_SUFFIX));
- strncpy (buf, filename, dot - filename);
-
- /* If emitting class files, we might have multiple
- targets. The class generation code takes care of
- registering them. Otherwise we compute the target
- name here. */
- if (flag_emit_class_files)
- jcf_dependency_set_target (NULL);
- else
- {
- strcpy (buf + (dot - filename), OBJECT_SUFFIX);
- jcf_dependency_set_target (buf);
- }
-
- if ((dependency_tracking & DEPEND_SET_FILE))
- {
- strcpy (buf + (dot - filename), ".d");
- jcf_dependency_set_dep_file (buf);
- }
- else
- jcf_dependency_set_dep_file ("-");
-
- free (buf);
- }
- }
- }
- init_lex ();
-
- return filename;
-}
-
-void
-finish_parse ()
-{
- fclose (finput);
- jcf_dependency_write ();
-}
-
-/* Buffer used by lang_printable_name. */
-static char *decl_buf = NULL;
-
-/* Allocated size of decl_buf. */
-static int decl_buflen = 0;
-
-/* Length of used part of decl_buf; position for next character. */
-static int decl_bufpos = 0;
-
-/* Append the string STR to decl_buf.
- It length is given by LEN; -1 means the string is nul-terminated. */
-
-static void
-put_decl_string (str, len)
- char *str;
- int len;
-{
- if (len < 0)
- len = strlen (str);
- if (decl_bufpos + len >= decl_buflen)
- {
- if (decl_buf == NULL)
- {
- decl_buflen = len + 100;
- decl_buf = (char *) xmalloc (decl_buflen);
- }
- else
- {
- decl_buflen *= 2;
- decl_buf = (char *) xrealloc (decl_buf, decl_buflen);
- }
- }
- strcpy (decl_buf + decl_bufpos, str);
- decl_bufpos += len;
-}
-
-/* Append to decl_buf a printable name for NODE. */
-
-static void
-put_decl_node (node)
- tree node;
-{
- int was_pointer = 0;
- if (TREE_CODE (node) == POINTER_TYPE)
- {
- node = TREE_TYPE (node);
- was_pointer = 1;
- }
- if (TREE_CODE_CLASS (TREE_CODE (node)) == 'd'
- && DECL_NAME (node) != NULL_TREE)
- {
-#if 0
- if (DECL_CONTEXT (node) != NULL_TREE)
- {
- put_decl_node (DECL_CONTEXT (node));
- put_decl_string (".", 1);
- }
-#endif
- if (TREE_CODE (node) == FUNCTION_DECL
- && DECL_NAME (node) == init_identifier_node
- && !DECL_ARTIFICIAL (node) && current_class)
- put_decl_node (TYPE_NAME (current_class));
- else
- put_decl_node (DECL_NAME (node));
- if (TREE_CODE (node) == FUNCTION_DECL && TREE_TYPE (node) != NULL_TREE)
- {
- int i = 0;
- tree args = TYPE_ARG_TYPES (TREE_TYPE (node));
- if (TREE_CODE (TREE_TYPE (node)) == METHOD_TYPE)
- args = TREE_CHAIN (args);
- put_decl_string ("(", 1);
- for ( ; args != end_params_node; args = TREE_CHAIN (args), i++)
- {
- if (i > 0)
- put_decl_string (",", 1);
- put_decl_node (TREE_VALUE (args));
- }
- put_decl_string (")", 1);
- }
- }
- else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't'
- && TYPE_NAME (node) != NULL_TREE)
- {
- if (TREE_CODE (node) == RECORD_TYPE && TYPE_ARRAY_P (node))
- {
- put_decl_node (TYPE_ARRAY_ELEMENT (node));
- put_decl_string("[]", 2);
- }
- else if (node == promoted_byte_type_node)
- put_decl_string ("byte", 4);
- else if (node == promoted_short_type_node)
- put_decl_string ("short", 5);
- else if (node == promoted_char_type_node)
- put_decl_string ("char", 4);
- else if (node == promoted_boolean_type_node)
- put_decl_string ("boolean", 7);
- else if (node == void_type_node && was_pointer)
- put_decl_string ("null", 4);
- else
- put_decl_node (TYPE_NAME (node));
- }
- else if (TREE_CODE (node) == IDENTIFIER_NODE)
- put_decl_string (IDENTIFIER_POINTER (node), IDENTIFIER_LENGTH (node));
- else
- put_decl_string ("<unknown>", -1);
-}
-
-/* Return a user-friendly name for DECL.
- The resulting string is only valid until the next call.
- The value of the hook decl_printable_name is this function,
- which is also called directly by lang_print_error. */
-
-char *
-lang_printable_name (decl, v)
- tree decl;
- int v __attribute__ ((__unused__));
-{
- decl_bufpos = 0;
- put_decl_node (decl);
- put_decl_string ("", 1);
- return decl_buf;
-}
-
-/* Print on stderr the current class and method context. This function
- is the value of the hook print_error_function, called from toplev.c. */
-
-void
-lang_print_error (file)
- char *file;
-{
- static tree last_error_function_context = NULL_TREE;
- static tree last_error_function = NULL;
-
- if (current_function_decl != NULL
- && DECL_CONTEXT (current_function_decl) != last_error_function_context)
- {
- if (file)
- fprintf (stderr, "%s: ", file);
-
- last_error_function_context = DECL_CONTEXT (current_function_decl);
- fprintf (stderr, "In class `%s':\n",
- lang_printable_name (last_error_function_context, 0));
- }
- if (last_error_function != current_function_decl)
- {
- if (file)
- fprintf (stderr, "%s: ", file);
-
- if (current_function_decl == NULL)
- fprintf (stderr, "At top level:\n");
- else
- {
- char *name = lang_printable_name (current_function_decl, 2);
- fprintf (stderr, "In method `%s':\n", name);
- }
-
- last_error_function = current_function_decl;
- }
-
-}
-
-void
-lang_init ()
-{
- extern struct rtx_def * java_lang_expand_expr ();
- extern struct rtx_def * (*lang_expand_expr) ();
- extern void (*print_error_function) PROTO((char *));
-#if 0
- extern int flag_minimal_debug;
- flag_minimal_debug = 0;
-#endif
-
- jcf_path_init ();
- jcf_path_seal ();
-
- decl_printable_name = lang_printable_name;
- print_error_function = lang_print_error;
- lang_expand_expr = java_lang_expand_expr;
-
- flag_exceptions = 1;
-
- /* Append to Gcc tree node definition arrays */
-
- bcopy (java_tree_code_type,
- tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
- (int)LAST_JAVA_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE);
- bcopy ((char *)java_tree_code_length,
- (char *)(tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
- (LAST_JAVA_TREE_CODE -
- (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (int));
- bcopy ((char *)java_tree_code_name,
- (char *)(tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE),
- (LAST_JAVA_TREE_CODE -
- (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
-
- using_eh_for_cleanups ();
-}
-
-/* This doesn't do anything on purpose. It's used to satisfy the
- print_error_function hook we don't print error messages with bogus
- function prototypes. */
-
-void java_dummy_print (s)
- char *s __attribute__ ((__unused__));
-{
-}
-
-/* Called to install the PRINT_ERROR_FUNCTION hook differently
- according to LEVEL. LEVEL is 1 during early parsing, when function
- prototypes aren't fully resolved. print_error_function is set so it
- doesn't print incomplete function prototypes. When LEVEL is 2,
- function prototypes are fully resolved and can be printed when
- reporting errors. */
-
-void lang_init_source (level)
- int level;
-{
- extern void (*print_error_function) PROTO((char *));
- if (level == 1)
- print_error_function = java_dummy_print;
- else
- print_error_function = lang_print_error;
-}
-
-void
-lang_init_options ()
-{
- flag_new_exceptions = 1;
-}
-
-void
-lang_finish ()
-{
-}
-
-char*
-lang_identify ()
-{
- return "Java";
-}
-
-/* Hooks for print_node. */
-
-void
-print_lang_decl (file, node, indent)
- FILE *file __attribute ((__unused__));
- tree node __attribute ((__unused__));
- int indent __attribute ((__unused__));
-{
-}
-
-void
-print_lang_type (file, node, indent)
- FILE *file __attribute ((__unused__));
- tree node __attribute ((__unused__));
- int indent __attribute ((__unused__));
-{
-}
-
-void
-print_lang_identifier (file, node, indent)
- FILE *file __attribute ((__unused__));
- tree node __attribute ((__unused__));
- int indent __attribute ((__unused__));
-{
-}
-
-void
-print_lang_statistics ()
-{
-}
-
-/* used by print-tree.c */
-
-void
-lang_print_xnode (file, node, indent)
- FILE *file __attribute ((__unused__));
- tree node __attribute ((__unused__));
- int indent __attribute ((__unused__));
-{
-}
diff --git a/gnu/dist/toolchain/gcc/java/lex.c b/gnu/dist/toolchain/gcc/java/lex.c
deleted file mode 100644
index fbaa23d80f0..00000000000
--- a/gnu/dist/toolchain/gcc/java/lex.c
+++ /dev/null
@@ -1,1409 +0,0 @@
-/* Language lexer for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* It defines java_lex (yylex) that reads a Java ASCII source file
-possibly containing Unicode escape sequence or utf8 encoded characters
-and returns a token for everything found but comments, white spaces
-and line terminators. When necessary, it also fills the java_lval
-(yylval) union. It's implemented to be called by a re-entrant parser
-generated by Bison.
-
-The lexical analysis conforms to the Java grammar described in "The
-Java(TM) Language Specification. J. Gosling, B. Joy, G. Steele.
-Addison Wesley 1996" (http://java.sun.com/docs/books/jls/html/3.doc.html) */
-
-#include "keyword.h"
-
-#ifndef JC1_LITE
-extern struct obstack *expression_obstack;
-#endif
-
-/* Function declaration */
-static int java_lineterminator PROTO ((unicode_t));
-static char *java_sprint_unicode PROTO ((struct java_line *, int));
-static void java_unicode_2_utf8 PROTO ((unicode_t));
-static void java_lex_error PROTO ((char *, int));
-#ifndef JC1_LITE
-static int java_is_eol PROTO ((FILE *, int));
-static tree build_wfl_node PROTO ((tree));
-#endif
-static void java_store_unicode PROTO ((struct java_line *, unicode_t, int));
-static unicode_t java_parse_escape_sequence PROTO ((void));
-static int java_letter_or_digit_p PROTO ((unicode_t));
-static int java_parse_doc_section PROTO ((unicode_t));
-static void java_parse_end_comment PROTO ((unicode_t));
-static unicode_t java_get_unicode PROTO (());
-static unicode_t java_read_unicode PROTO ((int, int *));
-static void java_store_unicode PROTO ((struct java_line *, unicode_t, int));
-static unicode_t java_read_char PROTO (());
-static void java_allocate_new_line PROTO (());
-static void java_unget_unicode PROTO (());
-static unicode_t java_sneak_unicode PROTO (());
-
-void
-java_init_lex ()
-{
-#ifndef JC1_LITE
- int java_lang_imported = 0;
-
- if (!java_lang_id)
- java_lang_id = get_identifier ("java.lang");
- if (!java_lang_cloneable)
- java_lang_cloneable = get_identifier ("java.lang.Cloneable");
-
- if (!java_lang_imported)
- {
- tree node = build_tree_list
- (build_expr_wfl (java_lang_id, NULL, 0, 0), NULL_TREE);
- read_import_dir (TREE_PURPOSE (node));
- TREE_CHAIN (node) = ctxp->import_demand_list;
- ctxp->import_demand_list = node;
- java_lang_imported = 1;
- }
-
- if (!wfl_operator)
- wfl_operator = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
- if (!label_id)
- label_id = get_identifier ("$L");
- if (!wfl_append)
- wfl_append = build_expr_wfl (get_identifier ("append"), NULL, 0, 0);
- if (!wfl_string_buffer)
- wfl_string_buffer =
- build_expr_wfl (get_identifier ("java.lang.StringBuffer"), NULL, 0, 0);
- if (!wfl_to_string)
- wfl_to_string = build_expr_wfl (get_identifier ("toString"), NULL, 0, 0);
-
- ctxp->static_initialized = ctxp->non_static_initialized =
- ctxp->incomplete_class = NULL_TREE;
-
- bzero ((PTR) ctxp->modifier_ctx, 11*sizeof (ctxp->modifier_ctx[0]));
- bzero ((PTR) current_jcf, sizeof (JCF));
- ctxp->current_parsed_class = NULL;
- ctxp->package = NULL_TREE;
-#endif
-
- ctxp->filename = input_filename;
- ctxp->lineno = lineno = 0;
- ctxp->p_line = NULL;
- ctxp->c_line = NULL;
- ctxp->unget_utf8_value = 0;
- ctxp->minus_seen = 0;
- ctxp->java_error_flag = 0;
-}
-
-static char *
-java_sprint_unicode (line, i)
- struct java_line *line;
- int i;
-{
- static char buffer [10];
- if (line->unicode_escape_p [i] || line->line [i] > 128)
- sprintf (buffer, "\\u%04x", line->line [i]);
- else
- {
- buffer [0] = line->line [i];
- buffer [1] = '\0';
- }
- return buffer;
-}
-
-static unicode_t
-java_sneak_unicode ()
-{
- return (ctxp->c_line->line [ctxp->c_line->current]);
-}
-
-static void
-java_unget_unicode ()
-{
- if (!ctxp->c_line->current)
- fatal ("can't unget unicode - java_unget_unicode");
- ctxp->c_line->current--;
- ctxp->c_line->char_col -= JAVA_COLUMN_DELTA (0);
-}
-
-static void
-java_allocate_new_line ()
-{
- unicode_t ahead = (ctxp->c_line ? ctxp->c_line->ahead[0] : '\0');
- char ahead_escape_p = (ctxp->c_line ?
- ctxp->c_line->unicode_escape_ahead_p : 0);
-
- if (ctxp->c_line && !ctxp->c_line->white_space_only)
- {
- if (ctxp->p_line)
- {
- free (ctxp->p_line->unicode_escape_p);
- free (ctxp->p_line->line);
- free (ctxp->p_line);
- }
- ctxp->p_line = ctxp->c_line;
- ctxp->c_line = NULL; /* Reallocated */
- }
-
- if (!ctxp->c_line)
- {
- ctxp->c_line = (struct java_line *)xmalloc (sizeof (struct java_line));
- ctxp->c_line->max = JAVA_LINE_MAX;
- ctxp->c_line->line = (unicode_t *)xmalloc
- (sizeof (unicode_t)*ctxp->c_line->max);
- ctxp->c_line->unicode_escape_p =
- (char *)xmalloc (sizeof (char)*ctxp->c_line->max);
- ctxp->c_line->white_space_only = 0;
- }
-
- ctxp->c_line->line [0] = ctxp->c_line->size = 0;
- ctxp->c_line->char_col = ctxp->c_line->current = 0;
- if (ahead)
- {
- ctxp->c_line->line [ctxp->c_line->size] = ahead;
- ctxp->c_line->unicode_escape_p [ctxp->c_line->size] = ahead_escape_p;
- ctxp->c_line->size++;
- }
- ctxp->c_line->ahead [0] = 0;
- ctxp->c_line->unicode_escape_ahead_p = 0;
- ctxp->c_line->lineno = ++lineno;
- ctxp->c_line->white_space_only = 1;
-}
-
-#define BAD_UTF8_VALUE 0xFFFE
-
-static unicode_t
-java_read_char ()
-{
- int c;
- int c1, c2;
-
- if (ctxp->unget_utf8_value)
- {
- int to_return = ctxp->unget_utf8_value;
- ctxp->unget_utf8_value = 0;
- return (to_return);
- }
-
- c = GETC ();
-
- if (c < 128)
- return (unicode_t)c;
- if (c == EOF)
- return UEOF;
- else
- {
- if ((c & 0xe0) == 0xc0)
- {
- c1 = GETC ();
- if ((c1 & 0xc0) == 0x80)
- return (unicode_t)(((c &0x1f) << 6) + (c1 & 0x3f));
- c = c1;
- }
- else if ((c & 0xf0) == 0xe0)
- {
- c1 = GETC ();
- if ((c1 & 0xc0) == 0x80)
- {
- c2 = GETC ();
- if ((c2 & 0xc0) == 0x80)
- return (unicode_t)(((c & 0xf) << 12) +
- (( c1 & 0x3f) << 6) + (c2 & 0x3f));
- else
- c = c2;
- }
- else
- c = c1;
- }
- /* We looked for a UTF8 multi-byte sequence (since we saw an initial
- byte with the high bit set), but found invalid bytes instead.
- If the most recent byte was Ascii (and not EOF), we should
- unget it, in case it was a comment terminator or other delimitor. */
- if ((c & 0x80) == 0)
- UNGETC (c);
- return BAD_UTF8_VALUE;
- }
-}
-
-static void
-java_store_unicode (l, c, unicode_escape_p)
- struct java_line *l;
- unicode_t c;
- int unicode_escape_p;
-{
- if (l->size == l->max)
- {
- l->max += JAVA_LINE_MAX;
- l->line = (unicode_t *)realloc (l->line, sizeof (unicode_t)*l->max);
- l->unicode_escape_p = (char *)realloc (l->unicode_escape_p,
- sizeof (char)*l->max);
- }
- l->line [l->size] = c;
- l->unicode_escape_p [l->size++] = unicode_escape_p;
-}
-
-static unicode_t
-java_read_unicode (term_context, unicode_escape_p)
- int term_context;
- int *unicode_escape_p;
-{
- unicode_t c;
- long i, base;
-
- c = java_read_char ();
- *unicode_escape_p = 0;
-
- if (c != '\\')
- return ((term_context ? c :
- java_lineterminator (c) ? '\n' : (unicode_t)c));
-
- /* Count the number of preceeding '\' */
- for (base = ftell (finput), i = base-2; c == '\\';)
- {
- fseek (finput, i--, SEEK_SET);
- c = java_read_char (); /* Will fail if reading utf8 stream. FIXME */
- }
- fseek (finput, base, SEEK_SET);
- if ((base-i-3)%2 == 0) /* If odd number of \ seen */
- {
- c = java_read_char ();
- if (c == 'u')
- {
- unsigned short unicode = 0;
- int shift = 12;
- /* Next should be 4 hex digits, otherwise it's an error.
- The hex value is converted into the unicode, pushed into
- the Unicode stream. */
- for (shift = 12; shift >= 0; shift -= 4)
- {
- if ((c = java_read_char ()) == UEOF)
- return UEOF;
- if (c >= '0' && c <= '9')
- unicode |= (unicode_t)((c-'0') << shift);
- else if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
- unicode |= (unicode_t)((10+(c | 0x20)-'a') << shift);
- else
- java_lex_error
- ("Non hex digit in Unicode escape sequence", 0);
- }
- *unicode_escape_p = 1;
- return (term_context ? unicode :
- (java_lineterminator (c) ? '\n' : unicode));
- }
- ctxp->unget_utf8_value = c;
- }
- return (unicode_t)'\\';
-}
-
-static unicode_t
-java_get_unicode ()
-{
- /* It's time to read a line when... */
- if (!ctxp->c_line || ctxp->c_line->current == ctxp->c_line->size)
- {
- unicode_t c;
- java_allocate_new_line ();
- if (ctxp->c_line->line[0] != '\n')
- for (;;)
- {
- int unicode_escape_p;
- c = java_read_unicode (0, &unicode_escape_p);
- java_store_unicode (ctxp->c_line, c, unicode_escape_p);
- if (ctxp->c_line->white_space_only
- && !JAVA_WHITE_SPACE_P (c) && c!='\n')
- ctxp->c_line->white_space_only = 0;
- if ((c == '\n') || (c == UEOF))
- break;
- }
- }
- ctxp->c_line->char_col += JAVA_COLUMN_DELTA (0);
- JAVA_LEX_CHAR (ctxp->c_line->line [ctxp->c_line->current]);
- return ctxp->c_line->line [ctxp->c_line->current++];
-}
-
-static int
-java_lineterminator (c)
- unicode_t c;
-{
- int unicode_escape_p;
- if (c == '\n') /* CR */
- {
- if ((c = java_read_unicode (1, &unicode_escape_p)) != '\r')
- {
- ctxp->c_line->ahead [0] = c;
- ctxp->c_line->unicode_escape_ahead_p = unicode_escape_p;
- }
- return 1;
- }
- else if (c == '\r') /* LF */
- {
- if ((c = java_read_unicode (1, &unicode_escape_p)) != '\n')
- {
- ctxp->c_line->ahead [0] = c;
- ctxp->c_line->unicode_escape_ahead_p = unicode_escape_p;
- }
- return 1;
- }
- else
- return 0;
-}
-
-/* Parse the end of a C style comment.
- * C is the first character following the '/' and '*'. */
-static void
-java_parse_end_comment (c)
- unicode_t c;
-{
-
- for ( ;; c = java_get_unicode ())
- {
- switch (c)
- {
- case UEOF:
- java_lex_error ("Comment not terminated at end of input", 0);
- case '*':
- switch (c = java_get_unicode ())
- {
- case UEOF:
- java_lex_error ("Comment not terminated at end of input", 0);
- case '/':
- return;
- case '*': /* reparse only '*' */
- java_unget_unicode ();
- }
- }
- }
-}
-
-/* Parse the documentation section. Keywords must be at the beginning
- of a documentation comment line (ignoring white space and any `*'
- character). Parsed keyword(s): @DEPRECATED. */
-
-static int
-java_parse_doc_section (c)
- unicode_t c;
-{
- int valid_tag = 0, seen_star = 0;
-
- while (JAVA_WHITE_SPACE_P (c) || (c == '*') || c == '\n')
- {
- switch (c)
- {
- case '*':
- seen_star = 1;
- break;
- case '\n': /* ULT */
- valid_tag = 1;
- default:
- seen_star = 0;
- }
- c = java_get_unicode();
- }
-
- if (c == UEOF)
- java_lex_error ("Comment not terminated at end of input", 0);
-
- if (seen_star && (c == '/'))
- return 1; /* Goto step1 in caller */
-
- /* We're parsing @deprecated */
- if (valid_tag && (c == '@'))
- {
- char tag [11];
- int tag_index = 0;
-
- while (tag_index < 10 && c != UEOF && c != ' ' && c != '\n')
- {
- c = java_get_unicode ();
- tag [tag_index++] = c;
- }
-
- if (c == UEOF)
- java_lex_error ("Comment not terminated at end of input", 0);
-
- java_unget_unicode ();
- tag [tag_index] = '\0';
-
- if (!strcmp (tag, "deprecated"))
- ctxp->deprecated = 1;
- }
- return 0;
-}
-
-/* This function to be used only by JAVA_ID_CHAR_P (), otherwise it
- will return a wrong result. */
-static int
-java_letter_or_digit_p (c)
- unicode_t c;
-{
- return _JAVA_LETTER_OR_DIGIT_P (c);
-}
-
-static unicode_t
-java_parse_escape_sequence ()
-{
- unicode_t char_lit;
- unicode_t c;
-
- switch (c = java_get_unicode ())
- {
- case 'b':
- return (unicode_t)0x8;
- case 't':
- return (unicode_t)0x9;
- case 'n':
- return (unicode_t)0xa;
- case 'f':
- return (unicode_t)0xc;
- case 'r':
- return (unicode_t)0xd;
- case '"':
- return (unicode_t)0x22;
- case '\'':
- return (unicode_t)0x27;
- case '\\':
- return (unicode_t)0x5c;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- {
- int octal_escape[3];
- int octal_escape_index = 0;
-
- for (; octal_escape_index < 3 && RANGE (c, '0', '9');
- c = java_get_unicode ())
- octal_escape [octal_escape_index++] = c;
-
- java_unget_unicode ();
-
- if ((octal_escape_index == 3) && (octal_escape [0] > '3'))
- {
- java_lex_error ("Literal octal escape out of range", 0);
- return JAVA_CHAR_ERROR;
- }
- else
- {
- int i, shift;
- for (char_lit=0, i = 0, shift = 3*(octal_escape_index-1);
- i < octal_escape_index; i++, shift -= 3)
- char_lit |= (octal_escape [i] - '0') << shift;
-
- return (char_lit);
- }
- break;
- }
- case '\n':
- return '\n'; /* ULT, caught latter as a specific error */
- default:
- java_lex_error ("Illegal character in escape sequence", 0);
- return JAVA_CHAR_ERROR;
- }
-}
-
-int
-#ifdef JC1_LITE
-yylex (java_lval)
-#else
-java_lex (java_lval)
-#endif
- YYSTYPE *java_lval;
-{
- unicode_t c, first_unicode;
- int ascii_index, all_ascii;
- char *string;
-
- /* Translation of the Unicode escape in the raw stream of Unicode
- characters. Takes care of line terminator. */
- step1:
- /* Skip white spaces: SP, TAB and FF or ULT */
- for (c = java_get_unicode ();
- c == '\n' || JAVA_WHITE_SPACE_P (c); c = java_get_unicode ())
- if (c == '\n')
- {
- ctxp->elc.line = ctxp->c_line->lineno;
- ctxp->elc.col = ctxp->c_line->char_col-2;
- }
-
- ctxp->elc.col = (ctxp->elc.col < 0 ? 0 : ctxp->elc.col);
-
- if (c == 0x1a) /* CTRL-Z */
- {
- if ((c = java_get_unicode ()) == UEOF)
- return 0; /* Ok here */
- else
- java_unget_unicode (); /* Caught latter at the end the function */
- }
- /* Handle EOF here */
- if (c == UEOF) /* Should probably do something here... */
- return 0;
-
- /* Take care of eventual comments. */
- if (c == '/')
- {
- switch (c = java_get_unicode ())
- {
- case '/':
- for (;;)
- {
- c = java_get_unicode ();
- if (c == UEOF)
- java_lex_error ("Comment not terminated at end of input", 0);
- if (c == '\n') /* ULT */
- goto step1;
- }
- break;
-
- case '*':
- if ((c = java_get_unicode ()) == '*')
- {
- if ((c = java_get_unicode ()) == '/')
- goto step1; /* Empy documentation comment */
- else if (java_parse_doc_section (c))
- goto step1;
- }
-
- java_parse_end_comment (c);
- goto step1;
- break;
- default:
- java_unget_unicode ();
- c = '/';
- break;
- }
- }
-
- ctxp->elc.line = ctxp->c_line->lineno;
- ctxp->elc.prev_col = ctxp->elc.col;
- ctxp->elc.col = ctxp->c_line->char_col - JAVA_COLUMN_DELTA (-1);
- if (ctxp->elc.col < 0)
- fatal ("ctxp->elc.col < 0 - java_lex");
-
- /* Numeric literals */
- if (JAVA_ASCII_DIGIT (c) || (c == '.'))
- {
- /* This section of code is borrowed from gcc/c-lex.c */
-#define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2)
- int parts[TOTAL_PARTS];
- HOST_WIDE_INT high, low;
- /* End borrowed section */
- char literal_token [256];
- int literal_index = 0, radix = 10, long_suffix = 0, overflow = 0, bytes;
- int i;
-#ifndef JC1_LITE
- int number_beginning = ctxp->c_line->current;
-#endif
-
- /* We might have a . separator instead of a FP like .[0-9]* */
- if (c == '.')
- {
- unicode_t peep = java_sneak_unicode ();
-
- if (!JAVA_ASCII_DIGIT (peep))
- {
- JAVA_LEX_SEP('.');
- BUILD_OPERATOR (DOT_TK);
- }
- }
-
- for (i = 0; i < TOTAL_PARTS; i++)
- parts [i] = 0;
-
- if (c == '0')
- {
- c = java_get_unicode ();
- if (c == 'x' || c == 'X')
- {
- radix = 16;
- c = java_get_unicode ();
- }
- else if (JAVA_ASCII_DIGIT (c))
- radix = 8;
- else if (c == '.')
- {
- /* Push the '.' back and prepare for a FP parsing... */
- java_unget_unicode ();
- c = '0';
- }
- else
- {
- /* We have a zero literal: 0, 0{f,F}, 0{d,D} */
- JAVA_LEX_LIT ("0", 10);
- switch (c)
- {
- case 'L': case 'l':
- SET_LVAL_NODE (long_zero_node);
- return (INT_LIT_TK);
- case 'f': case 'F':
- SET_LVAL_NODE (float_zero_node);
- return (FP_LIT_TK);
- case 'd': case 'D':
- SET_LVAL_NODE (double_zero_node);
- return (FP_LIT_TK);
- default:
- java_unget_unicode ();
- SET_LVAL_NODE (integer_zero_node);
- return (INT_LIT_TK);
- }
- }
- }
- /* Parse the first part of the literal, until we find something
- which is not a number. */
- while ((radix == 10 && JAVA_ASCII_DIGIT (c)) ||
- (radix == 16 && JAVA_ASCII_HEXDIGIT (c)) ||
- (radix == 8 && JAVA_ASCII_OCTDIGIT (c)))
- {
- /* We store in a string (in case it turns out to be a FP) and in
- PARTS if we have to process a integer literal. */
- int numeric = (RANGE (c, '0', '9') ? c-'0' : 10 +(c|0x20)-'a');
- int count;
-
- literal_token [literal_index++] = c;
- /* This section of code if borrowed from gcc/c-lex.c */
- for (count = 0; count < TOTAL_PARTS; count++)
- {
- parts[count] *= radix;
- if (count)
- {
- parts[count] += (parts[count-1] >> HOST_BITS_PER_CHAR);
- parts[count-1] &= (1 << HOST_BITS_PER_CHAR) - 1;
- }
- else
- parts[0] += numeric;
- }
- if (parts [TOTAL_PARTS-1] != 0)
- overflow = 1;
- /* End borrowed section. */
- c = java_get_unicode ();
- }
-
- /* If we have something from the FP char set but not a digit, parse
- a FP literal. */
- if (JAVA_ASCII_FPCHAR (c) && !JAVA_ASCII_DIGIT (c))
- {
- int stage = 0;
- int seen_digit = (literal_index ? 1 : 0);
- int seen_exponent = 0;
- int fflag = 0; /* 1 for {f,F}, 0 for {d,D}. FP literal are
- double unless specified. */
- if (radix != 10)
- java_lex_error ("Can't express non-decimal FP literal", 0);
-
- for (;;)
- {
- if (c == '.')
- {
- if (stage < 1)
- {
- stage = 1;
- literal_token [literal_index++ ] = c;
- c = java_get_unicode ();
- }
- else
- java_lex_error ("Invalid character in FP literal", 0);
- }
-
- if (c == 'e' || c == 'E')
- {
- if (stage < 2)
- {
- /* {E,e} must have seen at list a digit */
- if (!seen_digit)
- java_lex_error ("Invalid FP literal", 0);
- seen_digit = 0;
- seen_exponent = 1;
- stage = 2;
- literal_token [literal_index++] = c;
- c = java_get_unicode ();
- }
- else
- java_lex_error ("Invalid character in FP literal", 0);
- }
- if ( c == 'f' || c == 'F' || c == 'd' || c == 'D')
- {
- fflag = ((c == 'd') || (c == 'D')) ? 0 : 1;
- stage = 4; /* So we fall through */
- }
-
- if ((c=='-' || c =='+') && stage == 2)
- {
- stage = 3;
- literal_token [literal_index++] = c;
- c = java_get_unicode ();
- }
-
- if ((stage == 0 && JAVA_ASCII_FPCHAR (c)) ||
- (stage == 1 && JAVA_ASCII_FPCHAR (c) && !(c == '.')) ||
- (stage == 2 && (JAVA_ASCII_DIGIT (c) || JAVA_FP_PM (c))) ||
- (stage == 3 && JAVA_ASCII_DIGIT (c)))
- {
- if (JAVA_ASCII_DIGIT (c))
- seen_digit = 1;
- literal_token [literal_index++ ] = c;
- c = java_get_unicode ();
- }
- else
- {
- jmp_buf handler;
- REAL_VALUE_TYPE value;
-#ifndef JC1_LITE
- tree type = (fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
-#endif
-
- if (stage != 4) /* Don't push back fF/dD */
- java_unget_unicode ();
-
- /* An exponent (if any) must have seen a digit. */
- if (seen_exponent && !seen_digit)
- java_lex_error ("Invalid FP literal", 0);
-
- literal_token [literal_index] = '\0';
- JAVA_LEX_LIT (literal_token, radix);
-
- if (setjmp (handler))
- {
- JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
- value = DCONST0;
- }
- else
- {
- SET_FLOAT_HANDLER (handler);
- SET_REAL_VALUE_ATOF
- (value, REAL_VALUE_ATOF (literal_token,
- TYPE_MODE (type)));
-
- if (REAL_VALUE_ISINF (value))
- JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
-
- if (REAL_VALUE_ISNAN (value))
- JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
-
- SET_LVAL_NODE_TYPE (build_real (type, value), type);
- SET_FLOAT_HANDLER (NULL_PTR);
- return FP_LIT_TK;
- }
- }
- }
- } /* JAVA_ASCCI_FPCHAR (c) */
-
- /* Here we get back to converting the integral literal. */
- if (c == 'L' || c == 'l')
- long_suffix = 1;
- else if (radix == 16 && JAVA_ASCII_LETTER (c))
- java_lex_error ("Digit out of range in hexadecimal literal", 0);
- else if (radix == 8 && JAVA_ASCII_DIGIT (c))
- java_lex_error ("Digit out of range in octal literal", 0);
- else if (radix == 16 && !literal_index)
- java_lex_error ("No digit specified for hexadecimal literal", 0);
- else
- java_unget_unicode ();
-
-#ifdef JAVA_LEX_DEBUG
- literal_token [literal_index] = '\0'; /* So JAVA_LEX_LIT is safe. */
- JAVA_LEX_LIT (literal_token, radix);
-#endif
- /* This section of code is borrowed from gcc/c-lex.c */
- if (!overflow)
- {
- bytes = GET_TYPE_PRECISION (long_type_node);
- for (i = bytes; i < TOTAL_PARTS; i++)
- if (parts [i])
- {
- overflow = 1;
- break;
- }
- }
- high = low = 0;
- for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
- {
- high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
- / HOST_BITS_PER_CHAR)]
- << (i * HOST_BITS_PER_CHAR));
- low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
- }
- /* End borrowed section. */
-
- /* Range checking */
- if (long_suffix)
- {
- /* 9223372036854775808L is valid if operand of a '-'. Otherwise
- 9223372036854775807L is the biggest `long' literal that can be
- expressed using a 10 radix. For other radixes, everything that
- fits withing 64 bits is OK. */
- int hb = (high >> 31);
- if (overflow || (hb && low && radix == 10) ||
- (hb && high & 0x7fffffff && radix == 10) ||
- (hb && !(high & 0x7fffffff) && !ctxp->minus_seen && radix == 10))
- JAVA_INTEGRAL_RANGE_ERROR ("Numeric overflow for `long' literal");
- }
- else
- {
- /* 2147483648 is valid if operand of a '-'. Otherwise,
- 2147483647 is the biggest `int' literal that can be
- expressed using a 10 radix. For other radixes, everything
- that fits within 32 bits is OK. As all literals are
- signed, we sign extend here. */
- int hb = (low >> 31) & 0x1;
- if (overflow || high || (hb && low & 0x7fffffff && radix == 10) ||
- (hb && !(low & 0x7fffffff) && !ctxp->minus_seen && radix == 10))
- JAVA_INTEGRAL_RANGE_ERROR ("Numeric overflow for `int' literal");
- high = -hb;
- }
- ctxp->minus_seen = 0;
- SET_LVAL_NODE_TYPE (build_int_2 (low, high),
- (long_suffix ? long_type_node : int_type_node));
- return INT_LIT_TK;
- }
-
- ctxp->minus_seen = 0;
- /* Character literals */
- if (c == '\'')
- {
- unicode_t char_lit;
- if ((c = java_get_unicode ()) == '\\')
- char_lit = java_parse_escape_sequence ();
- else
- char_lit = c;
-
- c = java_get_unicode ();
-
- if ((c == '\n') || (c == UEOF))
- java_lex_error ("Character literal not terminated at end of line", 0);
- if (c != '\'')
- java_lex_error ("Syntax error in character literal", 0);
-
- if (c == JAVA_CHAR_ERROR)
- char_lit = 0; /* We silently convert it to zero */
-
- JAVA_LEX_CHAR_LIT (char_lit);
- SET_LVAL_NODE_TYPE (build_int_2 (char_lit, 0), char_type_node);
- return CHAR_LIT_TK;
- }
-
- /* String literals */
- if (c == '"')
- {
- int no_error;
- char *string;
-
- for (no_error = 1, c = java_get_unicode ();
- c != '"' && c != '\n'; c = java_get_unicode ())
- {
- if (c == '\\')
- c = java_parse_escape_sequence ();
- no_error &= (c != JAVA_CHAR_ERROR ? 1 : 0);
- java_unicode_2_utf8 (c);
- }
- if (c == '\n' || c == UEOF) /* ULT */
- {
- lineno--; /* Refer to the line the terminator was seen */
- java_lex_error ("String not terminated at end of line.", 0);
- lineno++;
- }
-
- obstack_1grow (&temporary_obstack, '\0');
- string = obstack_finish (&temporary_obstack);
-#ifndef JC1_LITE
- if (!no_error || (c != '"'))
- java_lval->node = error_mark_node; /* Requires futher testing FIXME */
- else
- {
- tree s = make_node (STRING_CST);
- TREE_STRING_LENGTH (s) = strlen (string);
- TREE_STRING_POINTER (s) =
- obstack_alloc (expression_obstack, TREE_STRING_LENGTH (s)+1);
- strcpy (TREE_STRING_POINTER (s), string);
- java_lval->node = s;
- }
-#endif
- return STRING_LIT_TK;
- }
-
- /* Separator */
- switch (c)
- {
- case '(':
- JAVA_LEX_SEP (c);
- BUILD_OPERATOR (OP_TK);
- case ')':
- JAVA_LEX_SEP (c);
- return CP_TK;
- case '{':
- JAVA_LEX_SEP (c);
- if (ctxp->ccb_indent == 1)
- ctxp->first_ccb_indent1 = lineno;
- ctxp->ccb_indent++;
- BUILD_OPERATOR (OCB_TK);
- case '}':
- JAVA_LEX_SEP (c);
- ctxp->ccb_indent--;
- if (ctxp->ccb_indent == 1)
- ctxp->last_ccb_indent1 = lineno;
- BUILD_OPERATOR (CCB_TK);
- case '[':
- JAVA_LEX_SEP (c);
- BUILD_OPERATOR (OSB_TK);
- case ']':
- JAVA_LEX_SEP (c);
- return CSB_TK;
- case ';':
- JAVA_LEX_SEP (c);
- return SC_TK;
- case ',':
- JAVA_LEX_SEP (c);
- return C_TK;
- case '.':
- JAVA_LEX_SEP (c);
- BUILD_OPERATOR (DOT_TK);
- /* return DOT_TK; */
- }
-
- /* Operators */
- switch (c)
- {
- case '=':
- if ((c = java_get_unicode ()) == '=')
- {
- BUILD_OPERATOR (EQ_TK);
- }
- else
- {
- /* Equals is used in two different locations. In the
- variable_declarator: rule, it has to be seen as '=' as opposed
- to being seen as an ordinary assignment operator in
- assignment_operators: rule. */
- java_unget_unicode ();
- BUILD_OPERATOR (ASSIGN_TK);
- }
-
- case '>':
- switch ((c = java_get_unicode ()))
- {
- case '=':
- BUILD_OPERATOR (GTE_TK);
- case '>':
- switch ((c = java_get_unicode ()))
- {
- case '>':
- if ((c = java_get_unicode ()) == '=')
- {
- BUILD_OPERATOR2 (ZRS_ASSIGN_TK);
- }
- else
- {
- java_unget_unicode ();
- BUILD_OPERATOR (ZRS_TK);
- }
- case '=':
- BUILD_OPERATOR2 (SRS_ASSIGN_TK);
- default:
- java_unget_unicode ();
- BUILD_OPERATOR (SRS_TK);
- }
- default:
- java_unget_unicode ();
- BUILD_OPERATOR (GT_TK);
- }
-
- case '<':
- switch ((c = java_get_unicode ()))
- {
- case '=':
- BUILD_OPERATOR (LTE_TK);
- case '<':
- if ((c = java_get_unicode ()) == '=')
- {
- BUILD_OPERATOR2 (LS_ASSIGN_TK);
- }
- else
- {
- java_unget_unicode ();
- BUILD_OPERATOR (LS_TK);
- }
- default:
- java_unget_unicode ();
- BUILD_OPERATOR (LT_TK);
- }
-
- case '&':
- switch ((c = java_get_unicode ()))
- {
- case '&':
- BUILD_OPERATOR (BOOL_AND_TK);
- case '=':
- BUILD_OPERATOR2 (AND_ASSIGN_TK);
- default:
- java_unget_unicode ();
- BUILD_OPERATOR (AND_TK);
- }
-
- case '|':
- switch ((c = java_get_unicode ()))
- {
- case '|':
- BUILD_OPERATOR (BOOL_OR_TK);
- case '=':
- BUILD_OPERATOR2 (OR_ASSIGN_TK);
- default:
- java_unget_unicode ();
- BUILD_OPERATOR (OR_TK);
- }
-
- case '+':
- switch ((c = java_get_unicode ()))
- {
- case '+':
- BUILD_OPERATOR (INCR_TK);
- case '=':
- BUILD_OPERATOR2 (PLUS_ASSIGN_TK);
- default:
- java_unget_unicode ();
- BUILD_OPERATOR (PLUS_TK);
- }
-
- case '-':
- switch ((c = java_get_unicode ()))
- {
- case '-':
- BUILD_OPERATOR (DECR_TK);
- case '=':
- BUILD_OPERATOR2 (MINUS_ASSIGN_TK);
- default:
- java_unget_unicode ();
- ctxp->minus_seen = 1;
- BUILD_OPERATOR (MINUS_TK);
- }
-
- case '*':
- if ((c = java_get_unicode ()) == '=')
- {
- BUILD_OPERATOR2 (MULT_ASSIGN_TK);
- }
- else
- {
- java_unget_unicode ();
- BUILD_OPERATOR (MULT_TK);
- }
-
- case '/':
- if ((c = java_get_unicode ()) == '=')
- {
- BUILD_OPERATOR2 (DIV_ASSIGN_TK);
- }
- else
- {
- java_unget_unicode ();
- BUILD_OPERATOR (DIV_TK);
- }
-
- case '^':
- if ((c = java_get_unicode ()) == '=')
- {
- BUILD_OPERATOR2 (XOR_ASSIGN_TK);
- }
- else
- {
- java_unget_unicode ();
- BUILD_OPERATOR (XOR_TK);
- }
-
- case '%':
- if ((c = java_get_unicode ()) == '=')
- {
- BUILD_OPERATOR2 (REM_ASSIGN_TK);
- }
- else
- {
- java_unget_unicode ();
- BUILD_OPERATOR (REM_TK);
- }
-
- case '!':
- if ((c = java_get_unicode()) == '=')
- {
- BUILD_OPERATOR (NEQ_TK);
- }
- else
- {
- java_unget_unicode ();
- BUILD_OPERATOR (NEG_TK);
- }
-
- case '?':
- JAVA_LEX_OP ("?");
- BUILD_OPERATOR (REL_QM_TK);
- case ':':
- JAVA_LEX_OP (":");
- BUILD_OPERATOR (REL_CL_TK);
- case '~':
- BUILD_OPERATOR (NOT_TK);
- }
-
- /* Keyword, boolean literal or null literal */
- for (first_unicode = c, all_ascii = 1, ascii_index = 0;
- JAVA_ID_CHAR_P (c); c = java_get_unicode ())
- {
- java_unicode_2_utf8 (c);
- if (all_ascii && c >= 128)
- all_ascii = 0;
- ascii_index++;
- }
-
- obstack_1grow (&temporary_obstack, '\0');
- string = obstack_finish (&temporary_obstack);
- java_unget_unicode ();
-
- /* If we have something all ascii, we consider a keyword, a boolean
- literal, a null literal or an all ASCII identifier. Otherwise,
- this is an identifier (possibly not respecting formation rule). */
- if (all_ascii)
- {
- struct java_keyword *kw;
- if ((kw=java_keyword (string, ascii_index)))
- {
- JAVA_LEX_KW (string);
- switch (kw->token)
- {
- case PUBLIC_TK: case PROTECTED_TK: case STATIC_TK:
- case ABSTRACT_TK: case FINAL_TK: case NATIVE_TK:
- case SYNCHRONIZED_TK: case TRANSIENT_TK: case VOLATILE_TK:
- case PRIVATE_TK:
- SET_MODIFIER_CTX (kw->token);
- return MODIFIER_TK;
- case FLOAT_TK:
- SET_LVAL_NODE (float_type_node);
- return FP_TK;
- case DOUBLE_TK:
- SET_LVAL_NODE (double_type_node);
- return FP_TK;
- case BOOLEAN_TK:
- SET_LVAL_NODE (boolean_type_node);
- return BOOLEAN_TK;
- case BYTE_TK:
- SET_LVAL_NODE (byte_type_node);
- return INTEGRAL_TK;
- case SHORT_TK:
- SET_LVAL_NODE (short_type_node);
- return INTEGRAL_TK;
- case INT_TK:
- SET_LVAL_NODE (int_type_node);
- return INTEGRAL_TK;
- case LONG_TK:
- SET_LVAL_NODE (long_type_node);
- return INTEGRAL_TK;
- case CHAR_TK:
- SET_LVAL_NODE (char_type_node);
- return INTEGRAL_TK;
-
- /* Keyword based literals */
- case TRUE_TK:
- case FALSE_TK:
- SET_LVAL_NODE ((kw->token == TRUE_TK ?
- boolean_true_node : boolean_false_node));
- return BOOL_LIT_TK;
- case NULL_TK:
- SET_LVAL_NODE (null_pointer_node);
- return NULL_TK;
-
- /* Some keyword we want to retain information on the location
- they where found */
- case CASE_TK:
- case DEFAULT_TK:
- case SUPER_TK:
- case THIS_TK:
- case RETURN_TK:
- case BREAK_TK:
- case CONTINUE_TK:
- case TRY_TK:
- case CATCH_TK:
- case THROW_TK:
- case INSTANCEOF_TK:
- BUILD_OPERATOR (kw->token);
-
- default:
- return kw->token;
- }
- }
- }
-
- /* We may have and ID here */
- if (JAVA_ID_CHAR_P(first_unicode) && !JAVA_DIGIT_P (first_unicode))
- {
- JAVA_LEX_ID (string);
- java_lval->node = BUILD_ID_WFL (GET_IDENTIFIER (string));
- return ID_TK;
- }
-
- /* Everything else is an invalid character in the input */
- {
- char lex_error_buffer [128];
- sprintf (lex_error_buffer, "Invalid character '%s' in input",
- java_sprint_unicode (ctxp->c_line, ctxp->c_line->current));
- java_lex_error (lex_error_buffer, 1);
- }
- return 0;
-}
-
-static void
-java_unicode_2_utf8 (unicode)
- unicode_t unicode;
-{
- if (RANGE (unicode, 0x01, 0x7f))
- obstack_1grow (&temporary_obstack, (char)unicode);
- else if (RANGE (unicode, 0x80, 0x7ff) || unicode == 0)
- {
- obstack_1grow (&temporary_obstack,
- (unsigned char)(0xc0 | ((0x7c0 & unicode) >> 6)));
- obstack_1grow (&temporary_obstack,
- (unsigned char)(0x80 | (unicode & 0x3f)));
- }
- else /* Range 0x800-0xffff */
- {
- obstack_1grow (&temporary_obstack,
- (unsigned char)(0xe0 | (unicode & 0xf000) >> 12));
- obstack_1grow (&temporary_obstack,
- (unsigned char)(0x80 | (unicode & 0x0fc0) >> 6));
- obstack_1grow (&temporary_obstack,
- (unsigned char)(0x80 | (unicode & 0x003f)));
- }
-}
-
-#ifndef JC1_LITE
-static tree
-build_wfl_node (node)
- tree node;
-{
- return build_expr_wfl (node, ctxp->filename, ctxp->elc.line, ctxp->elc.col);
-}
-#endif
-
-static void
-java_lex_error (msg, forward)
- char *msg ATTRIBUTE_UNUSED;
- int forward ATTRIBUTE_UNUSED;
-{
-#ifndef JC1_LITE
- ctxp->elc.line = ctxp->c_line->lineno;
- ctxp->elc.col = ctxp->c_line->char_col-1+forward;
-
- /* Might be caught in the middle of some error report */
- ctxp->java_error_flag = 0;
- java_error (NULL);
- java_error (msg);
-#endif
-}
-
-#ifndef JC1_LITE
-static int
-java_is_eol (fp, c)
- FILE *fp;
- int c;
-{
- int next;
- switch (c)
- {
- case '\r':
- next = getc (fp);
- if (next != '\n' && next != EOF)
- ungetc (next, fp);
- return 1;
- case '\n':
- return 1;
- default:
- return 0;
- }
-}
-#endif
-
-char *
-java_get_line_col (filename, line, col)
- char *filename ATTRIBUTE_UNUSED;
- int line ATTRIBUTE_UNUSED, col ATTRIBUTE_UNUSED;
-{
-#ifdef JC1_LITE
- return 0;
-#else
- /* Dumb implementation. Doesn't try to cache or optimize things. */
- /* First line of the file is line 1, first column is 1 */
-
- /* COL == -1 means, at the CR/LF in LINE */
- /* COL == -2 means, at the first non space char in LINE */
-
- FILE *fp;
- int c, ccol, cline = 1;
- int current_line_col = 0;
- int first_non_space = 0;
- char *base;
-
- if (!(fp = fopen (filename, "r")))
- fatal ("Can't open file - java_display_line_col");
-
- while (cline != line)
- {
- c = getc (fp);
- if (c < 0)
- {
- static char msg[] = "<<file too short - unexpected EOF>>";
- obstack_grow (&temporary_obstack, msg, sizeof(msg)-1);
- goto have_line;
- }
- if (java_is_eol (fp, c))
- cline++;
- }
-
- /* Gather the chars of the current line in a buffer */
- for (;;)
- {
- c = getc (fp);
- if (c < 0 || java_is_eol (fp, c))
- break;
- if (!first_non_space && !JAVA_WHITE_SPACE_P (c))
- first_non_space = current_line_col;
- obstack_1grow (&temporary_obstack, c);
- current_line_col++;
- }
- have_line:
-
- obstack_1grow (&temporary_obstack, '\n');
-
- if (col == -1)
- {
- col = current_line_col;
- first_non_space = 0;
- }
- else if (col == -2)
- col = first_non_space;
- else
- first_non_space = 0;
-
- /* Place the '^' a the right position */
- base = obstack_base (&temporary_obstack);
- for (ccol = 1; ccol <= col; ccol++)
- {
- /* Compute \t when reaching first_non_space */
- char c = (first_non_space ?
- (base [ccol-1] == '\t' ? '\t' : ' ') : ' ');
- obstack_1grow (&temporary_obstack, c);
- }
- obstack_grow0 (&temporary_obstack, "^", 1);
-
- fclose (fp);
- return obstack_finish (&temporary_obstack);
-#endif
-}
diff --git a/gnu/dist/toolchain/gcc/java/lex.h b/gnu/dist/toolchain/gcc/java/lex.h
deleted file mode 100644
index 4b55d26d781..00000000000
--- a/gnu/dist/toolchain/gcc/java/lex.h
+++ /dev/null
@@ -1,504 +0,0 @@
-/* Language lexer definitions for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#ifndef JV_LEX_H
-#define JV_LEX_H
-
-#include <setjmp.h> /* set_float_handler argument uses it */
-
-/* Extern global variables declarations */
-extern FILE *finput;
-extern int lineno;
-
-/* A Unicode character, as read from the input file */
-typedef unsigned short unicode_t;
-
-/* Debug macro to print-out what we match */
-#ifdef JAVA_LEX_DEBUG
-#ifdef JAVA_LEX_DEBUG_CHAR
-#define JAVA_LEX_CHAR(c) printf ("java_lex:%d: char '%c'.%d\n", \
- lineno, (c < 128 ? c : '.'), c);
-#else
-#define JAVA_LEX_CHAR(c)
-#endif
-#define JAVA_LEX_KW(c) printf ("java_lex:%d: keyword: '%s'\n", lineno,c)
-#define JAVA_LEX_ID(s) printf ("java_lex:%d: ID: '%s'\n", \
- lineno, \
- (all_ascii ? s : "<U>"))
-#define JAVA_LEX_LIT(s, r) printf ("java_lex:%d: literal '%s'_%d\n", \
- lineno, s, r)
-#define JAVA_LEX_CHAR_LIT(s) printf ("java_lex:%d: literal '%d'\n", lineno, s)
-#define JAVA_LEX_STR_LIT(s) { \
- int i; \
- printf ("java_lex:%d: literal '%s'\n", \
- lineno, s); \
- }
-#define JAVA_LEX_SEP(c) printf ("java_lex:%d: separator '%c'\n",lineno,c)
-#define JAVA_LEX_OP(c) printf ("java_lex:%d: operator '%s'\n", lineno,c)
-#else
-#define JAVA_LEX_CHAR(c)
-#define JAVA_LEX_KW(c)
-#define JAVA_LEX_ID(s)
-#define JAVA_LEX_LIT(s,r)
-#define JAVA_LEX_CHAR_LIT(s)
-#define JAVA_LEX_STR_LIT(s)
-#define JAVA_LEX_SEP(c)
-#define JAVA_LEX_OP(s)
-#endif
-
-/* Line information containers */
-struct java_line {
- unicode_t *line; /* The line's unicode */
- char *unicode_escape_p; /* The maching char was a unicode escape */
- unicode_t ahead[1]; /* Character ahead */
- char unicode_escape_ahead_p; /* Character ahead is a unicode escape */
- int max; /* buffer's max size */
- int size; /* number of unicodes */
- int current; /* Current position, unicode based */
- int char_col; /* Current position, input char based */
- int lineno; /* Its line number */
- int white_space_only; /* If it contains only white spaces */
-};
-#define JAVA_COLUMN_DELTA(p) \
- (ctxp->c_line->unicode_escape_p [ctxp->c_line->current+(p)] ? 6 : \
- (ctxp->c_line->line [ctxp->c_line->current+(p)] == '\t' ? 8 : 1))
-
-struct java_error {
- struct java_line *line;
- int error;
-};
-
-typedef struct _java_lc {
- int line;
- int prev_col;
- int col;
-} java_lc;
-
-
-#define JAVA_LINE_MAX 80
-
-/* Macro to read and unread bytes */
-#define UNGETC(c) ungetc(c, finput)
-#define GETC() getc(finput)
-
-/* Build a location compound integer */
-#define BUILD_LOCATION() ((ctxp->elc.line << 12) | (ctxp->elc.col & 0xfff))
-
-/* Those macros are defined differently if we compile jc1-lite
- (JC1_LITE defined) or jc1. */
-#ifdef JC1_LITE
-
-#define DCONST0 0
-#define REAL_VALUE_TYPE int
-#define SET_FLOAT_HANDLER(H)
-#define GET_IDENTIFIER(S) xstrdup ((S))
-#define REAL_VALUE_ATOF(LIT,MODE) 0
-#define REAL_VALUE_ISINF(VALUE) 0
-#define REAL_VALUE_ISNAN(VALUE) 0
-#define SET_REAL_VALUE_ATOF(TARGET,SOURCE)
-#define FLOAT_TYPE_NODE 0
-#define DOUBLE_TYPE_NODE 0
-#define SET_MODIFIER_CTX(TOKEN) java_lval->value = (TOKEN)
-#define GET_TYPE_PRECISION(NODE) 4
-#define BUILD_OPERATOR(TOKEN) return TOKEN
-#define BUILD_OPERATOR2(TOKEN) return TOKEN
-#define SET_LVAL_NODE(NODE)
-#define SET_LVAL_NODE_TYPE(NODE, TYPE)
-#define BUILD_ID_WFL(EXP) (EXP)
-#define JAVA_FLOAT_RANGE_ERROR(S) {}
-#define JAVA_INTEGRAL_RANGE_ERROR(S) {}
-
-#else
-
-extern void set_float_handler PROTO((jmp_buf));
-#define SET_FLOAT_HANDLER(H) set_float_handler ((H))
-#define DCONST0 dconst0
-#define GET_IDENTIFIER(S) get_identifier ((S))
-#define SET_REAL_VALUE_ATOF(TARGET,SOURCE) (TARGET) = (SOURCE)
-#define FLOAT_TYPE_NODE float_type_node
-#define DOUBLE_TYPE_NODE double_type_node
-/* Set modifier_ctx according to TOKEN */
-#define SET_MODIFIER_CTX(TOKEN) \
- { \
- ctxp->modifier_ctx [(TOKEN)-PUBLIC_TK] = build_wfl_node (NULL_TREE); \
- java_lval->value = (TOKEN)-PUBLIC_TK; \
- }
-/* Type precision for long */
-#define GET_TYPE_PRECISION(NODE) TYPE_PRECISION (long_type_node) / 8;
-/* Build an operator tree node and return TOKEN */
-#define BUILD_OPERATOR(TOKEN) \
- { \
- java_lval->operator.token = (TOKEN); \
- java_lval->operator.location = BUILD_LOCATION(); \
- return (TOKEN); \
- }
-
-/* Build an operator tree node but return ASSIGN_ANY_TK */
-#define BUILD_OPERATOR2(TOKEN) \
- { \
- java_lval->operator.token = (TOKEN); \
- java_lval->operator.location = BUILD_LOCATION(); \
- return ASSIGN_ANY_TK; \
- }
-/* Set java_lval->node and TREE_TYPE(java_lval->node) in macros */
-#define SET_LVAL_NODE(NODE) java_lval->node = (NODE)
-#define SET_LVAL_NODE_TYPE(NODE,TYPE) \
- { \
- java_lval->node = (NODE); \
- TREE_TYPE (java_lval->node) = (TYPE); \
- }
-/* Wrap identifier around a wfl */
-#define BUILD_ID_WFL(EXP) build_wfl_node ((EXP))
-/* Special ways to report error on numeric literals */
-#define JAVA_FLOAT_RANGE_ERROR(m) \
- { \
- char msg [1024]; \
- int i = ctxp->c_line->current; \
- ctxp->c_line->current = number_beginning; \
- sprintf (msg, "Floating pointer literal exceeds range of `%s'", (m)); \
- java_lex_error (msg, 0); \
- ctxp->c_line->current = i; \
- value = dconst0; \
- }
-#define JAVA_INTEGRAL_RANGE_ERROR(m) \
- { \
- int i = ctxp->c_line->current; \
- ctxp->c_line->current = number_beginning; \
- java_lex_error (m, 0); \
- ctxp->c_line->current = i; \
- }
-
-#endif /* Definitions for jc1 compilation only */
-
-/* Macros to decode character ranges */
-#define RANGE(c, l, h) (((c) >= l && (c) <= h))
-#define JAVA_WHITE_SPACE_P(c) (c == ' ' || c == '\t' || c == '\f')
-#define JAVA_ID_CHAR_P(c) ((c < 128 && (RANGE (c, 'A', 'Z') || \
- RANGE (c, 'a', 'z') || \
- RANGE (c, '0', '9') || \
- c == '_' || \
- c == '$')) || \
- (c > 127 && java_letter_or_digit_p (c)))
-#define JAVA_ASCII_DIGIT(c) RANGE(c,'0', '9')
-#define JAVA_ASCII_OCTDIGIT(c) RANGE(c,'0', '7')
-#define JAVA_ASCII_HEXDIGIT(c) (RANGE(c,'0', '9') || \
- RANGE(c,'a', 'f') || \
- RANGE(c,'A', 'F'))
-#define JAVA_ASCII_FPCHAR(c) (RANGE(c,'d', 'f') || RANGE(c,'D', 'F') || \
- c == '.' || JAVA_ASCII_DIGIT (c))
-#define JAVA_FP_SUFFIX(c) (c == 'D' || c == 'd' || c == 'f' || c == 'F')
-#define JAVA_FP_EXP(c) (c == 'E' || c == 'F')
-#define JAVA_FP_PM(c) (c == '-' || c == '+')
-#define JAVA_ASCII_LETTER(c) (RANGE(c,'a', 'z') || RANGE(c,'A', 'Z'))
-#define JAVA_DIGIT_P(c) \
- (RANGE (c, 0x030, 0x039) || /* ISO-Latin-1 (and ASCII) digits ('0'-'9') */ \
- RANGE (c, 0x660, 0x669) || /* Arabic-Indic digits */ \
- RANGE (c, 0x6F0, 0x6F9) || /* Eastern Arabic-Indic digits */ \
- RANGE (c, 0x966, 0x96F) || /* Devanagari digits */ \
- RANGE (c, 0x9E6, 0x9EF) || /* Bengali digits */ \
- RANGE (c, 0xA66, 0xA6F) || /* Gurmukhi digits */ \
- RANGE (c, 0xAE6, 0xAEF) || /* Gujarati digits */ \
- RANGE (c, 0xB66, 0xB6F) || /* Oriya digits */ \
- RANGE (c, 0xBE7, 0xBEF) || /* Tamil digits */ \
- RANGE (c, 0xC66, 0xC6F) || /* Telugu digits */ \
- RANGE (c, 0xCE6, 0xCEF) || /* Kannada digits */ \
- RANGE (c, 0xD66, 0xD6F) || /* Malayalam digits */ \
- RANGE (c, 0xE50, 0xE59) || /* Thai digits */ \
- RANGE (c, 0xED0, 0xED9)) /* Lao digits */
-
-/* This is not to be used as a stand alone macro. Use JAVA_ID_CHAR_P()
- or the forcoming JAVA_LETTER_OR_DIGIT_P() instead.
- It need to be split by region. FIXME. */
-#define _JAVA_LETTER_OR_DIGIT_P(c) \
- (RANGE (c, 0x00C0, 0x00D6) || \
- RANGE (c, 0x00D8, 0x00F6) || \
- RANGE (c, 0x00F8, 0x01F5) || \
- RANGE (c, 0x01FA, 0x0217) || \
- RANGE (c, 0x0250, 0x02A8) || \
- RANGE (c, 0x02B0, 0x02DE) || \
- RANGE (c, 0x02E0, 0x02E9) || \
- RANGE (c, 0x0300, 0x0345) || \
- RANGE (c, 0x0360, 0x0361) || \
- RANGE (c, 0x0374, 0x0375) || \
- c == 0x037A || \
- c == 0x037E || \
- RANGE (c, 0x0384, 0x038A) || \
- c == 0x038C || \
- c == 0x038E || \
- RANGE (c, 0x038F, 0x03A1) || \
- RANGE (c, 0x03A3, 0x03CE) || \
- RANGE (c, 0x03D0, 0x03D6) || \
- RANGE (c, 0x03DA, 0x03E2) || \
- c == 0x03DA || \
- c == 0x03DC || \
- c == 0x03DE || \
- c == 0x03E0 || \
- RANGE (c, 0x03E2, 0x03F3) || \
- RANGE (c, 0x0401, 0x040C) || \
- RANGE (c, 0x040E, 0x044F) || \
- RANGE (c, 0x0451, 0x045C) || \
- RANGE (c, 0x045E, 0x0486) || \
- RANGE (c, 0x0490, 0x04C4) || \
- RANGE (c, 0x04C7, 0x04C8) || \
- RANGE (c, 0x04CB, 0x04CC) || \
- RANGE (c, 0x04D0, 0x04EB) || \
- RANGE (c, 0x04EE, 0x04F5) || \
- RANGE (c, 0x04F8, 0x04F9) || \
- RANGE (c, 0x0531, 0x0556) || \
- RANGE (c, 0x0559, 0x055F) || \
- RANGE (c, 0x0561, 0x0587) || \
- c == 0x0589 || \
- RANGE (c, 0x05B0, 0x05B9) || \
- RANGE (c, 0x05BB, 0x05C3) || \
- RANGE (c, 0x05D0, 0x05EA) || \
- RANGE (c, 0x05F0, 0x05F4) || \
- c == 0x060C || \
- c == 0x061B || \
- c == 0x061F || \
- c == 0x0621 || \
- RANGE (c, 0x0622, 0x063A) || \
- RANGE (c, 0x0640, 0x0652) || \
- RANGE (c, 0x0660, 0x066D) || \
- RANGE (c, 0x0670, 0x06B7) || \
- RANGE (c, 0x06BA, 0x06BE) || \
- RANGE (c, 0x06C0, 0x06CE) || \
- RANGE (c, 0x06D0, 0x06ED) || \
- RANGE (c, 0x06F0, 0x06F9) || \
- RANGE (c, 0x0901, 0x0903) || \
- RANGE (c, 0x0905, 0x0939) || \
- RANGE (c, 0x093C, 0x094D) || \
- RANGE (c, 0x0950, 0x0954) || \
- RANGE (c, 0x0958, 0x0970) || \
- RANGE (c, 0x0981, 0x0983) || \
- RANGE (c, 0x0985, 0x098C) || \
- RANGE (c, 0x098F, 0x0990) || \
- RANGE (c, 0x0993, 0x09A8) || \
- RANGE (c, 0x09AA, 0x09B0) || \
- c == 0x09B2 || \
- RANGE (c, 0x09B6, 0x09B9) || \
- c == 0x09BC || \
- c == 0x09BE || \
- RANGE (c, 0x09BF, 0x09C4) || \
- RANGE (c, 0x09C7, 0x09C8) || \
- RANGE (c, 0x09CB, 0x09CD) || \
- c == 0x09D7 || \
- RANGE (c, 0x09DC, 0x09DD) || \
- RANGE (c, 0x09DF, 0x09E3) || \
- RANGE (c, 0x09E6, 0x09FA) || \
- c == 0x0A02 || \
- RANGE (c, 0x0A05, 0x0A0A) || \
- RANGE (c, 0x0A0F, 0x0A10) || \
- RANGE (c, 0x0A13, 0x0A28) || \
- RANGE (c, 0x0A2A, 0x0A30) || \
- RANGE (c, 0x0A32, 0x0A33) || \
- RANGE (c, 0x0A35, 0x0A36) || \
- RANGE (c, 0x0A38, 0x0A39) || \
- c == 0x0A3C || \
- c == 0x0A3E || \
- RANGE (c, 0x0A3F, 0x0A42) || \
- RANGE (c, 0x0A47, 0x0A48) || \
- RANGE (c, 0x0A4B, 0x0A4D) || \
- RANGE (c, 0x0A59, 0x0A5C) || \
- c == 0x0A5E || \
- RANGE (c, 0x0A66, 0x0A74) || \
- RANGE (c, 0x0A81, 0x0A83) || \
- RANGE (c, 0x0A85, 0x0A8B) || \
- c == 0x0A8D || \
- c == 0x0A8F || \
- RANGE (c, 0x0A90, 0x0A91) || \
- RANGE (c, 0x0A93, 0x0AA8) || \
- RANGE (c, 0x0AAA, 0x0AB0) || \
- RANGE (c, 0x0AB2, 0x0AB3) || \
- RANGE (c, 0x0AB5, 0x0AB9) || \
- RANGE (c, 0x0ABC, 0x0AC5) || \
- RANGE (c, 0x0AC7, 0x0AC9) || \
- RANGE (c, 0x0ACB, 0x0ACD) || \
- c == 0x0AD0 || \
- c == 0x0AE0 || \
- RANGE (c, 0x0AE6, 0x0AEF) || \
- RANGE (c, 0x0B01, 0x0B03) || \
- RANGE (c, 0x0B05, 0x0B0C) || \
- RANGE (c, 0x0B0F, 0x0B10) || \
- RANGE (c, 0x0B13, 0x0B28) || \
- RANGE (c, 0x0B2A, 0x0B30) || \
- RANGE (c, 0x0B32, 0x0B33) || \
- RANGE (c, 0x0B36, 0x0B39) || \
- RANGE (c, 0x0B3C, 0x0B43) || \
- RANGE (c, 0x0B47, 0x0B48) || \
- RANGE (c, 0x0B4B, 0x0B4D) || \
- RANGE (c, 0x0B56, 0x0B57) || \
- RANGE (c, 0x0B5C, 0x0B5D) || \
- RANGE (c, 0x0B5F, 0x0B61) || \
- RANGE (c, 0x0B66, 0x0B70) || \
- RANGE (c, 0x0B82, 0x0B83) || \
- RANGE (c, 0x0B85, 0x0B8A) || \
- RANGE (c, 0x0B8E, 0x0B90) || \
- RANGE (c, 0x0B92, 0x0B95) || \
- RANGE (c, 0x0B99, 0x0B9A) || \
- c == 0x0B9C || \
- c == 0x0B9E || \
- c == 0x0B9F || \
- RANGE (c, 0x0BA3, 0x0BA4) || \
- RANGE (c, 0x0BA8, 0x0BAA) || \
- RANGE (c, 0x0BAE, 0x0BB5) || \
- RANGE (c, 0x0BB7, 0x0BB9) || \
- RANGE (c, 0x0BBE, 0x0BC2) || \
- RANGE (c, 0x0BC6, 0x0BC8) || \
- RANGE (c, 0x0BCA, 0x0BCD) || \
- c == 0x0BD7 || \
- RANGE (c, 0x0BE7, 0x0BF2) || \
- RANGE (c, 0x0C01, 0x0C03) || \
- RANGE (c, 0x0C05, 0x0C0C) || \
- RANGE (c, 0x0C0E, 0x0C10) || \
- RANGE (c, 0x0C12, 0x0C28) || \
- RANGE (c, 0x0C2A, 0x0C33) || \
- RANGE (c, 0x0C35, 0x0C39) || \
- RANGE (c, 0x0C3E, 0x0C44) || \
- RANGE (c, 0x0C46, 0x0C48) || \
- RANGE (c, 0x0C4A, 0x0C4D) || \
- RANGE (c, 0x0C55, 0x0C56) || \
- RANGE (c, 0x0C60, 0x0C61) || \
- RANGE (c, 0x0C66, 0x0C6F) || \
- RANGE (c, 0x0C82, 0x0C83) || \
- RANGE (c, 0x0C85, 0x0C8C) || \
- RANGE (c, 0x0C8E, 0x0C90) || \
- RANGE (c, 0x0C92, 0x0CA8) || \
- RANGE (c, 0x0CAA, 0x0CB3) || \
- RANGE (c, 0x0CB5, 0x0CB9) || \
- RANGE (c, 0x0CBE, 0x0CC4) || \
- RANGE (c, 0x0CC6, 0x0CC8) || \
- RANGE (c, 0x0CCA, 0x0CCD) || \
- RANGE (c, 0x0CD5, 0x0CD6) || \
- c == 0x0CDE || \
- c == 0x0CE0 || \
- c == 0x0CE1 || \
- RANGE (c, 0x0CE6, 0x0CEF) || \
- RANGE (c, 0x0D02, 0x0D03) || \
- RANGE (c, 0x0D05, 0x0D0C) || \
- RANGE (c, 0x0D0E, 0x0D10) || \
- RANGE (c, 0x0D12, 0x0D28) || \
- RANGE (c, 0x0D2A, 0x0D39) || \
- RANGE (c, 0x0D3E, 0x0D43) || \
- RANGE (c, 0x0D46, 0x0D48) || \
- RANGE (c, 0x0D4A, 0x0D4D) || \
- c == 0x0D57 || \
- RANGE (c, 0x0D60, 0x0D61) || \
- RANGE (c, 0x0D66, 0x0D6F) || \
- RANGE (c, 0x0E01, 0x0E3A) || \
- RANGE (c, 0x0E3F, 0x0E5B) || \
- RANGE (c, 0x0E81, 0x0E82) || \
- c == 0x0E84 || \
- RANGE (c, 0x0E87, 0x0E88) || \
- c == 0x0E8A || \
- c == 0x0E8D || \
- RANGE (c, 0x0E94, 0x0E97) || \
- RANGE (c, 0x0E99, 0x0E9F) || \
- RANGE (c, 0x0EA1, 0x0EA3) || \
- c == 0x0EA5 || \
- c == 0x0EA7 || \
- RANGE (c, 0x0EAA, 0x0EAB) || \
- RANGE (c, 0x0EAD, 0x0EB9) || \
- RANGE (c, 0x0EBB, 0x0EBD) || \
- RANGE (c, 0x0EC0, 0x0EC4) || \
- c == 0x0EC6 || \
- c == 0x0EC8 || \
- RANGE (c, 0x0EC9, 0x0ECD) || \
- RANGE (c, 0x0ED0, 0x0ED9) || \
- RANGE (c, 0x0EDC, 0x0EDD) || \
- RANGE (c, 0x10A0, 0x10C5) || \
- RANGE (c, 0x10D0, 0x10F6) || \
- c == 0x10FB || \
- RANGE (c, 0x1100, 0x1159) || \
- RANGE (c, 0x115F, 0x11A2) || \
- RANGE (c, 0x11A8, 0x11F9) || \
- RANGE (c, 0x1E00, 0x1E9A) || \
- RANGE (c, 0x1EA0, 0x1EF9) || \
- RANGE (c, 0x1F00, 0x1F15) || \
- RANGE (c, 0x1F18, 0x1F1D) || \
- RANGE (c, 0x1F20, 0x1F45) || \
- RANGE (c, 0x1F48, 0x1F4D) || \
- RANGE (c, 0x1F50, 0x1F57) || \
- c == 0x1F59 || \
- c == 0x1F5B || \
- c == 0x1F5D || \
- RANGE (c, 0x1F5F, 0x1F7D) || \
- RANGE (c, 0x1F80, 0x1FB4) || \
- RANGE (c, 0x1FB6, 0x1FC4) || \
- RANGE (c, 0x1FC6, 0x1FD3) || \
- RANGE (c, 0x1FD6, 0x1FDB) || \
- RANGE (c, 0x1FDD, 0x1FEF) || \
- RANGE (c, 0x1FF2, 0x1FF4) || \
- RANGE (c, 0x1FF6, 0x1FFE) || \
- RANGE (c, 0x3041, 0x3094) || \
- RANGE (c, 0x3099, 0x309E) || \
- RANGE (c, 0x30A1, 0x30FE) || \
- RANGE (c, 0x3105, 0x312C) || \
- RANGE (c, 0x3131, 0x318E) || \
- RANGE (c, 0x3190, 0x319F) || \
- RANGE (c, 0x3200, 0x321C) || \
- RANGE (c, 0x3220, 0x3243) || \
- RANGE (c, 0x3260, 0x327B) || \
- RANGE (c, 0x327F, 0x32B0) || \
- RANGE (c, 0x32C0, 0x32CB) || \
- RANGE (c, 0x32D0, 0x32FE) || \
- RANGE (c, 0x3300, 0x3376) || \
- RANGE (c, 0x337B, 0x33DD) || \
- RANGE (c, 0x33E0, 0x33FE) || \
- RANGE (c, 0x3400, 0x9FA5) || \
- RANGE (c, 0xF900, 0xFA2D) || \
- RANGE (c, 0xFB00, 0xFB06) || \
- RANGE (c, 0xFB13, 0xFB17) || \
- RANGE (c, 0xFB1E, 0xFB36) || \
- RANGE (c, 0xFB38, 0xFB3C) || \
- c == 0xFB3E || \
- c == 0xFB40 || \
- c == 0xFB41 || \
- c == 0xFB43 || \
- c == 0xFB44 || \
- c == 0xFB46 || \
- RANGE (c, 0xFB47, 0xFBB1) || \
- RANGE (c, 0xFBD3, 0xFD3F) || \
- RANGE (c, 0xFD50, 0xFD8F) || \
- RANGE (c, 0xFD92, 0xFDC7) || \
- RANGE (c, 0xFDF0, 0xFDFB) || \
- RANGE (c, 0xFE70, 0xFE72) || \
- c == 0xFE74 || \
- c == 0xFE76 || \
- RANGE (c, 0xFE77, 0xFEFC) || \
- RANGE (c, 0xFF10, 0xFF19) || \
- RANGE (c, 0xFF21, 0xFF3A) || \
- RANGE (c, 0xFF41, 0xFF5A) || \
- RANGE (c, 0xFF66, 0xFFBE) || \
- RANGE (c, 0xFFC2, 0xFFC7) || \
- RANGE (c, 0xFFCA, 0xFFCF) || \
- RANGE (c, 0xFFD2, 0xFFD7) || \
- RANGE (c, 0xFFDA, 0xFFDC))
-
-/* Constants */
-#define JAVA_CHAR_ERROR 0xFFC1 /* This is an illegal unicode!?! FIXME */
-#define JAVA_READ_BUFFER 256
-#define UEOF (unicode_t)0xffff
-
-#endif
diff --git a/gnu/dist/toolchain/gcc/java/mangle.c b/gnu/dist/toolchain/gcc/java/mangle.c
deleted file mode 100644
index ebe680eb2e9..00000000000
--- a/gnu/dist/toolchain/gcc/java/mangle.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Functions related to mangling class names for the GNU compiler
- for the Java(TM) language.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com> */
-
-#include "config.h"
-#include "system.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "obstack.h"
-#include "toplev.h"
-
-/* Assuming (NAME, LEN) is a Utf8-encoding string, calculate
- the length of the string as mangled (a la g++) including Unicode escapes.
- If no escapes are needed, return 0. */
-
-int
-unicode_mangling_length (name, len)
- const char *name;
- int len;
-{
- const unsigned char *ptr;
- const unsigned char *limit = (const unsigned char *)name + len;
- int need_escapes = 0;
- int num_chars = 0;
- int underscores = 0;
- for (ptr = (const unsigned char *) name; ptr < limit; )
- {
- int ch = UTF8_GET(ptr, limit);
- if (ch < 0)
- error ("internal error - invalid Utf8 name");
- if (ch >= '0' && ch <= '9')
- need_escapes += num_chars == 0;
- else if (ch == '_')
- underscores++;
- else if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))
- need_escapes++;
- num_chars++;
- }
- if (need_escapes)
- return num_chars + 4 * (need_escapes + underscores);
- else
- return 0;
-}
-
-/* Assuming (NAME, LEN) is a Utf8-encoding string, emit the string
- appropriately mangled (with Unicode escapes) to OBSTACK. */
-
-void
-emit_unicode_mangled_name (obstack, name, len)
- struct obstack *obstack;
- const char *name;
- int len;
-{
- const unsigned char *ptr;
- const unsigned char *limit = (const unsigned char *)name + len;
- for (ptr = (const unsigned char *) name; ptr < limit; )
- {
- int ch = UTF8_GET(ptr, limit);
- int emit_escape;
- if (ch < 0)
- {
- error ("internal error - bad Utf8 string");
- break;
- }
- if (ch >= '0' && ch <= '9')
- emit_escape = (ptr == (unsigned char*) name);
- else
- emit_escape = (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z');
- if (emit_escape)
- {
- char buf[6];
- sprintf (buf, "_%04x", ch);
- obstack_grow (obstack, buf, 5);
- }
- else
- {
- obstack_1grow (obstack, ch);
- }
- }
-}
-
-/* Assuming (NAME, LEN) is a Utf8-encoding string, emit the string
- appropriately mangled (with Unicode escapes if needed) to OBSTACK. */
-
-void
-append_gpp_mangled_name (obstack, name, len)
- struct obstack *obstack;
- const char *name;
- int len;
-{
- int encoded_len = unicode_mangling_length (name, len);
- int needs_escapes = encoded_len > 0;
- char buf[6];
- if (needs_escapes)
- {
- sprintf (buf, "U%d", encoded_len);
- obstack_grow (obstack, buf, strlen(buf));
- emit_unicode_mangled_name (obstack, name, len);
- }
- else
- {
- sprintf (buf, "%d", len);
- obstack_grow (obstack, buf, strlen(buf));
- obstack_grow (obstack, name, len);
- }
-}
-
-/* Append the mangled name of a class named CLASSNAME onto OBSTACK. */
-
-void
-append_gpp_mangled_classtype (obstack, class_name)
- struct obstack *obstack;
- const char *class_name;
-{
- const char *ptr;
- int qualifications = 0;
-
- for (ptr = class_name; *ptr != '\0'; ptr++)
- {
- if (*ptr == '.')
- qualifications++;
- }
- if (qualifications)
- {
- char buf[8];
- if (qualifications >= 9)
- sprintf (buf, "Q_%d_", qualifications + 1);
- else
- sprintf (buf, "Q%d", qualifications + 1);
- obstack_grow (obstack, buf, strlen (buf));
- }
- for (ptr = class_name; ; ptr++)
- {
- if (ptr[0] == '.' || ptr[0] == '\0')
- {
- append_gpp_mangled_name (obstack, class_name, ptr - class_name);
- if (ptr[0] == '\0')
- break;
- class_name = ptr + 1;
- }
- }
-}
diff --git a/gnu/dist/toolchain/gcc/java/parse-scan.c b/gnu/dist/toolchain/gcc/java/parse-scan.c
deleted file mode 100644
index 6340ee8795f..00000000000
--- a/gnu/dist/toolchain/gcc/java/parse-scan.c
+++ /dev/null
@@ -1,2448 +0,0 @@
-
-/* A Bison parser, made from ./parse-scan.y
- by GNU Bison version 1.25
- */
-
-#define YYBISON 1 /* Identify Bison output. */
-
-#define PLUS_TK 258
-#define MINUS_TK 259
-#define MULT_TK 260
-#define DIV_TK 261
-#define REM_TK 262
-#define LS_TK 263
-#define SRS_TK 264
-#define ZRS_TK 265
-#define AND_TK 266
-#define XOR_TK 267
-#define OR_TK 268
-#define BOOL_AND_TK 269
-#define BOOL_OR_TK 270
-#define EQ_TK 271
-#define NEQ_TK 272
-#define GT_TK 273
-#define GTE_TK 274
-#define LT_TK 275
-#define LTE_TK 276
-#define PLUS_ASSIGN_TK 277
-#define MINUS_ASSIGN_TK 278
-#define MULT_ASSIGN_TK 279
-#define DIV_ASSIGN_TK 280
-#define REM_ASSIGN_TK 281
-#define LS_ASSIGN_TK 282
-#define SRS_ASSIGN_TK 283
-#define ZRS_ASSIGN_TK 284
-#define AND_ASSIGN_TK 285
-#define XOR_ASSIGN_TK 286
-#define OR_ASSIGN_TK 287
-#define PUBLIC_TK 288
-#define PRIVATE_TK 289
-#define PROTECTED_TK 290
-#define STATIC_TK 291
-#define FINAL_TK 292
-#define SYNCHRONIZED_TK 293
-#define VOLATILE_TK 294
-#define TRANSIENT_TK 295
-#define NATIVE_TK 296
-#define PAD_TK 297
-#define ABSTRACT_TK 298
-#define MODIFIER_TK 299
-#define DECR_TK 300
-#define INCR_TK 301
-#define DEFAULT_TK 302
-#define IF_TK 303
-#define THROW_TK 304
-#define BOOLEAN_TK 305
-#define DO_TK 306
-#define IMPLEMENTS_TK 307
-#define THROWS_TK 308
-#define BREAK_TK 309
-#define IMPORT_TK 310
-#define ELSE_TK 311
-#define INSTANCEOF_TK 312
-#define RETURN_TK 313
-#define VOID_TK 314
-#define CATCH_TK 315
-#define INTERFACE_TK 316
-#define CASE_TK 317
-#define EXTENDS_TK 318
-#define FINALLY_TK 319
-#define SUPER_TK 320
-#define WHILE_TK 321
-#define CLASS_TK 322
-#define SWITCH_TK 323
-#define CONST_TK 324
-#define TRY_TK 325
-#define FOR_TK 326
-#define NEW_TK 327
-#define CONTINUE_TK 328
-#define GOTO_TK 329
-#define PACKAGE_TK 330
-#define THIS_TK 331
-#define BYTE_TK 332
-#define SHORT_TK 333
-#define INT_TK 334
-#define LONG_TK 335
-#define CHAR_TK 336
-#define INTEGRAL_TK 337
-#define FLOAT_TK 338
-#define DOUBLE_TK 339
-#define FP_TK 340
-#define ID_TK 341
-#define REL_QM_TK 342
-#define REL_CL_TK 343
-#define NOT_TK 344
-#define NEG_TK 345
-#define ASSIGN_ANY_TK 346
-#define ASSIGN_TK 347
-#define OP_TK 348
-#define CP_TK 349
-#define OCB_TK 350
-#define CCB_TK 351
-#define OSB_TK 352
-#define CSB_TK 353
-#define SC_TK 354
-#define C_TK 355
-#define DOT_TK 356
-#define STRING_LIT_TK 357
-#define CHAR_LIT_TK 358
-#define INT_LIT_TK 359
-#define FP_LIT_TK 360
-#define TRUE_TK 361
-#define FALSE_TK 362
-#define BOOL_LIT_TK 363
-#define NULL_TK 364
-
-#line 37 "./parse-scan.y"
-
-#define JC1_LITE
-
-#include "config.h"
-#include "system.h"
-
-#include "obstack.h"
-#include "toplev.h"
-
-extern char *input_filename;
-extern FILE *finput, *out;
-
-/* Obstack for the lexer. */
-struct obstack temporary_obstack;
-
-/* The current parser context. */
-static struct parser_ctxt *ctxp;
-
-/* Error and warning counts, current line number, because they're used
- elsewhere */
-int java_error_count;
-int java_warning_count;
-int lineno;
-
-/* Tweak default rules when necessary. */
-static int absorber;
-#define USE_ABSORBER absorber = 0
-
-/* Keep track of the current class name and package name. */
-static char *current_class;
-static char *package_name;
-
-/* Keep track of whether things have be listed before. */
-static int previous_output;
-
-/* Record modifier uses */
-static int modifier_value;
-
-/* Keep track of number of bracket pairs after a variable declarator
- id. */
-static int bracket_count;
-
-/* Record a method declaration */
-struct method_declarator {
- char *method_name;
- char *args;
-};
-#define NEW_METHOD_DECLARATOR(D,N,A) \
-{ \
- (D) = \
- (struct method_declarator *)xmalloc (sizeof (struct method_declarator)); \
- (D)->method_name = (N); \
- (D)->args = (A); \
-}
-
-/* Two actions for this grammar */
-static void report_class_declaration PROTO ((char *));
-static void report_main_declaration PROTO ((struct method_declarator *));
-
-#include "lex.h"
-#include "parse.h"
-
-#line 100 "./parse-scan.y"
-typedef union {
- char *node;
- struct method_declarator *declarator;
- int value; /* For modifiers */
-} YYSTYPE;
-#ifndef YYDEBUG
-#define YYDEBUG 1
-#endif
-
-#include <stdio.h>
-
-#ifndef __cplusplus
-#ifndef __STDC__
-#define const
-#endif
-#endif
-
-
-
-#define YYFINAL 601
-#define YYFLAG -32768
-#define YYNTBASE 110
-
-#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 253)
-
-static const char yytranslate[] = { 0,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
- 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
- 106, 107, 108, 109
-};
-
-#if YYDEBUG != 0
-static const short yyprhs[] = { 0,
- 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
- 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
- 46, 48, 50, 52, 56, 58, 59, 61, 63, 65,
- 68, 71, 74, 78, 80, 83, 85, 88, 92, 94,
- 96, 100, 106, 108, 110, 112, 114, 117, 118, 126,
- 127, 134, 135, 138, 139, 142, 144, 148, 151, 155,
- 157, 160, 162, 164, 166, 168, 170, 172, 174, 176,
- 180, 185, 187, 191, 193, 197, 199, 203, 205, 207,
- 210, 214, 218, 223, 228, 232, 237, 241, 243, 247,
- 250, 254, 255, 258, 260, 264, 266, 269, 271, 274,
- 278, 280, 284, 289, 294, 300, 304, 309, 312, 316,
- 320, 325, 330, 336, 344, 351, 353, 355, 359, 364,
- 369, 375, 378, 382, 385, 389, 391, 394, 396, 398,
- 400, 402, 404, 407, 410, 414, 418, 423, 425, 429,
- 432, 436, 438, 441, 443, 445, 447, 450, 453, 457,
- 459, 461, 463, 465, 467, 469, 471, 473, 475, 477,
- 479, 481, 483, 485, 487, 489, 491, 493, 495, 497,
- 499, 501, 503, 506, 509, 512, 515, 517, 519, 521,
- 523, 525, 527, 529, 535, 543, 551, 557, 560, 564,
- 568, 573, 575, 578, 581, 583, 586, 590, 593, 598,
- 601, 604, 606, 614, 622, 629, 637, 644, 647, 650,
- 651, 653, 655, 656, 658, 660, 664, 667, 671, 674,
- 678, 681, 685, 689, 695, 701, 703, 707, 711, 716,
- 718, 721, 727, 730, 732, 734, 736, 738, 742, 744,
- 746, 748, 750, 754, 758, 762, 766, 772, 777, 784,
- 790, 795, 801, 807, 814, 818, 822, 824, 828, 832,
- 836, 840, 845, 850, 855, 860, 862, 865, 869, 872,
- 876, 880, 884, 888, 893, 899, 906, 912, 919, 924,
- 929, 931, 933, 935, 937, 940, 943, 945, 947, 950,
- 953, 955, 958, 961, 963, 966, 969, 971, 977, 982,
- 987, 993, 995, 999, 1003, 1007, 1009, 1013, 1017, 1019,
- 1023, 1027, 1031, 1033, 1037, 1041, 1045, 1049, 1053, 1055,
- 1059, 1063, 1065, 1069, 1071, 1075, 1077, 1081, 1083, 1087,
- 1089, 1093, 1095, 1101, 1103, 1105, 1109, 1111, 1113, 1115,
- 1117, 1119, 1121
-};
-
-static const short yyrhs[] = { 123,
- 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
- 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
- 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
- 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
- 0, 118, 97, 98, 0, 120, 0, 121, 0, 122,
- 0, 119, 101, 122, 0, 86, 0, 0, 126, 0,
- 124, 0, 125, 0, 126, 124, 0, 126, 125, 0,
- 124, 125, 0, 126, 124, 125, 0, 127, 0, 124,
- 127, 0, 130, 0, 125, 130, 0, 75, 119, 99,
- 0, 128, 0, 129, 0, 55, 119, 99, 0, 55,
- 119, 101, 5, 99, 0, 132, 0, 162, 0, 99,
- 0, 44, 0, 131, 44, 0, 0, 131, 67, 122,
- 135, 136, 133, 138, 0, 0, 67, 122, 135, 136,
- 134, 138, 0, 0, 63, 116, 0, 0, 52, 137,
- 0, 117, 0, 137, 100, 117, 0, 95, 96, 0,
- 95, 139, 96, 0, 140, 0, 139, 140, 0, 141,
- 0, 155, 0, 157, 0, 171, 0, 142, 0, 147,
- 0, 132, 0, 162, 0, 112, 143, 99, 0, 131,
- 112, 143, 99, 0, 144, 0, 143, 100, 144, 0,
- 145, 0, 145, 92, 146, 0, 122, 0, 145, 97,
- 98, 0, 251, 0, 169, 0, 148, 154, 0, 112,
- 149, 152, 0, 59, 149, 152, 0, 131, 112, 149,
- 152, 0, 131, 59, 149, 152, 0, 122, 93, 94,
- 0, 122, 93, 150, 94, 0, 149, 97, 98, 0,
- 151, 0, 150, 100, 151, 0, 112, 145, 0, 131,
- 112, 145, 0, 0, 53, 153, 0, 116, 0, 153,
- 100, 116, 0, 171, 0, 171, 99, 0, 99, 0,
- 156, 171, 0, 156, 171, 99, 0, 44, 0, 158,
- 152, 159, 0, 131, 158, 152, 159, 0, 158, 152,
- 159, 99, 0, 131, 158, 152, 159, 99, 0, 120,
- 93, 94, 0, 120, 93, 150, 94, 0, 95, 96,
- 0, 95, 160, 96, 0, 95, 172, 96, 0, 95,
- 160, 172, 96, 0, 161, 93, 94, 99, 0, 161,
- 93, 220, 94, 99, 0, 119, 101, 65, 93, 220,
- 94, 99, 0, 119, 101, 65, 93, 94, 99, 0,
- 76, 0, 65, 0, 61, 122, 164, 0, 131, 61,
- 122, 164, 0, 61, 122, 163, 164, 0, 131, 61,
- 122, 163, 164, 0, 63, 117, 0, 163, 100, 117,
- 0, 95, 96, 0, 95, 165, 96, 0, 166, 0,
- 165, 166, 0, 167, 0, 168, 0, 132, 0, 162,
- 0, 142, 0, 148, 99, 0, 95, 96, 0, 95,
- 170, 96, 0, 95, 100, 96, 0, 95, 170, 100,
- 96, 0, 146, 0, 170, 100, 146, 0, 95, 96,
- 0, 95, 172, 96, 0, 173, 0, 172, 173, 0,
- 174, 0, 176, 0, 132, 0, 175, 99, 0, 112,
- 143, 0, 131, 112, 143, 0, 178, 0, 181, 0,
- 185, 0, 186, 0, 195, 0, 199, 0, 178, 0,
- 182, 0, 187, 0, 196, 0, 200, 0, 171, 0,
- 179, 0, 183, 0, 188, 0, 198, 0, 206, 0,
- 207, 0, 208, 0, 210, 0, 209, 0, 212, 0,
- 99, 0, 122, 88, 0, 180, 176, 0, 180, 177,
- 0, 184, 99, 0, 248, 0, 232, 0, 233, 0,
- 229, 0, 230, 0, 226, 0, 218, 0, 48, 93,
- 251, 94, 176, 0, 48, 93, 251, 94, 177, 56,
- 176, 0, 48, 93, 251, 94, 177, 56, 177, 0,
- 68, 93, 251, 94, 189, 0, 95, 96, 0, 95,
- 192, 96, 0, 95, 190, 96, 0, 95, 190, 192,
- 96, 0, 191, 0, 190, 191, 0, 192, 172, 0,
- 193, 0, 192, 193, 0, 62, 252, 88, 0, 47,
- 88, 0, 66, 93, 251, 94, 0, 194, 176, 0,
- 194, 177, 0, 51, 0, 197, 176, 66, 93, 251,
- 94, 99, 0, 202, 99, 251, 99, 204, 94, 176,
- 0, 202, 99, 99, 204, 94, 176, 0, 202, 99,
- 251, 99, 204, 94, 177, 0, 202, 99, 99, 204,
- 94, 177, 0, 71, 93, 0, 201, 203, 0, 0,
- 205, 0, 175, 0, 0, 205, 0, 184, 0, 205,
- 100, 184, 0, 54, 99, 0, 54, 122, 99, 0,
- 73, 99, 0, 73, 122, 99, 0, 58, 99, 0,
- 58, 251, 99, 0, 49, 251, 99, 0, 211, 93,
- 251, 94, 171, 0, 211, 93, 251, 94, 1, 0,
- 44, 0, 70, 171, 213, 0, 70, 171, 215, 0,
- 70, 171, 213, 215, 0, 214, 0, 213, 214, 0,
- 60, 93, 151, 94, 171, 0, 64, 171, 0, 217,
- 0, 221, 0, 111, 0, 76, 0, 93, 251, 94,
- 0, 218, 0, 225, 0, 226, 0, 227, 0, 119,
- 101, 67, 0, 113, 101, 67, 0, 59, 101, 67,
- 0, 119, 101, 76, 0, 72, 116, 93, 220, 94,
- 0, 72, 116, 93, 94, 0, 72, 116, 93, 220,
- 94, 138, 0, 72, 116, 93, 94, 138, 0, 219,
- 122, 93, 94, 0, 219, 122, 93, 94, 138, 0,
- 219, 122, 93, 220, 94, 0, 219, 122, 93, 220,
- 94, 138, 0, 119, 101, 72, 0, 216, 101, 72,
- 0, 251, 0, 220, 100, 251, 0, 220, 100, 1,
- 0, 72, 113, 222, 0, 72, 115, 222, 0, 72,
- 113, 222, 224, 0, 72, 115, 222, 224, 0, 72,
- 115, 224, 169, 0, 72, 113, 224, 169, 0, 223,
- 0, 222, 223, 0, 97, 251, 98, 0, 97, 98,
- 0, 224, 97, 98, 0, 216, 101, 122, 0, 65,
- 101, 122, 0, 119, 93, 94, 0, 119, 93, 220,
- 94, 0, 216, 101, 122, 93, 94, 0, 216, 101,
- 122, 93, 220, 94, 0, 65, 101, 122, 93, 94,
- 0, 65, 101, 122, 93, 220, 94, 0, 119, 97,
- 251, 98, 0, 217, 97, 251, 98, 0, 216, 0,
- 119, 0, 229, 0, 230, 0, 228, 46, 0, 228,
- 45, 0, 232, 0, 233, 0, 3, 231, 0, 4,
- 231, 0, 234, 0, 46, 231, 0, 45, 231, 0,
- 228, 0, 89, 231, 0, 90, 231, 0, 235, 0,
- 93, 113, 224, 94, 231, 0, 93, 113, 94, 231,
- 0, 93, 251, 94, 234, 0, 93, 119, 224, 94,
- 234, 0, 231, 0, 236, 5, 231, 0, 236, 6,
- 231, 0, 236, 7, 231, 0, 236, 0, 237, 3,
- 236, 0, 237, 4, 236, 0, 237, 0, 238, 8,
- 237, 0, 238, 9, 237, 0, 238, 10, 237, 0,
- 238, 0, 239, 20, 238, 0, 239, 18, 238, 0,
- 239, 21, 238, 0, 239, 19, 238, 0, 239, 57,
- 114, 0, 239, 0, 240, 16, 239, 0, 240, 17,
- 239, 0, 240, 0, 241, 11, 240, 0, 241, 0,
- 242, 12, 241, 0, 242, 0, 243, 13, 242, 0,
- 243, 0, 244, 14, 243, 0, 244, 0, 245, 15,
- 244, 0, 245, 0, 245, 87, 251, 88, 246, 0,
- 246, 0, 248, 0, 249, 250, 247, 0, 119, 0,
- 225, 0, 227, 0, 91, 0, 92, 0, 247, 0,
- 251, 0
-};
-
-#endif
-
-#if YYDEBUG != 0
-static const short yyrline[] = { 0,
- 171, 176, 178, 179, 180, 181, 182, 186, 188, 191,
- 197, 202, 209, 211, 214, 218, 222, 226, 228, 235,
- 245, 247, 250, 254, 263, 268, 269, 270, 271, 272,
- 273, 274, 275, 278, 280, 283, 285, 288, 293, 295,
- 298, 302, 306, 308, 309, 315, 324, 335, 342, 342,
- 345, 347, 348, 351, 352, 355, 358, 362, 364, 367,
- 369, 372, 374, 375, 376, 379, 381, 382, 383, 387,
- 390, 394, 397, 400, 402, 405, 408, 412, 414, 418,
- 422, 425, 426, 428, 435, 442, 448, 451, 453, 461,
- 477, 493, 494, 497, 500, 504, 506, 507, 511, 513,
- 516, 526, 528, 531, 533, 539, 542, 546, 548, 549,
- 550, 554, 556, 559, 561, 565, 567, 572, 575, 577,
- 579, 583, 585, 588, 590, 593, 595, 598, 600, 601,
- 602, 605, 609, 614, 616, 617, 618, 621, 623, 627,
- 629, 632, 634, 637, 639, 640, 643, 647, 650, 654,
- 656, 657, 658, 659, 660, 663, 665, 666, 667, 668,
- 671, 673, 674, 675, 676, 677, 678, 679, 680, 681,
- 682, 685, 689, 694, 698, 704, 708, 710, 711, 712,
- 713, 714, 715, 718, 722, 726, 730, 734, 736, 737,
- 738, 741, 743, 746, 751, 753, 756, 758, 761, 765,
- 769, 773, 777, 781, 783, 786, 788, 791, 795, 798,
- 799, 800, 803, 804, 807, 809, 812, 814, 817, 819,
- 822, 824, 827, 831, 833, 836, 841, 843, 844, 847,
- 849, 852, 856, 861, 863, 866, 868, 869, 870, 871,
- 872, 873, 877, 879, 881, 885, 889, 891, 895, 896,
- 900, 901, 902, 903, 906, 909, 912, 914, 915, 918,
- 920, 921, 922, 925, 926, 929, 931, 934, 938, 940,
- 943, 945, 948, 951, 953, 954, 955, 956, 959, 962,
- 965, 967, 969, 970, 973, 977, 981, 983, 984, 985,
- 986, 989, 993, 997, 999, 1000, 1001, 1004, 1006, 1007,
- 1008, 1011, 1013, 1014, 1015, 1018, 1020, 1021, 1024, 1026,
- 1027, 1028, 1031, 1033, 1034, 1035, 1036, 1037, 1040, 1042,
- 1043, 1046, 1048, 1051, 1053, 1056, 1058, 1061, 1063, 1066,
- 1068, 1071, 1073, 1076, 1078, 1081, 1085, 1088, 1089, 1092,
- 1094, 1097, 1101
-};
-#endif
-
-
-#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
-
-static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK",
-"MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
-"OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
-"LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
-"REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
-"XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
-"FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
-"ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
-"BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
-"INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
-"FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
-"FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
-"INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
-"REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
-"CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
-"CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
-"goal","literal","type","primitive_type","reference_type","class_or_interface_type",
-"class_type","interface_type","array_type","name","simple_name","qualified_name",
-"identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
-"import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
-"type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
-"interface_type_list","class_body","class_body_declarations","class_body_declaration",
-"class_member_declaration","field_declaration","variable_declarators","variable_declarator",
-"variable_declarator_id","variable_initializer","method_declaration","method_header",
-"method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
-"method_body","static_initializer","static","constructor_declaration","constructor_declarator",
-"constructor_body","explicit_constructor_invocation","this_or_super","interface_declaration",
-"extends_interfaces","interface_body","interface_member_declarations","interface_member_declaration",
-"constant_declaration","abstract_method_declaration","array_initializer","variable_initializers",
-"block","block_statements","block_statement","local_variable_declaration_statement",
-"local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
-"empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
-"statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
-"switch_statement","switch_block","switch_block_statement_groups","switch_block_statement_group",
-"switch_labels","switch_label","while_expression","while_statement","while_statement_nsi",
-"do_statement_begin","do_statement","for_statement","for_statement_nsi","for_header",
-"for_begin","for_init","for_update","statement_expression_list","break_statement",
-"continue_statement","return_statement","throw_statement","synchronized_statement",
-"synchronized","try_statement","catches","catch_clause","finally","primary",
-"primary_no_new_array","class_instance_creation_expression","something_dot_new",
-"argument_list","array_creation_expression","dim_exprs","dim_expr","dims","field_access",
-"method_invocation","array_access","postfix_expression","post_increment_expression",
-"post_decrement_expression","unary_expression","pre_increment_expression","pre_decrement_expression",
-"unary_expression_not_plus_minus","cast_expression","multiplicative_expression",
-"additive_expression","shift_expression","relational_expression","equality_expression",
-"and_expression","exclusive_or_expression","inclusive_or_expression","conditional_and_expression",
-"conditional_or_expression","conditional_expression","assignment_expression",
-"assignment","left_hand_side","assignment_operator","expression","constant_expression", NULL
-};
-#endif
-
-static const short yyr1[] = { 0,
- 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
- 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
- 119, 119, 120, 121, 122, 123, 123, 123, 123, 123,
- 123, 123, 123, 124, 124, 125, 125, 126, 127, 127,
- 128, 129, 130, 130, 130, 131, 131, 133, 132, 134,
- 132, 135, 135, 136, 136, 137, 137, 138, 138, 139,
- 139, 140, 140, 140, 140, 141, 141, 141, 141, 142,
- 142, 143, 143, 144, 144, 145, 145, 146, 146, 147,
- 148, 148, 148, 148, 149, 149, 149, 150, 150, 151,
- 151, 152, 152, 153, 153, 154, 154, 154, 155, 155,
- 156, 157, 157, 157, 157, 158, 158, 159, 159, 159,
- 159, 160, 160, 160, 160, 161, 161, 162, 162, 162,
- 162, 163, 163, 164, 164, 165, 165, 166, 166, 166,
- 166, 167, 168, 169, 169, 169, 169, 170, 170, 171,
- 171, 172, 172, 173, 173, 173, 174, 175, 175, 176,
- 176, 176, 176, 176, 176, 177, 177, 177, 177, 177,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 179, 180, 181, 182, 183, 184, 184, 184, 184,
- 184, 184, 184, 185, 186, 187, 188, 189, 189, 189,
- 189, 190, 190, 191, 192, 192, 193, 193, 194, 195,
- 196, 197, 198, 199, 199, 200, 200, 201, 202, 203,
- 203, 203, 204, 204, 205, 205, 206, 206, 207, 207,
- 208, 208, 209, 210, 210, 211, 212, 212, 212, 213,
- 213, 214, 215, 216, 216, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 218, 218, 218, 218,
- 218, 218, 218, 218, 219, 219, 220, 220, 220, 221,
- 221, 221, 221, 221, 221, 222, 222, 223, 224, 224,
- 225, 225, 226, 226, 226, 226, 226, 226, 227, 227,
- 228, 228, 228, 228, 229, 230, 231, 231, 231, 231,
- 231, 232, 233, 234, 234, 234, 234, 235, 235, 235,
- 235, 236, 236, 236, 236, 237, 237, 237, 238, 238,
- 238, 238, 239, 239, 239, 239, 239, 239, 240, 240,
- 240, 241, 241, 242, 242, 243, 243, 244, 244, 245,
- 245, 246, 246, 247, 247, 248, 249, 249, 249, 250,
- 250, 251, 252
-};
-
-static const short yyr2[] = { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
- 1, 1, 1, 3, 1, 0, 1, 1, 1, 2,
- 2, 2, 3, 1, 2, 1, 2, 3, 1, 1,
- 3, 5, 1, 1, 1, 1, 2, 0, 7, 0,
- 6, 0, 2, 0, 2, 1, 3, 2, 3, 1,
- 2, 1, 1, 1, 1, 1, 1, 1, 1, 3,
- 4, 1, 3, 1, 3, 1, 3, 1, 1, 2,
- 3, 3, 4, 4, 3, 4, 3, 1, 3, 2,
- 3, 0, 2, 1, 3, 1, 2, 1, 2, 3,
- 1, 3, 4, 4, 5, 3, 4, 2, 3, 3,
- 4, 4, 5, 7, 6, 1, 1, 3, 4, 4,
- 5, 2, 3, 2, 3, 1, 2, 1, 1, 1,
- 1, 1, 2, 2, 3, 3, 4, 1, 3, 2,
- 3, 1, 2, 1, 1, 1, 2, 2, 3, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 2, 2, 2, 2, 1, 1, 1, 1,
- 1, 1, 1, 5, 7, 7, 5, 2, 3, 3,
- 4, 1, 2, 2, 1, 2, 3, 2, 4, 2,
- 2, 1, 7, 7, 6, 7, 6, 2, 2, 0,
- 1, 1, 0, 1, 1, 3, 2, 3, 2, 3,
- 2, 3, 3, 5, 5, 1, 3, 3, 4, 1,
- 2, 5, 2, 1, 1, 1, 1, 3, 1, 1,
- 1, 1, 3, 3, 3, 3, 5, 4, 6, 5,
- 4, 5, 5, 6, 3, 3, 1, 3, 3, 3,
- 3, 4, 4, 4, 4, 1, 2, 3, 2, 3,
- 3, 3, 3, 4, 5, 6, 5, 6, 4, 4,
- 1, 1, 1, 1, 2, 2, 1, 1, 2, 2,
- 1, 2, 2, 1, 2, 2, 1, 5, 4, 4,
- 5, 1, 3, 3, 3, 1, 3, 3, 1, 3,
- 3, 3, 1, 3, 3, 3, 3, 3, 1, 3,
- 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
- 3, 1, 5, 1, 1, 3, 1, 1, 1, 1,
- 1, 1, 1
-};
-
-static const short yydefact[] = { 26,
- 46, 0, 0, 0, 0, 45, 1, 28, 29, 27,
- 34, 39, 40, 36, 0, 43, 44, 25, 0, 21,
- 22, 23, 0, 52, 0, 32, 35, 37, 30, 31,
- 47, 0, 0, 41, 0, 0, 0, 0, 118, 0,
- 54, 38, 0, 33, 0, 52, 0, 24, 17, 122,
- 15, 12, 0, 10, 11, 124, 0, 8, 9, 13,
- 14, 15, 0, 130, 132, 0, 131, 0, 126, 128,
- 129, 0, 120, 16, 53, 0, 50, 0, 119, 54,
- 42, 0, 92, 76, 0, 72, 74, 92, 0, 0,
- 0, 0, 0, 133, 125, 127, 123, 56, 55, 0,
- 121, 48, 0, 0, 0, 82, 70, 0, 0, 0,
- 81, 18, 20, 19, 92, 0, 92, 0, 0, 51,
- 0, 85, 0, 0, 0, 88, 94, 93, 87, 76,
- 73, 0, 0, 0, 0, 0, 0, 0, 237, 0,
- 0, 0, 0, 6, 5, 2, 3, 4, 7, 236,
- 0, 282, 75, 79, 281, 234, 239, 0, 235, 240,
- 241, 242, 294, 283, 284, 302, 287, 288, 291, 297,
- 306, 309, 313, 319, 322, 324, 326, 328, 330, 332,
- 334, 342, 335, 0, 78, 77, 84, 71, 83, 57,
- 46, 0, 58, 21, 0, 68, 0, 60, 62, 66,
- 67, 0, 63, 0, 64, 92, 69, 65, 49, 90,
- 0, 86, 0, 0, 282, 240, 242, 289, 290, 293,
- 292, 0, 0, 0, 16, 0, 295, 296, 0, 282,
- 0, 134, 0, 138, 0, 0, 0, 0, 0, 0,
- 0, 0, 286, 285, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 340, 341, 0, 46, 0,
- 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
- 140, 172, 0, 8, 282, 23, 0, 146, 161, 0,
- 142, 144, 0, 145, 150, 162, 0, 151, 163, 0,
- 152, 153, 164, 0, 154, 0, 165, 155, 210, 0,
- 166, 167, 168, 170, 169, 0, 171, 239, 241, 0,
- 180, 181, 178, 179, 177, 0, 92, 59, 61, 98,
- 80, 96, 99, 0, 91, 89, 95, 245, 272, 0,
- 260, 266, 0, 261, 0, 0, 0, 0, 0, 0,
- 0, 238, 136, 135, 0, 244, 273, 0, 257, 0,
- 243, 255, 246, 256, 271, 0, 0, 303, 304, 305,
- 307, 308, 310, 311, 312, 315, 317, 314, 316, 0,
- 318, 320, 321, 323, 325, 327, 329, 331, 0, 336,
- 0, 0, 217, 0, 221, 0, 0, 0, 0, 208,
- 219, 0, 0, 148, 0, 173, 0, 141, 143, 147,
- 226, 174, 176, 200, 0, 0, 212, 215, 209, 211,
- 0, 0, 106, 0, 0, 97, 100, 0, 102, 0,
- 269, 0, 267, 262, 0, 265, 263, 264, 248, 0,
- 299, 0, 0, 300, 137, 139, 274, 0, 279, 0,
- 280, 251, 0, 0, 0, 223, 218, 222, 0, 0,
- 0, 0, 227, 230, 228, 220, 238, 149, 0, 0,
- 213, 0, 0, 107, 103, 117, 237, 108, 282, 0,
- 0, 0, 104, 277, 0, 268, 270, 250, 247, 298,
- 301, 259, 258, 275, 0, 252, 253, 333, 0, 199,
- 0, 0, 233, 231, 229, 0, 216, 0, 214, 213,
- 0, 105, 0, 109, 0, 0, 110, 278, 249, 276,
- 254, 0, 184, 0, 150, 0, 157, 158, 0, 159,
- 160, 0, 0, 187, 0, 0, 0, 0, 225, 224,
- 0, 111, 0, 0, 0, 0, 175, 201, 0, 0,
- 0, 188, 0, 192, 0, 195, 0, 0, 205, 0,
- 0, 112, 0, 0, 185, 213, 0, 198, 343, 0,
- 190, 193, 0, 189, 194, 196, 232, 203, 204, 0,
- 0, 113, 0, 0, 213, 197, 191, 115, 0, 0,
- 0, 0, 114, 0, 207, 0, 186, 206, 0, 0,
- 0
-};
-
-static const short yydefgoto[] = { 599,
- 150, 283, 151, 59, 60, 75, 50, 61, 152, 20,
- 21, 22, 7, 8, 9, 10, 11, 12, 13, 14,
- 287, 288, 121, 100, 41, 77, 99, 120, 197, 198,
- 199, 65, 85, 86, 87, 153, 201, 66, 83, 125,
- 126, 106, 128, 331, 203, 204, 205, 206, 429, 480,
- 481, 17, 38, 39, 68, 69, 70, 71, 154, 235,
- 289, 575, 291, 292, 293, 294, 524, 295, 296, 297,
- 298, 527, 299, 300, 301, 302, 528, 303, 534, 553,
- 554, 555, 556, 304, 305, 530, 306, 307, 308, 531,
- 309, 310, 419, 508, 509, 311, 312, 313, 314, 315,
- 316, 317, 463, 464, 465, 155, 156, 157, 158, 358,
- 159, 341, 342, 343, 160, 161, 162, 163, 164, 165,
- 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183, 184, 268,
- 359, 570
-};
-
-static const short yypact[] = { 11,
--32768, -52, -52, -52, -52,-32768,-32768, 18, 154, 18,
--32768,-32768,-32768,-32768, 185,-32768,-32768,-32768, 187,-32768,
--32768,-32768, -24, -5, 332, 154,-32768,-32768, 18, 154,
--32768, -52, -52,-32768, 5, -52, 745, 162,-32768, -52,
- 76,-32768, -52, 154, -24, -5, 57,-32768,-32768,-32768,
- 41,-32768, -52,-32768,-32768,-32768, -52, 71,-32768,-32768,
- 170, 113, 518,-32768,-32768, 126,-32768, 758,-32768,-32768,
--32768, -52,-32768,-32768,-32768, -52,-32768, 162,-32768, 76,
--32768, 249, -15, 249, 321,-32768, 205, -15, 149, 255,
- 265, -52, -52,-32768,-32768,-32768,-32768,-32768, 198, 294,
--32768,-32768, 58, -52, 298,-32768,-32768, -52, 1568, 309,
--32768,-32768,-32768,-32768, -15, 359, -15, -52, 596,-32768,
- 294,-32768, -52, 199, -13,-32768,-32768, 310,-32768,-32768,
--32768, 2315, 2315, 2315, 2315, 329, 352, 88,-32768, 2315,
- 2315, 2315, 1438,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 354, 393,-32768,-32768, 360, 369,-32768, -52,-32768, 347,
--32768, 378, 437,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 445, 495, 483, 380, 492, 461, 462, 467, 502, 1,
--32768,-32768,-32768, 412,-32768,-32768,-32768,-32768,-32768,-32768,
- 423, 2513,-32768, 429, 518,-32768, 683,-32768,-32768,-32768,
--32768, 128,-32768, 432,-32768, 471,-32768,-32768,-32768, 435,
- -52,-32768, 337, -52, 52,-32768,-32768,-32768,-32768,-32768,
--32768, 468, -52, 440, 440, 449,-32768,-32768, 174, 414,
- 454,-32768, 460,-32768, 235, 500, 1619, 2315, 261, -21,
- 2315, 476,-32768,-32768, 2315, 2315, 2315, 2315, 2315, 2315,
- 2315, 2315, 2315, 2315, 2315, 2315, 88, 2315, 2315, 2315,
- 2315, 2315, 2315, 2315, 2315,-32768,-32768, 2315, 480, 482,
- 2315,-32768, 60, 1684, 490, 491, 432, 494, 89, 2315,
--32768,-32768, -52, 137, 559, 488, 496,-32768,-32768, 2579,
--32768,-32768, 493,-32768,-32768,-32768, 2975,-32768,-32768, 498,
--32768,-32768,-32768, 2975,-32768, 2975,-32768,-32768, 1029, 499,
--32768,-32768,-32768,-32768,-32768, 497,-32768, 96, 196, 437,
- 485, 505,-32768,-32768,-32768, 323, 471,-32768,-32768,-32768,
--32768, 506, 507, 504, 435,-32768,-32768,-32768, 508, 1735,
- 440,-32768, 339, 440, 339, 1800, 2315, 509, 180, 1735,
- 246, 1364,-32768,-32768, 1503,-32768,-32768, 3,-32768, 512,
--32768,-32768,-32768,-32768, 520, 513, 1851,-32768,-32768,-32768,
- 445, 445, 495, 495, 495, 483, 483, 483, 483, 71,
--32768, 380, 380, 492, 461, 462, 467, 502, 501,-32768,
- 2315, 522,-32768, 523,-32768, 526, 2315, 2315, 322,-32768,
--32768, 528, 534, 535, 1916,-32768, -52,-32768,-32768,-32768,
--32768,-32768,-32768,-32768, 572, 199,-32768,-32768,-32768, 539,
- 1967, 2315,-32768, 141, 504,-32768,-32768, 2645, 543, 2032,
--32768, 545,-32768, 547, 549,-32768, 547,-32768, 294, 244,
--32768, 2315, 1364,-32768,-32768,-32768,-32768, 1323,-32768, 2083,
--32768, 294, 251, 2315, 555,-32768,-32768,-32768, 564, 565,
- 573, 432, 322,-32768,-32768,-32768,-32768, 535, 576, 1171,
- 1171, 566, 582,-32768, 571, 352, 584,-32768, 849, 2711,
- 587, 2777,-32768,-32768, 256,-32768,-32768,-32768, 294,-32768,
--32768,-32768,-32768,-32768, 260,-32768, 294,-32768, 3041,-32768,
- 588, 337,-32768,-32768,-32768, 2315,-32768, 591, 539, 1171,
- 6,-32768, 183,-32768, 2843, 2148,-32768,-32768,-32768,-32768,
--32768, 593,-32768, 631, 632, 3041,-32768,-32768, 3041,-32768,
--32768, 590, -16,-32768, 600, 601, 2975, 602,-32768,-32768,
- 604,-32768, 603, 272, 2315, 2975,-32768,-32768, 2199, 611,
- 2315,-32768, 45,-32768, 2381,-32768, 432, 609,-32768, 2975,
- 2264,-32768, 610, 616,-32768, 1171, 613,-32768,-32768, 615,
--32768,-32768, 2447,-32768, 2909,-32768,-32768,-32768,-32768, 619,
- 280,-32768, 3041, 621, 1171,-32768,-32768,-32768, 623, 670,
- 3041, 636,-32768, 3041,-32768, 3041,-32768,-32768, 725, 735,
--32768
-};
-
-static const short yypgoto[] = {-32768,
--32768, 139, -26, 479, 253, -85, 43,-32768, 59, -72,
--32768, -3,-32768, 729, 150,-32768, 20,-32768,-32768, 200,
- 15, 586,-32768,-32768, 695, 665,-32768, -113,-32768, 550,
--32768, -83, -80, 640, -105, -138,-32768, -71, 93, 426,
- -211, -82,-32768,-32768,-32768,-32768,-32768, 554, 328,-32768,
--32768, -25, 709, -18,-32768, 688,-32768,-32768, 103,-32768,
- -93, -188, -276,-32768, 450, -167, -372, -378,-32768, -151,
--32768,-32768,-32768, -306,-32768,-32768,-32768,-32768,-32768,-32768,
- 207, 208, -499, -134,-32768,-32768,-32768,-32768,-32768,-32768,
--32768, -58,-32768, -453, 458,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,-32768, 295, 300,-32768,-32768, 138,-32768, -283,
--32768, 546, 14, -208, 1037, 191, 1059, 327, 410, 434,
- -65, 487, 570, -343,-32768, 305, 308, 159, 306, 510,
- 511, 519, 517, 524,-32768, 319, 531, 669,-32768,-32768,
- 123,-32768
-};
-
-
-#define YYLAST 3150
-
-
-static const short yytable[] = { 23,
- 24, 336, 418, 290, 234, 111, 539, 209, 444, 47,
- 58, 67, 116, 409, 15, 264, 345, 210, 127, 73,
- 349, 351, 15, 15, 15, 208, 79, 27, 45, 46,
- 550, 48, 187, 18, 189, 200, 58, 104, 36, 48,
- 15, 58, 67, 15, 15, 551, 194, 202, 27, 82,
- 364, 63, 226, 84, 1, 576, 538, 40, 15, 101,
- 19, 1, 440, 25, 18, 2, 218, 219, 220, 221,
- 37, 3, 2, 576, 227, 228, 58, 4, 3, 552,
- 212, 105, 63, 453, 4, 5, 213, 265, 82, 84,
- 18, 550, 58, 207, 51, 62, 447, 58, 51, 491,
- 192, 1, 448, 208, 130, 335, 551, 52, 332, 6,
- 333, 224, 584, 200, 97, 229, 6, 124, 98, 130,
- 525, 62, 194, 334, 194, 202, 62, 76, 337, 412,
- 51, 592, 434, 195, 51, 437, 414, 52, 415, 54,
- 571, 43, 55, 18, 237, 18, 485, 525, 238, 88,
- 525, 122, 239, 547, 242, 81, 548, 26, 393, 30,
- 190, 62, 51, 507, 418, 284, 495, 89, 58, 54,
- 58, 207, 55, 18, 18, 57, 51, 62, 44, 368,
- 369, 370, 62, 399, 115, 117, 58, 401, 286, -183,
- 215, 215, 215, 215, -183, -183, 51, 1, 215, 215,
- 230, 93, 404, 418, 525, 409, 57, 130, 28, 91,
- 590, 195, 525, 43, 3, 525, 446, 525, 595, 339,
- 4, 597, 192, 598, 94, 28, 330, 124, 31, 28,
- 380, 185, 544, 89, 474, 48, 365, 236, 409, 482,
- 213, 123, 31, 28, 425, 32, 112, 541, 52, 361,
- 285, 33, 6, 62, 362, 62, 37, 57, 363, 418,
- 58, 72, 211, 284, 231, 185, 90, 347, 18, 394,
- 348, 62, 51, 442, 236, 402, 435, 581, 418, 130,
- 54, 441, 284, 55, 18, 34, 286, 35, 49, -182,
- 535, 515, 74, 286, -182, -182, 109, 118, 409, 58,
- 286, 110, 286, 215, 215, 215, 215, 215, 215, 215,
- 215, 215, 215, 215, 215, 62, 215, 215, 215, 215,
- 215, 215, 215, 416, 49, 488, 468, 361, 49, 318,
- 354, 523, 362, 93, 355, 57, 363, 489, 496, 443,
- 124, 103, 435, 448, 497, 62, 18, 526, 285, 518,
- 448, 123, 113, 520, 433, 448, 74, 433, 412, 448,
- 360, 414, 114, 366, 529, 563, 1, 285, 503, 559,
- 49, 448, 52, 589, 526, 519, 490, 526, 565, 448,
- 1, 461, 319, 521, 62, 462, 52, 389, 119, 58,
- 225, 529, 579, 392, 529, 129, 396, 253, 254, 255,
- 256, 284, 403, 130, 54, 215, 186, 55, 18, 214,
- 215, 376, 377, 378, 379, 523, 423, 540, 54, 107,
- 108, 55, 18, 559, 286, 407, 565, 318, 579, 222,
- 42, 526, 43, 143, 318, 435, 257, -338, -338, 526,
- 532, 318, 526, 318, 526, 436, 318, 438, 529, 245,
- 246, 247, 223, 284, 236, 284, 529, 188, 108, 529,
- 240, 529, 432, 577, 123, 241, 74, 532, -339, -339,
- 532, 260, 360, 261, 62, 58, 286, 185, 286, 262,
- 319, 243, 244, -337, -337, 237, 479, 319, 284, 238,
- 250, 251, 252, 239, 319, 286, 319, 248, 249, 319,
- 215, 215, 266, 267, -337, -337, 237, 258, 259, 48,
- 350, 286, 215, 455, 239, 263, 124, -101, 320, 459,
- 460, 326, 286, 104, 532, 286, 192, 360, 284, -283,
- -283, 110, 532, 286, 338, 532, 340, 532, 285, 31,
- 285, 346, 286, 472, 473, 52, 284, 352, 284, -284,
- -284, 286, 371, 372, 407, 353, 286, 373, 374, 375,
- 62, 31, 33, 382, 383, 318, 356, 52, 367, 286,
- 493, 286, -226, 285, 391, 406, 92, 54, 32, 286,
- 55, 18, 397, 398, 33, 16, 400, 286, 454, 422,
- 286, 410, 286, 16, 16, 16, 413, 421, 428, 54,
- 430, 321, 55, 18, 426, 427, 431, 318, 318, 449,
- 451, 16, 450, 285, 16, 16, 320, 318, 319, 318,
- 456, 457, 64, 320, 458, 322, 466, 467, 536, 16,
- 320, 285, 320, 285, 108, 320, 318, 469, 470, 191,
- 123, 483, 486, 435, -15, 52, 487, 318, 499, -337,
- -337, 237, 318, 64, 53, 405, 3, 500, 501, 239,
- 319, 319, 4, 318, 510, 502, 318, 564, 506, 512,
- 319, 567, 319, 569, 318, 511, -116, 54, 323, 516,
- 55, 18, 533, 318, 537, 545, 546, -156, 549, 319,
- 192, 193, 318, 557, 558, 560, 561, 318, 568, 321,
- 319, 562, 586, 318, 196, 319, 321, 578, 582, 583,
- 318, 585, 318, 321, 591, 321, 319, 588, 321, 319,
- 318, 593, 318, 322, 600, 594, 191, 319, 318, 596,
- 322, 318, 52, 318, 601, 381, 319, 322, 29, 322,
- 80, 53, 322, 3, 102, 319, 329, 131, 327, 4,
- 319, 424, 475, 78, 320, 96, 319, 504, 417, 572,
- 573, 324, 505, 319, 54, 319, 420, 55, 18, 384,
- 344, 385, 498, 319, 0, 319, 323, 192, 328, 387,
- 386, 319, 196, 323, 319, 0, 319, 388, 1, 0,
- 323, 0, 323, 0, 52, 323, 320, 320, 390, 0,
- 0, 1, 0, 53, 0, 3, 320, 52, 320, 0,
- 0, 4, 0, 0, 0, 0, 53, 0, 3, 0,
- 0, 0, 0, 0, 4, 320, 54, 0, 0, 55,
- 18, 0, 0, 0, 0, 0, 320, 321, 0, 54,
- 56, 320, 55, 18, 0, 0, 0, 0, 0, 0,
- 0, 0, 320, 95, 0, 320, 0, 0, 0, 324,
- 325, 322, 0, 320, 0, 0, 324, 0, 0, 0,
- 0, 0, 320, 324, 0, 324, 0, 0, 324, 321,
- 321, 320, 0, 0, 0, 0, 320, 0, 0, 321,
- 0, 321, 320, 0, 0, 0, 0, 0, 0, 320,
- 0, 320, 0, 322, 322, 0, 0, 0, 321, 320,
- 0, 320, 0, 322, 323, 322, 0, 320, 0, 321,
- 320, 0, 320, 0, 321, 0, 0, 0, 0, 0,
- 0, 0, 322, 0, -15, 321, 0, 0, 321, -337,
- -337, 237, 0, 322, 0, 405, 321, 0, 322, 513,
- 0, 0, 0, 0, 0, 321, 323, 323, 325, 322,
- 0, 0, 322, 0, 321, 325, 323, 0, 323, 321,
- 322, 0, 325, 0, 325, 321, 0, 325, 0, 322,
- 0, 0, 321, 0, 321, 323, 0, 0, 322, 0,
- 0, 0, 321, 322, 321, 0, 323, 324, 0, 322,
- 321, 323, 0, 321, 0, 321, 322, 0, 322, 0,
- 0, 0, 323, 0, 0, 323, 322, 0, 322, 0,
- 0, 0, 0, 323, 322, 0, 0, 322, 0, 322,
- 0, 0, 323, 0, 0, 0, 0, 0, 0, 324,
- 324, 323, 0, 0, 0, 0, 323, 0, 0, 324,
- 0, 324, 323, 0, 0, 0, 0, 0, 0, 323,
- 0, 323, 0, 0, 0, 0, 0, 0, 324, 323,
- 0, 323, 1, 134, 135, 0, 0, 323, 52, 324,
- 323, 0, 323, 0, 324, 0, 0, 136, 0, 0,
- 0, 0, 0, 137, 0, 324, 325, 0, 324, 0,
- 138, 0, 0, 0, 139, 0, 324, 0, 0, 0,
- 54, 0, 0, 55, 18, 324, 0, 0, 0, 0,
- 0, 280, 0, 0, 324, 0, 0, 0, 0, 324,
- 144, 145, 146, 147, 0, 324, 148, 149, 325, 325,
- 0, 0, 324, 0, 324, 0, 0, 0, 325, 0,
- 325, 0, 324, 0, 324, 0, 0, 0, 0, 0,
- 324, 0, 0, 324, 0, 324, 0, 325, 216, 216,
- 216, 216, 0, 0, 0, 0, 216, 216, 325, 0,
- 0, 0, 0, 325, 0, 0, 0, 0, 0, 0,
- 217, 217, 217, 217, 325, 0, 0, 325, 217, 217,
- 0, 0, 0, 0, 0, 325, 0, 0, 0, 0,
- 0, 0, 0, 0, 325, 134, 135, 0, 0, 0,
- 52, 0, 0, 325, 0, 0, 0, 0, 325, 136,
- 0, 0, 0, 0, 325, 137, 0, 0, 0, 0,
- 0, 325, 138, 325, 0, 0, 139, 0, 0, 0,
- 0, 325, 54, 325, 0, 55, 18, 0, 0, 325,
- 0, 0, 325, 280, 325, 0, 0, 0, 0, 0,
- 0, 0, 144, 145, 146, 147, 0, 0, 148, 149,
- 0, 216, 216, 216, 216, 216, 216, 216, 216, 216,
- 216, 216, 216, 0, 216, 216, 216, 216, 216, 216,
- 216, 0, 0, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 0, 217, 217, 217, 217,
- 217, 217, 217, 492, 0, 132, 133, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 134, 135, 0,
- 0, 0, 52, 0, 0, 0, 0, 0, 0, 0,
- 0, 136, 0, 216, 0, 0, 0, 137, 216, 0,
- 0, 0, 0, 0, 138, 0, 0, 0, 139, 0,
- 0, 0, 0, 0, 54, 217, 0, 55, 18, 0,
- 217, 140, 141, 52, 0, 142, 0, 0, 0, 0,
- 0, 0, 136, 0, 144, 145, 146, 147, 137, 0,
- 148, 149, 0, 0, 0, 138, 0, 0, 0, 139,
- 132, 133, 0, 0, 0, 54, 0, 0, 55, 18,
- 0, 0, 140, 141, 0, 0, 142, 0, 0, 0,
- 0, 0, 0, 0, 0, 144, 145, 146, 147, 0,
- 0, 148, 149, 0, 0, 0, 0, 0, 216, 216,
- 0, 0, 134, 135, 0, 0, 0, 52, 0, 0,
- 216, 0, 0, 0, 0, 0, 136, 0, 0, 0,
- 217, 217, 137, 0, 0, 132, 133, 0, 0, 138,
- 0, 0, 217, 139, 0, 0, 0, 0, 0, 54,
- 0, 0, 55, 18, 0, 0, 140, 141, 0, 0,
- 142, 0, 143, 232, 0, 0, 0, 233, 0, 144,
- 145, 146, 147, 0, 0, 148, 149, 134, 135, 0,
- 0, 0, 52, 0, 0, 0, 0, 0, 0, 0,
- 0, 136, 0, 0, 0, 0, 0, 137, 0, 0,
- 132, 133, 0, 0, 138, 0, 0, 0, 139, 0,
- 0, 0, 0, 0, 54, 0, 0, 55, 18, 0,
- 0, 140, 141, 0, 0, 142, 0, 143, 445, 0,
- 0, 0, 0, 0, 144, 145, 146, 147, 0, 0,
- 148, 149, 134, 135, 0, 0, 0, 52, 0, 0,
- 0, 132, 133, 0, 0, 0, 136, 0, 0, 0,
- 0, 0, 137, 0, 0, 0, 0, 0, 0, 138,
- 0, 0, 0, 139, 0, 0, 0, 0, 0, 54,
- 0, 0, 55, 18, 0, 0, 140, 141, 0, 0,
- 142, 0, 143, 134, 135, 0, 0, 0, 52, 144,
- 145, 146, 147, 0, 0, 148, 149, 136, 0, 0,
- 0, 0, 0, 137, 0, 0, 132, 133, 0, 0,
- 138, 0, 0, 0, 139, 0, 0, 0, 0, 0,
- 54, 0, 0, 55, 18, 0, 0, 140, 141, 0,
- 0, 142, 357, 0, 0, 0, 0, 0, 0, 0,
- 144, 145, 146, 147, 0, 0, 148, 149, 134, 135,
- 0, 0, 0, 52, 0, 0, 0, 132, 133, 0,
- 0, 0, 136, 0, 0, 0, 0, 0, 137, 0,
- 0, 0, 0, 0, 0, 138, 0, 0, 0, 139,
- 0, 0, 0, 0, 0, 54, 0, 0, 55, 18,
- 0, 0, 140, 141, 0, 0, 142, 0, 0, 134,
- 135, 0, 395, 0, 52, 144, 145, 146, 147, 0,
- 0, 148, 149, 136, 0, 0, 0, 0, 0, 137,
- 0, 0, 132, 133, 0, 0, 138, 0, 0, 0,
- 139, 0, 0, 0, 0, 0, 54, 0, 0, 55,
- 18, 0, 0, 140, 141, 0, 0, 142, 0, 0,
- 0, 0, 431, 0, 0, 0, 144, 145, 146, 147,
- 0, 0, 148, 149, 134, 135, 0, 0, 0, 52,
- 0, 0, 0, 132, 133, 0, 0, 0, 136, 0,
- 0, 0, 0, 0, 137, 0, 0, 0, 0, 0,
- 0, 138, 0, 0, 0, 139, 0, 0, 0, 0,
- 0, 54, 0, 0, 55, 18, 0, 0, 140, 141,
- 0, 0, 142, 439, 0, 134, 135, 0, 0, 0,
- 52, 144, 145, 146, 147, 0, 0, 148, 149, 136,
- 0, 0, 0, 0, 0, 137, 0, 0, 132, 133,
- 0, 0, 138, 0, 0, 0, 139, 0, 0, 0,
- 0, 0, 54, 0, 0, 55, 18, 0, 0, 140,
- 141, 0, 0, 142, 452, 0, 0, 0, 0, 0,
- 0, 0, 144, 145, 146, 147, 0, 0, 148, 149,
- 134, 135, 0, 0, 0, 52, 0, 0, 0, 132,
- 133, 0, 0, 0, 136, 0, 0, 0, 0, 0,
- 137, 0, 0, 0, 0, 0, 0, 138, 0, 0,
- 0, 139, 0, 0, 0, 0, 0, 54, 0, 0,
- 55, 18, 0, 0, 140, 141, 0, 0, 142, 0,
- 0, 134, 135, 114, 0, 0, 52, 144, 145, 146,
- 147, 0, 0, 148, 149, 136, 0, 0, 0, 0,
- 0, 137, 0, 0, 132, 133, 0, 0, 138, 0,
- 0, 0, 139, 0, 0, 0, 0, 0, 54, 0,
- 0, 55, 18, 0, 0, 140, 141, 0, 0, 142,
- 0, 0, 0, 0, 0, 471, 0, 0, 144, 145,
- 146, 147, 0, 0, 148, 149, 134, 135, 0, 0,
- 0, 52, 0, 0, 0, 132, 133, 0, 0, 0,
- 136, 0, 0, 0, 0, 0, 137, 0, 0, 0,
- 0, 0, 0, 138, 0, 0, 0, 139, 0, 0,
- 0, 0, 0, 54, 0, 0, 55, 18, 0, 0,
- 140, 141, 0, 0, 142, 484, 0, 134, 135, 0,
- 0, 0, 52, 144, 145, 146, 147, 0, 0, 148,
- 149, 136, 0, 0, 0, 0, 0, 137, 0, 0,
- 132, 133, 0, 0, 138, 0, 0, 0, 139, 0,
- 0, 0, 0, 0, 54, 0, 0, 55, 18, 0,
- 0, 140, 141, 0, 0, 142, 494, 0, 0, 0,
- 0, 0, 0, 0, 144, 145, 146, 147, 0, 0,
- 148, 149, 134, 135, 0, 0, 0, 52, 0, 0,
- 0, 132, 133, 0, 0, 0, 136, 0, 0, 0,
- 0, 0, 137, 0, 0, 0, 0, 0, 0, 138,
- 0, 0, 0, 139, 0, 0, 0, 0, 0, 54,
- 0, 0, 55, 18, 0, 0, 140, 141, 0, 0,
- 142, 543, 0, 134, 135, 0, 0, 0, 52, 144,
- 145, 146, 147, 0, 0, 148, 149, 136, 0, 0,
- 0, 0, 0, 137, 0, 0, 132, 133, 0, 0,
- 138, 0, 0, 0, 139, 0, 0, 0, 0, 0,
- 54, 0, 0, 55, 18, 0, 0, 140, 141, 0,
- 0, 142, 0, 0, 0, 0, 0, 566, 0, 0,
- 144, 145, 146, 147, 0, 0, 148, 149, 134, 135,
- 0, 0, 0, 52, 0, 0, 0, 132, 133, 0,
- 0, 0, 136, 0, 0, 0, 0, 0, 137, 0,
- 0, 0, 0, 0, 0, 138, 0, 0, 0, 139,
- 0, 0, 0, 0, 0, 54, 0, 0, 55, 18,
- 0, 0, 140, 141, 0, 0, 142, 580, 0, 134,
- 135, 0, 0, 0, 52, 144, 145, 146, 147, 0,
- 0, 148, 149, 136, 0, 0, 0, 0, 0, 137,
- 0, 0, 0, 0, 0, 0, 138, 0, 0, 0,
- 139, 0, 0, 0, 0, 0, 54, 0, 0, 55,
- 18, 0, 0, 140, 141, 0, 0, 142, 0, 0,
- 0, 0, 0, 0, 0, 0, 144, 145, 146, 147,
- 0, 0, 148, 149, 269, 134, 135, 550, 270, 271,
- 52, 272, 0, 0, 273, 0, 0, 0, 274, 136,
- 0, 0, 551, 0, 0, 137, 275, 4, 276, 0,
- 277, 278, 138, 279, 0, 0, 139, 0, 0, 0,
- 0, 0, 54, 0, 0, 55, 18, 0, 0, 0,
- 0, 0, 0, 280, 0, 192, 574, 0, 0, 282,
- 0, 0, 144, 145, 146, 147, 0, 0, 148, 149,
- 269, 134, 135, 550, 270, 271, 52, 272, 0, 0,
- 273, 0, 0, 0, 274, 136, 0, 0, 551, 0,
- 0, 137, 275, 4, 276, 0, 277, 278, 138, 279,
- 0, 0, 139, 0, 0, 0, 0, 0, 54, 0,
- 0, 55, 18, 0, 0, 0, 0, 0, 0, 280,
- 0, 192, 587, 0, 0, 282, 0, 0, 144, 145,
- 146, 147, 0, 0, 148, 149, 269, 134, 135, 0,
- 270, 271, 52, 272, 0, 0, 273, 0, 0, 0,
- 274, 136, 0, 0, 0, 0, 0, 137, 275, 4,
- 276, 0, 277, 278, 138, 279, 0, 0, 139, 0,
- 0, 0, 0, 0, 54, 0, 0, 55, 18, 0,
- 0, 0, 0, 0, 0, 280, 0, 192, 281, 0,
- 0, 282, 0, 0, 144, 145, 146, 147, 0, 0,
- 148, 149, 269, 134, 135, 0, 270, 271, 52, 272,
- 0, 0, 273, 0, 0, 0, 274, 136, 0, 0,
- 0, 0, 0, 137, 275, 4, 276, 0, 277, 278,
- 138, 279, 0, 0, 139, 0, 0, 0, 0, 0,
- 54, 0, 0, 55, 18, 0, 0, 0, 0, 0,
- 0, 280, 0, 192, 408, 0, 0, 282, 0, 0,
- 144, 145, 146, 147, 0, 0, 148, 149, 269, 134,
- 135, 0, 270, 271, 52, 272, 0, 0, 273, 0,
- 0, 0, 274, 136, 0, 0, 0, 0, 0, 476,
- 275, 4, 276, 0, 277, 278, 138, 279, 0, 0,
- 477, 0, 0, 0, 0, 0, 54, 0, 0, 55,
- 18, 0, 0, 0, 0, 0, 0, 280, 0, 192,
- 478, 0, 0, 282, 0, 0, 144, 145, 146, 147,
- 0, 0, 148, 149, 269, 134, 135, 0, 270, 271,
- 52, 272, 0, 0, 273, 0, 0, 0, 274, 136,
- 0, 0, 0, 0, 0, 137, 275, 4, 276, 0,
- 277, 278, 138, 279, 0, 0, 139, 0, 0, 0,
- 0, 0, 54, 0, 0, 55, 18, 0, 0, 0,
- 0, 0, 0, 280, 0, 192, 514, 0, 0, 282,
- 0, 0, 144, 145, 146, 147, 0, 0, 148, 149,
- 269, 134, 135, 0, 270, 271, 52, 272, 0, 0,
- 273, 0, 0, 0, 274, 136, 0, 0, 0, 0,
- 0, 137, 275, 4, 276, 0, 277, 278, 138, 279,
- 0, 0, 139, 0, 0, 0, 0, 0, 54, 0,
- 0, 55, 18, 0, 0, 0, 0, 0, 0, 280,
- 0, 192, 517, 0, 0, 282, 0, 0, 144, 145,
- 146, 147, 0, 0, 148, 149, 269, 134, 135, 0,
- 270, 271, 52, 272, 0, 0, 273, 0, 0, 0,
- 274, 136, 0, 0, 0, 0, 0, 137, 275, 4,
- 276, 0, 277, 278, 138, 279, 0, 0, 139, 0,
- 0, 0, 0, 0, 54, 0, 0, 55, 18, 0,
- 0, 0, 0, 0, 0, 280, 0, 192, 542, 0,
- 0, 282, 0, 0, 144, 145, 146, 147, 0, 0,
- 148, 149, 269, 134, 135, 0, 270, 271, 52, 272,
- 0, 0, 273, 0, 0, 0, 274, 136, 0, 0,
- 0, 0, 0, 137, 275, 4, 276, 0, 277, 278,
- 138, 279, 0, 0, 139, 0, 0, 0, 0, 0,
- 54, 0, 0, 55, 18, 0, 0, 0, 0, 0,
- 0, 280, 0, 192, 0, 0, 0, 282, 0, 0,
- 144, 145, 146, 147, 0, 0, 148, 149, 411, 134,
- 135, 0, 270, 271, 52, 272, 0, 0, 273, 0,
- 0, 0, 274, 136, 0, 0, 0, 0, 0, 137,
- 275, 0, 276, 0, 277, 278, 138, 279, 0, 0,
- 139, 0, 0, 0, 0, 0, 54, 0, 0, 55,
- 18, 0, 0, 0, 0, 0, 0, 280, 0, 192,
- 0, 0, 0, 282, 0, 0, 144, 145, 146, 147,
- 0, 0, 148, 149, 411, 134, 135, 0, 522, 271,
- 52, 272, 0, 0, 273, 0, 0, 0, 274, 136,
- 0, 0, 0, 0, 0, 137, 275, 0, 276, 0,
- 277, 278, 138, 279, 0, 0, 139, 0, 0, 0,
- 0, 0, 54, 0, 0, 55, 18, 0, 0, 0,
- 0, 0, 0, 280, 0, 192, 0, 0, 0, 282,
- 0, 0, 144, 145, 146, 147, 0, 0, 148, 149
-};
-
-static const short yycheck[] = { 3,
- 4, 213, 309, 192, 143, 88, 1, 121, 352, 5,
- 37, 37, 93, 290, 0, 15, 225, 123, 104, 38,
- 229, 230, 8, 9, 10, 119, 45, 8, 32, 33,
- 47, 35, 115, 86, 117, 119, 63, 53, 63, 43,
- 26, 68, 68, 29, 30, 62, 119, 119, 29, 53,
- 72, 37, 138, 57, 44, 555, 510, 63, 44, 78,
- 2, 44, 346, 5, 86, 55, 132, 133, 134, 135,
- 95, 61, 55, 573, 140, 141, 103, 67, 61, 96,
- 94, 97, 68, 367, 67, 75, 100, 87, 92, 93,
- 86, 47, 119, 119, 36, 37, 94, 124, 40, 443,
- 95, 44, 100, 197, 108, 211, 62, 50, 202, 99,
- 204, 138, 566, 197, 72, 142, 99, 103, 76, 123,
- 499, 63, 195, 206, 197, 197, 68, 52, 214, 297,
- 72, 585, 341, 119, 76, 344, 304, 50, 306, 82,
- 96, 101, 85, 86, 93, 86, 430, 526, 97, 57,
- 529, 94, 101, 526, 158, 99, 529, 8, 99, 10,
- 118, 103, 104, 470, 471, 192, 450, 97, 195, 82,
- 197, 197, 85, 86, 86, 37, 118, 119, 29, 245,
- 246, 247, 124, 277, 92, 93, 213, 99, 192, 94,
- 132, 133, 134, 135, 99, 100, 138, 44, 140, 141,
- 142, 63, 283, 510, 583, 482, 68, 211, 9, 97,
- 583, 197, 591, 101, 61, 594, 355, 596, 591, 223,
- 67, 594, 95, 596, 99, 26, 99, 213, 44, 30,
- 257, 109, 516, 97, 94, 239, 240, 101, 515, 428,
- 100, 103, 44, 44, 327, 61, 98, 65, 50, 67,
- 192, 67, 99, 195, 72, 197, 95, 119, 76, 566,
- 287, 100, 124, 290, 142, 143, 97, 94, 86, 273,
- 97, 213, 214, 94, 101, 279, 97, 561, 585, 283,
- 82, 347, 309, 85, 86, 99, 290, 101, 36, 94,
- 502, 480, 40, 297, 99, 100, 92, 100, 575, 326,
- 304, 97, 306, 245, 246, 247, 248, 249, 250, 251,
- 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
- 262, 263, 264, 309, 72, 439, 407, 67, 76, 192,
- 96, 499, 72, 195, 100, 197, 76, 94, 452, 94,
- 326, 93, 97, 100, 94, 287, 86, 499, 290, 94,
- 100, 213, 98, 94, 341, 100, 104, 344, 526, 100,
- 238, 529, 98, 241, 499, 94, 44, 309, 462, 537,
- 118, 100, 50, 94, 526, 489, 442, 529, 546, 100,
- 44, 60, 192, 497, 326, 64, 50, 265, 95, 416,
- 138, 526, 560, 271, 529, 98, 274, 18, 19, 20,
- 21, 428, 280, 407, 82, 347, 98, 85, 86, 100,
- 352, 253, 254, 255, 256, 583, 94, 511, 82, 99,
- 100, 85, 86, 591, 428, 287, 594, 290, 596, 101,
- 99, 583, 101, 95, 297, 97, 57, 91, 92, 591,
- 499, 304, 594, 306, 596, 343, 309, 345, 583, 5,
- 6, 7, 101, 480, 101, 482, 591, 99, 100, 594,
- 101, 596, 340, 557, 326, 97, 214, 526, 91, 92,
- 529, 11, 350, 12, 416, 502, 480, 355, 482, 13,
- 290, 45, 46, 91, 92, 93, 428, 297, 515, 97,
- 8, 9, 10, 101, 304, 499, 306, 3, 4, 309,
- 442, 443, 91, 92, 91, 92, 93, 16, 17, 513,
- 97, 515, 454, 391, 101, 14, 502, 95, 192, 397,
- 398, 93, 526, 53, 583, 529, 95, 405, 555, 45,
- 46, 97, 591, 537, 67, 594, 97, 596, 480, 44,
- 482, 93, 546, 421, 422, 50, 573, 94, 575, 45,
- 46, 555, 248, 249, 416, 96, 560, 250, 251, 252,
- 502, 44, 67, 258, 259, 428, 67, 50, 93, 573,
- 448, 575, 93, 515, 93, 88, 59, 82, 61, 583,
- 85, 86, 93, 93, 67, 0, 93, 591, 88, 93,
- 594, 99, 596, 8, 9, 10, 99, 99, 95, 82,
- 93, 192, 85, 86, 99, 99, 98, 470, 471, 98,
- 98, 26, 93, 555, 29, 30, 290, 480, 428, 482,
- 99, 99, 37, 297, 99, 192, 99, 94, 506, 44,
- 304, 573, 306, 575, 100, 309, 499, 66, 100, 44,
- 502, 99, 98, 97, 86, 50, 98, 510, 94, 91,
- 92, 93, 515, 68, 59, 97, 61, 94, 94, 101,
- 470, 471, 67, 526, 99, 93, 529, 545, 93, 99,
- 480, 549, 482, 551, 537, 94, 93, 82, 192, 93,
- 85, 86, 95, 546, 94, 93, 56, 56, 99, 499,
- 95, 96, 555, 94, 94, 94, 93, 560, 88, 290,
- 510, 99, 88, 566, 119, 515, 297, 99, 99, 94,
- 573, 99, 575, 304, 94, 306, 526, 99, 309, 529,
- 583, 99, 585, 290, 0, 56, 44, 537, 591, 94,
- 297, 594, 50, 596, 0, 257, 546, 304, 10, 306,
- 46, 59, 309, 61, 80, 555, 197, 108, 195, 67,
- 560, 326, 425, 45, 428, 68, 566, 463, 309, 553,
- 553, 192, 463, 573, 82, 575, 309, 85, 86, 260,
- 225, 261, 454, 583, -1, 585, 290, 95, 96, 263,
- 262, 591, 197, 297, 594, -1, 596, 264, 44, -1,
- 304, -1, 306, -1, 50, 309, 470, 471, 268, -1,
- -1, 44, -1, 59, -1, 61, 480, 50, 482, -1,
- -1, 67, -1, -1, -1, -1, 59, -1, 61, -1,
- -1, -1, -1, -1, 67, 499, 82, -1, -1, 85,
- 86, -1, -1, -1, -1, -1, 510, 428, -1, 82,
- 96, 515, 85, 86, -1, -1, -1, -1, -1, -1,
- -1, -1, 526, 96, -1, 529, -1, -1, -1, 290,
- 192, 428, -1, 537, -1, -1, 297, -1, -1, -1,
- -1, -1, 546, 304, -1, 306, -1, -1, 309, 470,
- 471, 555, -1, -1, -1, -1, 560, -1, -1, 480,
- -1, 482, 566, -1, -1, -1, -1, -1, -1, 573,
- -1, 575, -1, 470, 471, -1, -1, -1, 499, 583,
- -1, 585, -1, 480, 428, 482, -1, 591, -1, 510,
- 594, -1, 596, -1, 515, -1, -1, -1, -1, -1,
- -1, -1, 499, -1, 86, 526, -1, -1, 529, 91,
- 92, 93, -1, 510, -1, 97, 537, -1, 515, 101,
- -1, -1, -1, -1, -1, 546, 470, 471, 290, 526,
- -1, -1, 529, -1, 555, 297, 480, -1, 482, 560,
- 537, -1, 304, -1, 306, 566, -1, 309, -1, 546,
- -1, -1, 573, -1, 575, 499, -1, -1, 555, -1,
- -1, -1, 583, 560, 585, -1, 510, 428, -1, 566,
- 591, 515, -1, 594, -1, 596, 573, -1, 575, -1,
- -1, -1, 526, -1, -1, 529, 583, -1, 585, -1,
- -1, -1, -1, 537, 591, -1, -1, 594, -1, 596,
- -1, -1, 546, -1, -1, -1, -1, -1, -1, 470,
- 471, 555, -1, -1, -1, -1, 560, -1, -1, 480,
- -1, 482, 566, -1, -1, -1, -1, -1, -1, 573,
- -1, 575, -1, -1, -1, -1, -1, -1, 499, 583,
- -1, 585, 44, 45, 46, -1, -1, 591, 50, 510,
- 594, -1, 596, -1, 515, -1, -1, 59, -1, -1,
- -1, -1, -1, 65, -1, 526, 428, -1, 529, -1,
- 72, -1, -1, -1, 76, -1, 537, -1, -1, -1,
- 82, -1, -1, 85, 86, 546, -1, -1, -1, -1,
- -1, 93, -1, -1, 555, -1, -1, -1, -1, 560,
- 102, 103, 104, 105, -1, 566, 108, 109, 470, 471,
- -1, -1, 573, -1, 575, -1, -1, -1, 480, -1,
- 482, -1, 583, -1, 585, -1, -1, -1, -1, -1,
- 591, -1, -1, 594, -1, 596, -1, 499, 132, 133,
- 134, 135, -1, -1, -1, -1, 140, 141, 510, -1,
- -1, -1, -1, 515, -1, -1, -1, -1, -1, -1,
- 132, 133, 134, 135, 526, -1, -1, 529, 140, 141,
- -1, -1, -1, -1, -1, 537, -1, -1, -1, -1,
- -1, -1, -1, -1, 546, 45, 46, -1, -1, -1,
- 50, -1, -1, 555, -1, -1, -1, -1, 560, 59,
- -1, -1, -1, -1, 566, 65, -1, -1, -1, -1,
- -1, 573, 72, 575, -1, -1, 76, -1, -1, -1,
- -1, 583, 82, 585, -1, 85, 86, -1, -1, 591,
- -1, -1, 594, 93, 596, -1, -1, -1, -1, -1,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- -1, 245, 246, 247, 248, 249, 250, 251, 252, 253,
- 254, 255, 256, -1, 258, 259, 260, 261, 262, 263,
- 264, -1, -1, 245, 246, 247, 248, 249, 250, 251,
- 252, 253, 254, 255, 256, -1, 258, 259, 260, 261,
- 262, 263, 264, 1, -1, 3, 4, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 45, 46, -1,
- -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
- -1, 59, -1, 347, -1, -1, -1, 65, 352, -1,
- -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, 347, -1, 85, 86, -1,
- 352, 89, 90, 50, -1, 93, -1, -1, -1, -1,
- -1, -1, 59, -1, 102, 103, 104, 105, 65, -1,
- 108, 109, -1, -1, -1, 72, -1, -1, -1, 76,
- 3, 4, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
- -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
- -1, 108, 109, -1, -1, -1, -1, -1, 442, 443,
- -1, -1, 45, 46, -1, -1, -1, 50, -1, -1,
- 454, -1, -1, -1, -1, -1, 59, -1, -1, -1,
- 442, 443, 65, -1, -1, 3, 4, -1, -1, 72,
- -1, -1, 454, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, -1, 95, 96, -1, -1, -1, 100, -1, 102,
- 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
- -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
- -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
- 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, 89, 90, -1, -1, 93, -1, 95, 96, -1,
- -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 45, 46, -1, -1, -1, 50, -1, -1,
- -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
- -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, -1, 95, 45, 46, -1, -1, -1, 50, 102,
- 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
- -1, -1, -1, 65, -1, -1, 3, 4, -1, -1,
- 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
- -1, 93, 94, -1, -1, -1, -1, -1, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
- -1, -1, -1, 50, -1, -1, -1, 3, 4, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
- -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
- 46, -1, 99, -1, 50, 102, 103, 104, 105, -1,
- -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
- -1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
- -1, -1, 98, -1, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
- -1, -1, -1, 3, 4, -1, -1, -1, 59, -1,
- -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
- -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
- -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
- -1, -1, 93, 94, -1, 45, 46, -1, -1, -1,
- 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
- -1, -1, -1, -1, -1, 65, -1, -1, 3, 4,
- -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
- 90, -1, -1, 93, 94, -1, -1, -1, -1, -1,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- 45, 46, -1, -1, -1, 50, -1, -1, -1, 3,
- 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
- 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
- -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
- 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
- -1, 45, 46, 98, -1, -1, 50, 102, 103, 104,
- 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
- -1, 65, -1, -1, 3, 4, -1, -1, 72, -1,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
- -1, -1, -1, -1, -1, 99, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
- -1, 50, -1, -1, -1, 3, 4, -1, -1, -1,
- 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
- -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
- -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
- 89, 90, -1, -1, 93, 94, -1, 45, 46, -1,
- -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
- 109, 59, -1, -1, -1, -1, -1, 65, -1, -1,
- 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, 89, 90, -1, -1, 93, 94, -1, -1, -1,
- -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 45, 46, -1, -1, -1, 50, -1, -1,
- -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
- -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
- 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
- -1, -1, -1, 65, -1, -1, 3, 4, -1, -1,
- 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
- -1, 93, -1, -1, -1, -1, -1, 99, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
- -1, -1, -1, 50, -1, -1, -1, 3, 4, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
- -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, 94, -1, 45,
- 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
- -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
- -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 44, 45, 46, 47, 48, 49,
- 50, 51, -1, -1, 54, -1, -1, -1, 58, 59,
- -1, -1, 62, -1, -1, 65, 66, 67, 68, -1,
- 70, 71, 72, 73, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
- -1, -1, -1, 93, -1, 95, 96, -1, -1, 99,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
- 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
- -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
- -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
- 48, 49, 50, 51, -1, -1, 54, -1, -1, -1,
- 58, 59, -1, -1, -1, -1, -1, 65, 66, 67,
- 68, -1, 70, 71, 72, 73, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, -1, -1, -1, -1, 93, -1, 95, 96, -1,
- -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 44, 45, 46, -1, 48, 49, 50, 51,
- -1, -1, 54, -1, -1, -1, 58, 59, -1, -1,
- -1, -1, -1, 65, 66, 67, 68, -1, 70, 71,
- 72, 73, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
- -1, 93, -1, 95, 96, -1, -1, 99, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 44, 45,
- 46, -1, 48, 49, 50, 51, -1, -1, 54, -1,
- -1, -1, 58, 59, -1, -1, -1, -1, -1, 65,
- 66, 67, 68, -1, 70, 71, 72, 73, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, -1, -1, -1, -1, 93, -1, 95,
- 96, -1, -1, 99, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 44, 45, 46, -1, 48, 49,
- 50, 51, -1, -1, 54, -1, -1, -1, 58, 59,
- -1, -1, -1, -1, -1, 65, 66, 67, 68, -1,
- 70, 71, 72, 73, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
- -1, -1, -1, 93, -1, 95, 96, -1, -1, 99,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- 44, 45, 46, -1, 48, 49, 50, 51, -1, -1,
- 54, -1, -1, -1, 58, 59, -1, -1, -1, -1,
- -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
- -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
- 48, 49, 50, 51, -1, -1, 54, -1, -1, -1,
- 58, 59, -1, -1, -1, -1, -1, 65, 66, 67,
- 68, -1, 70, 71, 72, 73, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, -1, -1, -1, -1, 93, -1, 95, 96, -1,
- -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 44, 45, 46, -1, 48, 49, 50, 51,
- -1, -1, 54, -1, -1, -1, 58, 59, -1, -1,
- -1, -1, -1, 65, 66, 67, 68, -1, 70, 71,
- 72, 73, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
- -1, 93, -1, 95, -1, -1, -1, 99, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 44, 45,
- 46, -1, 48, 49, 50, 51, -1, -1, 54, -1,
- -1, -1, 58, 59, -1, -1, -1, -1, -1, 65,
- 66, -1, 68, -1, 70, 71, 72, 73, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, -1, -1, -1, -1, 93, -1, 95,
- -1, -1, -1, 99, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 44, 45, 46, -1, 48, 49,
- 50, 51, -1, -1, 54, -1, -1, -1, 58, 59,
- -1, -1, -1, -1, -1, 65, 66, -1, 68, -1,
- 70, 71, 72, 73, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
- -1, -1, -1, 93, -1, 95, -1, -1, -1, 99,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109
-};
-#define YYPURE 1
-
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/cygnus/gnupro-98r2/share/bison.simple"
-
-/* Skeleton output parser for bison,
- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-#ifndef alloca
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
-#include <alloca.h>
-#else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
-#include <malloc.h>
-#else /* not MSDOS, or __TURBOC__ */
-#if defined(_AIX)
-#include <malloc.h>
- #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#ifdef __cplusplus
-extern "C" {
-void *alloca (unsigned int);
-};
-#else /* not __cplusplus */
-void *alloca ();
-#endif /* not __cplusplus */
-#endif /* __hpux */
-#endif /* not _AIX */
-#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc. */
-#endif /* not GNU C. */
-#endif /* alloca not defined. */
-
-/* This is the parser code that is written into each bison parser
- when the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-/* Note: there must be only one dollar sign in this file.
- It is replaced by the list of actions, each action
- as one case of the switch. */
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-#define YYACCEPT return(0)
-#define YYABORT return(1)
-#define YYERROR goto yyerrlab1
-/* Like YYERROR except do call yyerror.
- This remains here temporarily to ease the
- transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-#define YYFAIL goto yyerrlab
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(token, value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { yychar = (token), yylval = (value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { yyerror ("syntax error: cannot back up"); YYERROR; } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-#ifndef YYPURE
-#define YYLEX yylex()
-#endif
-
-#ifdef YYPURE
-#ifdef YYLSP_NEEDED
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval, &yylloc)
-#endif
-#else /* not YYLSP_NEEDED */
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval)
-#endif
-#endif /* not YYLSP_NEEDED */
-#endif
-
-/* If nonreentrant, generate the variables here */
-
-#ifndef YYPURE
-
-int yychar; /* the lookahead symbol */
-YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-
-#ifdef YYLSP_NEEDED
-YYLTYPE yylloc; /* location data for the lookahead */
- /* symbol */
-#endif
-
-int yynerrs; /* number of parse errors so far */
-#endif /* not YYPURE */
-
-#if YYDEBUG != 0
-int yydebug; /* nonzero means print parse trace */
-/* Since this is uninitialized, it does not stop multiple parsers
- from coexisting. */
-#endif
-
-/* YYINITDEPTH indicates the initial size of the parser's stacks */
-
-#ifndef YYINITDEPTH
-#define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH is the maximum size the stacks can grow to
- (effective only if the built-in stack extension method is used). */
-
-#if YYMAXDEPTH == 0
-#undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-#define YYMAXDEPTH 10000
-#endif
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-int yyparse (void);
-#endif
-
-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
-#else /* not GNU C or C++ */
-#ifndef __cplusplus
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (to, from, count)
- char *to;
- char *from;
- int count;
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#else /* __cplusplus */
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (char *to, char *from, int count)
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#endif
-#endif
-
-#line 196 "/usr/cygnus/gnupro-98r2/share/bison.simple"
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-#ifdef __cplusplus
-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else /* not __cplusplus */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-#endif /* not __cplusplus */
-#else /* not YYPARSE_PARAM */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* not YYPARSE_PARAM */
-
-int
-yyparse(YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- register int yystate;
- register int yyn;
- register short *yyssp;
- register YYSTYPE *yyvsp;
- int yyerrstatus; /* number of tokens to shift before error messages enabled */
- int yychar1 = 0; /* lookahead token as an internal (translated) token number */
-
- short yyssa[YYINITDEPTH]; /* the state stack */
- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
-
- short *yyss = yyssa; /* refer to the stacks thru separate pointers */
- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
-
-#ifdef YYLSP_NEEDED
- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
-
-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
-#else
-#define YYPOPSTACK (yyvsp--, yyssp--)
-#endif
-
- int yystacksize = YYINITDEPTH;
-
-#ifdef YYPURE
- int yychar;
- YYSTYPE yylval;
- int yynerrs;
-#ifdef YYLSP_NEEDED
- YYLTYPE yylloc;
-#endif
-#endif
-
- YYSTYPE yyval; /* the variable used to return */
- /* semantic values from the action */
- /* routines */
-
- int yylen;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Starting parse\n");
-#endif
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss - 1;
- yyvsp = yyvs;
-#ifdef YYLSP_NEEDED
- yylsp = yyls;
-#endif
-
-/* Push a new state, which is found in yystate . */
-/* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks. */
-yynewstate:
-
- *++yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Give user a chance to reallocate the stack */
- /* Use copies of these so that the &'s don't force the real ones into memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-#ifdef YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
-#endif
-
- /* Get the current used size of the three stacks, in elements. */
- int size = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- /* Each stack pointer address is followed by the size of
- the data in use in that stack, in bytes. */
-#ifdef YYLSP_NEEDED
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yyls1, size * sizeof (*yylsp),
- &yystacksize);
-#else
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yystacksize);
-#endif
-
- yyss = yyss1; yyvs = yyvs1;
-#ifdef YYLSP_NEEDED
- yyls = yyls1;
-#endif
-#else /* no yyoverflow */
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- {
- yyerror("parser stack overflow");
- return 2;
- }
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
- yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
- yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
-#ifdef YYLSP_NEEDED
- yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
-#endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + size - 1;
- yyvsp = yyvs + size - 1;
-#ifdef YYLSP_NEEDED
- yylsp = yyls + size - 1;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Entering state %d\n", yystate);
-#endif
-
- goto yybackup;
- yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Reading a token: ");
-#endif
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Now at end of input.\n");
-#endif
- }
- else
- {
- yychar1 = YYTRANSLATE(yychar);
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
- /* Give the individual parser a way to print the precise meaning
- of a token, for further debugging info. */
-#ifdef YYPRINT
- YYPRINT (stderr, yychar, yylval);
-#endif
- fprintf (stderr, ")\n");
- }
-#endif
- }
-
- yyn += yychar1;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- goto yydefault;
-
- yyn = yytable[yyn];
-
- /* yyn is what to do for this token type in this state.
- Negative => reduce, -yyn is rule number.
- Positive => shift, yyn is new state.
- New state is final state => don't bother to shift,
- just return success.
- 0, or most negative number => error. */
-
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrlab;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- /* count tokens shifted since error; after three, turn off error status. */
- if (yyerrstatus) yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-/* Do the default action for the current state. */
-yydefault:
-
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
-
-/* Do a reduction. yyn is the number of a rule to reduce with. */
-yyreduce:
- yylen = yyr2[yyn];
- if (yylen > 0)
- yyval = yyvsp[1-yylen]; /* implement default value of the action */
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- int i;
-
- fprintf (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
- fprintf (stderr, "%s ", yytname[yyrhs[i]]);
- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
-
-
- switch (yyn) {
-
-case 10:
-#line 193 "./parse-scan.y"
-{
- /* use preset global here. FIXME */
- yyval.node = xstrdup ("int");
- ;
- break;}
-case 11:
-#line 198 "./parse-scan.y"
-{
- /* use preset global here. FIXME */
- yyval.node = xstrdup ("double");
- ;
- break;}
-case 12:
-#line 203 "./parse-scan.y"
-{
- /* use preset global here. FIXME */
- yyval.node = xstrdup ("boolean");
- ;
- break;}
-case 19:
-#line 229 "./parse-scan.y"
-{
- char *n = xmalloc (strlen (yyvsp[-2].node)+2);
- n [0] = '[';
- strcpy (n+1, yyvsp[-2].node);
- yyval.node = n;
- ;
- break;}
-case 20:
-#line 236 "./parse-scan.y"
-{
- char *n = xmalloc (strlen (yyvsp[-2].node)+2);
- n [0] = '[';
- strcpy (n+1, yyvsp[-2].node);
- yyval.node = n;
- ;
- break;}
-case 24:
-#line 256 "./parse-scan.y"
-{
- char *n = xmalloc (strlen (yyvsp[-2].node)+strlen (yyvsp[0].node)+2);
- sprintf (n, "%s.%s", yyvsp[-2].node, yyvsp[0].node);
- yyval.node = n;
- ;
- break;}
-case 38:
-#line 290 "./parse-scan.y"
-{ package_name = yyvsp[-1].node; ;
- break;}
-case 46:
-#line 317 "./parse-scan.y"
-{
- if (yyvsp[0].value == PUBLIC_TK)
- modifier_value++;
- if (yyvsp[0].value == STATIC_TK)
- modifier_value++;
- USE_ABSORBER;
- ;
- break;}
-case 47:
-#line 325 "./parse-scan.y"
-{
- if (yyvsp[0].value == PUBLIC_TK)
- modifier_value++;
- if (yyvsp[0].value == STATIC_TK)
- modifier_value++;
- USE_ABSORBER;
- ;
- break;}
-case 48:
-#line 337 "./parse-scan.y"
-{
- report_class_declaration(yyvsp[-2].node);
- modifier_value = 0;
- ;
- break;}
-case 50:
-#line 343 "./parse-scan.y"
-{ report_class_declaration(yyvsp[-2].node); ;
- break;}
-case 56:
-#line 357 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 57:
-#line 359 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 70:
-#line 389 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 71:
-#line 391 "./parse-scan.y"
-{ modifier_value = 0; ;
- break;}
-case 76:
-#line 407 "./parse-scan.y"
-{ bracket_count = 0; USE_ABSORBER; ;
- break;}
-case 77:
-#line 409 "./parse-scan.y"
-{ ++bracket_count; ;
- break;}
-case 81:
-#line 424 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 83:
-#line 427 "./parse-scan.y"
-{ modifier_value = 0; ;
- break;}
-case 84:
-#line 429 "./parse-scan.y"
-{
- report_main_declaration (yyvsp[-1].declarator);
- modifier_value = 0;
- ;
- break;}
-case 85:
-#line 437 "./parse-scan.y"
-{
- struct method_declarator *d;
- NEW_METHOD_DECLARATOR (d, yyvsp[-2].node, NULL);
- yyval.declarator = d;
- ;
- break;}
-case 86:
-#line 443 "./parse-scan.y"
-{
- struct method_declarator *d;
- NEW_METHOD_DECLARATOR (d, yyvsp[-3].node, yyvsp[-1].node);
- yyval.declarator = d;
- ;
- break;}
-case 89:
-#line 454 "./parse-scan.y"
-{
- char *n = xmalloc (strlen (yyvsp[-2].node)+strlen(yyvsp[0].node)+2);
- sprintf (n, "%s,%s", yyvsp[-2].node, yyvsp[0].node);
- yyval.node = n;
- ;
- break;}
-case 90:
-#line 463 "./parse-scan.y"
-{
- USE_ABSORBER;
- if (bracket_count)
- {
- int i;
- char *n = xmalloc (bracket_count + 1 + strlen (yyval.node));
- for (i = 0; i < bracket_count; ++i)
- n[i] = '[';
- strcpy (n + bracket_count, yyval.node);
- yyval.node = n;
- }
- else
- yyval.node = yyvsp[-1].node;
- ;
- break;}
-case 91:
-#line 478 "./parse-scan.y"
-{
- if (bracket_count)
- {
- int i;
- char *n = xmalloc (bracket_count + 1 + strlen (yyval.node));
- for (i = 0; i < bracket_count; ++i)
- n[i] = '[';
- strcpy (n + bracket_count, yyval.node);
- yyval.node = n;
- }
- else
- yyval.node = yyvsp[-1].node;
- ;
- break;}
-case 94:
-#line 499 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 95:
-#line 501 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 101:
-#line 518 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 103:
-#line 529 "./parse-scan.y"
-{ modifier_value = 0; ;
- break;}
-case 105:
-#line 534 "./parse-scan.y"
-{ modifier_value = 0; ;
- break;}
-case 106:
-#line 541 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 107:
-#line 543 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 114:
-#line 560 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 115:
-#line 562 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 118:
-#line 574 "./parse-scan.y"
-{ report_class_declaration (yyvsp[-1].node); modifier_value = 0; ;
- break;}
-case 119:
-#line 576 "./parse-scan.y"
-{ report_class_declaration (yyvsp[-1].node); modifier_value = 0; ;
- break;}
-case 120:
-#line 578 "./parse-scan.y"
-{ report_class_declaration (yyvsp[-2].node); modifier_value = 0; ;
- break;}
-case 121:
-#line 580 "./parse-scan.y"
-{ report_class_declaration (yyvsp[-2].node); modifier_value = 0; ;
- break;}
-case 148:
-#line 649 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 149:
-#line 651 "./parse-scan.y"
-{ modifier_value = 0; ;
- break;}
-case 173:
-#line 691 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 226:
-#line 838 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 243:
-#line 878 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 244:
-#line 880 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 246:
-#line 886 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 255:
-#line 908 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 273:
-#line 950 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 274:
-#line 952 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 279:
-#line 961 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 282:
-#line 968 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-case 337:
-#line 1087 "./parse-scan.y"
-{ USE_ABSORBER; ;
- break;}
-}
- /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/cygnus/gnupro-98r2/share/bison.simple"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-#ifdef YYLSP_NEEDED
- yylsp -= yylen;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-
-#ifdef YYLSP_NEEDED
- yylsp++;
- if (yylen == 0)
- {
- yylsp->first_line = yylloc.first_line;
- yylsp->first_column = yylloc.first_column;
- yylsp->last_line = (yylsp-1)->last_line;
- yylsp->last_column = (yylsp-1)->last_column;
- yylsp->text = 0;
- }
- else
- {
- yylsp->last_line = (yylsp+yylen-1)->last_line;
- yylsp->last_column = (yylsp+yylen-1)->last_column;
- }
-#endif
-
- /* Now "shift" the result of the reduction.
- Determine what state that goes to,
- based on the state we popped back to
- and the rule number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
-
- goto yynewstate;
-
-yyerrlab: /* here on detecting error */
-
- if (! yyerrstatus)
- /* If not already recovering from an error, report this error. */
- {
- ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- int size = 0;
- char *msg;
- int x, count;
-
- count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- size += strlen(yytname[x]) + 15, count++;
- msg = (char *) malloc(size + 15);
- if (msg != 0)
- {
- strcpy(msg, "parse error");
-
- if (count < 5)
- {
- count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- {
- strcat(msg, count == 0 ? ", expecting `" : " or `");
- strcat(msg, yytname[x]);
- strcat(msg, "'");
- count++;
- }
- }
- yyerror(msg);
- free(msg);
- }
- else
- yyerror ("parse error; also virtual memory exceeded");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror("parse error");
- }
-
- goto yyerrlab1;
-yyerrlab1: /* here on error raised explicitly by an action */
-
- if (yyerrstatus == 3)
- {
- /* if just tried and failed to reuse lookahead token after an error, discard it. */
-
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
-
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token
- after shifting the error token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this */
-
- goto yyerrhandle;
-
-yyerrdefault: /* current state does not do anything special for the error token. */
-
-#if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
- if (yyn) goto yydefault;
-#endif
-
-yyerrpop: /* pop the current state because it cannot handle the error token */
-
- if (yyssp == yyss) YYABORT;
- yyvsp--;
- yystate = *--yyssp;
-#ifdef YYLSP_NEEDED
- yylsp--;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "Error: state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
-yyerrhandle:
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
-
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
-
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting error token, ");
-#endif
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- yystate = yyn;
- goto yynewstate;
-}
-#line 1105 "./parse-scan.y"
-
-
-#include "lex.c"
-
-/* Create a new parser context */
-
-void
-java_push_parser_context ()
-{
- struct parser_ctxt *new =
- (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
-
- bzero ((PTR) new, sizeof (struct parser_ctxt));
- new->next = ctxp;
- ctxp = new;
-}
-
-/* Actions defined here */
-
-static void
-report_class_declaration (name)
- char * name;
-{
- extern int flag_dump_class, flag_list_filename;
-
- if (flag_dump_class)
- {
- if (!previous_output)
- {
- if (flag_list_filename)
- fprintf (out, "%s: ", input_filename);
- previous_output = 1;
- }
-
- if (package_name)
- fprintf (out, "%s.%s ", package_name, name);
- else
- fprintf (out, "%s ", name);
- }
-
- current_class = name;
-}
-
-static void
-report_main_declaration (declarator)
- struct method_declarator *declarator;
-{
- extern int flag_find_main;
-
- if (flag_find_main
- && modifier_value == 2
- && !strcmp (declarator->method_name, "main")
- && declarator->args
- && declarator->args [0] == '['
- && (! strcmp (declarator->args+1, "String")
- || ! strcmp (declarator->args + 1, "java.lang.String"))
- && current_class)
- {
- if (!previous_output)
- {
- if (package_name)
- fprintf (out, "%s.%s ", package_name, current_class);
- else
- fprintf (out, current_class);
- previous_output = 1;
- }
- }
-}
-
-/* Reset global status used by the report functions. */
-
-void reset_report ()
-{
- previous_output = 0;
- current_class = package_name = NULL;
-}
-
-void
-yyerror (msg)
- char *msg ATTRIBUTE_UNUSED;
-{
-}
-
-char *
-xstrdup (s)
- const char *s;
-{
- char *ret;
-
- ret = xmalloc (strlen (s) + 1);
- strcpy (ret, s);
- return ret;
-}
diff --git a/gnu/dist/toolchain/gcc/java/parse-scan.y b/gnu/dist/toolchain/gcc/java/parse-scan.y
deleted file mode 100644
index 0e890aced9f..00000000000
--- a/gnu/dist/toolchain/gcc/java/parse-scan.y
+++ /dev/null
@@ -1,1197 +0,0 @@
-/* Parser grammar for quick source code scan of Java(TM) language programs.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* This file parses Java source code. Action can be further completed
-to achieve a desired behavior. This file isn't part of the Java
-language gcc front end.
-
-The grammar conforms to the Java grammar described in "The Java(TM)
-Language Specification. J. Gosling, B. Joy, G. Steele. Addison Wesley
-1996, ISBN 0-201-63451-1"
-
-Some rules have been modified to support JDK1.1 inner classes
-definitions and other extensions. */
-
-%{
-#define JC1_LITE
-
-#include "config.h"
-#include "system.h"
-
-#include "obstack.h"
-#include "toplev.h"
-
-extern char *input_filename;
-extern FILE *finput, *out;
-
-/* Obstack for the lexer. */
-struct obstack temporary_obstack;
-
-/* The current parser context. */
-static struct parser_ctxt *ctxp;
-
-/* Error and warning counts, current line number, because they're used
- elsewhere */
-int java_error_count;
-int java_warning_count;
-int lineno;
-
-/* Tweak default rules when necessary. */
-static int absorber;
-#define USE_ABSORBER absorber = 0
-
-/* Keep track of the current class name and package name. */
-static char *current_class;
-static char *package_name;
-
-/* Keep track of whether things have be listed before. */
-static int previous_output;
-
-/* Record modifier uses */
-static int modifier_value;
-
-/* Keep track of number of bracket pairs after a variable declarator
- id. */
-static int bracket_count;
-
-/* Record a method declaration */
-struct method_declarator {
- char *method_name;
- char *args;
-};
-#define NEW_METHOD_DECLARATOR(D,N,A) \
-{ \
- (D) = \
- (struct method_declarator *)xmalloc (sizeof (struct method_declarator)); \
- (D)->method_name = (N); \
- (D)->args = (A); \
-}
-
-/* Two actions for this grammar */
-static void report_class_declaration PROTO ((char *));
-static void report_main_declaration PROTO ((struct method_declarator *));
-
-#include "lex.h"
-#include "parse.h"
-%}
-
-%union {
- char *node;
- struct method_declarator *declarator;
- int value; /* For modifiers */
-}
-
-%pure_parser
-
-/* Things defined here have to match the order of what's in the
- binop_lookup table. */
-
-%token PLUS_TK MINUS_TK MULT_TK DIV_TK REM_TK
-%token LS_TK SRS_TK ZRS_TK
-%token AND_TK XOR_TK OR_TK
-%token BOOL_AND_TK BOOL_OR_TK
-%token EQ_TK NEQ_TK GT_TK GTE_TK LT_TK LTE_TK
-
-/* This maps to the same binop_lookup entry than the token above */
-
-%token PLUS_ASSIGN_TK MINUS_ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
-%token REM_ASSIGN_TK
-%token LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK
-%token AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK
-
-
-/* Modifier TOKEN have to be kept in this order. Don't scramble it */
-
-%token PUBLIC_TK PRIVATE_TK PROTECTED_TK
-%token STATIC_TK FINAL_TK SYNCHRONIZED_TK
-%token VOLATILE_TK TRANSIENT_TK NATIVE_TK
-%token PAD_TK ABSTRACT_TK MODIFIER_TK
-
-/* Keep those two in order, too */
-%token DECR_TK INCR_TK
-
-/* From now one, things can be in any order */
-
-%token DEFAULT_TK IF_TK THROW_TK
-%token BOOLEAN_TK DO_TK IMPLEMENTS_TK
-%token THROWS_TK BREAK_TK IMPORT_TK
-%token ELSE_TK INSTANCEOF_TK RETURN_TK
-%token VOID_TK CATCH_TK INTERFACE_TK
-%token CASE_TK EXTENDS_TK FINALLY_TK
-%token SUPER_TK WHILE_TK CLASS_TK
-%token SWITCH_TK CONST_TK TRY_TK
-%token FOR_TK NEW_TK CONTINUE_TK
-%token GOTO_TK PACKAGE_TK THIS_TK
-
-%token BYTE_TK SHORT_TK INT_TK LONG_TK
-%token CHAR_TK INTEGRAL_TK
-
-%token FLOAT_TK DOUBLE_TK FP_TK
-
-%token ID_TK
-
-%token REL_QM_TK REL_CL_TK NOT_TK NEG_TK
-
-%token ASSIGN_ANY_TK ASSIGN_TK
-%token OP_TK CP_TK OCB_TK CCB_TK OSB_TK CSB_TK SC_TK C_TK DOT_TK
-
-%token STRING_LIT_TK CHAR_LIT_TK INT_LIT_TK FP_LIT_TK
-%token TRUE_TK FALSE_TK BOOL_LIT_TK NULL_TK
-
-%type <node> ID_TK identifier name simple_name qualified_name type
- primitive_type reference_type array_type formal_parameter_list
- formal_parameter class_or_interface_type class_type interface_type
-%type <declarator> method_declarator
-%type <value> MODIFIER_TK
-
-%%
-/* 19.2 Production from 2.3: The Syntactic Grammar */
-goal:
- compilation_unit
-;
-
-/* 19.3 Productions from 3: Lexical structure */
-literal:
- INT_LIT_TK
-| FP_LIT_TK
-| BOOL_LIT_TK
-| CHAR_LIT_TK
-| STRING_LIT_TK
-| NULL_TK
-;
-
-/* 19.4 Productions from 4: Types, Values and Variables */
-type:
- primitive_type
-| reference_type
-;
-
-primitive_type:
- INTEGRAL_TK
- {
- /* use preset global here. FIXME */
- $$ = xstrdup ("int");
- }
-| FP_TK
- {
- /* use preset global here. FIXME */
- $$ = xstrdup ("double");
- }
-| BOOLEAN_TK
- {
- /* use preset global here. FIXME */
- $$ = xstrdup ("boolean");
- }
-;
-
-reference_type:
- class_or_interface_type
-| array_type
-;
-
-class_or_interface_type:
- name
-;
-
-class_type:
- class_or_interface_type /* Default rule */
-;
-
-interface_type:
- class_or_interface_type
-;
-
-array_type:
- primitive_type OSB_TK CSB_TK
-| name OSB_TK CSB_TK
- {
- char *n = xmalloc (strlen ($1)+2);
- n [0] = '[';
- strcpy (n+1, $1);
- $$ = n;
- }
-| array_type OSB_TK CSB_TK
- {
- char *n = xmalloc (strlen ($1)+2);
- n [0] = '[';
- strcpy (n+1, $1);
- $$ = n;
- }
-;
-
-/* 19.5 Productions from 6: Names */
-name:
- simple_name /* Default rule */
-| qualified_name /* Default rule */
-;
-
-simple_name:
- identifier /* Default rule */
-;
-
-qualified_name:
- name DOT_TK identifier
- {
- char *n = xmalloc (strlen ($1)+strlen ($3)+2);
- sprintf (n, "%s.%s", $1, $3);
- $$ = n;
- }
-;
-
-identifier:
- ID_TK
-;
-
-/* 19.6: Production from 7: Packages */
-compilation_unit:
-| package_declaration
-| import_declarations
-| type_declarations
-| package_declaration import_declarations
-| package_declaration type_declarations
-| import_declarations type_declarations
-| package_declaration import_declarations type_declarations
-;
-
-import_declarations:
- import_declaration
-| import_declarations import_declaration
-;
-
-type_declarations:
- type_declaration
-| type_declarations type_declaration
-;
-
-package_declaration:
- PACKAGE_TK name SC_TK
- { package_name = $2; }
-;
-
-import_declaration:
- single_type_import_declaration
-| type_import_on_demand_declaration
-;
-
-single_type_import_declaration:
- IMPORT_TK name SC_TK
-;
-
-type_import_on_demand_declaration:
- IMPORT_TK name DOT_TK MULT_TK SC_TK
-;
-
-type_declaration:
- class_declaration
-| interface_declaration
-| SC_TK
-;
-
-/* 19.7 Shortened from the original:
- modifiers: modifier | modifiers modifier
- modifier: any of public... */
-modifiers:
- MODIFIER_TK
- {
- if ($1 == PUBLIC_TK)
- modifier_value++;
- if ($1 == STATIC_TK)
- modifier_value++;
- USE_ABSORBER;
- }
-| modifiers MODIFIER_TK
- {
- if ($2 == PUBLIC_TK)
- modifier_value++;
- if ($2 == STATIC_TK)
- modifier_value++;
- USE_ABSORBER;
- }
-;
-
-/* 19.8.1 Production from $8.1: Class Declaration */
-class_declaration:
- modifiers CLASS_TK identifier super interfaces
- {
- report_class_declaration($3);
- modifier_value = 0;
- }
- class_body
-| CLASS_TK identifier super interfaces
- { report_class_declaration($2); }
- class_body
-;
-
-super:
-| EXTENDS_TK class_type
-;
-
-interfaces:
-| IMPLEMENTS_TK interface_type_list
-;
-
-interface_type_list:
- interface_type
- { USE_ABSORBER; }
-| interface_type_list C_TK interface_type
- { USE_ABSORBER; }
-;
-
-class_body:
- OCB_TK CCB_TK
-| OCB_TK class_body_declarations CCB_TK
-;
-
-class_body_declarations:
- class_body_declaration
-| class_body_declarations class_body_declaration
-;
-
-class_body_declaration:
- class_member_declaration
-| static_initializer
-| constructor_declaration
-| block /* Added, JDK1.1, instance initializer */
-;
-
-class_member_declaration:
- field_declaration
-| method_declaration
-| class_declaration /* Added, JDK1.1 inner classes */
-| interface_declaration /* Added, JDK1.1 inner classes */
-;
-
-/* 19.8.2 Productions from 8.3: Field Declarations */
-field_declaration:
- type variable_declarators SC_TK
- { USE_ABSORBER; }
-| modifiers type variable_declarators SC_TK
- { modifier_value = 0; }
-;
-
-variable_declarators:
- /* Should we use build_decl_list () instead ? FIXME */
- variable_declarator /* Default rule */
-| variable_declarators C_TK variable_declarator
-;
-
-variable_declarator:
- variable_declarator_id
-| variable_declarator_id ASSIGN_TK variable_initializer
-;
-
-variable_declarator_id:
- identifier
- { bracket_count = 0; USE_ABSORBER; }
-| variable_declarator_id OSB_TK CSB_TK
- { ++bracket_count; }
-;
-
-variable_initializer:
- expression
-| array_initializer
-;
-
-/* 19.8.3 Productions from 8.4: Method Declarations */
-method_declaration:
- method_header method_body
-;
-
-method_header:
- type method_declarator throws
- { USE_ABSORBER; }
-| VOID_TK method_declarator throws
-| modifiers type method_declarator throws
- { modifier_value = 0; }
-| modifiers VOID_TK method_declarator throws
- {
- report_main_declaration ($3);
- modifier_value = 0;
- }
-;
-
-method_declarator:
- identifier OP_TK CP_TK
- {
- struct method_declarator *d;
- NEW_METHOD_DECLARATOR (d, $1, NULL);
- $$ = d;
- }
-| identifier OP_TK formal_parameter_list CP_TK
- {
- struct method_declarator *d;
- NEW_METHOD_DECLARATOR (d, $1, $3);
- $$ = d;
- }
-| method_declarator OSB_TK CSB_TK
-;
-
-formal_parameter_list:
- formal_parameter
-| formal_parameter_list C_TK formal_parameter
- {
- char *n = xmalloc (strlen ($1)+strlen($3)+2);
- sprintf (n, "%s,%s", $1, $3);
- $$ = n;
- }
-;
-
-formal_parameter:
- type variable_declarator_id
- {
- USE_ABSORBER;
- if (bracket_count)
- {
- int i;
- char *n = xmalloc (bracket_count + 1 + strlen ($$));
- for (i = 0; i < bracket_count; ++i)
- n[i] = '[';
- strcpy (n + bracket_count, $$);
- $$ = n;
- }
- else
- $$ = $1;
- }
-| modifiers type variable_declarator_id /* Added, JDK1.1 final locals */
- {
- if (bracket_count)
- {
- int i;
- char *n = xmalloc (bracket_count + 1 + strlen ($$));
- for (i = 0; i < bracket_count; ++i)
- n[i] = '[';
- strcpy (n + bracket_count, $$);
- $$ = n;
- }
- else
- $$ = $2;
- }
-;
-
-throws:
-| THROWS_TK class_type_list
-;
-
-class_type_list:
- class_type
- { USE_ABSORBER; }
-| class_type_list C_TK class_type
- { USE_ABSORBER; }
-;
-
-method_body:
- block
-| block SC_TK
-| SC_TK
-;
-
-/* 19.8.4 Productions from 8.5: Static Initializers */
-static_initializer:
- static block
-| static block SC_TK /* Shouldn't be here. FIXME */
-;
-
-static: /* Test lval.sub_token here */
- MODIFIER_TK
- { USE_ABSORBER; }
-;
-
-/* 19.8.5 Productions from 8.6: Constructor Declarations */
-/* NOTE FOR FURTHER WORK ON CONSTRUCTORS:
- - If a forbidded modifier is found, the the error is either the use of
- a forbidded modifier for a constructor OR bogus attempt to declare a
- method without having specified the return type. FIXME */
-constructor_declaration:
- constructor_declarator throws constructor_body
-| modifiers constructor_declarator throws constructor_body
- { modifier_value = 0; }
-/* extra SC_TK, FIXME */
-| constructor_declarator throws constructor_body SC_TK
-/* extra SC_TK, FIXME */
-| modifiers constructor_declarator throws constructor_body SC_TK
- { modifier_value = 0; }
-/* I'm not happy with the SC_TK addition. It isn't in the grammer and should
- probably be matched by and empty statement. But it doesn't work. FIXME */
-;
-
-constructor_declarator:
- simple_name OP_TK CP_TK
- { USE_ABSORBER; }
-| simple_name OP_TK formal_parameter_list CP_TK
- { USE_ABSORBER; }
-;
-
-constructor_body:
- OCB_TK CCB_TK
-| OCB_TK explicit_constructor_invocation CCB_TK
-| OCB_TK block_statements CCB_TK
-| OCB_TK explicit_constructor_invocation block_statements CCB_TK
-;
-
-/* Error recovery for that rule moved down expression_statement: rule. */
-explicit_constructor_invocation:
- this_or_super OP_TK CP_TK SC_TK
-| this_or_super OP_TK argument_list CP_TK SC_TK
- /* Added, JDK1.1 inner classes. Modified because the rule
- 'primary' couldn't work. */
-| name DOT_TK SUPER_TK OP_TK argument_list CP_TK SC_TK
- { USE_ABSORBER; }
-| name DOT_TK SUPER_TK OP_TK CP_TK SC_TK
- { USE_ABSORBER; }
-;
-
-this_or_super: /* Added, simplifies error diagnostics */
- THIS_TK
-| SUPER_TK
-;
-
-/* 19.9 Productions from 9: Interfaces */
-/* 19.9.1 Productions from 9.1: Interfaces Declarations */
-interface_declaration:
- INTERFACE_TK identifier interface_body
- { report_class_declaration ($2); modifier_value = 0; }
-| modifiers INTERFACE_TK identifier interface_body
- { report_class_declaration ($3); modifier_value = 0; }
-| INTERFACE_TK identifier extends_interfaces interface_body
- { report_class_declaration ($2); modifier_value = 0; }
-| modifiers INTERFACE_TK identifier extends_interfaces interface_body
- { report_class_declaration ($3); modifier_value = 0; }
-;
-
-extends_interfaces:
- EXTENDS_TK interface_type
-| extends_interfaces C_TK interface_type
-;
-
-interface_body:
- OCB_TK CCB_TK
-| OCB_TK interface_member_declarations CCB_TK
-;
-
-interface_member_declarations:
- interface_member_declaration
-| interface_member_declarations interface_member_declaration
-;
-
-interface_member_declaration:
- constant_declaration
-| abstract_method_declaration
-| class_declaration /* Added, JDK1.1 inner classes */
-| interface_declaration /* Added, JDK1.1 inner classes */
-;
-
-constant_declaration:
- field_declaration
-;
-
-abstract_method_declaration:
- method_header SC_TK
-;
-
-/* 19.10 Productions from 10: Arrays */
-array_initializer:
- OCB_TK CCB_TK
-| OCB_TK variable_initializers CCB_TK
-| OCB_TK C_TK CCB_TK
-| OCB_TK variable_initializers C_TK CCB_TK
-;
-
-variable_initializers:
- variable_initializer
-| variable_initializers C_TK variable_initializer
-;
-
-/* 19.11 Production from 14: Blocks and Statements */
-block:
- OCB_TK CCB_TK
-| OCB_TK block_statements CCB_TK
-;
-
-block_statements:
- block_statement
-| block_statements block_statement
-;
-
-block_statement:
- local_variable_declaration_statement
-| statement
-| class_declaration /* Added, JDK1.1 inner classes */
-;
-
-local_variable_declaration_statement:
- local_variable_declaration SC_TK /* Can't catch missing ';' here */
-;
-
-local_variable_declaration:
- type variable_declarators
- { USE_ABSORBER; }
-| modifiers type variable_declarators /* Added, JDK1.1 final locals */
- { modifier_value = 0; }
-;
-
-statement:
- statement_without_trailing_substatement
-| labeled_statement
-| if_then_statement
-| if_then_else_statement
-| while_statement
-| for_statement
-;
-
-statement_nsi:
- statement_without_trailing_substatement
-| labeled_statement_nsi
-| if_then_else_statement_nsi
-| while_statement_nsi
-| for_statement_nsi
-;
-
-statement_without_trailing_substatement:
- block
-| empty_statement
-| expression_statement
-| switch_statement
-| do_statement
-| break_statement
-| continue_statement
-| return_statement
-| synchronized_statement
-| throw_statement
-| try_statement
-;
-
-empty_statement:
- SC_TK
-;
-
-label_decl:
- identifier REL_CL_TK
- { USE_ABSORBER; }
-;
-
-labeled_statement:
- label_decl statement
-;
-
-labeled_statement_nsi:
- label_decl statement_nsi
-;
-
-/* We concentrate here a bunch of error handling rules that we couldn't write
- earlier, because expression_statement catches a missing ';'. */
-expression_statement:
- statement_expression SC_TK
-;
-
-statement_expression:
- assignment
-| pre_increment_expression
-| pre_decrement_expression
-| post_increment_expression
-| post_decrement_expression
-| method_invocation
-| class_instance_creation_expression
-;
-
-if_then_statement:
- IF_TK OP_TK expression CP_TK statement
-;
-
-if_then_else_statement:
- IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement
-;
-
-if_then_else_statement_nsi:
- IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement_nsi
-;
-
-switch_statement:
- SWITCH_TK OP_TK expression CP_TK switch_block
-;
-
-switch_block:
- OCB_TK CCB_TK
-| OCB_TK switch_labels CCB_TK
-| OCB_TK switch_block_statement_groups CCB_TK
-| OCB_TK switch_block_statement_groups switch_labels CCB_TK
-;
-
-switch_block_statement_groups:
- switch_block_statement_group
-| switch_block_statement_groups switch_block_statement_group
-;
-
-switch_block_statement_group:
- switch_labels block_statements
-;
-
-
-switch_labels:
- switch_label
-| switch_labels switch_label
-;
-
-switch_label:
- CASE_TK constant_expression REL_CL_TK
-| DEFAULT_TK REL_CL_TK
-;
-
-while_expression:
- WHILE_TK OP_TK expression CP_TK
-;
-
-while_statement:
- while_expression statement
-;
-
-while_statement_nsi:
- while_expression statement_nsi
-;
-
-do_statement_begin:
- DO_TK
-;
-
-do_statement:
- do_statement_begin statement WHILE_TK OP_TK expression CP_TK SC_TK
-;
-
-for_statement:
- for_begin SC_TK expression SC_TK for_update CP_TK statement
-| for_begin SC_TK SC_TK for_update CP_TK statement
-;
-
-for_statement_nsi:
- for_begin SC_TK expression SC_TK for_update CP_TK statement_nsi
-| for_begin SC_TK SC_TK for_update CP_TK statement_nsi
-;
-
-for_header:
- FOR_TK OP_TK
-;
-
-for_begin:
- for_header for_init
-;
-for_init: /* Can be empty */
-| statement_expression_list
-| local_variable_declaration
-;
-
-for_update: /* Can be empty */
-| statement_expression_list
-;
-
-statement_expression_list:
- statement_expression
-| statement_expression_list C_TK statement_expression
-;
-
-break_statement:
- BREAK_TK SC_TK
-| BREAK_TK identifier SC_TK
-;
-
-continue_statement:
- CONTINUE_TK SC_TK
-| CONTINUE_TK identifier SC_TK
-;
-
-return_statement:
- RETURN_TK SC_TK
-| RETURN_TK expression SC_TK
-;
-
-throw_statement:
- THROW_TK expression SC_TK
-;
-
-synchronized_statement:
- synchronized OP_TK expression CP_TK block
-| synchronized OP_TK expression CP_TK error
-;
-
-synchronized: /* Test lval.sub_token here */
- MODIFIER_TK
- { USE_ABSORBER; }
-;
-
-try_statement:
- TRY_TK block catches
-| TRY_TK block finally
-| TRY_TK block catches finally
-;
-
-catches:
- catch_clause
-| catches catch_clause
-;
-
-catch_clause:
- CATCH_TK OP_TK formal_parameter CP_TK block
-;
-
-finally:
- FINALLY_TK block
-;
-
-/* 19.12 Production from 15: Expressions */
-primary:
- primary_no_new_array
-| array_creation_expression
-;
-
-primary_no_new_array:
- literal
-| THIS_TK
-| OP_TK expression CP_TK
-| class_instance_creation_expression
-| field_access
-| method_invocation
-| array_access
- /* type DOT_TK CLASS_TK doens't work. So we split the rule
- 'type' into its components. Missing is something for array,
- which will complete the reference_type part. FIXME */
-| name DOT_TK CLASS_TK /* Added, JDK1.1 class literals */
- { USE_ABSORBER; }
-| primitive_type DOT_TK CLASS_TK /* Added, JDK1.1 class literals */
- { USE_ABSORBER; }
-| VOID_TK DOT_TK CLASS_TK /* Added, JDK1.1 class literals */
- /* Added, JDK1.1 inner classes. Documentation is wrong
- refering to a 'ClassName' (class_name) rule that doesn't
- exist. Used name instead. */
-| name DOT_TK THIS_TK
- { USE_ABSORBER; }
-;
-
-class_instance_creation_expression:
- NEW_TK class_type OP_TK argument_list CP_TK
-| NEW_TK class_type OP_TK CP_TK
- /* Added, JDK1.1 inner classes but modified to use
- 'class_type' instead of 'TypeName' (type_name) mentionned
- in the documentation but doesn't exist. */
-| NEW_TK class_type OP_TK argument_list CP_TK class_body
-| NEW_TK class_type OP_TK CP_TK class_body
- /* Added, JDK1.1 inner classes, modified to use name or
- primary instead of primary solely which couldn't work in
- all situations. */
-| something_dot_new identifier OP_TK CP_TK
-| something_dot_new identifier OP_TK CP_TK class_body
-| something_dot_new identifier OP_TK argument_list CP_TK
-| something_dot_new identifier OP_TK argument_list CP_TK class_body
-;
-
-something_dot_new: /* Added, not part of the specs. */
- name DOT_TK NEW_TK
- { USE_ABSORBER; }
-| primary DOT_TK NEW_TK
-;
-
-argument_list:
- expression
-| argument_list C_TK expression
-| argument_list C_TK error
-;
-
-array_creation_expression:
- NEW_TK primitive_type dim_exprs
-| NEW_TK class_or_interface_type dim_exprs
-| NEW_TK primitive_type dim_exprs dims
-| NEW_TK class_or_interface_type dim_exprs dims
- /* Added, JDK1.1 anonymous array. Initial documentation rule
- modified */
-| NEW_TK class_or_interface_type dims array_initializer
-| NEW_TK primitive_type dims array_initializer
-;
-
-dim_exprs:
- dim_expr
-| dim_exprs dim_expr
-;
-
-dim_expr:
- OSB_TK expression CSB_TK
-;
-
-dims:
- OSB_TK CSB_TK
-| dims OSB_TK CSB_TK
-;
-
-field_access:
- primary DOT_TK identifier
-| SUPER_TK DOT_TK identifier
-;
-
-method_invocation:
- name OP_TK CP_TK
- { USE_ABSORBER; }
-| name OP_TK argument_list CP_TK
- { USE_ABSORBER; }
-| primary DOT_TK identifier OP_TK CP_TK
-| primary DOT_TK identifier OP_TK argument_list CP_TK
-| SUPER_TK DOT_TK identifier OP_TK CP_TK
-| SUPER_TK DOT_TK identifier OP_TK argument_list CP_TK
-;
-
-array_access:
- name OSB_TK expression CSB_TK
- { USE_ABSORBER; }
-| primary_no_new_array OSB_TK expression CSB_TK
-;
-
-postfix_expression:
- primary
-| name
- { USE_ABSORBER; }
-| post_increment_expression
-| post_decrement_expression
-;
-
-post_increment_expression:
- postfix_expression INCR_TK
-;
-
-post_decrement_expression:
- postfix_expression DECR_TK
-;
-
-unary_expression:
- pre_increment_expression
-| pre_decrement_expression
-| PLUS_TK unary_expression
-| MINUS_TK unary_expression
-| unary_expression_not_plus_minus
-;
-
-pre_increment_expression:
- INCR_TK unary_expression
-;
-
-pre_decrement_expression:
- DECR_TK unary_expression
-;
-
-unary_expression_not_plus_minus:
- postfix_expression
-| NOT_TK unary_expression
-| NEG_TK unary_expression
-| cast_expression
-;
-
-cast_expression: /* Error handling here is potentially weak */
- OP_TK primitive_type dims CP_TK unary_expression
-| OP_TK primitive_type CP_TK unary_expression
-| OP_TK expression CP_TK unary_expression_not_plus_minus
-| OP_TK name dims CP_TK unary_expression_not_plus_minus
-;
-
-multiplicative_expression:
- unary_expression
-| multiplicative_expression MULT_TK unary_expression
-| multiplicative_expression DIV_TK unary_expression
-| multiplicative_expression REM_TK unary_expression
-;
-
-additive_expression:
- multiplicative_expression
-| additive_expression PLUS_TK multiplicative_expression
-| additive_expression MINUS_TK multiplicative_expression
-;
-
-shift_expression:
- additive_expression
-| shift_expression LS_TK additive_expression
-| shift_expression SRS_TK additive_expression
-| shift_expression ZRS_TK additive_expression
-;
-
-relational_expression:
- shift_expression
-| relational_expression LT_TK shift_expression
-| relational_expression GT_TK shift_expression
-| relational_expression LTE_TK shift_expression
-| relational_expression GTE_TK shift_expression
-| relational_expression INSTANCEOF_TK reference_type
-;
-
-equality_expression:
- relational_expression
-| equality_expression EQ_TK relational_expression
-| equality_expression NEQ_TK relational_expression
-;
-
-and_expression:
- equality_expression
-| and_expression AND_TK equality_expression
-;
-
-exclusive_or_expression:
- and_expression
-| exclusive_or_expression XOR_TK and_expression
-;
-
-inclusive_or_expression:
- exclusive_or_expression
-| inclusive_or_expression OR_TK exclusive_or_expression
-;
-
-conditional_and_expression:
- inclusive_or_expression
-| conditional_and_expression BOOL_AND_TK inclusive_or_expression
-;
-
-conditional_or_expression:
- conditional_and_expression
-| conditional_or_expression BOOL_OR_TK conditional_and_expression
-;
-
-conditional_expression: /* Error handling here is weak */
- conditional_or_expression
-| conditional_or_expression REL_QM_TK expression REL_CL_TK conditional_expression
-;
-
-assignment_expression:
- conditional_expression
-| assignment
-;
-
-assignment:
- left_hand_side assignment_operator assignment_expression
-;
-
-left_hand_side:
- name
- { USE_ABSORBER; }
-| field_access
-| array_access
-;
-
-assignment_operator:
- ASSIGN_ANY_TK
-| ASSIGN_TK
-;
-
-expression:
- assignment_expression
-;
-
-constant_expression:
- expression
-;
-
-%%
-
-#include "lex.c"
-
-/* Create a new parser context */
-
-void
-java_push_parser_context ()
-{
- struct parser_ctxt *new =
- (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
-
- bzero ((PTR) new, sizeof (struct parser_ctxt));
- new->next = ctxp;
- ctxp = new;
-}
-
-/* Actions defined here */
-
-static void
-report_class_declaration (name)
- char * name;
-{
- extern int flag_dump_class, flag_list_filename;
-
- if (flag_dump_class)
- {
- if (!previous_output)
- {
- if (flag_list_filename)
- fprintf (out, "%s: ", input_filename);
- previous_output = 1;
- }
-
- if (package_name)
- fprintf (out, "%s.%s ", package_name, name);
- else
- fprintf (out, "%s ", name);
- }
-
- current_class = name;
-}
-
-static void
-report_main_declaration (declarator)
- struct method_declarator *declarator;
-{
- extern int flag_find_main;
-
- if (flag_find_main
- && modifier_value == 2
- && !strcmp (declarator->method_name, "main")
- && declarator->args
- && declarator->args [0] == '['
- && (! strcmp (declarator->args+1, "String")
- || ! strcmp (declarator->args + 1, "java.lang.String"))
- && current_class)
- {
- if (!previous_output)
- {
- if (package_name)
- fprintf (out, "%s.%s ", package_name, current_class);
- else
- fprintf (out, current_class);
- previous_output = 1;
- }
- }
-}
-
-/* Reset global status used by the report functions. */
-
-void reset_report ()
-{
- previous_output = 0;
- current_class = package_name = NULL;
-}
-
-void
-yyerror (msg)
- char *msg ATTRIBUTE_UNUSED;
-{
-}
-
-char *
-xstrdup (s)
- const char *s;
-{
- char *ret;
-
- ret = xmalloc (strlen (s) + 1);
- strcpy (ret, s);
- return ret;
-}
diff --git a/gnu/dist/toolchain/gcc/java/parse.c b/gnu/dist/toolchain/gcc/java/parse.c
deleted file mode 100644
index 69c8789236e..00000000000
--- a/gnu/dist/toolchain/gcc/java/parse.c
+++ /dev/null
@@ -1,14429 +0,0 @@
-
-/* A Bison parser, made from ./parse.y
- by GNU Bison version 1.27
- */
-
-#define YYBISON 1 /* Identify Bison output. */
-
-#define yyparse java_parse
-#define yylex java_lex
-#define yyerror java_error
-#define yylval java_lval
-#define yychar java_char
-#define yydebug java_debug
-#define yynerrs java_nerrs
-#define PLUS_TK 257
-#define MINUS_TK 258
-#define MULT_TK 259
-#define DIV_TK 260
-#define REM_TK 261
-#define LS_TK 262
-#define SRS_TK 263
-#define ZRS_TK 264
-#define AND_TK 265
-#define XOR_TK 266
-#define OR_TK 267
-#define BOOL_AND_TK 268
-#define BOOL_OR_TK 269
-#define EQ_TK 270
-#define NEQ_TK 271
-#define GT_TK 272
-#define GTE_TK 273
-#define LT_TK 274
-#define LTE_TK 275
-#define PLUS_ASSIGN_TK 276
-#define MINUS_ASSIGN_TK 277
-#define MULT_ASSIGN_TK 278
-#define DIV_ASSIGN_TK 279
-#define REM_ASSIGN_TK 280
-#define LS_ASSIGN_TK 281
-#define SRS_ASSIGN_TK 282
-#define ZRS_ASSIGN_TK 283
-#define AND_ASSIGN_TK 284
-#define XOR_ASSIGN_TK 285
-#define OR_ASSIGN_TK 286
-#define PUBLIC_TK 287
-#define PRIVATE_TK 288
-#define PROTECTED_TK 289
-#define STATIC_TK 290
-#define FINAL_TK 291
-#define SYNCHRONIZED_TK 292
-#define VOLATILE_TK 293
-#define TRANSIENT_TK 294
-#define NATIVE_TK 295
-#define PAD_TK 296
-#define ABSTRACT_TK 297
-#define MODIFIER_TK 298
-#define DECR_TK 299
-#define INCR_TK 300
-#define DEFAULT_TK 301
-#define IF_TK 302
-#define THROW_TK 303
-#define BOOLEAN_TK 304
-#define DO_TK 305
-#define IMPLEMENTS_TK 306
-#define THROWS_TK 307
-#define BREAK_TK 308
-#define IMPORT_TK 309
-#define ELSE_TK 310
-#define INSTANCEOF_TK 311
-#define RETURN_TK 312
-#define VOID_TK 313
-#define CATCH_TK 314
-#define INTERFACE_TK 315
-#define CASE_TK 316
-#define EXTENDS_TK 317
-#define FINALLY_TK 318
-#define SUPER_TK 319
-#define WHILE_TK 320
-#define CLASS_TK 321
-#define SWITCH_TK 322
-#define CONST_TK 323
-#define TRY_TK 324
-#define FOR_TK 325
-#define NEW_TK 326
-#define CONTINUE_TK 327
-#define GOTO_TK 328
-#define PACKAGE_TK 329
-#define THIS_TK 330
-#define BYTE_TK 331
-#define SHORT_TK 332
-#define INT_TK 333
-#define LONG_TK 334
-#define CHAR_TK 335
-#define INTEGRAL_TK 336
-#define FLOAT_TK 337
-#define DOUBLE_TK 338
-#define FP_TK 339
-#define ID_TK 340
-#define REL_QM_TK 341
-#define REL_CL_TK 342
-#define NOT_TK 343
-#define NEG_TK 344
-#define ASSIGN_ANY_TK 345
-#define ASSIGN_TK 346
-#define OP_TK 347
-#define CP_TK 348
-#define OCB_TK 349
-#define CCB_TK 350
-#define OSB_TK 351
-#define CSB_TK 352
-#define SC_TK 353
-#define C_TK 354
-#define DOT_TK 355
-#define STRING_LIT_TK 356
-#define CHAR_LIT_TK 357
-#define INT_LIT_TK 358
-#define FP_LIT_TK 359
-#define TRUE_TK 360
-#define FALSE_TK 361
-#define BOOL_LIT_TK 362
-#define NULL_TK 363
-
-#line 48 "./parse.y"
-
-#include "config.h"
-#include "system.h"
-#include <dirent.h>
-#include "tree.h"
-#include "rtl.h"
-#include "obstack.h"
-#include "toplev.h"
-#include "flags.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "lex.h"
-#include "parse.h"
-#include "zipfile.h"
-#include "convert.h"
-#include "buffer.h"
-#include "xref.h"
-#include "except.h"
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-/* Local function prototypes */
-static char *java_accstring_lookup PROTO ((int));
-static void classitf_redefinition_error PROTO ((char *,tree, tree, tree));
-static void variable_redefinition_error PROTO ((tree, tree, tree, int));
-static void check_modifiers PROTO ((char *, int, int));
-static tree create_class PROTO ((int, tree, tree, tree));
-static tree create_interface PROTO ((int, tree, tree));
-static tree find_field PROTO ((tree, tree));
-static tree lookup_field_wrapper PROTO ((tree, tree));
-static int duplicate_declaration_error_p PROTO ((tree, tree, tree));
-static void register_fields PROTO ((int, tree, tree));
-static tree parser_qualified_classname PROTO ((tree));
-static int parser_check_super PROTO ((tree, tree, tree));
-static int parser_check_super_interface PROTO ((tree, tree, tree));
-static void check_modifiers_consistency PROTO ((int));
-static tree lookup_cl PROTO ((tree));
-static tree lookup_java_method2 PROTO ((tree, tree, int));
-static tree method_header PROTO ((int, tree, tree, tree));
-static void fix_method_argument_names PROTO ((tree ,tree));
-static tree method_declarator PROTO ((tree, tree));
-static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
- ATTRIBUTE_PRINTF_2;
-static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
-static tree parse_jdk1_1_error PROTO ((char *));
-static void complete_class_report_errors PROTO ((jdep *));
-static int process_imports PROTO ((void));
-static void read_import_dir PROTO ((tree));
-static int find_in_imports_on_demand PROTO ((tree));
-static int find_in_imports PROTO ((tree));
-static int check_pkg_class_access PROTO ((tree, tree));
-static tree resolve_package PROTO ((tree, tree *));
-static tree lookup_package_type PROTO ((char *, int));
-static tree lookup_package_type_and_set_next PROTO ((char *, int, tree *));
-static tree resolve_class PROTO ((tree, tree, tree));
-static void declare_local_variables PROTO ((int, tree, tree));
-static void source_start_java_method PROTO ((tree));
-static void source_end_java_method PROTO ((void));
-static void expand_start_java_method PROTO ((tree));
-static tree find_name_in_single_imports PROTO ((tree));
-static void check_abstract_method_header PROTO ((tree));
-static tree lookup_java_interface_method2 PROTO ((tree, tree));
-static tree resolve_expression_name PROTO ((tree, tree *));
-static tree maybe_create_class_interface_decl PROTO ((tree, tree, tree));
-static int check_class_interface_creation PROTO ((int, int, tree,
- tree, tree, tree));
-static tree patch_method_invocation PROTO ((tree, tree, tree,
- int *, tree *));
-static int breakdown_qualified PROTO ((tree *, tree *, tree));
-static tree resolve_and_layout PROTO ((tree, tree));
-static tree resolve_no_layout PROTO ((tree, tree));
-static int invocation_mode PROTO ((tree, int));
-static tree find_applicable_accessible_methods_list PROTO ((int, tree,
- tree, tree));
-static void search_applicable_methods_list PROTO ((int, tree, tree, tree,
- tree *, tree *));
-static tree find_most_specific_methods_list PROTO ((tree));
-static int argument_types_convertible PROTO ((tree, tree));
-static tree patch_invoke PROTO ((tree, tree, tree));
-static tree lookup_method_invoke PROTO ((int, tree, tree, tree, tree));
-static tree register_incomplete_type PROTO ((int, tree, tree, tree));
-static tree obtain_incomplete_type PROTO ((tree));
-static tree java_complete_lhs PROTO ((tree));
-static tree java_complete_tree PROTO ((tree));
-static void java_complete_expand_method PROTO ((tree));
-static int unresolved_type_p PROTO ((tree, tree *));
-static void create_jdep_list PROTO ((struct parser_ctxt *));
-static tree build_expr_block PROTO ((tree, tree));
-static tree enter_block PROTO ((void));
-static tree enter_a_block PROTO ((tree));
-static tree exit_block PROTO ((void));
-static tree lookup_name_in_blocks PROTO ((tree));
-static void maybe_absorb_scoping_blocks PROTO ((void));
-static tree build_method_invocation PROTO ((tree, tree));
-static tree build_new_invocation PROTO ((tree, tree));
-static tree build_assignment PROTO ((int, int, tree, tree));
-static tree build_binop PROTO ((enum tree_code, int, tree, tree));
-static int check_final_assignment PROTO ((tree ,tree));
-static tree patch_assignment PROTO ((tree, tree, tree ));
-static tree patch_binop PROTO ((tree, tree, tree));
-static tree build_unaryop PROTO ((int, int, tree));
-static tree build_incdec PROTO ((int, int, tree, int));
-static tree patch_unaryop PROTO ((tree, tree));
-static tree build_cast PROTO ((int, tree, tree));
-static tree build_null_of_type PROTO ((tree));
-static tree patch_cast PROTO ((tree, tree));
-static int valid_ref_assignconv_cast_p PROTO ((tree, tree, int));
-static int valid_builtin_assignconv_identity_widening_p PROTO ((tree, tree));
-static int valid_cast_to_p PROTO ((tree, tree));
-static int valid_method_invocation_conversion_p PROTO ((tree, tree));
-static tree try_builtin_assignconv PROTO ((tree, tree, tree));
-static tree try_reference_assignconv PROTO ((tree, tree));
-static tree build_unresolved_array_type PROTO ((tree));
-static tree build_array_from_name PROTO ((tree, tree, tree, tree *));
-static tree build_array_ref PROTO ((int, tree, tree));
-static tree patch_array_ref PROTO ((tree));
-static tree make_qualified_name PROTO ((tree, tree, int));
-static tree merge_qualified_name PROTO ((tree, tree));
-static tree make_qualified_primary PROTO ((tree, tree, int));
-static int resolve_qualified_expression_name PROTO ((tree, tree *,
- tree *, tree *));
-static void qualify_ambiguous_name PROTO ((tree));
-static void maybe_generate_clinit PROTO ((void));
-static tree resolve_field_access PROTO ((tree, tree *, tree *));
-static tree build_newarray_node PROTO ((tree, tree, int));
-static tree patch_newarray PROTO ((tree));
-static tree resolve_type_during_patch PROTO ((tree));
-static tree build_this PROTO ((int));
-static tree build_return PROTO ((int, tree));
-static tree patch_return PROTO ((tree));
-static tree maybe_access_field PROTO ((tree, tree, tree));
-static int complete_function_arguments PROTO ((tree));
-static int check_for_static_method_reference PROTO ((tree, tree, tree, tree, tree));
-static int not_accessible_p PROTO ((tree, tree, int));
-static void check_deprecation PROTO ((tree, tree));
-static int class_in_current_package PROTO ((tree));
-static tree build_if_else_statement PROTO ((int, tree, tree, tree));
-static tree patch_if_else_statement PROTO ((tree));
-static tree add_stmt_to_compound PROTO ((tree, tree, tree));
-static tree add_stmt_to_block PROTO ((tree, tree, tree));
-static tree patch_exit_expr PROTO ((tree));
-static tree build_labeled_block PROTO ((int, tree));
-static tree finish_labeled_statement PROTO ((tree, tree));
-static tree build_bc_statement PROTO ((int, int, tree));
-static tree patch_bc_statement PROTO ((tree));
-static tree patch_loop_statement PROTO ((tree));
-static tree build_new_loop PROTO ((tree));
-static tree build_loop_body PROTO ((int, tree, int));
-static tree finish_loop_body PROTO ((int, tree, tree, int));
-static tree build_debugable_stmt PROTO ((int, tree));
-static tree finish_for_loop PROTO ((int, tree, tree, tree));
-static tree patch_switch_statement PROTO ((tree));
-static tree string_constant_concatenation PROTO ((tree, tree));
-static tree build_string_concatenation PROTO ((tree, tree));
-static tree patch_string_cst PROTO ((tree));
-static tree patch_string PROTO ((tree));
-static tree build_try_statement PROTO ((int, tree, tree));
-static tree build_try_finally_statement PROTO ((int, tree, tree));
-static tree patch_try_statement PROTO ((tree));
-static tree patch_synchronized_statement PROTO ((tree, tree));
-static tree patch_throw_statement PROTO ((tree, tree));
-static void check_thrown_exceptions PROTO ((int, tree));
-static int check_thrown_exceptions_do PROTO ((tree));
-static void purge_unchecked_exceptions PROTO ((tree));
-static void check_throws_clauses PROTO ((tree, tree, tree));
-static void finish_method_declaration PROTO ((tree));
-static tree build_super_invocation PROTO (());
-static int verify_constructor_circularity PROTO ((tree, tree));
-static char *constructor_circularity_msg PROTO ((tree, tree));
-static tree build_this_super_qualified_invocation PROTO ((int, tree, tree,
- int, int));
-static char *get_printable_method_name PROTO ((tree));
-static tree patch_conditional_expr PROTO ((tree, tree, tree));
-static void maybe_generate_finit PROTO (());
-static void fix_constructors PROTO ((tree));
-static int verify_constructor_super PROTO (());
-static tree create_artificial_method PROTO ((tree, int, tree, tree, tree));
-static void start_artificial_method_body PROTO ((tree));
-static void end_artificial_method_body PROTO ((tree));
-static int check_method_redefinition PROTO ((tree, tree));
-static int reset_method_name PROTO ((tree));
-static void java_check_regular_methods PROTO ((tree));
-static void java_check_abstract_methods PROTO ((tree));
-static tree maybe_build_primttype_type_ref PROTO ((tree, tree));
-static void unreachable_stmt_error PROTO ((tree));
-static tree find_expr_with_wfl PROTO ((tree));
-static void missing_return_error PROTO ((tree));
-static tree build_new_array_init PROTO ((int, tree));
-static tree patch_new_array_init PROTO ((tree, tree));
-static tree maybe_build_array_element_wfl PROTO ((tree));
-static int array_constructor_check_entry PROTO ((tree, tree));
-static char *purify_type_name PROTO ((char *));
-static tree fold_constant_for_init PROTO ((tree, tree));
-static tree strip_out_static_field_access_decl PROTO ((tree));
-static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
-static void static_ref_err PROTO ((tree, tree, tree));
-
-/* Number of error found so far. */
-int java_error_count;
-/* Number of warning found so far. */
-int java_warning_count;
-/* Tell when not to fold, when doing xrefs */
-int do_not_fold;
-
-/* The current parser context */
-struct parser_ctxt *ctxp;
-
-/* List of things that were analyzed for which code will be generated */
-static struct parser_ctxt *ctxp_for_generation = NULL;
-
-/* binop_lookup maps token to tree_code. It is used where binary
- operations are involved and required by the parser. RDIV_EXPR
- covers both integral/floating point division. The code is changed
- once the type of both operator is worked out. */
-
-static enum tree_code binop_lookup[19] =
- {
- PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
- LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
- BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
- TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
- EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
- };
-#define BINOP_LOOKUP(VALUE) \
- binop_lookup [((VALUE) - PLUS_TK)% \
- (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
-
-/* Fake WFL used to report error message. It is initialized once if
- needed and reused with it's location information is overriden. */
-tree wfl_operator = NULL_TREE;
-
-/* The "$L" identifier we use to create labels. */
-static tree label_id = NULL_TREE;
-
-/* The "StringBuffer" identifier used for the String `+' operator. */
-static tree wfl_string_buffer = NULL_TREE;
-
-/* The "append" identifier used for String `+' operator. */
-static tree wfl_append = NULL_TREE;
-
-/* The "toString" identifier used for String `+' operator. */
-static tree wfl_to_string = NULL_TREE;
-
-/* The "java.lang" import qualified name. */
-static tree java_lang_id = NULL_TREE;
-
-/* The "java.lang.Cloneable" qualified name. */
-static tree java_lang_cloneable = NULL_TREE;
-
-/* Context and flag for static blocks */
-static tree current_static_block = NULL_TREE;
-
-
-#line 304 "./parse.y"
-typedef union {
- tree node;
- int sub_token;
- struct {
- int token;
- int location;
- } operator;
- int value;
-} YYSTYPE;
-#line 314 "./parse.y"
-
-#include "lex.c"
-#ifndef YYDEBUG
-#define YYDEBUG 1
-#endif
-
-#include <stdio.h>
-
-#ifndef __cplusplus
-#ifndef __STDC__
-#define const
-#endif
-#endif
-
-
-
-#define YYFINAL 777
-#define YYFLAG -32768
-#define YYNTBASE 110
-
-#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 266)
-
-static const char yytranslate[] = { 0,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
- 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
- 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
- 107, 108, 109
-};
-
-#if YYDEBUG != 0
-static const short yyprhs[] = { 0,
- 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
- 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
- 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
- 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
- 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
- 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
- 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
- 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
- 229, 231, 233, 235, 238, 240, 242, 244, 248, 253,
- 255, 259, 263, 265, 269, 273, 278, 280, 284, 287,
- 291, 295, 297, 299, 300, 304, 307, 311, 315, 320,
- 325, 328, 332, 335, 339, 342, 346, 351, 355, 359,
- 363, 365, 369, 373, 376, 380, 383, 387, 388, 391,
- 394, 396, 400, 404, 406, 409, 411, 414, 418, 420,
- 421, 425, 428, 432, 436, 441, 444, 448, 452, 457,
- 459, 462, 467, 473, 481, 488, 490, 492, 493, 498,
- 499, 505, 506, 512, 513, 520, 524, 529, 532, 536,
- 539, 543, 546, 550, 552, 555, 557, 559, 561, 563,
- 565, 568, 571, 574, 578, 583, 585, 589, 593, 596,
- 600, 602, 604, 606, 609, 611, 613, 615, 618, 621,
- 625, 627, 629, 631, 633, 635, 637, 639, 641, 643,
- 645, 647, 649, 651, 653, 655, 657, 659, 661, 663,
- 665, 667, 669, 671, 674, 677, 680, 683, 686, 689,
- 692, 695, 699, 704, 709, 715, 720, 726, 733, 741,
- 748, 750, 752, 754, 756, 758, 760, 762, 768, 771,
- 775, 780, 788, 796, 797, 801, 806, 809, 813, 819,
- 822, 826, 830, 835, 837, 840, 843, 845, 848, 852,
- 855, 858, 862, 865, 870, 873, 876, 880, 885, 888,
- 890, 898, 906, 913, 917, 923, 928, 936, 943, 946,
- 949, 953, 956, 957, 959, 961, 964, 965, 967, 969,
- 973, 977, 980, 984, 987, 991, 994, 998, 1001, 1005,
- 1008, 1012, 1015, 1019, 1023, 1026, 1030, 1036, 1042, 1045,
- 1050, 1054, 1056, 1060, 1064, 1069, 1072, 1074, 1077, 1080,
- 1085, 1088, 1092, 1097, 1100, 1103, 1105, 1107, 1109, 1111,
- 1115, 1117, 1119, 1121, 1123, 1127, 1131, 1135, 1139, 1143,
- 1147, 1151, 1155, 1161, 1166, 1173, 1179, 1184, 1190, 1196,
- 1203, 1207, 1211, 1216, 1222, 1225, 1229, 1233, 1237, 1239,
- 1243, 1247, 1251, 1255, 1260, 1265, 1270, 1275, 1279, 1283,
- 1285, 1288, 1292, 1296, 1299, 1302, 1306, 1310, 1314, 1318,
- 1321, 1325, 1330, 1336, 1343, 1349, 1356, 1361, 1366, 1371,
- 1376, 1380, 1385, 1389, 1394, 1396, 1398, 1400, 1402, 1405,
- 1408, 1410, 1412, 1415, 1418, 1420, 1423, 1426, 1429, 1432,
- 1435, 1438, 1440, 1443, 1446, 1448, 1451, 1454, 1460, 1465,
- 1470, 1476, 1481, 1484, 1490, 1495, 1501, 1503, 1507, 1511,
- 1515, 1519, 1523, 1527, 1529, 1533, 1537, 1541, 1545, 1547,
- 1551, 1555, 1559, 1563, 1567, 1571, 1573, 1577, 1581, 1585,
- 1589, 1593, 1597, 1601, 1605, 1609, 1613, 1615, 1619, 1623,
- 1627, 1631, 1633, 1637, 1641, 1643, 1647, 1651, 1653, 1657,
- 1661, 1663, 1667, 1671, 1673, 1677, 1681, 1683, 1689, 1694,
- 1698, 1704, 1706, 1708, 1712, 1716, 1718, 1720, 1722, 1724,
- 1726, 1728
-};
-
-static const short yyrhs[] = { 123,
- 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
- 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
- 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
- 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
- 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
- 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
- 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
- 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
- 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
- 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
- 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
- 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
- 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
- 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
- 166, 0, 99, 0, 1, 0, 44, 0, 131, 44,
- 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
- 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
- 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
- 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
- 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
- 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
- 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
- 0, 139, 140, 0, 141, 0, 156, 0, 158, 0,
- 179, 0, 142, 0, 142, 99, 0, 147, 0, 132,
- 0, 166, 0, 112, 143, 99, 0, 131, 112, 143,
- 99, 0, 144, 0, 143, 100, 144, 0, 143, 100,
- 1, 0, 145, 0, 145, 92, 146, 0, 145, 92,
- 1, 0, 145, 92, 146, 1, 0, 122, 0, 145,
- 97, 98, 0, 122, 1, 0, 145, 97, 1, 0,
- 145, 98, 1, 0, 264, 0, 177, 0, 0, 149,
- 148, 155, 0, 149, 1, 0, 112, 150, 153, 0,
- 59, 150, 153, 0, 131, 112, 150, 153, 0, 131,
- 59, 150, 153, 0, 112, 1, 0, 131, 112, 1,
- 0, 59, 1, 0, 131, 59, 1, 0, 131, 1,
- 0, 122, 93, 94, 0, 122, 93, 151, 94, 0,
- 150, 97, 98, 0, 122, 93, 1, 0, 150, 97,
- 1, 0, 152, 0, 151, 100, 152, 0, 151, 100,
- 1, 0, 112, 145, 0, 131, 112, 145, 0, 112,
- 1, 0, 131, 112, 1, 0, 0, 53, 154, 0,
- 53, 1, 0, 116, 0, 154, 100, 116, 0, 154,
- 100, 1, 0, 179, 0, 179, 99, 0, 99, 0,
- 157, 179, 0, 157, 179, 99, 0, 44, 0, 0,
- 160, 159, 162, 0, 161, 153, 0, 131, 161, 153,
- 0, 120, 93, 94, 0, 120, 93, 151, 94, 0,
- 180, 163, 0, 180, 164, 163, 0, 180, 182, 163,
- 0, 180, 164, 182, 163, 0, 181, 0, 181, 99,
- 0, 165, 93, 94, 99, 0, 165, 93, 233, 94,
- 99, 0, 119, 101, 65, 93, 233, 94, 99, 0,
- 119, 101, 65, 93, 94, 99, 0, 76, 0, 65,
- 0, 0, 61, 122, 167, 172, 0, 0, 131, 61,
- 122, 168, 172, 0, 0, 61, 122, 171, 169, 172,
- 0, 0, 131, 61, 122, 171, 170, 172, 0, 61,
- 122, 1, 0, 131, 61, 122, 1, 0, 63, 117,
- 0, 171, 100, 117, 0, 63, 1, 0, 171, 100,
- 1, 0, 95, 96, 0, 95, 173, 96, 0, 174,
- 0, 173, 174, 0, 175, 0, 176, 0, 132, 0,
- 166, 0, 142, 0, 149, 99, 0, 149, 1, 0,
- 95, 96, 0, 95, 178, 96, 0, 95, 178, 100,
- 96, 0, 146, 0, 178, 100, 146, 0, 178, 100,
- 1, 0, 95, 96, 0, 180, 182, 181, 0, 95,
- 0, 96, 0, 183, 0, 182, 183, 0, 184, 0,
- 186, 0, 132, 0, 185, 99, 0, 112, 143, 0,
- 131, 112, 143, 0, 188, 0, 191, 0, 195, 0,
- 196, 0, 207, 0, 211, 0, 188, 0, 192, 0,
- 197, 0, 208, 0, 212, 0, 179, 0, 189, 0,
- 193, 0, 198, 0, 210, 0, 218, 0, 219, 0,
- 220, 0, 222, 0, 221, 0, 224, 0, 99, 0,
- 122, 88, 0, 190, 186, 0, 122, 1, 0, 190,
- 187, 0, 194, 99, 0, 1, 99, 0, 1, 95,
- 0, 1, 96, 0, 165, 93, 1, 0, 165, 93,
- 94, 1, 0, 165, 93, 233, 1, 0, 165, 93,
- 233, 94, 1, 0, 119, 101, 65, 1, 0, 119,
- 101, 65, 93, 1, 0, 119, 101, 65, 93, 233,
- 1, 0, 119, 101, 65, 93, 233, 94, 1, 0,
- 119, 101, 65, 93, 94, 1, 0, 261, 0, 245,
- 0, 246, 0, 242, 0, 243, 0, 239, 0, 231,
- 0, 48, 93, 264, 94, 186, 0, 48, 1, 0,
- 48, 93, 1, 0, 48, 93, 264, 1, 0, 48,
- 93, 264, 94, 187, 56, 186, 0, 48, 93, 264,
- 94, 187, 56, 187, 0, 0, 200, 199, 201, 0,
- 68, 93, 264, 94, 0, 68, 1, 0, 68, 93,
- 1, 0, 68, 93, 264, 94, 1, 0, 95, 96,
- 0, 95, 204, 96, 0, 95, 202, 96, 0, 95,
- 202, 204, 96, 0, 203, 0, 202, 203, 0, 204,
- 182, 0, 205, 0, 204, 205, 0, 62, 265, 88,
- 0, 47, 88, 0, 62, 1, 0, 62, 265, 1,
- 0, 47, 1, 0, 66, 93, 264, 94, 0, 206,
- 186, 0, 66, 1, 0, 66, 93, 1, 0, 66,
- 93, 264, 1, 0, 206, 187, 0, 51, 0, 209,
- 186, 66, 93, 264, 94, 99, 0, 214, 99, 264,
- 99, 216, 94, 186, 0, 214, 99, 99, 216, 94,
- 186, 0, 214, 99, 1, 0, 214, 99, 264, 99,
- 1, 0, 214, 99, 99, 1, 0, 214, 99, 264,
- 99, 216, 94, 187, 0, 214, 99, 99, 216, 94,
- 187, 0, 71, 93, 0, 71, 1, 0, 71, 93,
- 1, 0, 213, 215, 0, 0, 217, 0, 185, 0,
- 217, 1, 0, 0, 217, 0, 194, 0, 217, 100,
- 194, 0, 217, 100, 1, 0, 54, 99, 0, 54,
- 122, 99, 0, 54, 1, 0, 54, 122, 1, 0,
- 73, 99, 0, 73, 122, 99, 0, 73, 1, 0,
- 73, 122, 1, 0, 58, 99, 0, 58, 264, 99,
- 0, 58, 1, 0, 58, 264, 1, 0, 49, 264,
- 99, 0, 49, 1, 0, 49, 264, 1, 0, 223,
- 93, 264, 94, 179, 0, 223, 93, 264, 94, 1,
- 0, 223, 1, 0, 223, 93, 1, 94, 0, 223,
- 93, 1, 0, 44, 0, 70, 179, 225, 0, 70,
- 179, 228, 0, 70, 179, 225, 228, 0, 70, 1,
- 0, 226, 0, 225, 226, 0, 227, 179, 0, 60,
- 93, 152, 94, 0, 60, 1, 0, 60, 93, 1,
- 0, 60, 93, 1, 94, 0, 64, 179, 0, 64,
- 1, 0, 230, 0, 234, 0, 111, 0, 76, 0,
- 93, 264, 94, 0, 231, 0, 238, 0, 239, 0,
- 240, 0, 119, 101, 67, 0, 113, 101, 67, 0,
- 59, 101, 67, 0, 119, 101, 76, 0, 93, 264,
- 1, 0, 119, 101, 1, 0, 113, 101, 1, 0,
- 59, 101, 1, 0, 72, 116, 93, 233, 94, 0,
- 72, 116, 93, 94, 0, 72, 116, 93, 233, 94,
- 138, 0, 72, 116, 93, 94, 138, 0, 232, 122,
- 93, 94, 0, 232, 122, 93, 94, 138, 0, 232,
- 122, 93, 233, 94, 0, 232, 122, 93, 233, 94,
- 138, 0, 72, 1, 99, 0, 72, 116, 1, 0,
- 72, 116, 93, 1, 0, 72, 116, 93, 233, 1,
- 0, 232, 1, 0, 232, 122, 1, 0, 119, 101,
- 72, 0, 229, 101, 72, 0, 264, 0, 233, 100,
- 264, 0, 233, 100, 1, 0, 72, 113, 235, 0,
- 72, 115, 235, 0, 72, 113, 235, 237, 0, 72,
- 115, 235, 237, 0, 72, 115, 237, 177, 0, 72,
- 113, 237, 177, 0, 72, 1, 98, 0, 72, 1,
- 97, 0, 236, 0, 235, 236, 0, 97, 264, 98,
- 0, 97, 264, 1, 0, 97, 1, 0, 97, 98,
- 0, 237, 97, 98, 0, 237, 97, 1, 0, 229,
- 101, 122, 0, 65, 101, 122, 0, 65, 1, 0,
- 119, 93, 94, 0, 119, 93, 233, 94, 0, 229,
- 101, 122, 93, 94, 0, 229, 101, 122, 93, 233,
- 94, 0, 65, 101, 122, 93, 94, 0, 65, 101,
- 122, 93, 233, 94, 0, 65, 101, 1, 94, 0,
- 65, 101, 1, 101, 0, 119, 97, 264, 98, 0,
- 230, 97, 264, 98, 0, 119, 97, 1, 0, 119,
- 97, 264, 1, 0, 230, 97, 1, 0, 230, 97,
- 264, 1, 0, 229, 0, 119, 0, 242, 0, 243,
- 0, 241, 46, 0, 241, 45, 0, 245, 0, 246,
- 0, 3, 244, 0, 4, 244, 0, 247, 0, 3,
- 1, 0, 4, 1, 0, 46, 244, 0, 46, 1,
- 0, 45, 244, 0, 45, 1, 0, 241, 0, 89,
- 244, 0, 90, 244, 0, 248, 0, 89, 1, 0,
- 90, 1, 0, 93, 113, 237, 94, 244, 0, 93,
- 113, 94, 244, 0, 93, 264, 94, 247, 0, 93,
- 119, 237, 94, 247, 0, 93, 113, 97, 1, 0,
- 93, 1, 0, 93, 113, 237, 94, 1, 0, 93,
- 113, 94, 1, 0, 93, 119, 237, 94, 1, 0,
- 244, 0, 249, 5, 244, 0, 249, 6, 244, 0,
- 249, 7, 244, 0, 249, 5, 1, 0, 249, 6,
- 1, 0, 249, 7, 1, 0, 249, 0, 250, 3,
- 249, 0, 250, 4, 249, 0, 250, 3, 1, 0,
- 250, 4, 1, 0, 250, 0, 251, 8, 250, 0,
- 251, 9, 250, 0, 251, 10, 250, 0, 251, 8,
- 1, 0, 251, 9, 1, 0, 251, 10, 1, 0,
- 251, 0, 252, 20, 251, 0, 252, 18, 251, 0,
- 252, 21, 251, 0, 252, 19, 251, 0, 252, 57,
- 114, 0, 252, 20, 1, 0, 252, 18, 1, 0,
- 252, 21, 1, 0, 252, 19, 1, 0, 252, 57,
- 1, 0, 252, 0, 253, 16, 252, 0, 253, 17,
- 252, 0, 253, 16, 1, 0, 253, 17, 1, 0,
- 253, 0, 254, 11, 253, 0, 254, 11, 1, 0,
- 254, 0, 255, 12, 254, 0, 255, 12, 1, 0,
- 255, 0, 256, 13, 255, 0, 256, 13, 1, 0,
- 256, 0, 257, 14, 256, 0, 257, 14, 1, 0,
- 257, 0, 258, 15, 257, 0, 258, 15, 1, 0,
- 258, 0, 258, 87, 264, 88, 259, 0, 258, 87,
- 88, 1, 0, 258, 87, 1, 0, 258, 87, 264,
- 88, 1, 0, 259, 0, 261, 0, 262, 263, 260,
- 0, 262, 263, 1, 0, 119, 0, 238, 0, 240,
- 0, 91, 0, 92, 0, 260, 0, 264, 0
-};
-
-#endif
-
-#if YYDEBUG != 0
-static const short yyrline[] = { 0,
- 458, 464, 466, 467, 468, 469, 470, 474, 476, 479,
- 481, 482, 485, 487, 490, 494, 498, 502, 508, 510,
- 512, 514, 519, 521, 524, 528, 533, 538, 540, 541,
- 542, 543, 544, 545, 546, 549, 554, 560, 562, 565,
- 568, 570, 574, 576, 579, 606, 608, 612, 625, 627,
- 631, 638, 643, 645, 655, 660, 675, 679, 682, 685,
- 688, 690, 692, 697, 701, 703, 705, 707, 711, 713,
- 715, 722, 728, 733, 737, 746, 756, 758, 761, 763,
- 764, 765, 769, 771, 773, 774, 776, 781, 784, 794,
- 797, 799, 803, 806, 813, 819, 827, 829, 831, 833,
- 835, 839, 841, 845, 852, 853, 857, 860, 862, 864,
- 866, 868, 870, 872, 874, 881, 884, 886, 895, 897,
- 901, 906, 911, 915, 920, 925, 927, 934, 936, 938,
- 942, 945, 947, 951, 953, 954, 959, 965, 972, 980,
- 987, 990, 993, 997, 1000, 1004, 1013, 1015, 1017, 1021,
- 1023, 1026, 1033, 1041, 1043, 1047, 1054, 1064, 1068, 1071,
- 1074, 1077, 1080, 1083, 1086, 1089, 1091, 1095, 1101, 1106,
- 1108, 1112, 1115, 1119, 1121, 1124, 1126, 1127, 1129, 1133,
- 1137, 1143, 1148, 1151, 1153, 1157, 1163, 1167, 1172, 1181,
- 1185, 1190, 1202, 1204, 1207, 1209, 1211, 1215, 1219, 1222,
- 1226, 1228, 1229, 1230, 1231, 1232, 1236, 1238, 1239, 1240,
- 1241, 1245, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254,
- 1255, 1256, 1259, 1264, 1275, 1278, 1282, 1289, 1299, 1305,
- 1311, 1317, 1319, 1325, 1327, 1333, 1335, 1337, 1339, 1341,
- 1345, 1347, 1348, 1349, 1350, 1351, 1352, 1355, 1361, 1363,
- 1365, 1369, 1374, 1379, 1385, 1395, 1401, 1403, 1405, 1412,
- 1415, 1417, 1419, 1423, 1425, 1428, 1432, 1434, 1437, 1444,
- 1450, 1452, 1454, 1458, 1466, 1469, 1471, 1473, 1477, 1482,
- 1491, 1496, 1499, 1506, 1508, 1510, 1514, 1517, 1526, 1533,
- 1535, 1539, 1552, 1554, 1560, 1566, 1570, 1572, 1576, 1579,
- 1581, 1585, 1588, 1590, 1592, 1596, 1599, 1601, 1603, 1607,
- 1610, 1612, 1614, 1618, 1624, 1626, 1630, 1637, 1639, 1641,
- 1643, 1647, 1655, 1658, 1660, 1665, 1669, 1671, 1678, 1686,
- 1703, 1705, 1707, 1711, 1714, 1719, 1721, 1724, 1726, 1728,
- 1730, 1731, 1732, 1733, 1737, 1739, 1741, 1746, 1748, 1750,
- 1752, 1754, 1758, 1761, 1766, 1768, 1773, 1774, 1775, 1776,
- 1777, 1779, 1781, 1783, 1785, 1787, 1791, 1793, 1796, 1802,
- 1807, 1811, 1814, 1816, 1818, 1822, 1824, 1826, 1828, 1832,
- 1835, 1839, 1845, 1847, 1855, 1882, 1884, 1888, 1893, 1900,
- 1904, 1907, 1909, 1920, 1931, 1936, 1945, 1947, 1951, 1954,
- 1956, 1961, 1966, 1971, 1978, 1980, 1981, 1982, 1985, 1990,
- 1995, 1997, 1998, 2000, 2002, 2003, 2005, 2009, 2012, 2016,
- 2019, 2023, 2025, 2027, 2029, 2030, 2032, 2036, 2045, 2047,
- 2049, 2062, 2064, 2070, 2072, 2074, 2078, 2080, 2085, 2090,
- 2095, 2097, 2099, 2103, 2105, 2110, 2115, 2117, 2121, 2123,
- 2128, 2133, 2138, 2140, 2142, 2146, 2148, 2153, 2158, 2163,
- 2168, 2170, 2172, 2174, 2176, 2178, 2182, 2184, 2189, 2194,
- 2196, 2200, 2202, 2207, 2211, 2213, 2218, 2222, 2224, 2229,
- 2233, 2235, 2240, 2244, 2246, 2251, 2255, 2257, 2262, 2268,
- 2270, 2274, 2276, 2279, 2282, 2290, 2292, 2293, 2296, 2298,
- 2301, 2305
-};
-#endif
-
-
-#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
-
-static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK",
-"MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
-"OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
-"LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
-"REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
-"XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
-"FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
-"ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
-"BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
-"INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
-"FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
-"FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
-"INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
-"REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
-"CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
-"CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
-"goal","literal","type","primitive_type","reference_type","class_or_interface_type",
-"class_type","interface_type","array_type","name","simple_name","qualified_name",
-"identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
-"import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
-"type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
-"interface_type_list","class_body","class_body_declarations","class_body_declaration",
-"class_member_declaration","field_declaration","variable_declarators","variable_declarator",
-"variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
-"method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
-"method_body","static_initializer","static","constructor_declaration","@4","constructor_header",
-"constructor_declarator","constructor_body","constructor_block_end","explicit_constructor_invocation",
-"this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces",
-"interface_body","interface_member_declarations","interface_member_declaration",
-"constant_declaration","abstract_method_declaration","array_initializer","variable_initializers",
-"block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement",
-"local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
-"empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
-"statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
-"switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
-"switch_block_statement_group","switch_labels","switch_label","while_expression",
-"while_statement","while_statement_nsi","do_statement_begin","do_statement",
-"for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
-"statement_expression_list","break_statement","continue_statement","return_statement",
-"throw_statement","synchronized_statement","synchronized","try_statement","catches",
-"catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
-"class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
-"dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
-"postfix_expression","post_increment_expression","post_decrement_expression",
-"unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
-"cast_expression","multiplicative_expression","additive_expression","shift_expression",
-"relational_expression","equality_expression","and_expression","exclusive_or_expression",
-"inclusive_or_expression","conditional_and_expression","conditional_or_expression",
-"conditional_expression","assignment_expression","assignment","left_hand_side",
-"assignment_operator","expression","constant_expression", NULL
-};
-#endif
-
-static const short yyr1[] = { 0,
- 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
- 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
- 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
- 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
- 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
- 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
- 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
- 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
- 140, 140, 141, 141, 141, 141, 141, 142, 142, 143,
- 143, 143, 144, 144, 144, 144, 145, 145, 145, 145,
- 145, 146, 146, 148, 147, 147, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 150, 150, 150, 150, 150,
- 151, 151, 151, 152, 152, 152, 152, 153, 153, 153,
- 154, 154, 154, 155, 155, 155, 156, 156, 157, 159,
- 158, 160, 160, 161, 161, 162, 162, 162, 162, 163,
- 163, 164, 164, 164, 164, 165, 165, 167, 166, 168,
- 166, 169, 166, 170, 166, 166, 166, 171, 171, 171,
- 171, 172, 172, 173, 173, 174, 174, 174, 174, 175,
- 176, 176, 177, 177, 177, 178, 178, 178, 179, 179,
- 180, 181, 182, 182, 183, 183, 183, 184, 185, 185,
- 186, 186, 186, 186, 186, 186, 187, 187, 187, 187,
- 187, 188, 188, 188, 188, 188, 188, 188, 188, 188,
- 188, 188, 189, 190, 191, 191, 192, 193, 193, 193,
- 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
- 194, 194, 194, 194, 194, 194, 194, 195, 195, 195,
- 195, 196, 197, 199, 198, 200, 200, 200, 200, 201,
- 201, 201, 201, 202, 202, 203, 204, 204, 205, 205,
- 205, 205, 205, 206, 207, 207, 207, 207, 208, 209,
- 210, 211, 211, 211, 211, 211, 212, 212, 213, 213,
- 213, 214, 215, 215, 215, 215, 216, 216, 217, 217,
- 217, 218, 218, 218, 218, 219, 219, 219, 219, 220,
- 220, 220, 220, 221, 221, 221, 222, 222, 222, 222,
- 222, 223, 224, 224, 224, 224, 225, 225, 226, 227,
- 227, 227, 227, 228, 228, 229, 229, 230, 230, 230,
- 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
- 230, 230, 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 232, 232, 233, 233,
- 233, 234, 234, 234, 234, 234, 234, 234, 234, 235,
- 235, 236, 236, 236, 237, 237, 237, 238, 238, 238,
- 239, 239, 239, 239, 239, 239, 239, 239, 240, 240,
- 240, 240, 240, 240, 241, 241, 241, 241, 242, 243,
- 244, 244, 244, 244, 244, 244, 244, 245, 245, 246,
- 246, 247, 247, 247, 247, 247, 247, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 249, 249, 249, 249,
- 249, 249, 249, 250, 250, 250, 250, 250, 251, 251,
- 251, 251, 251, 251, 251, 252, 252, 252, 252, 252,
- 252, 252, 252, 252, 252, 252, 253, 253, 253, 253,
- 253, 254, 254, 254, 255, 255, 255, 256, 256, 256,
- 257, 257, 257, 258, 258, 258, 259, 259, 259, 259,
- 259, 260, 260, 261, 261, 262, 262, 262, 263, 263,
- 264, 265
-};
-
-static const short yyr2[] = { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
- 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
- 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
- 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
- 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
- 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
- 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
- 1, 1, 1, 2, 1, 1, 1, 3, 4, 1,
- 3, 3, 1, 3, 3, 4, 1, 3, 2, 3,
- 3, 1, 1, 0, 3, 2, 3, 3, 4, 4,
- 2, 3, 2, 3, 2, 3, 4, 3, 3, 3,
- 1, 3, 3, 2, 3, 2, 3, 0, 2, 2,
- 1, 3, 3, 1, 2, 1, 2, 3, 1, 0,
- 3, 2, 3, 3, 4, 2, 3, 3, 4, 1,
- 2, 4, 5, 7, 6, 1, 1, 0, 4, 0,
- 5, 0, 5, 0, 6, 3, 4, 2, 3, 2,
- 3, 2, 3, 1, 2, 1, 1, 1, 1, 1,
- 2, 2, 2, 3, 4, 1, 3, 3, 2, 3,
- 1, 1, 1, 2, 1, 1, 1, 2, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
- 2, 3, 4, 4, 5, 4, 5, 6, 7, 6,
- 1, 1, 1, 1, 1, 1, 1, 5, 2, 3,
- 4, 7, 7, 0, 3, 4, 2, 3, 5, 2,
- 3, 3, 4, 1, 2, 2, 1, 2, 3, 2,
- 2, 3, 2, 4, 2, 2, 3, 4, 2, 1,
- 7, 7, 6, 3, 5, 4, 7, 6, 2, 2,
- 3, 2, 0, 1, 1, 2, 0, 1, 1, 3,
- 3, 2, 3, 2, 3, 2, 3, 2, 3, 2,
- 3, 2, 3, 3, 2, 3, 5, 5, 2, 4,
- 3, 1, 3, 3, 4, 2, 1, 2, 2, 4,
- 2, 3, 4, 2, 2, 1, 1, 1, 1, 3,
- 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 5, 4, 6, 5, 4, 5, 5, 6,
- 3, 3, 4, 5, 2, 3, 3, 3, 1, 3,
- 3, 3, 3, 4, 4, 4, 4, 3, 3, 1,
- 2, 3, 3, 2, 2, 3, 3, 3, 3, 2,
- 3, 4, 5, 6, 5, 6, 4, 4, 4, 4,
- 3, 4, 3, 4, 1, 1, 1, 1, 2, 2,
- 1, 1, 2, 2, 1, 2, 2, 2, 2, 2,
- 2, 1, 2, 2, 1, 2, 2, 5, 4, 4,
- 5, 4, 2, 5, 4, 5, 1, 3, 3, 3,
- 3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
- 3, 3, 3, 3, 3, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
- 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
- 1, 3, 3, 1, 3, 3, 1, 5, 4, 3,
- 5, 1, 1, 3, 3, 1, 1, 1, 1, 1,
- 1, 1
-};
-
-static const short yydefact[] = { 0,
- 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
- 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
- 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
- 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
- 166, 0, 0, 162, 63, 0, 69, 42, 40, 0,
- 0, 0, 61, 0, 49, 0, 26, 170, 17, 168,
- 15, 0, 159, 0, 0, 68, 16, 0, 0, 59,
- 167, 0, 164, 64, 69, 50, 48, 12, 0, 10,
- 11, 172, 0, 8, 9, 13, 14, 15, 0, 178,
- 180, 0, 179, 0, 174, 176, 177, 171, 169, 163,
- 67, 71, 72, 70, 0, 161, 0, 57, 113, 0,
- 128, 111, 0, 0, 90, 93, 128, 0, 0, 0,
- 115, 0, 0, 182, 181, 173, 175, 0, 0, 60,
- 165, 0, 0, 0, 0, 108, 99, 88, 0, 0,
- 0, 0, 107, 21, 18, 22, 20, 19, 114, 128,
- 112, 0, 128, 74, 73, 55, 191, 75, 23, 0,
- 86, 0, 77, 79, 83, 85, 0, 80, 0, 81,
- 140, 128, 87, 82, 0, 58, 119, 116, 0, 0,
- 0, 121, 130, 131, 129, 120, 118, 92, 0, 91,
- 95, 0, 0, 0, 0, 0, 0, 0, 339, 0,
- 0, 0, 0, 6, 5, 2, 3, 4, 7, 338,
- 0, 406, 0, 103, 405, 336, 341, 0, 337, 342,
- 343, 344, 422, 407, 408, 437, 411, 412, 415, 425,
- 444, 449, 456, 467, 472, 475, 478, 481, 484, 487,
- 492, 501, 493, 0, 102, 100, 98, 101, 110, 89,
- 109, 189, 0, 128, 76, 78, 84, 106, 0, 137,
- 0, 142, 0, 55, 0, 0, 280, 0, 0, 0,
- 0, 0, 0, 0, 0, 339, 0, 223, 0, 8,
- 406, 0, 0, 197, 0, 212, 0, 193, 195, 0,
- 196, 201, 213, 0, 202, 214, 0, 203, 204, 215,
- 254, 0, 205, 0, 216, 206, 293, 0, 217, 218,
- 219, 221, 220, 0, 222, 247, 246, 0, 244, 245,
- 242, 243, 241, 126, 124, 0, 117, 0, 0, 416,
- 406, 342, 344, 413, 417, 414, 421, 420, 419, 418,
- 0, 390, 0, 0, 0, 16, 0, 426, 423, 427,
- 424, 433, 0, 406, 0, 183, 186, 0, 0, 0,
- 0, 0, 96, 0, 0, 365, 0, 410, 409, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 499, 500, 0, 144, 0, 143, 136, 105, 134, 138,
- 191, 141, 0, 230, 231, 229, 249, 0, 315, 0,
- 304, 302, 0, 312, 310, 0, 276, 0, 257, 0,
- 326, 0, 290, 0, 308, 306, 0, 0, 199, 0,
- 0, 226, 224, 0, 0, 192, 190, 194, 198, 322,
- 406, 225, 228, 0, 275, 0, 406, 0, 295, 299,
- 292, 0, 0, 319, 0, 127, 125, 123, 122, 133,
- 132, 352, 347, 0, 389, 379, 378, 361, 0, 372,
- 380, 0, 373, 0, 362, 0, 0, 0, 0, 0,
- 0, 349, 340, 184, 0, 351, 346, 391, 0, 369,
- 401, 0, 350, 345, 367, 348, 368, 388, 403, 0,
- 366, 0, 441, 438, 442, 439, 443, 440, 447, 445,
- 448, 446, 453, 450, 454, 451, 455, 452, 463, 458,
- 465, 460, 462, 457, 464, 459, 466, 0, 461, 470,
- 468, 471, 469, 474, 473, 477, 476, 480, 479, 483,
- 482, 486, 485, 490, 0, 0, 495, 494, 145, 135,
- 406, 146, 0, 0, 150, 0, 250, 0, 316, 314,
- 305, 303, 313, 311, 277, 0, 258, 0, 0, 0,
- 323, 327, 0, 324, 291, 309, 307, 340, 0, 200,
- 232, 0, 0, 0, 255, 0, 296, 0, 284, 0,
- 0, 321, 0, 397, 398, 0, 384, 385, 0, 381,
- 374, 0, 377, 375, 376, 363, 354, 0, 435, 429,
- 432, 0, 0, 430, 188, 185, 187, 392, 0, 402,
- 399, 0, 404, 400, 357, 0, 489, 0, 0, 147,
- 0, 0, 151, 148, 251, 0, 278, 274, 0, 331,
- 0, 335, 334, 328, 325, 329, 236, 0, 233, 234,
- 0, 0, 0, 260, 0, 264, 0, 267, 0, 301,
- 300, 286, 0, 298, 0, 320, 0, 395, 0, 383,
- 382, 387, 386, 356, 364, 353, 434, 428, 436, 431,
- 371, 370, 393, 0, 358, 359, 491, 488, 0, 149,
- 0, 0, 0, 248, 0, 201, 0, 208, 209, 0,
- 210, 211, 0, 259, 332, 0, 237, 0, 0, 235,
- 273, 270, 271, 502, 0, 262, 265, 0, 261, 0,
- 268, 0, 0, 285, 0, 318, 317, 396, 355, 394,
- 360, 0, 152, 0, 0, 0, 227, 279, 0, 333,
- 330, 240, 238, 0, 272, 269, 263, 0, 283, 0,
- 0, 0, 153, 0, 252, 0, 0, 239, 281, 282,
- 155, 0, 0, 0, 0, 154, 0, 0, 0, 0,
- 288, 0, 253, 287, 0, 0, 0
-};
-
-static const short yydefgoto[] = { 775,
- 210, 279, 211, 85, 86, 68, 60, 87, 212, 22,
- 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
- 283, 284, 132, 105, 47, 70, 104, 130, 162, 163,
- 164, 91, 114, 115, 116, 213, 166, 259, 92, 111,
- 181, 182, 136, 185, 398, 168, 169, 170, 261, 171,
- 172, 402, 552, 553, 285, 18, 43, 72, 65, 107,
- 44, 63, 94, 95, 96, 97, 214, 358, 286, 175,
- 555, 720, 288, 289, 290, 291, 695, 292, 293, 294,
- 295, 698, 296, 297, 298, 299, 699, 300, 444, 301,
- 585, 655, 656, 657, 658, 302, 303, 701, 304, 305,
- 306, 702, 307, 308, 451, 663, 664, 309, 310, 311,
- 312, 313, 314, 315, 571, 572, 573, 574, 215, 216,
- 217, 218, 489, 219, 470, 471, 472, 220, 221, 222,
- 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
- 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
- 243, 244, 393, 490, 715
-};
-
-static const short yypact[] = { 507,
--32768,-32768, 15, -30, 18, 244,-32768,-32768, 414, 443,
- 556,-32768,-32768,-32768,-32768, 714,-32768,-32768,-32768,-32768,
- 23,-32768,-32768,-32768, 359,-32768, 340,-32768, 49, 601,
--32768,-32768, 585, 603,-32768, -30, 417,-32768,-32768, 92,
--32768, 489, -24, 107,-32768, 529, 295,-32768,-32768, -30,
- 710, 452,-32768, 344,-32768, 40,-32768,-32768,-32768,-32768,
- 192, 1047,-32768, 530, -24,-32768,-32768, 388, 534,-32768,
--32768, -24, 107,-32768, 295,-32768,-32768,-32768, 540,-32768,
--32768,-32768, 548, 258,-32768,-32768, 307, 442, 736,-32768,
--32768, 77,-32768, 1638,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,-32768, 312, 406,-32768, -24,-32768,-32768, 379,
- -18,-32768, 426, 331,-32768, 693, -18, 120, 210, 429,
--32768, 564, 587,-32768,-32768,-32768,-32768, 593, 951,-32768,
--32768, 406, 607, 617, 214,-32768,-32768,-32768, 618, 1077,
- 219, 531,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -18,
--32768, 361, -18,-32768,-32768, 460, 471,-32768, 494, 736,
--32768, 1204,-32768,-32768, 500,-32768, 180,-32768, 535,-32768,
--32768, 591,-32768,-32768, 1759,-32768,-32768,-32768, 620, 728,
- 377,-32768,-32768,-32768, 613,-32768,-32768,-32768, 157,-32768,
--32768, 2663, 2728, 2779, 2844, 655, 32, 707,-32768, 2895,
- 2960, 3011, 5025,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 673, 881, 56,-32768, 678, 746,-32768, 640,-32768, 671,
--32768, 715, 866,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 899, 921, 1006, 838, 920, 654, 814, 820, 847, 263,
--32768,-32768,-32768, 850,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768, 963, 591,-32768,-32768,-32768,-32768, 484, 769,
- 775,-32768, -1, 306, 353, 3076,-32768, 232, 1357, 35,
- 392, 419, 228, 424, 234, 779, 5324,-32768, -30, 538,
- 974, 265, 872,-32768, 784,-32768, 1691,-32768,-32768, 789,
--32768,-32768,-32768, 1827,-32768,-32768, 797,-32768,-32768,-32768,
--32768, 1827,-32768, 1827,-32768,-32768, 5375, 802,-32768,-32768,
--32768,-32768,-32768, 427,-32768, 737, 806, 866, 902, 916,
--32768,-32768,-32768,-32768, 891, 642,-32768, 592, 660,-32768,
- 189,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 409,-32768, 666, 964, 793, 793, 428,-32768,-32768,-32768,
--32768,-32768, 777, 1121, 66,-32768,-32768, 622, 432, 5092,
- 3127, 729,-32768, -28, 3192,-32768, 435,-32768,-32768, 3243,
- 3308, 3359, 3424, 3475, 3540, 3591, 3656, 3707, 3772, 3823,
- 3888, 864, 3939, 4004, 4055, 4120, 4171, 4236, 4287, 2032,
--32768,-32768, 4352,-32768, 605,-32768,-32768,-32768, 810,-32768,
--32768,-32768, 1691,-32768,-32768,-32768,-32768, 4403,-32768, 95,
--32768,-32768, 126,-32768,-32768, 174,-32768, 4468,-32768, 4519,
--32768, 785,-32768, 4933,-32768,-32768, 182, 269, 815, 2083,
- 604,-32768,-32768, -30, 2148,-32768,-32768,-32768,-32768,-32768,
- 1158,-32768,-32768, 823,-32768, 861, 1018, 728,-32768,-32768,
--32768, 86, 2199,-32768, 4584,-32768, 891,-32768,-32768,-32768,
--32768,-32768,-32768, 565, 836,-32768,-32768,-32768, 2264, 793,
--32768, 590, 793, 590,-32768, 2315, 4635, 223, -43, 2380,
- 191,-32768, 894,-32768, 1967,-32768,-32768,-32768, 649,-32768,
--32768, 237,-32768,-32768,-32768,-32768,-32768, 839,-32768, 239,
--32768, 5143,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 899,
--32768, 899,-32768, 921,-32768, 921,-32768, 921,-32768, 1006,
--32768, 1006,-32768, 1006,-32768, 1006,-32768, 258,-32768,-32768,
- 838,-32768, 838,-32768, 920,-32768, 654,-32768, 814,-32768,
- 820,-32768, 847,-32768, 933, 857,-32768,-32768,-32768,-32768,
- 1254,-32768, 1691, 859, 856, 1691,-32768, 314,-32768,-32768,
--32768,-32768,-32768,-32768,-32768, 348,-32768, 870, 461, 229,
- 785,-32768, 535,-32768,-32768,-32768,-32768,-32768, 467, 815,
--32768, 967, 14, 444,-32768, 878,-32768, 5067,-32768, 4958,
- 876, 887, 892,-32768,-32768, 5208,-32768,-32768, 241,-32768,
- 895, 299,-32768, 895,-32768,-32768, 406, 17,-32768,-32768,
--32768, 4700, 487,-32768,-32768,-32768,-32768,-32768, 4751,-32768,
--32768, 5259,-32768,-32768, 406, 704,-32768, 4816, 662,-32768,
- 1691, 2431,-32768,-32768,-32768, 1893,-32768,-32768, 343,-32768,
- 835,-32768,-32768,-32768,-32768,-32768,-32768, 2496,-32768,-32768,
- 999, 91, 4867,-32768, 674,-32768, 1467,-32768, 5324,-32768,
--32768,-32768, 928, 923, 5000,-32768, 410,-32768, 723,-32768,
--32768,-32768,-32768,-32768,-32768, 406,-32768,-32768,-32768,-32768,
--32768,-32768,-32768, 731,-32768, 406,-32768,-32768, 477,-32768,
- 243, 108, 485,-32768, 978, 979, 1893,-32768,-32768, 1893,
--32768,-32768, 942,-32768, 948, 950,-32768, 1053, 128,-32768,
--32768,-32768,-32768,-32768, 328,-32768,-32768, 1540,-32768, 1608,
--32768, 961, 1827,-32768, 970,-32768,-32768,-32768,-32768,-32768,
--32768, 2547,-32768, 262, 4403, 1827,-32768,-32768, 2612,-32768,
--32768,-32768,-32768, 1071,-32768,-32768,-32768, 980,-32768, 1827,
- 296, 202,-32768, 358,-32768, 4958, 983,-32768,-32768,-32768,
--32768, 302, 1893, 990, 5000,-32768, 1021, 1893, 992, 1893,
--32768, 1893,-32768,-32768, 1087, 1089,-32768
-};
-
-static const short yypgoto[] = {-32768,
--32768, -57, -60, 711, -16, -123, 568,-32768, -3, 552,
--32768, 130,-32768, 1085, 791,-32768, 22,-32768,-32768, 778,
- 12, 154,-32768,-32768, 1044, 1030,-32768, -128,-32768, 945,
--32768, 382, -106, 973, -165, -193,-32768,-32768, 469, -58,
- 865, -327, -40,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 957,-32768, 142,-32768, 718, -10,-32768,-32768,-32768,-32768,
- 1072, 584,-32768, 1031,-32768,-32768, 372,-32768, -122, 867,
- 843, -166, -279,-32768, 819, -234, 197, -551,-32768, -529,
--32768,-32768,-32768, -301,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768, 476, 486, -619, -496,-32768,-32768,-32768,-32768,
--32768,-32768,-32768, -436,-32768, -603, 832,-32768,-32768,-32768,
--32768,-32768,-32768,-32768,-32768, 569,-32768, 573,-32768,-32768,
- 119,-32768, -386,-32768, 799, 362, -326, 858, 163, 1120,
- 320, 437, 438, -112, 560, 636, -470,-32768, 632, 724,
- 651, 625, 761, 765, 760, 764, 776,-32768, 526, 771,
- 717,-32768,-32768, 29,-32768
-};
-
-
-#define YYLAST 5484
-
-
-static const short yytable[] = { 21,
- 459, 84, 29, 176, 83, 450, 174, 438, 287, 357,
- 184, 16, 614, 325, 650, 19, 152, 675, 26, 474,
- 16, 16, 16, 38, 117, 59, 479, 481, 84, 67,
- 31, 123, 342, 84, 134, 342, 83, 721, 61, 174,
- 76, 16, 61, 497, 16, 16, 260, 59, 583, 48,
- 612, 93, 59, 602, 31, 20, 363, 20, 88, 442,
- 61, 725, 16, 150, 153, 61, 482, 445, 84, 446,
- 62, 83, 84, 89, 347, 179, 143, 124, 135, 334,
- 336, 338, 340, 93, 696, 88, 587, 349, 351, 608,
- 88, 711, 55, 404, 405, 559, 56, 406, 721, 84,
- 20, 84, 123, 20, 83, 89, 697, 651, 650, 249,
- 676, 59, 251, 619, 280, 626, 619, 67, 173, 84,
- 144, 39, 326, 40, 61, 88, 561, -157, 743, 88,
- 61, 262, 343, 25, 27, 343, 399, 345, 77, 700,
- 160, 353, 680, 601, 180, 696, 604, 49, 696, 50,
- 422, 173, 764, 17, -94, -94, 88, 137, 88, 483,
- 457, 769, 17, 17, 17, 52, 54, 697, 245, 57,
- 697, 281, 429, 160, 563, 125, 88, 20, 712, 57,
- 258, 346, 576, 17, -294, 588, 17, 17, 331, 331,
- 331, 331, 84, 560, 61, 179, 331, 331, 354, 703,
- 700, 734, 743, 700, 17, 461, 64, 619, 110, 669,
- 146, 696, 113, 396, 186, 90, 696, 145, 696, 246,
- 696, 744, 84, 611, 562, 434, 280, 619, 421, 642,
- 355, 245, 411, 697, 425, 684, 556, 620, 697, 623,
- 697, 670, 697, 649, 28, 692, 280, 90, -97, 88,
- -97, 110, 113, -97, -97, -97, -97, 504, 506, 508,
- 703, 709, 710, 703, 180, 432, 700, 84, 189, 482,
- 179, 700, 564, 700, -104, 700, 438, 389, -104, 88,
- 577, 360, 161, 281, 613, 361, 661, 602, 450, 362,
- 441, 617, 50, 316, 410, 762, 742, 416, 441, 672,
- 441, 619, 758, 447, 282, 428, -322, 147, 189, -25,
- -25, 187, 67, 706, 635, 161, 247, 20, 448, 20,
- 598, 528, 157, 157, 88, 61, 703, 580, 745, 20,
- 412, 703, 426, 703, 621, 703, 624, 317, 671, 180,
- 45, 733, 280, 704, 74, 752, 69, 367, 637, 390,
- -25, 438, 433, 407, 118, -25, -25, -25, 635, 41,
- 753, -25, 578, 450, 610, -25, 331, 331, 331, 331,
- 331, 331, 331, 331, 331, 331, 331, 331, 88, 331,
- 331, 331, 331, 331, 331, 331, 631, 84, 101, 492,
- 434, -65, 417, 500, 761, -65, 673, 413, -322, 551,
- 766, 694, 46, 119, 427, 316, 46, 636, 189, 462,
- 726, 128, 316, -30, 1, 746, 282, 53, 546, 419,
- 316, 42, 316, 282, 423, 316, 137, 454, 475, 138,
- 139, 282, 486, 282, -65, 501, 558, -256, -65, -66,
- 438, 638, -31, 1, 88, 408, 566, 643, 568, 317,
- 646, 763, 71, -158, 450, 189, 317, 2, 492, 250,
- 139, 640, 442, 450, 317, 445, 317, 647, 3, 317,
- 327, 133, 465, 331, 4, 463, 328, 647, 674, 331,
- 5, 591, -66, 593, 418, 407, 2, 679, 749, 58,
- 652, 57, 280, 498, 318, 280, 685, 599, 487, 678,
- 129, 755, 20, 4, 157, 653, -28, 1, 492, 5,
- 165, 420, 7, 245, 42, 760, 424, -97, 133, 455,
- 476, 316, -97, -97, -97, -97, 148, 502, 694, 66,
- 98, 248, 282, 749, 102, 755, 78, 760, 120, 654,
- 109, 7, 50, 165, 727, 196, -160, 729, 112, 281,
- 2, 197, 281, 641, -139, -29, 1, 731, 198, 648,
- 57, 3, 199, 189, 149, 317, 252, 4, 80, 732,
- 280, 81, 20, 5, 20, 200, 201, 735, 157, 202,
- 84, 6, 397, 179, -32, 1, 253, 151, 204, 205,
- 206, 207, 458, 154, 208, 209, 280, 167, 257, 2,
- -34, 1, -33, 1, 493, 7, 318, 177, 331, 331,
- 3, 319, 320, 318, 20, 20, 4, 183, 188, 20,
- 324, 318, 5, 318, 331, 20, 318, 281, 2, 157,
- 167, 99, 441, 20, 118, 2, 103, 88, 359, 3,
- 366, 78, 456, 134, 2, 4, 2, 682, 100, 20,
- 2, 5, 180, 281, 7, 106, 78, 280, 594, 280,
- 460, 4, 493, 4, 385, 595, 464, 5, 579, 5,
- 494, 316, 20, 80, 316, 495, 81, 20, 20, 496,
- 159, 714, 282, 7, 203, 282, 602, 722, 80, 20,
- 131, 81, 20, 441, 630, 155, 441, 634, 549, 7,
- 178, 7, 20, 20, 328, 20, 316, 344, 316, -35,
- 1, 159, 329, 159, 281, 317, 281, 484, 317, 441,
- 652, 485, 318, 319, 320, 20, 689, 20, 494, 493,
- 319, 320, 441, 495, 321, 653, 121, 496, 319, 320,
- 319, 320, 618, 319, 320, 20, 441, 20, 619, 316,
- 317, 20, 317, 2, 316, 341, 78, 35, 57, 441,
- 282, -497, -497, 754, 441, 282, 441, 757, 441, 716,
- 4, 35, 690, 359, 36, 316, 5, 78, 364, 35,
- 37, -341, -341, 316, 140, 78, 282, 32, 80, 141,
- 142, 81, 20, 317, 122, 494, 36, 686, 317, 30,
- 495, 34, 37, 619, 496, -498, -498, 32, 7, 80,
- 322, 32, 81, 20, 20, 316, 728, 80, 316, 317,
- 81, 20, 619, 51, 730, 386, 282, 317, 32, 282,
- 619, 600, 387, -341, 600, 705, 316, -341, 316, 319,
- 320, 316, 365, 603, 569, 605, 321, 282, 570, 282,
- -343, -343, 282, 321, 316, 378, 379, 380, 381, 317,
- 388, 321, 317, 321, 527, 282, 321, 400, 316, 401,
- 477, -156, 318, 478, 316, 318, 435, 359, 2, 282,
- 317, 316, 317, 316, 78, 317, 316, 439, 316, 469,
- 316, 323, 282, 737, 382, 443, 738, 282, 317, 282,
- 453, 282, -343, 370, 371, 372, -343, 318, 550, 318,
- 368, 369, 317, 78, 139, 35, 80, 584, 317, 81,
- 20, 78, 322, 373, 374, 317, 586, 317, 596, 322,
- 317, 622, 317, 627, 317, 383, 384, 322, 37, 322,
- 391, 392, 322, 78, 628, 80, -407, -407, 81, 20,
- 318, 632, 196, 80, 633, 318, 81, 20, 197, 767,
- -408, -408, 321, 639, 771, 198, 773, 649, 774, 199,
- 659, -496, -496, 360, 665, 80, 318, 361, 81, 20,
- 666, 362, 200, 201, 318, 667, 202, 141, 142, 319,
- 320, 602, 319, 320, 156, 204, 205, 206, 207, 710,
- 78, 208, 209, 323, 510, 512, 2, 531, 533, 79,
- 323, 4, 78, 375, 376, 377, 318, 5, 323, 318,
- 323, 723, 588, 323, 319, 320, 319, 320, 520, 522,
- 524, 526, 80, 736, -207, 81, 20, 318, 322, 318,
- 739, 740, 318, 741, 80, 157, 158, 81, 20, 332,
- 332, 332, 332, 742, 748, 318, 394, 332, 332, -15,
- 466, 467, 468, 750, -496, -496, 360, 319, 320, 318,
- 430, 758, 319, 320, 431, 318, 770, 191, 759, 192,
- 193, 765, 318, 768, 318, 772, 776, 318, 777, 318,
- 2, 318, 529, 319, 320, 33, 78, 75, 514, 516,
- 518, 319, 320, -15, 108, 79, 256, 4, -496, -496,
- 360, 190, 321, 5, 430, 321, 254, 395, 362, 323,
- 554, 194, 195, 73, 127, 449, 78, 403, 80, 437,
- 717, 81, 20, 319, 320, 196, 319, 320, 452, 644,
- 718, 197, 82, 645, 473, 535, 539, 321, 198, 321,
- 537, 541, 199, 688, 319, 320, 319, 320, 80, 319,
- 320, 81, 20, 548, 543, 200, 201, 0, 0, 202,
- 0, 203, 319, 320, 0, 0, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 319, 320, 322, 0,
- 321, 322, 319, 320, 0, 321, 0, 0, 0, 319,
- 320, 319, 320, 0, 319, 320, 319, 320, 319, 320,
- 0, -496, -496, 360, 0, 0, 321, 480, 0, 0,
- 0, 362, 0, 322, 321, 322, 0, 332, 332, 332,
- 332, 332, 332, 332, 332, 332, 332, 332, 332, 0,
- 332, 332, 332, 332, 332, 332, 332, 156, -496, -496,
- 360, 0, 0, 78, 361, 0, 321, 0, 431, 321,
- 0, 0, 79, 0, 4, 0, 322, 0, 0, 323,
- 5, 322, 323, 0, 0, 0, 0, 321, 0, 321,
- 0, 0, 321, 0, 0, 80, 0, 0, 81, 20,
- 0, 0, 322, 0, 0, 321, 0, 0, 157, 255,
- 322, 0, 0, 0, 323, 0, 323, 0, 0, 321,
- 0, 333, 333, 333, 333, 321, 0, 0, 0, 333,
- 333, 0, 321, 0, 321, 0, 0, 321, 0, 321,
- 0, 321, 322, 0, 332, 322, 0, 0, 0, -15,
- 332, 0, 0, 0, -496, -496, 360, 323, 0, 0,
- 430, 0, 323, 322, 629, 322, 0, 414, 322, 192,
- 193, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 322, 0, 323, 0, 0, 0, 0, 0, 0,
- 0, 323, 0, 0, 0, 322, 0, 0, 0, 0,
- 0, 322, 0, 0, 0, 0, 0, 0, 322, 0,
- 322, 194, 195, 322, 0, 322, 78, 322, 0, 0,
- 0, 0, 0, 323, 0, 196, 323, 0, 0, 0,
- 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
- 0, 0, 199, 0, 323, 0, 323, 0, 80, 323,
- 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
- 0, 0, 323, 0, 0, 415, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 323, 263, 0, 332,
- 332, 0, 323, 0, 0, 0, 0, 0, 0, 323,
- 0, 323, 0, 0, 323, 332, 323, 0, 323, 333,
- 333, 333, 333, 333, 333, 333, 333, 333, 333, 333,
- 333, 0, 333, 333, 333, 333, 333, 333, 333, 0,
- 264, 194, 195, 652, 265, 266, 78, 267, 0, 0,
- 268, 0, 0, 0, 269, 196, 0, 0, 653, 0,
- 0, 270, 271, 5, 272, 0, 273, 274, 198, 275,
- 263, 0, 276, 0, 0, 0, 0, 0, 80, 0,
- 0, 81, 20, 0, 0, 0, 0, 0, 0, 277,
- 0, 157, 719, 0, 0, 278, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 0, 0, 0, 0,
- 0, 0, 0, 264, 194, 195, 652, 265, 266, 78,
- 267, 0, 0, 268, 0, 0, 333, 269, 196, 0,
- 0, 653, 333, 0, 270, 271, 5, 272, 263, 273,
- 274, 198, 275, 0, 0, 276, 0, 0, 0, 0,
- 0, 80, 0, 0, 81, 20, 0, 0, 0, 0,
- 0, 0, 277, 0, 157, 747, 0, 0, 278, 0,
- 0, 204, 205, 206, 207, 0, 0, 208, 209, 0,
- 0, 264, 194, 195, -266, 265, 266, 78, 267, 0,
- 0, 268, 0, 0, 0, 269, 196, 0, 0, -266,
- 0, 0, 270, 271, 5, 272, 0, 273, 274, 198,
- 275, 2, 0, 276, 0, 0, 0, 78, 0, 80,
- 0, 263, 81, 20, 0, 0, 79, 0, 4, 0,
- 277, 0, 157, -266, 5, 0, 278, 0, 0, 204,
- 205, 206, 207, 0, 0, 208, 209, 0, 0, 80,
- 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
- 0, 333, 333, 126, 264, 194, 195, 0, 265, 266,
- 78, 267, 0, 0, 268, 0, 0, 333, 269, 196,
- 0, 0, 0, 0, 0, 270, 271, 5, 272, 263,
- 273, 274, 198, 275, 0, 0, 276, 0, 0, 0,
- 0, 0, 80, 0, 0, 81, 20, 0, 0, 0,
- 0, 0, 0, 277, 0, 157, 436, 0, 0, 278,
- 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
- 0, 0, 264, 194, 195, 0, 265, 266, 78, 267,
- 0, 0, 268, 0, 0, 0, 269, 196, 0, 0,
- 0, 0, 0, 270, 271, 5, 272, 263, 273, 274,
- 198, 275, 0, 0, 276, 0, 0, 0, 0, 0,
- 80, 0, 0, 81, 20, 0, 0, 0, 0, 0,
- 0, 277, 0, 157, 0, 0, 0, 278, 0, 0,
- 204, 205, 206, 207, 0, 0, 208, 209, 0, 0,
- 440, 194, 195, 0, 265, 266, 78, 267, 0, 0,
- 268, 0, 0, 0, 269, 196, 0, 0, 0, 0,
- 0, 270, 271, 263, 272, 0, 273, 274, 198, 275,
- 0, 0, 276, 0, 0, 0, 0, 0, 80, 0,
- 0, 81, 20, 0, 0, 0, 0, 0, 0, 277,
- 0, 157, 0, 0, 0, 278, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 440, 194, 195, 0,
- 693, 266, 78, 267, 0, 0, 268, 0, 0, 0,
- 269, 196, 0, 0, 0, 0, 0, 270, 271, 0,
- 272, 0, 273, 274, 198, 275, 0, 615, 276, 192,
- 193, 0, 0, 0, 80, 0, 0, 81, 20, 0,
- 0, 0, 0, 0, 0, 277, 0, 157, 0, 0,
- 0, 278, 0, 0, 204, 205, 206, 207, 0, 0,
- 208, 209, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 194, 195, 0, 0, 0, 78, 0, 0, 0,
- 0, 0, 0, 0, 0, 196, 0, 0, 0, 0,
- 0, 197, 544, 0, 192, 193, 0, 0, 198, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
- 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
- 0, 203, 616, 0, 0, 0, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
- 0, 78, 0, 491, 0, 192, 193, 0, 0, 0,
- 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
- 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
- 0, 0, 0, 80, 0, 0, 81, 20, 0, 545,
- 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
- 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
- 209, 196, 0, 0, 0, 0, 0, 197, 581, 0,
- 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
- 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
- 148, 0, 0, 0, 204, 205, 206, 207, 0, 0,
- 208, 209, 194, 195, 0, 0, 0, 78, 0, 589,
- 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
- 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
- 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
- 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
- 202, 582, 0, 194, 195, 0, 0, 0, 78, 204,
- 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
- 0, 0, 0, 197, 597, 0, 192, 193, 0, 0,
- 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
- 0, 202, 0, 0, 0, 0, 0, 590, 0, 0,
- 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
- 0, 0, 0, 78, 0, 606, 0, 192, 193, 0,
- 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
- 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
- 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
- 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
- 195, 598, 0, 0, 78, 204, 205, 206, 207, 0,
- 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
- 491, 0, 192, 193, 0, 0, 198, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
- 20, 0, 0, 200, 201, 0, 0, 202, 607, 0,
- 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
- 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
- 0, 581, 0, 192, 193, 0, 0, 0, 196, 0,
- 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
- 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
- 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
- 0, 0, 202, 0, 0, 194, 195, 598, 0, 0,
- 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
- 0, 0, 0, 0, 0, 197, 707, 0, 192, 193,
- 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
- 201, 0, 0, 202, 691, 0, 0, 0, 0, 0,
- 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
- 194, 195, 0, 0, 0, 78, 0, 707, 0, 192,
- 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
- 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
- 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
- 81, 20, 0, 0, 200, 201, 0, 0, 202, 708,
- 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
- 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
- 0, 197, 589, 0, 192, 193, 0, 0, 198, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
- 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
- 751, 0, 0, 0, 0, 0, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
- 0, 78, 0, 330, 0, 192, 193, 0, 0, 0,
- 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
- 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
- 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
- 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
- 756, 0, 78, 204, 205, 206, 207, 0, 0, 208,
- 209, 196, 0, 0, 0, 0, 0, 197, 335, 0,
- 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
- 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
- 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
- 208, 209, 194, 195, 0, 0, 0, 78, 0, 337,
- 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
- 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
- 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
- 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
- 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
- 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
- 0, 0, 0, 197, 339, 0, 192, 193, 0, 0,
- 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
- 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
- 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
- 0, 0, 0, 78, 0, 348, 0, 192, 193, 0,
- 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
- 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
- 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
- 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
- 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
- 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
- 350, 0, 192, 193, 0, 0, 198, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
- 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
- 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
- 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
- 0, 352, 0, 192, 193, 0, 0, 0, 196, 0,
- 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
- 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
- 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
- 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
- 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
- 0, 0, 0, 0, 0, 197, 409, 0, 192, 193,
- 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
- 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
- 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
- 194, 195, 0, 0, 0, 78, 0, 491, 0, 192,
- 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
- 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
- 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
- 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
- 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
- 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
- 0, 197, 499, 0, 192, 193, 0, 0, 198, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
- 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
- 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
- 0, 78, 0, 503, 0, 192, 193, 0, 0, 0,
- 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
- 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
- 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
- 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
- 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
- 209, 196, 0, 0, 0, 0, 0, 197, 505, 0,
- 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
- 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
- 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
- 208, 209, 194, 195, 0, 0, 0, 78, 0, 507,
- 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
- 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
- 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
- 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
- 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
- 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
- 0, 0, 0, 197, 509, 0, 192, 193, 0, 0,
- 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
- 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
- 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
- 0, 0, 0, 78, 0, 511, 0, 192, 193, 0,
- 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
- 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
- 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
- 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
- 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
- 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
- 513, 0, 192, 193, 0, 0, 198, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
- 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
- 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
- 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
- 0, 515, 0, 192, 193, 0, 0, 0, 196, 0,
- 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
- 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
- 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
- 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
- 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
- 0, 0, 0, 0, 0, 197, 517, 0, 192, 193,
- 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
- 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
- 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
- 194, 195, 0, 0, 0, 78, 0, 519, 0, 192,
- 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
- 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
- 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
- 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
- 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
- 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
- 0, 197, 521, 0, 192, 193, 0, 0, 198, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
- 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
- 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
- 0, 78, 0, 523, 0, 192, 193, 0, 0, 0,
- 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
- 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
- 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
- 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
- 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
- 209, 196, 0, 0, 0, 0, 0, 197, 525, 0,
- 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
- 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
- 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
- 208, 209, 194, 195, 0, 0, 0, 78, 0, 530,
- 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
- 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
- 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
- 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
- 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
- 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
- 0, 0, 0, 197, 532, 0, 192, 193, 0, 0,
- 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
- 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
- 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
- 0, 0, 0, 78, 0, 534, 0, 192, 193, 0,
- 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
- 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
- 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
- 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
- 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
- 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
- 536, 0, 192, 193, 0, 0, 198, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
- 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
- 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
- 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
- 0, 538, 0, 192, 193, 0, 0, 0, 196, 0,
- 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
- 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
- 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
- 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
- 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
- 0, 0, 0, 0, 0, 197, 540, 0, 192, 193,
- 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
- 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
- 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
- 194, 195, 0, 0, 0, 78, 0, 542, 0, 192,
- 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
- 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
- 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
- 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
- 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
- 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
- 0, 197, 547, 0, 192, 193, 0, 0, 198, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
- 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
- 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
- 0, 78, 0, 557, 0, 192, 193, 0, 0, 0,
- 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
- 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
- 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
- 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
- 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
- 209, 196, 0, 0, 0, 0, 0, 197, 565, 0,
- 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
- 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
- 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
- 208, 209, 194, 195, 0, 0, 0, 78, 0, 567,
- 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
- 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
- 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
- 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
- 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
- 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
- 0, 0, 0, 197, 592, 0, 192, 193, 0, 0,
- 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
- 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
- 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
- 0, 0, 0, 78, 0, 609, 0, 192, 193, 0,
- 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
- 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
- 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
- 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
- 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
- 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
- 677, 0, 192, 193, 0, 0, 198, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
- 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
- 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
- 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
- 0, 681, 0, 192, 193, 0, 0, 0, 196, 0,
- 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
- 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
- 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
- 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
- 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
- 0, 0, 0, 0, 0, 197, 687, 0, 192, 193,
- 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
- 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
- 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
- 194, 195, 0, 0, 0, 78, 0, 713, 0, 192,
- 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
- 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
- 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
- 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
- 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
- 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
- 0, 197, 0, 575, 0, 0, 0, 0, 198, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
- 0, 81, 20, 0, 0, 200, 201, 0, 662, 202,
- 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
- 206, 207, 0, 0, 208, 209, -289, -289, -289, 0,
- 0, 0, -289, 0, 0, 0, 0, 0, 0, 0,
- 0, -289, 0, 0, 0, 0, 0, -289, 0, 0,
- 724, 0, 194, 195, -289, 0, 0, 78, -289, 0,
- 0, 0, 0, 0, -289, 0, 196, -289, -289, 0,
- 0, 0, 197, 0, 0, -289, 0, 192, 193, 198,
- 0, -289, 0, 199, -289, -289, -289, -289, 0, 80,
- -289, -289, 81, 20, 194, 195, 0, 0, 0, 78,
- 277, -297, 0, 0, 0, 0, 0, 0, 196, 204,
- 205, 206, 207, 0, 197, 208, 209, 660, 0, 194,
- 195, 198, 0, 0, 78, 199, 0, 0, 0, 0,
- 0, 80, 0, 196, 81, 20, 0, 0, 0, 197,
- 0, 0, 277, -297, 192, 193, 198, 0, 0, 0,
- 199, 204, 205, 206, 207, 0, 80, 208, 209, 81,
- 20, 194, 195, 200, 201, 0, 78, 202, 0, 203,
- 356, 0, 0, 0, 0, 196, 204, 205, 206, 207,
- 0, 197, 208, 209, 0, 0, 194, 195, 198, 0,
- 0, 78, 199, 0, 0, 192, 193, 0, 80, 0,
- 196, 81, 20, 0, 0, 0, 197, 0, 0, 277,
- 0, 0, 0, 198, 0, 0, 0, 199, 204, 205,
- 206, 207, 0, 80, 208, 209, 81, 20, 0, 0,
- 200, 201, 0, 0, 202, 488, 0, 194, 195, 0,
- 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
- 209, 196, 0, 0, 0, 0, 0, 197, 0, 0,
- 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
- 0, 200, 201, 0, 0, 202, 625, 0, 0, 0,
- 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
- 208, 209, 194, 195, 0, 0, 0, 78, 0, 0,
- 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
- 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
- 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
- 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
- 202, 668, 0, 194, 195, 0, 0, 0, 78, 204,
- 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
- 0, 0, 0, 197, 0, 0, 192, 193, 0, 0,
- 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
- 0, 202, 683, 0, 0, 0, 0, 0, 0, 0,
- 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
- 0, 0, 0, 78, 0, 0, 0, 0, 0, 0,
- 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
- 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
- 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
- 0, 0, 200, 201, 0, 0, 202, 0, 2, 194,
- 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
- 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
- 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
- 20, 0, 0, 0, 0, 0, 0, 277, 0, 0,
- 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
- 0, 0, 208, 209
-};
-
-static const short yycheck[] = { 3,
- 328, 62, 6, 132, 62, 307, 129, 287, 175, 203,
- 134, 0, 483, 179, 1, 1, 123, 1, 1, 346,
- 9, 10, 11, 1, 83, 42, 353, 354, 89, 46,
- 9, 89, 1, 94, 53, 1, 94, 657, 42, 162,
- 1, 30, 46, 72, 33, 34, 169, 64, 435, 1,
- 94, 62, 69, 97, 33, 86, 1, 86, 62, 294,
- 64, 665, 51, 122, 123, 69, 1, 302, 129, 304,
- 95, 129, 133, 62, 198, 133, 117, 1, 97, 192,
- 193, 194, 195, 94, 636, 89, 1, 200, 201, 476,
- 94, 1, 1, 95, 96, 1, 5, 99, 718, 160,
- 86, 162, 160, 86, 162, 94, 636, 94, 1, 150,
- 94, 128, 153, 100, 175, 502, 100, 134, 129, 180,
- 1, 99, 180, 101, 128, 129, 1, 93, 1, 133,
- 134, 172, 101, 4, 5, 101, 259, 198, 99, 636,
- 129, 202, 613, 470, 133, 697, 473, 99, 700, 101,
- 273, 162, 756, 0, 99, 100, 160, 1, 162, 94,
- 326, 765, 9, 10, 11, 36, 37, 697, 140, 40,
- 700, 175, 279, 162, 1, 99, 180, 86, 88, 50,
- 1, 198, 1, 30, 99, 100, 33, 34, 192, 193,
- 194, 195, 253, 99, 198, 253, 200, 201, 202, 636,
- 697, 94, 1, 700, 51, 329, 100, 100, 79, 596,
- 1, 763, 83, 254, 1, 62, 768, 98, 770, 1,
- 772, 94, 283, 1, 99, 283, 287, 100, 1, 1,
- 202, 203, 1, 763, 1, 622, 403, 1, 768, 1,
- 770, 1, 772, 1, 1, 632, 307, 94, 92, 253,
- 94, 122, 123, 97, 98, 99, 100, 370, 371, 372,
- 697, 648, 1, 700, 253, 1, 763, 328, 139, 1,
- 328, 768, 99, 770, 95, 772, 556, 15, 99, 283,
- 99, 93, 129, 287, 94, 97, 588, 97, 590, 101,
- 294, 485, 101, 175, 266, 94, 1, 269, 302, 1,
- 304, 100, 1, 307, 175, 277, 1, 98, 179, 45,
- 46, 98, 329, 641, 1, 162, 98, 86, 307, 86,
- 98, 382, 95, 95, 328, 329, 763, 434, 1, 86,
- 99, 768, 99, 770, 98, 772, 98, 175, 98, 328,
- 1, 99, 403, 1, 1, 732, 52, 218, 1, 87,
- 86, 631, 88, 1, 97, 91, 92, 93, 1, 1,
- 99, 97, 94, 665, 477, 101, 370, 371, 372, 373,
- 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
- 384, 385, 386, 387, 388, 389, 553, 448, 1, 361,
- 448, 52, 1, 365, 99, 52, 98, 268, 93, 403,
- 99, 636, 63, 97, 275, 287, 63, 94, 279, 1,
- 1, 100, 294, 0, 1, 88, 287, 1, 390, 1,
- 302, 63, 304, 294, 1, 307, 1, 1, 1, 99,
- 100, 302, 1, 304, 95, 1, 408, 95, 95, 52,
- 720, 94, 0, 1, 448, 93, 418, 570, 420, 287,
- 573, 94, 1, 95, 756, 326, 294, 44, 430, 99,
- 100, 1, 697, 765, 302, 700, 304, 1, 55, 307,
- 94, 93, 343, 477, 61, 67, 100, 1, 607, 483,
- 67, 453, 95, 455, 93, 1, 44, 1, 723, 1,
- 47, 362, 553, 364, 175, 556, 625, 469, 67, 612,
- 95, 736, 86, 61, 95, 62, 0, 1, 480, 67,
- 129, 93, 99, 485, 63, 750, 93, 92, 93, 93,
- 93, 403, 97, 98, 99, 100, 98, 93, 763, 1,
- 1, 1, 403, 768, 1, 770, 50, 772, 97, 96,
- 1, 99, 101, 162, 667, 59, 95, 676, 1, 553,
- 44, 65, 556, 93, 95, 0, 1, 686, 72, 93,
- 431, 55, 76, 434, 1, 403, 96, 61, 82, 93,
- 631, 85, 86, 67, 86, 89, 90, 93, 95, 93,
- 641, 75, 99, 641, 0, 1, 93, 1, 102, 103,
- 104, 105, 1, 1, 108, 109, 657, 129, 99, 44,
- 0, 1, 0, 1, 1, 99, 287, 1, 612, 613,
- 55, 175, 175, 294, 86, 86, 61, 1, 1, 86,
- 1, 302, 67, 304, 628, 86, 307, 631, 44, 95,
- 162, 64, 636, 86, 97, 44, 69, 641, 101, 55,
- 1, 50, 1, 53, 44, 61, 44, 619, 65, 86,
- 44, 67, 641, 657, 99, 72, 50, 718, 94, 720,
- 1, 61, 1, 61, 11, 101, 1, 67, 65, 67,
- 67, 553, 86, 82, 556, 72, 85, 86, 86, 76,
- 129, 653, 553, 99, 95, 556, 97, 659, 82, 86,
- 107, 85, 86, 697, 553, 128, 700, 556, 94, 99,
- 94, 99, 86, 86, 100, 86, 588, 1, 590, 0,
- 1, 160, 100, 162, 718, 553, 720, 96, 556, 723,
- 47, 100, 403, 287, 287, 86, 65, 86, 67, 1,
- 294, 294, 736, 72, 175, 62, 1, 76, 302, 302,
- 304, 304, 94, 307, 307, 86, 750, 86, 100, 631,
- 588, 86, 590, 44, 636, 101, 50, 44, 629, 763,
- 631, 91, 92, 735, 768, 636, 770, 739, 772, 96,
- 61, 44, 631, 101, 61, 657, 67, 50, 101, 44,
- 67, 45, 46, 665, 92, 50, 657, 10, 82, 97,
- 98, 85, 86, 631, 59, 67, 61, 94, 636, 9,
- 72, 11, 67, 100, 76, 91, 92, 30, 99, 82,
- 175, 34, 85, 86, 86, 697, 94, 82, 700, 657,
- 85, 86, 100, 33, 94, 12, 697, 665, 51, 700,
- 100, 470, 13, 97, 473, 1, 718, 101, 720, 403,
- 403, 723, 97, 472, 60, 474, 287, 718, 64, 720,
- 45, 46, 723, 294, 736, 18, 19, 20, 21, 697,
- 14, 302, 700, 304, 1, 736, 307, 99, 750, 95,
- 94, 93, 553, 97, 756, 556, 93, 101, 44, 750,
- 718, 763, 720, 765, 50, 723, 768, 99, 770, 97,
- 772, 175, 763, 697, 57, 99, 700, 768, 736, 770,
- 99, 772, 97, 5, 6, 7, 101, 588, 99, 590,
- 45, 46, 750, 50, 100, 44, 82, 95, 756, 85,
- 86, 50, 287, 3, 4, 763, 66, 765, 93, 294,
- 768, 93, 770, 1, 772, 16, 17, 302, 67, 304,
- 91, 92, 307, 50, 88, 82, 45, 46, 85, 86,
- 631, 93, 59, 82, 99, 636, 85, 86, 65, 763,
- 45, 46, 403, 94, 768, 72, 770, 1, 772, 76,
- 93, 91, 92, 93, 99, 82, 657, 97, 85, 86,
- 94, 101, 89, 90, 665, 94, 93, 97, 98, 553,
- 553, 97, 556, 556, 44, 102, 103, 104, 105, 1,
- 50, 108, 109, 287, 373, 374, 44, 383, 384, 59,
- 294, 61, 50, 8, 9, 10, 697, 67, 302, 700,
- 304, 94, 100, 307, 588, 588, 590, 590, 378, 379,
- 380, 381, 82, 56, 56, 85, 86, 718, 403, 720,
- 99, 94, 723, 94, 82, 95, 96, 85, 86, 192,
- 193, 194, 195, 1, 94, 736, 94, 200, 201, 86,
- 97, 98, 99, 94, 91, 92, 93, 631, 631, 750,
- 97, 1, 636, 636, 101, 756, 56, 1, 99, 3,
- 4, 99, 763, 94, 765, 94, 0, 768, 0, 770,
- 44, 772, 382, 657, 657, 11, 50, 54, 375, 376,
- 377, 665, 665, 86, 75, 59, 162, 61, 91, 92,
- 93, 139, 553, 67, 97, 556, 160, 253, 101, 403,
- 403, 45, 46, 52, 94, 307, 50, 261, 82, 287,
- 655, 85, 86, 697, 697, 59, 700, 700, 307, 571,
- 655, 65, 96, 571, 346, 385, 387, 588, 72, 590,
- 386, 388, 76, 628, 718, 718, 720, 720, 82, 723,
- 723, 85, 86, 393, 389, 89, 90, -1, -1, 93,
- -1, 95, 736, 736, -1, -1, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 750, 750, 553, -1,
- 631, 556, 756, 756, -1, 636, -1, -1, -1, 763,
- 763, 765, 765, -1, 768, 768, 770, 770, 772, 772,
- -1, 91, 92, 93, -1, -1, 657, 97, -1, -1,
- -1, 101, -1, 588, 665, 590, -1, 370, 371, 372,
- 373, 374, 375, 376, 377, 378, 379, 380, 381, -1,
- 383, 384, 385, 386, 387, 388, 389, 44, 91, 92,
- 93, -1, -1, 50, 97, -1, 697, -1, 101, 700,
- -1, -1, 59, -1, 61, -1, 631, -1, -1, 553,
- 67, 636, 556, -1, -1, -1, -1, 718, -1, 720,
- -1, -1, 723, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 657, -1, -1, 736, -1, -1, 95, 96,
- 665, -1, -1, -1, 588, -1, 590, -1, -1, 750,
- -1, 192, 193, 194, 195, 756, -1, -1, -1, 200,
- 201, -1, 763, -1, 765, -1, -1, 768, -1, 770,
- -1, 772, 697, -1, 477, 700, -1, -1, -1, 86,
- 483, -1, -1, -1, 91, 92, 93, 631, -1, -1,
- 97, -1, 636, 718, 101, 720, -1, 1, 723, 3,
- 4, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 736, -1, 657, -1, -1, -1, -1, -1, -1,
- -1, 665, -1, -1, -1, 750, -1, -1, -1, -1,
- -1, 756, -1, -1, -1, -1, -1, -1, 763, -1,
- 765, 45, 46, 768, -1, 770, 50, 772, -1, -1,
- -1, -1, -1, 697, -1, 59, 700, -1, -1, -1,
- -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
- -1, -1, 76, -1, 718, -1, 720, -1, 82, 723,
- -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
- -1, -1, 736, -1, -1, 99, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 750, 1, -1, 612,
- 613, -1, 756, -1, -1, -1, -1, -1, -1, 763,
- -1, 765, -1, -1, 768, 628, 770, -1, 772, 370,
- 371, 372, 373, 374, 375, 376, 377, 378, 379, 380,
- 381, -1, 383, 384, 385, 386, 387, 388, 389, -1,
- 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
- 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
- -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
- 1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
- -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, -1, -1, -1, -1,
- -1, -1, -1, 44, 45, 46, 47, 48, 49, 50,
- 51, -1, -1, 54, -1, -1, 477, 58, 59, -1,
- -1, 62, 483, -1, 65, 66, 67, 68, 1, 70,
- 71, 72, 73, -1, -1, 76, -1, -1, -1, -1,
- -1, 82, -1, -1, 85, 86, -1, -1, -1, -1,
- -1, -1, 93, -1, 95, 96, -1, -1, 99, -1,
- -1, 102, 103, 104, 105, -1, -1, 108, 109, -1,
- -1, 44, 45, 46, 47, 48, 49, 50, 51, -1,
- -1, 54, -1, -1, -1, 58, 59, -1, -1, 62,
- -1, -1, 65, 66, 67, 68, -1, 70, 71, 72,
- 73, 44, -1, 76, -1, -1, -1, 50, -1, 82,
- -1, 1, 85, 86, -1, -1, 59, -1, 61, -1,
- 93, -1, 95, 96, 67, -1, 99, -1, -1, 102,
- 103, 104, 105, -1, -1, 108, 109, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
- -1, 612, 613, 96, 44, 45, 46, -1, 48, 49,
- 50, 51, -1, -1, 54, -1, -1, 628, 58, 59,
- -1, -1, -1, -1, -1, 65, 66, 67, 68, 1,
- 70, 71, 72, 73, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
- -1, -1, -1, 93, -1, 95, 96, -1, -1, 99,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- -1, -1, 44, 45, 46, -1, 48, 49, 50, 51,
- -1, -1, 54, -1, -1, -1, 58, 59, -1, -1,
- -1, -1, -1, 65, 66, 67, 68, 1, 70, 71,
- 72, 73, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
- -1, 93, -1, 95, -1, -1, -1, 99, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, -1, -1,
- 44, 45, 46, -1, 48, 49, 50, 51, -1, -1,
- 54, -1, -1, -1, 58, 59, -1, -1, -1, -1,
- -1, 65, 66, 1, 68, -1, 70, 71, 72, 73,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
- -1, 95, -1, -1, -1, 99, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
- 48, 49, 50, 51, -1, -1, 54, -1, -1, -1,
- 58, 59, -1, -1, -1, -1, -1, 65, 66, -1,
- 68, -1, 70, 71, 72, 73, -1, 1, 76, 3,
- 4, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, -1, -1, -1, -1, 93, -1, 95, -1, -1,
- -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 45, 46, -1, -1, -1, 50, -1, -1, -1,
- -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
- -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
- -1, 95, 96, -1, -1, -1, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
- -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
- 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
- -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
- -1, -1, -1, 82, -1, -1, 85, 86, -1, 88,
- 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
- -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
- 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
- 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
- 98, -1, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
- -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
- -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
- 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
- -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
- 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
- -1, 93, -1, -1, -1, -1, -1, 99, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
- -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
- -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
- 46, 98, -1, -1, 50, 102, 103, 104, 105, -1,
- -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
- 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
- -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
- -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
- -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
- -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
- -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
- -1, -1, 93, -1, -1, 45, 46, 98, -1, -1,
- 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
- -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
- -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
- 90, -1, -1, 93, 94, -1, -1, -1, -1, -1,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
- 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
- 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
- -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
- 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
- -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
- 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
- -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
- 94, -1, -1, -1, -1, -1, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
- -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
- 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
- -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
- -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
- 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
- 99, -1, 50, 102, 103, 104, 105, -1, -1, 108,
- 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
- 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
- -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
- -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
- -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
- 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
- -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
- 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
- -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
- -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
- -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
- 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
- -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
- 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
- -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
- -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
- -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
- -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
- -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
- 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
- -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
- -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
- 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
- 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
- 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
- -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
- 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
- -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
- 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
- -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
- -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
- -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
- 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
- -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
- -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
- 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
- -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
- 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
- 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
- -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
- -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
- -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
- 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
- -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
- 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
- -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
- -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
- -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
- 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
- -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
- 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
- -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
- -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
- -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
- -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
- -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
- 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
- -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
- -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
- 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
- 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
- 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
- -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
- 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
- -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
- 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
- -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
- -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
- -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
- 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
- -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
- -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
- 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
- -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
- 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
- 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
- -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
- -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
- -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
- 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
- -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
- 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
- -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
- -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
- -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
- 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
- -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
- 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
- -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
- -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
- -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
- -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
- -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
- 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
- -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
- -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
- 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
- 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
- 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
- -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
- 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
- -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
- 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
- -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
- -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
- -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
- 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
- -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
- -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
- 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
- -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
- 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
- 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
- -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
- -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
- -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
- 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
- -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
- 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
- -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
- -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
- -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
- 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
- -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
- 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
- -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
- -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
- -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
- -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
- -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
- 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
- -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
- -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
- -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
- 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
- -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
- 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
- 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
- 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
- -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
- 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
- -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
- 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
- -1, 65, -1, 1, -1, -1, -1, -1, 72, -1,
- -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
- -1, 85, 86, -1, -1, 89, 90, -1, 1, 93,
- -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
- 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
- -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
- -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
- 1, -1, 45, 46, 72, -1, -1, 50, 76, -1,
- -1, -1, -1, -1, 82, -1, 59, 85, 86, -1,
- -1, -1, 65, -1, -1, 93, -1, 3, 4, 72,
- -1, 99, -1, 76, 102, 103, 104, 105, -1, 82,
- 108, 109, 85, 86, 45, 46, -1, -1, -1, 50,
- 93, 94, -1, -1, -1, -1, -1, -1, 59, 102,
- 103, 104, 105, -1, 65, 108, 109, 1, -1, 45,
- 46, 72, -1, -1, 50, 76, -1, -1, -1, -1,
- -1, 82, -1, 59, 85, 86, -1, -1, -1, 65,
- -1, -1, 93, 94, 3, 4, 72, -1, -1, -1,
- 76, 102, 103, 104, 105, -1, 82, 108, 109, 85,
- 86, 45, 46, 89, 90, -1, 50, 93, -1, 95,
- 96, -1, -1, -1, -1, 59, 102, 103, 104, 105,
- -1, 65, 108, 109, -1, -1, 45, 46, 72, -1,
- -1, 50, 76, -1, -1, 3, 4, -1, 82, -1,
- 59, 85, 86, -1, -1, -1, 65, -1, -1, 93,
- -1, -1, -1, 72, -1, -1, -1, 76, 102, 103,
- 104, 105, -1, 82, 108, 109, 85, 86, -1, -1,
- 89, 90, -1, -1, 93, 94, -1, 45, 46, -1,
- -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
- 109, 59, -1, -1, -1, -1, -1, 65, -1, -1,
- 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
- -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
- -1, 89, 90, -1, -1, 93, 94, -1, -1, -1,
- -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
- 108, 109, 45, 46, -1, -1, -1, 50, -1, -1,
- -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
- -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
- -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
- 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
- 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
- -1, -1, -1, 65, -1, -1, 3, 4, -1, -1,
- 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
- 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
- -1, 93, 94, -1, -1, -1, -1, -1, -1, -1,
- 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
- -1, -1, -1, 50, -1, -1, -1, -1, -1, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
- -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
- -1, -1, 89, 90, -1, -1, 93, -1, 44, 45,
- 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
- -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
- -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
- 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, -1, -1, -1, -1, -1, -1, 93, -1, -1,
- -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
- -1, -1, 108, 109
-};
-#define YYPURE 1
-
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/lib/bison.simple"
-/* This file comes from bison-1.27. */
-
-/* Skeleton output parser for bison,
- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* This is the parser code that is written into each bison parser
- when the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-#ifndef YYSTACK_USE_ALLOCA
-#ifdef alloca
-#define YYSTACK_USE_ALLOCA
-#else /* alloca not defined */
-#ifdef __GNUC__
-#define YYSTACK_USE_ALLOCA
-#define alloca __builtin_alloca
-#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
-#define YYSTACK_USE_ALLOCA
-#include <alloca.h>
-#else /* not sparc */
-/* We think this test detects Watcom and Microsoft C. */
-/* This used to test MSDOS, but that is a bad idea
- since that symbol is in the user namespace. */
-#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
-#if 0 /* No need for malloc.h, which pollutes the namespace;
- instead, just don't use alloca. */
-#include <malloc.h>
-#endif
-#else /* not MSDOS, or __TURBOC__ */
-#if defined(_AIX)
-/* I don't know what this was needed for, but it pollutes the namespace.
- So I turned it off. rms, 2 May 1997. */
-/* #include <malloc.h> */
- #pragma alloca
-#define YYSTACK_USE_ALLOCA
-#else /* not MSDOS, or __TURBOC__, or _AIX */
-#if 0
-#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
- and on HPUX 10. Eventually we can turn this on. */
-#define YYSTACK_USE_ALLOCA
-#define alloca __builtin_alloca
-#endif /* __hpux */
-#endif
-#endif /* not _AIX */
-#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc */
-#endif /* not GNU C */
-#endif /* alloca not defined */
-#endif /* YYSTACK_USE_ALLOCA not defined */
-
-#ifdef YYSTACK_USE_ALLOCA
-#define YYSTACK_ALLOC alloca
-#else
-#define YYSTACK_ALLOC malloc
-#endif
-
-/* Note: there must be only one dollar sign in this file.
- It is replaced by the list of actions, each action
- as one case of the switch. */
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrlab1
-/* Like YYERROR except do call yyerror.
- This remains here temporarily to ease the
- transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-#define YYFAIL goto yyerrlab
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(token, value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { yychar = (token), yylval = (value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { yyerror ("syntax error: cannot back up"); YYERROR; } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-#ifndef YYPURE
-#define YYLEX yylex()
-#endif
-
-#ifdef YYPURE
-#ifdef YYLSP_NEEDED
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval, &yylloc)
-#endif
-#else /* not YYLSP_NEEDED */
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval)
-#endif
-#endif /* not YYLSP_NEEDED */
-#endif
-
-/* If nonreentrant, generate the variables here */
-
-#ifndef YYPURE
-
-int yychar; /* the lookahead symbol */
-YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-
-#ifdef YYLSP_NEEDED
-YYLTYPE yylloc; /* location data for the lookahead */
- /* symbol */
-#endif
-
-int yynerrs; /* number of parse errors so far */
-#endif /* not YYPURE */
-
-#if YYDEBUG != 0
-int yydebug; /* nonzero means print parse trace */
-/* Since this is uninitialized, it does not stop multiple parsers
- from coexisting. */
-#endif
-
-/* YYINITDEPTH indicates the initial size of the parser's stacks */
-
-#ifndef YYINITDEPTH
-#define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH is the maximum size the stacks can grow to
- (effective only if the built-in stack extension method is used). */
-
-#if YYMAXDEPTH == 0
-#undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-#define YYMAXDEPTH 10000
-#endif
-
-/* Define __yy_memcpy. Note that the size argument
- should be passed with type unsigned int, because that is what the non-GCC
- definitions require. With GCC, __builtin_memcpy takes an arg
- of type size_t, but it can handle unsigned int. */
-
-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
-#else /* not GNU C or C++ */
-#ifndef __cplusplus
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (to, from, count)
- char *to;
- char *from;
- unsigned int count;
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#else /* __cplusplus */
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (char *to, char *from, unsigned int count)
-{
- register char *t = to;
- register char *f = from;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#endif
-#endif
-
-#line 216 "/usr/lib/bison.simple"
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-#ifdef __cplusplus
-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else /* not __cplusplus */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-#endif /* not __cplusplus */
-#else /* not YYPARSE_PARAM */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* not YYPARSE_PARAM */
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-#ifdef YYPARSE_PARAM
-int yyparse (void *);
-#else
-int yyparse (void);
-#endif
-#endif
-
-int
-yyparse(YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- register int yystate;
- register int yyn;
- register short *yyssp;
- register YYSTYPE *yyvsp;
- int yyerrstatus; /* number of tokens to shift before error messages enabled */
- int yychar1 = 0; /* lookahead token as an internal (translated) token number */
-
- short yyssa[YYINITDEPTH]; /* the state stack */
- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
-
- short *yyss = yyssa; /* refer to the stacks thru separate pointers */
- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
-
-#ifdef YYLSP_NEEDED
- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
-
-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
-#else
-#define YYPOPSTACK (yyvsp--, yyssp--)
-#endif
-
- int yystacksize = YYINITDEPTH;
- int yyfree_stacks = 0;
-
-#ifdef YYPURE
- int yychar;
- YYSTYPE yylval;
- int yynerrs;
-#ifdef YYLSP_NEEDED
- YYLTYPE yylloc;
-#endif
-#endif
-
- YYSTYPE yyval; /* the variable used to return */
- /* semantic values from the action */
- /* routines */
-
- int yylen;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Starting parse\n");
-#endif
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss - 1;
- yyvsp = yyvs;
-#ifdef YYLSP_NEEDED
- yylsp = yyls;
-#endif
-
-/* Push a new state, which is found in yystate . */
-/* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks. */
-yynewstate:
-
- *++yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Give user a chance to reallocate the stack */
- /* Use copies of these so that the &'s don't force the real ones into memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-#ifdef YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
-#endif
-
- /* Get the current used size of the three stacks, in elements. */
- int size = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- /* Each stack pointer address is followed by the size of
- the data in use in that stack, in bytes. */
-#ifdef YYLSP_NEEDED
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yyls1, size * sizeof (*yylsp),
- &yystacksize);
-#else
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yystacksize);
-#endif
-
- yyss = yyss1; yyvs = yyvs1;
-#ifdef YYLSP_NEEDED
- yyls = yyls1;
-#endif
-#else /* no yyoverflow */
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- {
- yyerror("parser stack overflow");
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 2;
- }
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
-#ifndef YYSTACK_USE_ALLOCA
- yyfree_stacks = 1;
-#endif
- yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1,
- size * (unsigned int) sizeof (*yyssp));
- yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1,
- size * (unsigned int) sizeof (*yyvsp));
-#ifdef YYLSP_NEEDED
- yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1,
- size * (unsigned int) sizeof (*yylsp));
-#endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + size - 1;
- yyvsp = yyvs + size - 1;
-#ifdef YYLSP_NEEDED
- yylsp = yyls + size - 1;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Entering state %d\n", yystate);
-#endif
-
- goto yybackup;
- yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Reading a token: ");
-#endif
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Now at end of input.\n");
-#endif
- }
- else
- {
- yychar1 = YYTRANSLATE(yychar);
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
- /* Give the individual parser a way to print the precise meaning
- of a token, for further debugging info. */
-#ifdef YYPRINT
- YYPRINT (stderr, yychar, yylval);
-#endif
- fprintf (stderr, ")\n");
- }
-#endif
- }
-
- yyn += yychar1;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- goto yydefault;
-
- yyn = yytable[yyn];
-
- /* yyn is what to do for this token type in this state.
- Negative => reduce, -yyn is rule number.
- Positive => shift, yyn is new state.
- New state is final state => don't bother to shift,
- just return success.
- 0, or most negative number => error. */
-
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrlab;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- /* count tokens shifted since error; after three, turn off error status. */
- if (yyerrstatus) yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-/* Do the default action for the current state. */
-yydefault:
-
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
-
-/* Do a reduction. yyn is the number of a rule to reduce with. */
-yyreduce:
- yylen = yyr2[yyn];
- if (yylen > 0)
- yyval = yyvsp[1-yylen]; /* implement default value of the action */
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- int i;
-
- fprintf (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
- fprintf (stderr, "%s ", yytname[yyrhs[i]]);
- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
-
-
- switch (yyn) {
-
-case 1:
-#line 460 "./parse.y"
-{;
- break;}
-case 18:
-#line 504 "./parse.y"
-{
- yyval.node = build_java_array_type (yyvsp[-2].node, -1);
- CLASS_LOADED_P (yyval.node) = 1;
- ;
- break;}
-case 19:
-#line 509 "./parse.y"
-{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
- break;}
-case 20:
-#line 511 "./parse.y"
-{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
- break;}
-case 21:
-#line 513 "./parse.y"
-{RULE ("']' expected"); RECOVER;;
- break;}
-case 22:
-#line 515 "./parse.y"
-{RULE ("']' expected"); RECOVER;;
- break;}
-case 26:
-#line 530 "./parse.y"
-{ yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
- break;}
-case 28:
-#line 539 "./parse.y"
-{yyval.node = NULL;;
- break;}
-case 36:
-#line 551 "./parse.y"
-{
- yyval.node = NULL;
- ;
- break;}
-case 37:
-#line 555 "./parse.y"
-{
- yyval.node = NULL;
- ;
- break;}
-case 40:
-#line 567 "./parse.y"
-{ ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ;
- break;}
-case 41:
-#line 569 "./parse.y"
-{yyerror ("Missing name"); RECOVER;;
- break;}
-case 42:
-#line 571 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 45:
-#line 581 "./parse.y"
-{
- tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
- int i = IDENTIFIER_LENGTH (name)-1;
- char *last = &IDENTIFIER_POINTER (name)[i];
- while (last != IDENTIFIER_POINTER (name))
- {
- if (last [0] == '.')
- break;
- last--;
- }
- last_name = get_identifier (++last);
- if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name))
- {
- tree err = find_name_in_single_imports (last_name);
- if (err && err != name)
- parse_error_context
- (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'",
- IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (err));
- else
- REGISTER_IMPORT (yyvsp[-1].node, last_name)
- }
- else
- REGISTER_IMPORT (yyvsp[-1].node, last_name);
- ;
- break;}
-case 46:
-#line 607 "./parse.y"
-{yyerror ("Missing name"); RECOVER;;
- break;}
-case 47:
-#line 609 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 48:
-#line 614 "./parse.y"
-{
- tree name = EXPR_WFL_NODE (yyvsp[-3].node);
- /* Don't import java.lang.* twice. */
- if (name != java_lang_id)
- {
- tree node = build_tree_list (yyvsp[-3].node, NULL_TREE);
- read_import_dir (yyvsp[-3].node);
- TREE_CHAIN (node) = ctxp->import_demand_list;
- ctxp->import_demand_list = node;
- }
- ;
- break;}
-case 49:
-#line 626 "./parse.y"
-{yyerror ("'*' expected"); RECOVER;;
- break;}
-case 50:
-#line 628 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 51:
-#line 633 "./parse.y"
-{
- maybe_generate_finit ();
- maybe_generate_clinit ();
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 52:
-#line 639 "./parse.y"
-{
- maybe_generate_clinit ();
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 53:
-#line 644 "./parse.y"
-{ yyval.node = NULL; ;
- break;}
-case 54:
-#line 646 "./parse.y"
-{
- YYERROR_NOW;
- yyerror ("Class or interface declaration expected");
- ;
- break;}
-case 55:
-#line 657 "./parse.y"
-{
- yyval.value = (1 << yyvsp[0].value);
- ;
- break;}
-case 56:
-#line 661 "./parse.y"
-{
- int acc = (1 << yyvsp[0].value);
- if (yyval.value & acc)
- parse_error_context
- (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice",
- java_accstring_lookup (acc));
- else
- {
- yyval.value |= acc;
- }
- ;
- break;}
-case 57:
-#line 677 "./parse.y"
-{ create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 58:
-#line 679 "./parse.y"
-{
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 59:
-#line 683 "./parse.y"
-{ create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 60:
-#line 685 "./parse.y"
-{
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 61:
-#line 689 "./parse.y"
-{yyerror ("Missing class name"); RECOVER;;
- break;}
-case 62:
-#line 691 "./parse.y"
-{yyerror ("Missing class name"); RECOVER;;
- break;}
-case 63:
-#line 693 "./parse.y"
-{
- if (!ctxp->class_err) yyerror ("'{' expected");
- DRECOVER(class1);
- ;
- break;}
-case 64:
-#line 698 "./parse.y"
-{if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
- break;}
-case 65:
-#line 702 "./parse.y"
-{ yyval.node = NULL; ;
- break;}
-case 66:
-#line 704 "./parse.y"
-{ yyval.node = yyvsp[0].node; ;
- break;}
-case 67:
-#line 706 "./parse.y"
-{yyerror ("'{' expected"); ctxp->class_err=1;;
- break;}
-case 68:
-#line 708 "./parse.y"
-{yyerror ("Missing super class name"); ctxp->class_err=1;;
- break;}
-case 69:
-#line 712 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 70:
-#line 714 "./parse.y"
-{ yyval.node = yyvsp[0].node; ;
- break;}
-case 71:
-#line 716 "./parse.y"
-{
- ctxp->class_err=1;
- yyerror ("Missing interface name");
- ;
- break;}
-case 72:
-#line 724 "./parse.y"
-{
- ctxp->interface_number = 1;
- yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
- ;
- break;}
-case 73:
-#line 729 "./parse.y"
-{
- ctxp->interface_number++;
- yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
- ;
- break;}
-case 74:
-#line 734 "./parse.y"
-{yyerror ("Missing interface name"); RECOVER;;
- break;}
-case 75:
-#line 739 "./parse.y"
-{
- /* Store the location of the `}' when doing xrefs */
- if (flag_emit_xref)
- DECL_END_SOURCE_LINE (ctxp->current_parsed_class) =
- EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
- yyval.node = ctxp->current_parsed_class;
- ;
- break;}
-case 76:
-#line 747 "./parse.y"
-{
- /* Store the location of the `}' when doing xrefs */
- if (flag_emit_xref)
- DECL_END_SOURCE_LINE (ctxp->current_parsed_class) =
- EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
- yyval.node = ctxp->current_parsed_class;
- ;
- break;}
-case 82:
-#line 766 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("instance initializer"); ;
- break;}
-case 84:
-#line 772 "./parse.y"
-{ yyval.node = yyvsp[-1].node; ;
- break;}
-case 86:
-#line 775 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("inner classe declaration"); ;
- break;}
-case 87:
-#line 777 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
- break;}
-case 88:
-#line 783 "./parse.y"
-{ register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
- break;}
-case 89:
-#line 785 "./parse.y"
-{
- check_modifiers
- ("Illegal modifier `%s' for field declaration",
- yyvsp[-3].value, FIELD_MODIFIERS);
- check_modifiers_consistency (yyvsp[-3].value);
- register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node);
- ;
- break;}
-case 91:
-#line 798 "./parse.y"
-{ yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
- break;}
-case 92:
-#line 800 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 93:
-#line 805 "./parse.y"
-{ yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
- break;}
-case 94:
-#line 807 "./parse.y"
-{
- if (java_error_count)
- yyvsp[0].node = NULL_TREE;
- yyval.node = build_tree_list
- (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node));
- ;
- break;}
-case 95:
-#line 814 "./parse.y"
-{
- yyerror ("Missing variable initializer");
- yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
- RECOVER;
- ;
- break;}
-case 96:
-#line 820 "./parse.y"
-{
- yyerror ("';' expected");
- yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
- RECOVER;
- ;
- break;}
-case 98:
-#line 830 "./parse.y"
-{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
- break;}
-case 99:
-#line 832 "./parse.y"
-{yyerror ("Invalid declaration"); DRECOVER(vdi);;
- break;}
-case 100:
-#line 834 "./parse.y"
-{yyerror ("']' expected"); DRECOVER(vdi);;
- break;}
-case 101:
-#line 836 "./parse.y"
-{yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
- break;}
-case 104:
-#line 847 "./parse.y"
-{
- current_function_decl = yyvsp[0].node;
- source_start_java_method (current_function_decl);
- ;
- break;}
-case 105:
-#line 852 "./parse.y"
-{ finish_method_declaration (yyvsp[0].node); ;
- break;}
-case 106:
-#line 854 "./parse.y"
-{YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
- break;}
-case 107:
-#line 859 "./parse.y"
-{ yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 108:
-#line 861 "./parse.y"
-{ yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 109:
-#line 863 "./parse.y"
-{ yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 110:
-#line 865 "./parse.y"
-{ yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 111:
-#line 867 "./parse.y"
-{RECOVER;;
- break;}
-case 112:
-#line 869 "./parse.y"
-{RECOVER;;
- break;}
-case 113:
-#line 871 "./parse.y"
-{yyerror ("Identifier expected"); RECOVER;;
- break;}
-case 114:
-#line 873 "./parse.y"
-{yyerror ("Identifier expected"); RECOVER;;
- break;}
-case 115:
-#line 875 "./parse.y"
-{
- yyerror ("Invalid method declaration, return type required");
- RECOVER;
- ;
- break;}
-case 116:
-#line 883 "./parse.y"
-{ yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
- break;}
-case 117:
-#line 885 "./parse.y"
-{ yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
- break;}
-case 118:
-#line 887 "./parse.y"
-{
- EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
- TREE_PURPOSE (yyvsp[-2].node) =
- build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node));
- parse_warning_context
- (wfl_operator,
- "Discouraged form of returned type specification");
- ;
- break;}
-case 119:
-#line 896 "./parse.y"
-{yyerror ("')' expected"); DRECOVER(method_declarator);;
- break;}
-case 120:
-#line 898 "./parse.y"
-{yyerror ("']' expected"); RECOVER;;
- break;}
-case 121:
-#line 903 "./parse.y"
-{
- ctxp->formal_parameter_number = 1;
- ;
- break;}
-case 122:
-#line 907 "./parse.y"
-{
- ctxp->formal_parameter_number += 1;
- yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 123:
-#line 912 "./parse.y"
-{yyerror ("Missing formal parameter term"); RECOVER;;
- break;}
-case 124:
-#line 917 "./parse.y"
-{
- yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
- ;
- break;}
-case 125:
-#line 921 "./parse.y"
-{
- parse_jdk1_1_error ("final parameters");
- yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
- ;
- break;}
-case 126:
-#line 926 "./parse.y"
-{yyerror ("Missing identifier"); RECOVER;;
- break;}
-case 127:
-#line 928 "./parse.y"
-{
- SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value));
- yyerror ("Missing identifier"); RECOVER;
- ;
- break;}
-case 128:
-#line 935 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 129:
-#line 937 "./parse.y"
-{ yyval.node = yyvsp[0].node; ;
- break;}
-case 130:
-#line 939 "./parse.y"
-{yyerror ("Missing class type term"); RECOVER;;
- break;}
-case 131:
-#line 944 "./parse.y"
-{ yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ;
- break;}
-case 132:
-#line 946 "./parse.y"
-{ yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ;
- break;}
-case 133:
-#line 948 "./parse.y"
-{yyerror ("Missing class type term"); RECOVER;;
- break;}
-case 136:
-#line 955 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 137:
-#line 961 "./parse.y"
-{
- TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized;
- ctxp->static_initialized = yyvsp[0].node;
- ;
- break;}
-case 138:
-#line 966 "./parse.y"
-{
- TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized;
- ctxp->static_initialized = yyvsp[-1].node;
- ;
- break;}
-case 139:
-#line 974 "./parse.y"
-{
- SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
- ;
- break;}
-case 140:
-#line 982 "./parse.y"
-{
- current_function_decl = yyvsp[0].node;
- source_start_java_method (current_function_decl);
- ;
- break;}
-case 141:
-#line 987 "./parse.y"
-{ finish_method_declaration (yyvsp[0].node); ;
- break;}
-case 142:
-#line 992 "./parse.y"
-{ yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 143:
-#line 994 "./parse.y"
-{ yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 144:
-#line 999 "./parse.y"
-{ yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
- break;}
-case 145:
-#line 1001 "./parse.y"
-{ yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
- break;}
-case 146:
-#line 1009 "./parse.y"
-{
- BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 147:
-#line 1014 "./parse.y"
-{ yyval.node = yyvsp[0].node; ;
- break;}
-case 148:
-#line 1016 "./parse.y"
-{ yyval.node = yyvsp[0].node; ;
- break;}
-case 149:
-#line 1018 "./parse.y"
-{ yyval.node = yyvsp[0].node; ;
- break;}
-case 152:
-#line 1028 "./parse.y"
-{
- yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE);
- yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
- yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
- ;
- break;}
-case 153:
-#line 1034 "./parse.y"
-{
- yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node);
- yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
- yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
- ;
- break;}
-case 154:
-#line 1042 "./parse.y"
-{yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
- break;}
-case 155:
-#line 1044 "./parse.y"
-{yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
- break;}
-case 156:
-#line 1049 "./parse.y"
-{
- tree wfl = build_wfl_node (this_identifier_node);
- EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
- yyval.node = wfl;
- ;
- break;}
-case 157:
-#line 1055 "./parse.y"
-{
- tree wfl = build_wfl_node (super_identifier_node);
- EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
- yyval.node = wfl;
- ;
- break;}
-case 158:
-#line 1066 "./parse.y"
-{ create_interface (0, yyvsp[0].node, NULL_TREE); ;
- break;}
-case 159:
-#line 1068 "./parse.y"
-{
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 160:
-#line 1072 "./parse.y"
-{ create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
- break;}
-case 161:
-#line 1074 "./parse.y"
-{
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 162:
-#line 1078 "./parse.y"
-{ create_interface (0, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 163:
-#line 1080 "./parse.y"
-{
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 164:
-#line 1084 "./parse.y"
-{ create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 165:
-#line 1086 "./parse.y"
-{
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 166:
-#line 1090 "./parse.y"
-{yyerror ("'{' expected"); RECOVER;;
- break;}
-case 167:
-#line 1092 "./parse.y"
-{yyerror ("'{' expected"); RECOVER;;
- break;}
-case 168:
-#line 1097 "./parse.y"
-{
- ctxp->interface_number = 1;
- yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
- ;
- break;}
-case 169:
-#line 1102 "./parse.y"
-{
- ctxp->interface_number++;
- yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
- ;
- break;}
-case 170:
-#line 1107 "./parse.y"
-{yyerror ("Invalid interface type"); RECOVER;;
- break;}
-case 171:
-#line 1109 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 172:
-#line 1114 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 173:
-#line 1116 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 178:
-#line 1128 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("inner class declaration"); ;
- break;}
-case 179:
-#line 1130 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
- break;}
-case 181:
-#line 1139 "./parse.y"
-{
- check_abstract_method_header (yyvsp[-1].node);
- current_function_decl = NULL_TREE; /* FIXME ? */
- ;
- break;}
-case 182:
-#line 1144 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 183:
-#line 1150 "./parse.y"
-{ yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ;
- break;}
-case 184:
-#line 1152 "./parse.y"
-{ yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ;
- break;}
-case 185:
-#line 1154 "./parse.y"
-{ yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ;
- break;}
-case 186:
-#line 1159 "./parse.y"
-{
- yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node),
- yyvsp[0].node, NULL_TREE);
- ;
- break;}
-case 187:
-#line 1164 "./parse.y"
-{
- yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
- ;
- break;}
-case 188:
-#line 1168 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 189:
-#line 1174 "./parse.y"
-{
- /* Store the location of the `}' when doing xrefs */
- if (current_function_decl && flag_emit_xref)
- DECL_END_SOURCE_LINE (current_function_decl) =
- EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
- yyval.node = empty_stmt_node;
- ;
- break;}
-case 190:
-#line 1182 "./parse.y"
-{ yyval.node = yyvsp[0].node; ;
- break;}
-case 191:
-#line 1187 "./parse.y"
-{ enter_block (); ;
- break;}
-case 192:
-#line 1192 "./parse.y"
-{
- maybe_absorb_scoping_blocks ();
- /* Store the location of the `}' when doing xrefs */
- if (current_function_decl && flag_emit_xref)
- DECL_END_SOURCE_LINE (current_function_decl) =
- EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
- yyval.node = exit_block ();
- ;
- break;}
-case 196:
-#line 1210 "./parse.y"
-{ java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
- break;}
-case 197:
-#line 1212 "./parse.y"
-{ parse_jdk1_1_error ("inner class declaration"); ;
- break;}
-case 199:
-#line 1221 "./parse.y"
-{ declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 200:
-#line 1223 "./parse.y"
-{ declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 206:
-#line 1233 "./parse.y"
-{ yyval.node = exit_block (); ;
- break;}
-case 211:
-#line 1242 "./parse.y"
-{ yyval.node = exit_block (); ;
- break;}
-case 223:
-#line 1261 "./parse.y"
-{ yyval.node = empty_stmt_node; ;
- break;}
-case 224:
-#line 1266 "./parse.y"
-{
- yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
- EXPR_WFL_NODE (yyvsp[-1].node));
- pushlevel (2);
- push_labeled_block (yyval.node);
- PUSH_LABELED_BLOCK (yyval.node);
- ;
- break;}
-case 225:
-#line 1277 "./parse.y"
-{ yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 226:
-#line 1279 "./parse.y"
-{yyerror ("':' expected"); RECOVER;;
- break;}
-case 227:
-#line 1284 "./parse.y"
-{ yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 228:
-#line 1291 "./parse.y"
-{
- /* We have a statement. Generate a WFL around it so
- we can debug it */
- yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0);
- /* We know we have a statement, so set the debug
- info to be eventually generate here. */
- yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node);
- ;
- break;}
-case 229:
-#line 1300 "./parse.y"
-{
- if (ctxp->prevent_ese != lineno)
- yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- ;
- break;}
-case 230:
-#line 1306 "./parse.y"
-{
- if (ctxp->prevent_ese != lineno)
- yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- ;
- break;}
-case 231:
-#line 1312 "./parse.y"
-{
- if (ctxp->prevent_ese != lineno)
- yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- ;
- break;}
-case 232:
-#line 1318 "./parse.y"
-{yyerror ("')' expected"); RECOVER;;
- break;}
-case 233:
-#line 1320 "./parse.y"
-{
- yyerror ("Constructor invocation must be first "
- "thing in a constructor");
- RECOVER;
- ;
- break;}
-case 234:
-#line 1326 "./parse.y"
-{yyerror ("')' expected"); RECOVER;;
- break;}
-case 235:
-#line 1328 "./parse.y"
-{
- yyerror ("Constructor invocation must be first "
- "thing in a constructor");
- RECOVER;
- ;
- break;}
-case 236:
-#line 1334 "./parse.y"
-{yyerror ("'(' expected"); RECOVER;;
- break;}
-case 237:
-#line 1336 "./parse.y"
-{yyerror ("')' expected"); RECOVER;;
- break;}
-case 238:
-#line 1338 "./parse.y"
-{yyerror ("')' expected"); RECOVER;;
- break;}
-case 239:
-#line 1340 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 240:
-#line 1342 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 248:
-#line 1357 "./parse.y"
-{
- yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node,
- yyvsp[0].node, NULL_TREE);
- ;
- break;}
-case 249:
-#line 1362 "./parse.y"
-{yyerror ("'(' expected"); RECOVER;;
- break;}
-case 250:
-#line 1364 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 251:
-#line 1366 "./parse.y"
-{yyerror ("')' expected"); RECOVER;;
- break;}
-case 252:
-#line 1371 "./parse.y"
-{ yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
-case 253:
-#line 1376 "./parse.y"
-{ yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
-case 254:
-#line 1381 "./parse.y"
-{
- enter_block ();
- ;
- break;}
-case 255:
-#line 1385 "./parse.y"
-{
- /* Make into "proper list" of COMPOUND_EXPRs.
- I.e. make the last statment also have its own
- COMPOUND_EXPR. */
- maybe_absorb_scoping_blocks ();
- TREE_OPERAND (yyvsp[-2].node, 1) = exit_block ();
- yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node);
- ;
- break;}
-case 256:
-#line 1397 "./parse.y"
-{
- yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
- EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
- ;
- break;}
-case 257:
-#line 1402 "./parse.y"
-{yyerror ("'(' expected"); RECOVER;;
- break;}
-case 258:
-#line 1404 "./parse.y"
-{yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
- break;}
-case 259:
-#line 1406 "./parse.y"
-{yyerror ("'{' expected"); RECOVER;;
- break;}
-case 260:
-#line 1414 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 261:
-#line 1416 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 262:
-#line 1418 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 263:
-#line 1420 "./parse.y"
-{ yyval.node = NULL_TREE; ;
- break;}
-case 269:
-#line 1439 "./parse.y"
-{
- tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
- EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
- java_method_add_stmt (current_function_decl, lab);
- ;
- break;}
-case 270:
-#line 1445 "./parse.y"
-{
- tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
- EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
- java_method_add_stmt (current_function_decl, lab);
- ;
- break;}
-case 271:
-#line 1451 "./parse.y"
-{yyerror ("Missing or invalid constant expression"); RECOVER;;
- break;}
-case 272:
-#line 1453 "./parse.y"
-{yyerror ("':' expected"); RECOVER;;
- break;}
-case 273:
-#line 1455 "./parse.y"
-{yyerror ("':' expected"); RECOVER;;
- break;}
-case 274:
-#line 1460 "./parse.y"
-{
- tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
- yyval.node = build_new_loop (body);
- ;
- break;}
-case 275:
-#line 1468 "./parse.y"
-{ yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
- break;}
-case 276:
-#line 1470 "./parse.y"
-{YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
- break;}
-case 277:
-#line 1472 "./parse.y"
-{yyerror ("Missing term and ')' expected"); RECOVER;;
- break;}
-case 278:
-#line 1474 "./parse.y"
-{yyerror ("')' expected"); RECOVER;;
- break;}
-case 279:
-#line 1479 "./parse.y"
-{ yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
- break;}
-case 280:
-#line 1484 "./parse.y"
-{
- tree body = build_loop_body (0, NULL_TREE, 1);
- yyval.node = build_new_loop (body);
- ;
- break;}
-case 281:
-#line 1493 "./parse.y"
-{ yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
- break;}
-case 282:
-#line 1498 "./parse.y"
-{ yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
-case 283:
-#line 1500 "./parse.y"
-{
- yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
- /* We have not condition, so we get rid of the EXIT_EXPR */
- LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
- empty_stmt_node;
- ;
- break;}
-case 284:
-#line 1507 "./parse.y"
-{yyerror ("Invalid control expression"); RECOVER;;
- break;}
-case 285:
-#line 1509 "./parse.y"
-{yyerror ("Invalid update expression"); RECOVER;;
- break;}
-case 286:
-#line 1511 "./parse.y"
-{yyerror ("Invalid update expression"); RECOVER;;
- break;}
-case 287:
-#line 1516 "./parse.y"
-{ yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
- break;}
-case 288:
-#line 1518 "./parse.y"
-{
- yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
- /* We have not condition, so we get rid of the EXIT_EXPR */
- LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
- empty_stmt_node;
- ;
- break;}
-case 289:
-#line 1528 "./parse.y"
-{
- /* This scope defined for local variable that may be
- defined within the scope of the for loop */
- enter_block ();
- ;
- break;}
-case 290:
-#line 1534 "./parse.y"
-{yyerror ("'(' expected"); DRECOVER(for_1);;
- break;}
-case 291:
-#line 1536 "./parse.y"
-{yyerror ("Invalid init statement"); RECOVER;;
- break;}
-case 292:
-#line 1541 "./parse.y"
-{
- /* We now declare the loop body. The loop is
- declared as a for loop. */
- tree body = build_loop_body (0, NULL_TREE, 0);
- yyval.node = build_new_loop (body);
- IS_FOR_LOOP_P (yyval.node) = 1;
- /* The loop is added to the current block the for
- statement is defined within */
- java_method_add_stmt (current_function_decl, yyval.node);
- ;
- break;}
-case 293:
-#line 1553 "./parse.y"
-{ yyval.node = empty_stmt_node; ;
- break;}
-case 294:
-#line 1555 "./parse.y"
-{
- /* Init statement recorded within the previously
- defined block scope */
- yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node);
- ;
- break;}
-case 295:
-#line 1561 "./parse.y"
-{
- /* Local variable are recorded within the previously
- defined block scope */
- yyval.node = NULL_TREE;
- ;
- break;}
-case 296:
-#line 1567 "./parse.y"
-{yyerror ("';' expected"); DRECOVER(for_init_1);;
- break;}
-case 297:
-#line 1571 "./parse.y"
-{yyval.node = empty_stmt_node;;
- break;}
-case 298:
-#line 1573 "./parse.y"
-{ yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
- break;}
-case 299:
-#line 1578 "./parse.y"
-{ yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
- break;}
-case 300:
-#line 1580 "./parse.y"
-{ yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
- break;}
-case 301:
-#line 1582 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 302:
-#line 1587 "./parse.y"
-{ yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
- break;}
-case 303:
-#line 1589 "./parse.y"
-{ yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
- break;}
-case 304:
-#line 1591 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 305:
-#line 1593 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 306:
-#line 1598 "./parse.y"
-{ yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
- break;}
-case 307:
-#line 1600 "./parse.y"
-{ yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
- break;}
-case 308:
-#line 1602 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 309:
-#line 1604 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 310:
-#line 1609 "./parse.y"
-{ yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
- break;}
-case 311:
-#line 1611 "./parse.y"
-{ yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
- break;}
-case 312:
-#line 1613 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 313:
-#line 1615 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 314:
-#line 1620 "./parse.y"
-{
- yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
- EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
- ;
- break;}
-case 315:
-#line 1625 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 316:
-#line 1627 "./parse.y"
-{yyerror ("';' expected"); RECOVER;;
- break;}
-case 317:
-#line 1632 "./parse.y"
-{
- yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
- EXPR_WFL_LINECOL (yyval.node) =
- EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
- ;
- break;}
-case 318:
-#line 1638 "./parse.y"
-{yyerror ("'{' expected"); RECOVER;;
- break;}
-case 319:
-#line 1640 "./parse.y"
-{yyerror ("'(' expected"); RECOVER;;
- break;}
-case 320:
-#line 1642 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 321:
-#line 1644 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 322:
-#line 1649 "./parse.y"
-{
- if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED)
- fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value));
- ;
- break;}
-case 323:
-#line 1657 "./parse.y"
-{ yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 324:
-#line 1659 "./parse.y"
-{ yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
- break;}
-case 325:
-#line 1661 "./parse.y"
-{ yyval.node = build_try_finally_statement
- (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location,
- yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node);
- ;
- break;}
-case 326:
-#line 1666 "./parse.y"
-{yyerror ("'{' expected"); DRECOVER (try_statement);;
- break;}
-case 328:
-#line 1672 "./parse.y"
-{
- TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
- yyval.node = yyvsp[0].node;
- ;
- break;}
-case 329:
-#line 1680 "./parse.y"
-{
- java_method_add_stmt (current_function_decl, yyvsp[0].node);
- exit_block ();
- yyval.node = yyvsp[-1].node;
- ;
- break;}
-case 330:
-#line 1688 "./parse.y"
-{
- /* We add a block to define a scope for
- formal_parameter (CCBP). The formal parameter is
- declared initialized by the appropriate function
- call */
- tree ccpb = enter_block ();
- tree init = build_assignment (ASSIGN_TK, yyvsp[-2].operator.location,
- TREE_PURPOSE (yyvsp[-1].node),
- soft_exceptioninfo_call_node);
- declare_local_variables (0, TREE_VALUE (yyvsp[-1].node),
- build_tree_list (TREE_PURPOSE (yyvsp[-1].node),
- init));
- yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb);
- EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
- ;
- break;}
-case 331:
-#line 1704 "./parse.y"
-{yyerror ("'(' expected"); RECOVER;;
- break;}
-case 332:
-#line 1706 "./parse.y"
-{yyerror ("Missing term or ')' expected"); DRECOVER (2);;
- break;}
-case 333:
-#line 1708 "./parse.y"
-{yyerror ("')' expected"); DRECOVER (1);;
- break;}
-case 334:
-#line 1713 "./parse.y"
-{ yyval.node = yyvsp[0].node; ;
- break;}
-case 335:
-#line 1715 "./parse.y"
-{yyerror ("'{' expected"); RECOVER; ;
- break;}
-case 339:
-#line 1727 "./parse.y"
-{ yyval.node = build_this (yyvsp[0].operator.location); ;
- break;}
-case 340:
-#line 1729 "./parse.y"
-{yyval.node = yyvsp[-1].node;;
- break;}
-case 345:
-#line 1738 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("named class literals"); ;
- break;}
-case 346:
-#line 1740 "./parse.y"
-{ yyval.node = build_class_ref (yyvsp[-2].node); ;
- break;}
-case 347:
-#line 1742 "./parse.y"
-{ yyval.node = build_class_ref (void_type_node); ;
- break;}
-case 348:
-#line 1747 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("class literals"); ;
- break;}
-case 349:
-#line 1749 "./parse.y"
-{yyerror ("')' expected"); RECOVER;;
- break;}
-case 350:
-#line 1751 "./parse.y"
-{yyerror ("'class' or 'this' expected" ); RECOVER;;
- break;}
-case 351:
-#line 1753 "./parse.y"
-{yyerror ("'class' expected" ); RECOVER;;
- break;}
-case 352:
-#line 1755 "./parse.y"
-{yyerror ("'class' expected" ); RECOVER;;
- break;}
-case 353:
-#line 1760 "./parse.y"
-{ yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
- break;}
-case 354:
-#line 1762 "./parse.y"
-{ yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ;
- break;}
-case 355:
-#line 1767 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
- break;}
-case 356:
-#line 1769 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
- break;}
-case 361:
-#line 1778 "./parse.y"
-{yyerror ("'(' expected"); DRECOVER(new_1);;
- break;}
-case 362:
-#line 1780 "./parse.y"
-{yyerror ("'(' expected"); RECOVER;;
- break;}
-case 363:
-#line 1782 "./parse.y"
-{yyerror ("')' or term expected"); RECOVER;;
- break;}
-case 364:
-#line 1784 "./parse.y"
-{yyerror ("')' expected"); RECOVER;;
- break;}
-case 365:
-#line 1786 "./parse.y"
-{YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
- break;}
-case 366:
-#line 1788 "./parse.y"
-{yyerror ("'(' expected"); RECOVER;;
- break;}
-case 369:
-#line 1798 "./parse.y"
-{
- yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
- ctxp->formal_parameter_number = 1;
- ;
- break;}
-case 370:
-#line 1803 "./parse.y"
-{
- ctxp->formal_parameter_number += 1;
- yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
- ;
- break;}
-case 371:
-#line 1808 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 372:
-#line 1813 "./parse.y"
-{ yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
- break;}
-case 373:
-#line 1815 "./parse.y"
-{ yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
- break;}
-case 374:
-#line 1817 "./parse.y"
-{ yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
- break;}
-case 375:
-#line 1819 "./parse.y"
-{ yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
- break;}
-case 376:
-#line 1823 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("anonymous array"); ;
- break;}
-case 377:
-#line 1825 "./parse.y"
-{ yyval.node = parse_jdk1_1_error ("anonymous array"); ;
- break;}
-case 378:
-#line 1827 "./parse.y"
-{yyerror ("'[' expected"); DRECOVER ("]");;
- break;}
-case 379:
-#line 1829 "./parse.y"
-{yyerror ("']' expected"); RECOVER;;
- break;}
-case 380:
-#line 1834 "./parse.y"
-{ yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
- break;}
-case 381:
-#line 1836 "./parse.y"
-{ yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
- break;}
-case 382:
-#line 1841 "./parse.y"
-{
- EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
- yyval.node = yyvsp[-1].node;
- ;
- break;}
-case 383:
-#line 1846 "./parse.y"
-{yyerror ("']' expected"); RECOVER;;
- break;}
-case 384:
-#line 1848 "./parse.y"
-{
- yyerror ("Missing term");
- yyerror ("']' expected");
- RECOVER;
- ;
- break;}
-case 385:
-#line 1857 "./parse.y"
-{
- int allocate = 0;
- /* If not initialized, allocate memory for the osb
- numbers stack */
- if (!ctxp->osb_limit)
- {
- allocate = ctxp->osb_limit = 32;
- ctxp->osb_depth = -1;
- }
- /* If capacity overflown, reallocate a bigger chuck */
- else if (ctxp->osb_depth+1 == ctxp->osb_limit)
- allocate = ctxp->osb_limit << 1;
-
- if (allocate)
- {
- allocate *= sizeof (int);
- if (ctxp->osb_number)
- ctxp->osb_number = (int *)xrealloc (ctxp->osb_number,
- allocate);
- else
- ctxp->osb_number = (int *)xmalloc (allocate);
- }
- ctxp->osb_depth++;
- CURRENT_OSB (ctxp) = 1;
- ;
- break;}
-case 386:
-#line 1883 "./parse.y"
-{ CURRENT_OSB (ctxp)++; ;
- break;}
-case 387:
-#line 1885 "./parse.y"
-{ yyerror ("']' expected"); RECOVER;;
- break;}
-case 388:
-#line 1890 "./parse.y"
-{ yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
- break;}
-case 389:
-#line 1894 "./parse.y"
-{
- tree super_wfl =
- build_wfl_node (super_identifier_node);
- EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location;
- yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location);
- ;
- break;}
-case 390:
-#line 1901 "./parse.y"
-{yyerror ("Field expected"); DRECOVER (super_field_acces);;
- break;}
-case 391:
-#line 1906 "./parse.y"
-{ yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
- break;}
-case 392:
-#line 1908 "./parse.y"
-{ yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
- break;}
-case 393:
-#line 1910 "./parse.y"
-{
- if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
- yyval.node = build_this_super_qualified_invocation
- (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location);
- else
- {
- tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE);
- yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location);
- }
- ;
- break;}
-case 394:
-#line 1921 "./parse.y"
-{
- if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
- yyval.node = build_this_super_qualified_invocation
- (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location);
- else
- {
- tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
- yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location);
- }
- ;
- break;}
-case 395:
-#line 1932 "./parse.y"
-{
- yyval.node = build_this_super_qualified_invocation
- (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
- ;
- break;}
-case 396:
-#line 1937 "./parse.y"
-{
- yyval.node = build_this_super_qualified_invocation
- (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
- ;
- break;}
-case 397:
-#line 1946 "./parse.y"
-{ yyerror ("'(' expected"); DRECOVER (method_invocation); ;
- break;}
-case 398:
-#line 1948 "./parse.y"
-{ yyerror ("'(' expected"); DRECOVER (method_invocation); ;
- break;}
-case 399:
-#line 1953 "./parse.y"
-{ yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
- break;}
-case 400:
-#line 1955 "./parse.y"
-{ yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
- break;}
-case 401:
-#line 1957 "./parse.y"
-{
- yyerror ("Missing term and ']' expected");
- DRECOVER(array_access);
- ;
- break;}
-case 402:
-#line 1962 "./parse.y"
-{
- yyerror ("']' expected");
- DRECOVER(array_access);
- ;
- break;}
-case 403:
-#line 1967 "./parse.y"
-{
- yyerror ("Missing term and ']' expected");
- DRECOVER(array_access);
- ;
- break;}
-case 404:
-#line 1972 "./parse.y"
-{
- yyerror ("']' expected");
- DRECOVER(array_access);
- ;
- break;}
-case 409:
-#line 1987 "./parse.y"
-{ yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
- break;}
-case 410:
-#line 1992 "./parse.y"
-{ yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
- break;}
-case 413:
-#line 1999 "./parse.y"
-{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
- break;}
-case 414:
-#line 2001 "./parse.y"
-{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
- break;}
-case 416:
-#line 2004 "./parse.y"
-{yyerror ("Missing term"); RECOVER;
- break;}
-case 417:
-#line 2006 "./parse.y"
-{yyerror ("Missing term"); RECOVER;
- break;}
-case 418:
-#line 2011 "./parse.y"
-{yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
- break;}
-case 419:
-#line 2013 "./parse.y"
-{yyerror ("Missing term"); RECOVER;
- break;}
-case 420:
-#line 2018 "./parse.y"
-{yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
- break;}
-case 421:
-#line 2020 "./parse.y"
-{yyerror ("Missing term"); RECOVER;
- break;}
-case 423:
-#line 2026 "./parse.y"
-{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
- break;}
-case 424:
-#line 2028 "./parse.y"
-{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
- break;}
-case 426:
-#line 2031 "./parse.y"
-{yyerror ("Missing term"); RECOVER;
- break;}
-case 427:
-#line 2033 "./parse.y"
-{yyerror ("Missing term"); RECOVER;
- break;}
-case 428:
-#line 2038 "./parse.y"
-{
- tree type = yyvsp[-3].node;
- while (CURRENT_OSB (ctxp)--)
- type = build_java_array_type (type, -1);
- ctxp->osb_depth--;
- yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node);
- ;
- break;}
-case 429:
-#line 2046 "./parse.y"
-{ yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
-case 430:
-#line 2048 "./parse.y"
-{ yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
-case 431:
-#line 2050 "./parse.y"
-{
- char *ptr;
- while (CURRENT_OSB (ctxp)--)
- obstack_1grow (&temporary_obstack, '[');
- ctxp->osb_depth--;
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node)));
- ptr = obstack_finish (&temporary_obstack);
- EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr);
- yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node);
- ;
- break;}
-case 432:
-#line 2063 "./parse.y"
-{yyerror ("']' expected, invalid type expression");;
- break;}
-case 433:
-#line 2065 "./parse.y"
-{
- if (ctxp->prevent_ese != lineno)
- yyerror ("Invalid type expression"); RECOVER;
- RECOVER;
- ;
- break;}
-case 434:
-#line 2071 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 435:
-#line 2073 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 436:
-#line 2075 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 438:
-#line 2081 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
- yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 439:
-#line 2086 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 440:
-#line 2091 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 441:
-#line 2096 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 442:
-#line 2098 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 443:
-#line 2100 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 445:
-#line 2106 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 446:
-#line 2111 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 447:
-#line 2116 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 448:
-#line 2118 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 450:
-#line 2124 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 451:
-#line 2129 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 452:
-#line 2134 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 453:
-#line 2139 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 454:
-#line 2141 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 455:
-#line 2143 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 457:
-#line 2149 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 458:
-#line 2154 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 459:
-#line 2159 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 460:
-#line 2164 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 461:
-#line 2169 "./parse.y"
-{ yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
-case 462:
-#line 2171 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 463:
-#line 2173 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 464:
-#line 2175 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 465:
-#line 2177 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 466:
-#line 2179 "./parse.y"
-{yyerror ("Invalid reference type"); RECOVER;;
- break;}
-case 468:
-#line 2185 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 469:
-#line 2190 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 470:
-#line 2195 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 471:
-#line 2197 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 473:
-#line 2203 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 474:
-#line 2208 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 476:
-#line 2214 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 477:
-#line 2219 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 479:
-#line 2225 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 480:
-#line 2230 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 482:
-#line 2236 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 483:
-#line 2241 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 485:
-#line 2247 "./parse.y"
-{
- yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
- yyvsp[-2].node, yyvsp[0].node);
- ;
- break;}
-case 486:
-#line 2252 "./parse.y"
-{yyerror ("Missing term"); RECOVER;;
- break;}
-case 488:
-#line 2258 "./parse.y"
-{
- yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
- EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
- ;
- break;}
-case 489:
-#line 2263 "./parse.y"
-{
- YYERROR_NOW;
- yyerror ("Missing term");
- DRECOVER (1);
- ;
- break;}
-case 490:
-#line 2269 "./parse.y"
-{yyerror ("Missing term"); DRECOVER (2);;
- break;}
-case 491:
-#line 2271 "./parse.y"
-{yyerror ("Missing term"); DRECOVER (3);;
- break;}
-case 494:
-#line 2281 "./parse.y"
-{ yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
-case 495:
-#line 2283 "./parse.y"
-{
- if (ctxp->prevent_ese != lineno)
- yyerror ("Missing term");
- DRECOVER (assign);
- ;
- break;}
-}
- /* the action file gets copied in in place of this dollarsign */
-#line 542 "/usr/lib/bison.simple"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-#ifdef YYLSP_NEEDED
- yylsp -= yylen;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-
-#ifdef YYLSP_NEEDED
- yylsp++;
- if (yylen == 0)
- {
- yylsp->first_line = yylloc.first_line;
- yylsp->first_column = yylloc.first_column;
- yylsp->last_line = (yylsp-1)->last_line;
- yylsp->last_column = (yylsp-1)->last_column;
- yylsp->text = 0;
- }
- else
- {
- yylsp->last_line = (yylsp+yylen-1)->last_line;
- yylsp->last_column = (yylsp+yylen-1)->last_column;
- }
-#endif
-
- /* Now "shift" the result of the reduction.
- Determine what state that goes to,
- based on the state we popped back to
- and the rule number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
-
- goto yynewstate;
-
-yyerrlab: /* here on detecting error */
-
- if (! yyerrstatus)
- /* If not already recovering from an error, report this error. */
- {
- ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- int size = 0;
- char *msg;
- int x, count;
-
- count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- size += strlen(yytname[x]) + 15, count++;
- msg = (char *) malloc(size + 15);
- if (msg != 0)
- {
- strcpy(msg, "parse error");
-
- if (count < 5)
- {
- count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- {
- strcat(msg, count == 0 ? ", expecting `" : " or `");
- strcat(msg, yytname[x]);
- strcat(msg, "'");
- count++;
- }
- }
- yyerror(msg);
- free(msg);
- }
- else
- yyerror ("parse error; also virtual memory exceeded");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror("parse error");
- }
-
- goto yyerrlab1;
-yyerrlab1: /* here on error raised explicitly by an action */
-
- if (yyerrstatus == 3)
- {
- /* if just tried and failed to reuse lookahead token after an error, discard it. */
-
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
-
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token
- after shifting the error token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this */
-
- goto yyerrhandle;
-
-yyerrdefault: /* current state does not do anything special for the error token. */
-
-#if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
- if (yyn) goto yydefault;
-#endif
-
-yyerrpop: /* pop the current state because it cannot handle the error token */
-
- if (yyssp == yyss) YYABORT;
- yyvsp--;
- yystate = *--yyssp;
-#ifdef YYLSP_NEEDED
- yylsp--;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "Error: state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
-yyerrhandle:
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
-
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
-
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting error token, ");
-#endif
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- yystate = yyn;
- goto yynewstate;
-
- yyacceptlab:
- /* YYACCEPT comes here. */
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 0;
-
- yyabortlab:
- /* YYABORT comes here. */
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 1;
-}
-#line 2309 "./parse.y"
-
-
-
-/* Flag for the error report routine to issue the error the first time
- it's called (overriding the default behavior which is to drop the
- first invocation and honor the second one, taking advantage of a
- richer context. */
-static int force_error = 0;
-
-/* Create a new parser context and make it the current one. */
-
-void
-java_push_parser_context ()
-{
- struct parser_ctxt *new =
- (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
-
- bzero ((PTR) new, sizeof (struct parser_ctxt));
- new->next = ctxp;
- ctxp = new;
- if (ctxp->next)
- {
- ctxp->incomplete_class = ctxp->next->incomplete_class;
- ctxp->gclass_list = ctxp->next->gclass_list;
- }
-}
-
-/* If the first file of a file list was a class file, no context
- exists for a source file to be parsed. This boolean remembers that
- java_parser_context_save_global might have created a dummy one, so
- that java_parser_context_restore_global can pop it. */
-static int extra_ctxp_pushed_p = 0;
-
-void
-java_parser_context_save_global ()
-{
- if (!ctxp)
- {
- java_push_parser_context ();
- extra_ctxp_pushed_p = 1;
- }
- ctxp->finput = finput;
- ctxp->lineno = lineno;
- ctxp->current_class = current_class;
- ctxp->filename = input_filename;
- ctxp->current_function_decl = current_function_decl;
-}
-
-void
-java_parser_context_restore_global ()
-{
- finput = ctxp->finput;
- lineno = ctxp->lineno;
- current_class = ctxp->current_class;
- input_filename = ctxp->filename;
- current_function_decl = ctxp->current_function_decl;
- if (!ctxp->next && extra_ctxp_pushed_p)
- {
- java_pop_parser_context (0);
- extra_ctxp_pushed_p = 0;
- }
-}
-
-void
-java_pop_parser_context (generate)
- int generate;
-{
- tree current;
- struct parser_ctxt *toFree, *next;
-
- if (!ctxp)
- return;
-
- toFree = ctxp;
- next = ctxp->next;
- if (next)
- {
- next->incomplete_class = ctxp->incomplete_class;
- next->gclass_list = ctxp->gclass_list;
- lineno = ctxp->lineno;
- finput = ctxp->finput;
- current_class = ctxp->current_class;
- }
-
- /* Set the single import class file flag to 0 for the current list
- of imported things */
- for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
- IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0;
-
- /* And restore those of the previous context */
- if ((ctxp = next)) /* Assignment is really meant here */
- for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
- IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1;
-
- if (generate)
- {
- toFree->next = ctxp_for_generation;
- ctxp_for_generation = toFree;
- }
- else
- free (toFree);
-}
-
-/* Reporting JDK1.1 features not implemented */
-
-static tree
-parse_jdk1_1_error (msg)
- char *msg;
-{
- sorry (": `%s' JDK1.1(TM) feature", msg);
- java_error_count++;
- return empty_stmt_node;
-}
-
-static int do_warning = 0;
-
-void
-yyerror (msg)
- char *msg;
-{
- static java_lc elc;
- static int prev_lineno;
- static char *prev_msg;
-
- int save_lineno;
- char *remainder, *code_from_source;
- extern struct obstack temporary_obstack;
-
- if (!force_error && prev_lineno == lineno)
- return;
-
- /* Save current error location but report latter, when the context is
- richer. */
- if (ctxp->java_error_flag == 0)
- {
- ctxp->java_error_flag = 1;
- elc = ctxp->elc;
- /* Do something to use the previous line if we're reaching the
- end of the file... */
-#ifdef VERBOSE_SKELETON
- printf ("* Error detected (%s)\n", (msg ? msg : "(null)"));
-#endif
- return;
- }
-
- /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
- if (!force_error && msg == prev_msg && prev_lineno == elc.line)
- return;
-
- ctxp->java_error_flag = 0;
- if (do_warning)
- java_warning_count++;
- else
- java_error_count++;
-
- if (elc.col == 0 && msg[1] == ';')
- {
- elc.col = ctxp->p_line->char_col-1;
- elc.line = ctxp->p_line->lineno;
- }
-
- save_lineno = lineno;
- prev_lineno = lineno = elc.line;
- prev_msg = msg;
-
- code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
- obstack_grow0 (&temporary_obstack,
- code_from_source, strlen (code_from_source));
- remainder = obstack_finish (&temporary_obstack);
- if (do_warning)
- warning ("%s.\n%s", msg, remainder);
- else
- error ("%s.\n%s", msg, remainder);
-
- /* This allow us to cheaply avoid an extra 'Invalid expression
- statement' error report when errors have been already reported on
- the same line. This occurs when we report an error but don't have
- a synchronization point other than ';', which
- expression_statement is the only one to take care of. */
- ctxp->prevent_ese = lineno = save_lineno;
-}
-
-static void
-issue_warning_error_from_context (cl, msg, ap)
- tree cl;
- const char *msg;
- va_list ap;
-{
- char *saved, *saved_input_filename;
- char buffer [4096];
- vsprintf (buffer, msg, ap);
- force_error = 1;
-
- ctxp->elc.line = EXPR_WFL_LINENO (cl);
- ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 :
- (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl)));
-
- /* We have a CL, that's a good reason for using it if it contains data */
- saved = ctxp->filename;
- if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl))
- ctxp->filename = EXPR_WFL_FILENAME (cl);
- saved_input_filename = input_filename;
- input_filename = ctxp->filename;
- java_error (NULL);
- java_error (buffer);
- ctxp->filename = saved;
- input_filename = saved_input_filename;
- force_error = 0;
-}
-
-/* Issue an error message at a current source line CL */
-
-void
-parse_error_context VPROTO ((tree cl, const char *msg, ...))
-{
-#ifndef ANSI_PROTOTYPES
- tree cl;
- const char *msg;
-#endif
- va_list ap;
-
- VA_START (ap, msg);
-#ifndef ANSI_PROTOTYPES
- cl = va_arg (ap, tree);
- msg = va_arg (ap, const char *);
-#endif
- issue_warning_error_from_context (cl, msg, ap);
- va_end (ap);
-}
-
-/* Issue a warning at a current source line CL */
-
-static void
-parse_warning_context VPROTO ((tree cl, const char *msg, ...))
-{
-#ifndef ANSI_PROTOTYPES
- tree cl;
- const char *msg;
-#endif
- va_list ap;
-
- VA_START (ap, msg);
-#ifndef ANSI_PROTOTYPES
- cl = va_arg (ap, tree);
- msg = va_arg (ap, const char *);
-#endif
-
- force_error = do_warning = 1;
- issue_warning_error_from_context (cl, msg, ap);
- do_warning = force_error = 0;
- va_end (ap);
-}
-
-static tree
-find_expr_with_wfl (node)
- tree node;
-{
- while (node)
- {
- char code;
- tree to_return;
-
- switch (TREE_CODE (node))
- {
- case BLOCK:
- node = BLOCK_EXPR_BODY (node);
- continue;
-
- case COMPOUND_EXPR:
- to_return = find_expr_with_wfl (TREE_OPERAND (node, 0));
- if (to_return)
- return to_return;
- node = TREE_OPERAND (node, 1);
- continue;
-
- case LOOP_EXPR:
- node = TREE_OPERAND (node, 0);
- continue;
-
- case LABELED_BLOCK_EXPR:
- node = TREE_OPERAND (node, 1);
- continue;
-
- default:
- code = TREE_CODE_CLASS (TREE_CODE (node));
- if (((code == '1') || (code == '2') || (code == 'e'))
- && EXPR_WFL_LINECOL (node))
- return node;
- return NULL_TREE;
- }
- }
- return NULL_TREE;
-}
-
-/* Issue a missing return statement error. Uses METHOD to figure the
- last line of the method the error occurs in. */
-
-static void
-missing_return_error (method)
- tree method;
-{
- EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2);
- parse_error_context (wfl_operator, "Missing return statement");
-}
-
-/* Issue an unreachable statement error. From NODE, find the next
- statement to report appropriately. */
-static void
-unreachable_stmt_error (node)
- tree node;
-{
- /* Browse node to find the next expression node that has a WFL. Use
- the location to report the error */
- if (TREE_CODE (node) == COMPOUND_EXPR)
- node = find_expr_with_wfl (TREE_OPERAND (node, 1));
- else
- node = find_expr_with_wfl (node);
-
- if (node)
- {
- EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
- parse_error_context (wfl_operator, "Unreachable statement");
- }
- else
- fatal ("Can't get valid statement - unreachable_stmt_error");
-}
-
-int
-java_report_errors ()
-{
- if (java_error_count)
- fprintf (stderr, "%d error%s",
- java_error_count, (java_error_count == 1 ? "" : "s"));
- if (java_warning_count)
- fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
- java_warning_count, (java_warning_count == 1 ? "" : "s"));
- if (java_error_count || java_warning_count)
- putc ('\n', stderr);
- return java_error_count;
-}
-
-static char *
-java_accstring_lookup (flags)
- int flags;
-{
- static char buffer [80];
-#define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
-
- /* Access modifier looked-up first for easier report on forbidden
- access. */
- if (flags & ACC_PUBLIC) COPY_RETURN ("public");
- if (flags & ACC_PRIVATE) COPY_RETURN ("private");
- if (flags & ACC_PROTECTED) COPY_RETURN ("protected");
- if (flags & ACC_STATIC) COPY_RETURN ("static");
- if (flags & ACC_FINAL) COPY_RETURN ("final");
- if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized");
- if (flags & ACC_VOLATILE) COPY_RETURN ("volatile");
- if (flags & ACC_TRANSIENT) COPY_RETURN ("transient");
- if (flags & ACC_NATIVE) COPY_RETURN ("native");
- if (flags & ACC_INTERFACE) COPY_RETURN ("interface");
- if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract");
-
- buffer [0] = '\0';
- return buffer;
-#undef COPY_RETURN
-}
-
-/* Issuing error messages upon redefinition of classes, interfaces or
- variables. */
-
-static void
-classitf_redefinition_error (context, id, decl, cl)
- char *context;
- tree id, decl, cl;
-{
- parse_error_context (cl, "%s `%s' already defined in %s:%d",
- context, IDENTIFIER_POINTER (id),
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
- /* Here we should point out where its redefined. It's a unicode. FIXME */
-}
-
-static void
-variable_redefinition_error (context, name, type, line)
- tree context, name, type;
- int line;
-{
- char *type_name;
-
- /* Figure a proper name for type. We might haven't resolved it */
- if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type))
- type_name = IDENTIFIER_POINTER (TYPE_NAME (type));
- else
- type_name = lang_printable_name (type, 0);
-
- parse_error_context (context,
- "Variable `%s' is already defined in this method and "
- "was declared `%s %s' at line %d",
- IDENTIFIER_POINTER (name),
- type_name, IDENTIFIER_POINTER (name), line);
-}
-
-static tree
-build_array_from_name (type, type_wfl, name, ret_name)
- tree type, type_wfl, name, *ret_name;
-{
- int more_dims = 0;
- char *string;
-
- /* Eventually get more dims */
- string = IDENTIFIER_POINTER (name);
- while (string [more_dims] == '[')
- more_dims++;
-
- /* If we have, then craft a new type for this variable */
- if (more_dims)
- {
- name = get_identifier (&string [more_dims]);
-
- /* If we have a pointer, use its type */
- if (TREE_CODE (type) == POINTER_TYPE)
- type = TREE_TYPE (type);
-
- /* Building the first dimension of a primitive type uses this
- function */
- if (JPRIMITIVE_TYPE_P (type))
- {
- type = build_java_array_type (type, -1);
- CLASS_LOADED_P (type) = 1;
- more_dims--;
- }
- /* Otherwise, if we have a WFL for this type, use it (the type
- is already an array on an unresolved type, and we just keep
- on adding dimensions) */
- else if (type_wfl)
- type = type_wfl;
-
- /* Add all the dimensions */
- while (more_dims--)
- type = build_unresolved_array_type (type);
-
- /* The type may have been incomplete in the first place */
- if (type_wfl)
- type = obtain_incomplete_type (type);
- }
-
- *ret_name = name;
- return type;
-}
-
-/* Build something that the type identifier resolver will identify as
- being an array to an unresolved type. TYPE_WFL is a WFL on a
- identifier. */
-
-static tree
-build_unresolved_array_type (type_or_wfl)
- tree type_or_wfl;
-{
- char *ptr;
-
- /* TYPE_OR_WFL might be an array on a resolved type. In this case,
- just create a array type */
- if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
- {
- tree type = build_java_array_type (type_or_wfl, -1);
- CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl);
- return type;
- }
-
- obstack_1grow (&temporary_obstack, '[');
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
- ptr = obstack_finish (&temporary_obstack);
- return build_expr_wfl (get_identifier (ptr),
- EXPR_WFL_FILENAME (type_or_wfl),
- EXPR_WFL_LINENO (type_or_wfl),
- EXPR_WFL_COLNO (type_or_wfl));
-}
-
-/* Check modifiers. If one doesn't fit, retrieve it in its declaration line
- and point it out. */
-
-static void
-check_modifiers (message, value, mask)
- char *message;
- int value;
- int mask;
-{
- /* Should point out the one that don't fit. ASCII/unicode,
- going backward. FIXME */
- if (value & ~mask)
- {
- int i, remainder = value & ~mask;
- for (i = 0; i <= 10; i++)
- if ((1 << i) & remainder)
- parse_error_context (ctxp->modifier_ctx [i], message,
- java_accstring_lookup (1 << i));
- }
-}
-
-static void
-parser_add_interface (class_decl, interface_decl, wfl)
- tree class_decl, interface_decl, wfl;
-{
- if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
- parse_error_context (wfl, "Interface `%s' repeated",
- IDENTIFIER_POINTER (DECL_NAME (interface_decl)));
-}
-
-/* Bulk of common class/interface checks. Return 1 if an error was
- encountered. TAG is 0 for a class, 1 for an interface. */
-
-static int
-check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl)
- int is_interface, flags;
- tree raw_name, qualified_name, decl, cl;
-{
- tree node;
-
- if (!quiet_flag)
- fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"),
- IDENTIFIER_POINTER (qualified_name));
-
- /* Scope of an interface/class type name:
- - Can't be imported by a single type import
- - Can't already exists in the package */
- if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name)
- && (node = find_name_in_single_imports (raw_name)))
- {
- parse_error_context
- (cl, "%s name `%s' clashes with imported type `%s'",
- (is_interface ? "Interface" : "Class"),
- IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
- return 1;
- }
- if (decl && CLASS_COMPLETE_P (decl))
- {
- classitf_redefinition_error ((is_interface ? "Interface" : "Class"),
- qualified_name, decl, cl);
- return 1;
- }
-
- /* If public, file name should match class/interface name */
- if (flags & ACC_PUBLIC)
- {
- char *f;
-
- /* Contains OS dependent assumption on path separator. FIXME */
- for (f = &input_filename [strlen (input_filename)];
- f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR;
- f--)
- ;
- if (f[0] == '/' || f[0] == DIR_SEPARATOR)
- f++;
- if (strncmp (IDENTIFIER_POINTER (raw_name),
- f , IDENTIFIER_LENGTH (raw_name)) ||
- f [IDENTIFIER_LENGTH (raw_name)] != '.')
- parse_error_context (cl, "Public %s `%s' must be defined in a file "
- "called `%s.java'",
- (is_interface ? "interface" : "class"),
- IDENTIFIER_POINTER (qualified_name),
- IDENTIFIER_POINTER (raw_name));
- }
-
- check_modifiers ((is_interface ?
- "Illegal modifier `%s' for interface declaration" :
- "Illegal modifier `%s' for class declaration"), flags,
- (is_interface ? INTERFACE_MODIFIERS : CLASS_MODIFIERS));
- return 0;
-}
-
-/* If DECL is NULL, create and push a new DECL, record the current
- line CL and do other maintenance things. */
-
-static tree
-maybe_create_class_interface_decl (decl, qualified_name, cl)
- tree decl, qualified_name, cl;
-{
- if (!decl)
- decl = push_class (make_class (), qualified_name);
-
- /* Take care of the file and line business */
- DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
- /* If we're emiting xrefs, store the line/col number information */
- if (flag_emit_xref)
- DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl);
- else
- DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
- CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
- CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) =
- IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
-
- ctxp->current_parsed_class = decl;
-
- /* Link the declaration to the already seen ones */
- TREE_CHAIN (decl) = ctxp->class_list;
- ctxp->class_list = decl;
-
- /* Create a new nodes in the global lists */
- ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list);
- all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
-
- /* Install a new dependency list element */
- create_jdep_list (ctxp);
-
- SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
- IDENTIFIER_POINTER (qualified_name)));
- return decl;
-}
-
-static void
-add_superinterfaces (decl, interface_list)
- tree decl, interface_list;
-{
- tree node;
- /* Superinterface(s): if present and defined, parser_check_super_interface ()
- takes care of ensuring that:
- - This is an accessible interface type,
- - Circularity detection.
- parser_add_interface is then called. If present but not defined,
- the check operation is delayed until the super interface gets
- defined. */
- for (node = interface_list; node; node = TREE_CHAIN (node))
- {
- tree current = TREE_PURPOSE (node);
- tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current));
- if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl)))
- {
- if (!parser_check_super_interface (idecl, decl, current))
- parser_add_interface (decl, idecl, current);
- }
- else
- register_incomplete_type (JDEP_INTERFACE,
- current, decl, NULL_TREE);
- }
-}
-
-/* Create an interface in pass1 and return its decl. Return the
- interface's decl in pass 2. */
-
-static tree
-create_interface (flags, id, super)
- int flags;
- tree id, super;
-{
- tree raw_name = EXPR_WFL_NODE (id);
- tree q_name = parser_qualified_classname (id);
- tree decl = IDENTIFIER_CLASS_VALUE (q_name);
-
- EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */
-
- /* Basic checks: scope, redefinition, modifiers */
- if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
- return NULL_TREE;
-
- /* Interface modifiers check
- - public/abstract allowed (already done at that point)
- - abstract is obsolete (comes first, it's a warning, or should be)
- - Can't use twice the same (checked in the modifier rule) */
- if ((flags & ACC_ABSTRACT) && flag_redundant)
- parse_warning_context
- (MODIFIER_WFL (ABSTRACT_TK),
- "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
- "abstract", IDENTIFIER_POINTER (raw_name));
-
- /* Create a new decl if DECL is NULL, otherwise fix it */
- decl = maybe_create_class_interface_decl (decl, q_name, id);
-
- /* Set super info and mark the class a complete */
- set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl),
- object_type_node, ctxp->interface_number);
- ctxp->interface_number = 0;
- CLASS_COMPLETE_P (decl) = 1;
- add_superinterfaces (decl, super);
-
- return decl;
-}
-
-/* Create an class in pass1 and return its decl. Return class
- interface's decl in pass 2. */
-
-static tree
-create_class (flags, id, super, interfaces)
- int flags;
- tree id, super, interfaces;
-{
- tree raw_name = EXPR_WFL_NODE (id);
- tree class_id, decl;
- tree super_decl_type;
-
- class_id = parser_qualified_classname (id);
- decl = IDENTIFIER_CLASS_VALUE (class_id);
- ctxp->current_parsed_class_un = EXPR_WFL_NODE (id);
- EXPR_WFL_NODE (id) = class_id;
-
- /* Basic check: scope, redefinition, modifiers */
- if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id))
- return NULL_TREE;
-
- /* Class modifier check:
- - Allowed modifier (already done at that point)
- - abstract AND final forbidden
- - Public classes defined in the correct file */
- if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
- parse_error_context (id, "Class `%s' can't be declared both abstract "
- "and final", IDENTIFIER_POINTER (raw_name));
-
- /* Create a new decl if DECL is NULL, otherwise fix it */
- decl = maybe_create_class_interface_decl (decl, class_id, id);
-
- /* If SUPER exists, use it, otherwise use Object */
- if (super)
- {
- /* Can't extend java.lang.Object */
- if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
- {
- parse_error_context (id, "Can't extend `java.lang.Object'");
- return NULL_TREE;
- }
-
- super_decl_type =
- register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
- }
- else if (TREE_TYPE (decl) != object_type_node)
- super_decl_type = object_type_node;
- /* We're defining java.lang.Object */
- else
- super_decl_type = NULL_TREE;
-
- /* Set super info and mark the class a complete */
- set_super_info (flags, TREE_TYPE (decl), super_decl_type,
- ctxp->interface_number);
- ctxp->interface_number = 0;
- CLASS_COMPLETE_P (decl) = 1;
- add_superinterfaces (decl, interfaces);
-
- /* If doing xref, store the location at which the inherited class
- (if any) was seen. */
- if (flag_emit_xref && super)
- DECL_INHERITED_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (super);
-
- /* Eventually sets the @deprecated tag flag */
- CHECK_DEPRECATED (decl);
-
- return decl;
-}
-
-/* Can't use lookup_field () since we don't want to load the class and
- can't set the CLASS_LOADED_P flag */
-
-static tree
-find_field (class, name)
- tree class;
- tree name;
-{
- tree decl;
- for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl))
- {
- if (DECL_NAME (decl) == name)
- return decl;
- }
- return NULL_TREE;
-}
-
-/* Wrap around lookup_field that doesn't potentially upset the value
- of CLASS */
-
-static tree
-lookup_field_wrapper (class, name)
- tree class, name;
-{
- tree type = class;
- tree decl;
- java_parser_context_save_global ();
- decl = lookup_field (&type, name);
- java_parser_context_restore_global ();
- return decl == error_mark_node ? NULL : decl;
-}
-
-/* Find duplicate field within the same class declarations and report
- the error. Returns 1 if a duplicated field was found, 0
- otherwise. */
-
-static int
-duplicate_declaration_error_p (new_field_name, new_type, cl)
- tree new_field_name, new_type, cl;
-{
- /* This might be modified to work with method decl as well */
- tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class),
- new_field_name);
- if (decl)
- {
- char *t1 = strdup (purify_type_name
- ((TREE_CODE (new_type) == POINTER_TYPE
- && TREE_TYPE (new_type) == NULL_TREE) ?
- IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
- lang_printable_name (new_type, 1)));
- /* The type may not have been completed by the time we report
- the error */
- char *t2 = strdup (purify_type_name
- ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
- && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
- IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
- lang_printable_name (TREE_TYPE (decl), 1)));
- parse_error_context
- (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
- t1, IDENTIFIER_POINTER (new_field_name),
- t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
- free (t1);
- free (t2);
- return 1;
- }
- return 0;
-}
-
-/* Field registration routine. If TYPE doesn't exist, field
- declarations are linked to the undefined TYPE dependency list, to
- be later resolved in java_complete_class () */
-
-static void
-register_fields (flags, type, variable_list)
- int flags;
- tree type, variable_list;
-{
- tree current, saved_type;
- tree class_type = TREE_TYPE (ctxp->current_parsed_class);
- int saved_lineno = lineno;
- int must_chain = 0;
- tree wfl = NULL_TREE;
-
- /* If we're adding fields to interfaces, those fields are public,
- static, final */
- if (CLASS_INTERFACE (TYPE_NAME (class_type)))
- {
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
- flags, ACC_PUBLIC,
- "%s", "interface field(s)");
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
- flags, ACC_STATIC,
- "%s", "interface field(s)");
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
- flags, ACC_FINAL, "%s", "interface field(s)");
- check_modifiers ("Illegal interface member modifier `%s'", flags,
- INTERFACE_FIELD_MODIFIERS);
- flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
- }
-
- /* Obtain a suitable type for resolution, if necessary */
- SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain);
-
- /* If TYPE is fully resolved and we don't have a reference, make one */
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
-
- for (current = variable_list, saved_type = type; current;
- current = TREE_CHAIN (current), type = saved_type)
- {
- tree real_type;
- tree field_decl;
- tree cl = TREE_PURPOSE (current);
- tree init = TREE_VALUE (current);
- tree current_name = EXPR_WFL_NODE (cl);
-
- /* Process NAME, as it may specify extra dimension(s) for it */
- type = build_array_from_name (type, wfl, current_name, &current_name);
-
- /* Type adjustment. We may have just readjusted TYPE because
- the variable specified more dimensions. Make sure we have
- a reference if we can and don't have one already. Also
- change the name if we have an init. */
- if (type != saved_type)
- {
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
- if (init)
- EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name;
- }
-
- real_type = GET_REAL_TYPE (type);
- /* Check for redeclarations */
- if (duplicate_declaration_error_p (current_name, real_type, cl))
- continue;
-
- /* Set lineno to the line the field was found and create a
- declaration for it. Eventually sets the @deprecated tag flag. */
- if (flag_emit_xref)
- lineno = EXPR_WFL_LINECOL (cl);
- else
- lineno = EXPR_WFL_LINENO (cl);
- field_decl = add_field (class_type, current_name, real_type, flags);
- CHECK_DEPRECATED (field_decl);
-
- /* Check if we must chain. */
- if (must_chain)
- register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
-
- /* If we have an initialization value tied to the field */
- if (init)
- {
- /* The field is declared static */
- if (flags & ACC_STATIC)
- {
- /* We include the field and its initialization part into
- a list used to generate <clinit>. After <clinit> is
- walked, field initializations will be processed and
- fields initialized with known constants will be taken
- out of <clinit> and have their DECL_INITIAL set
- appropriately. */
- TREE_CHAIN (init) = ctxp->static_initialized;
- ctxp->static_initialized = init;
- if (TREE_OPERAND (init, 1)
- && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT)
- TREE_STATIC (TREE_OPERAND (init, 1)) = 1;
- }
- /* A non-static field declared with an immediate initialization is
- to be initialized in <init>, if any. This field is remembered
- to be processed at the time of the generation of <init>. */
- else
- {
- TREE_CHAIN (init) = ctxp->non_static_initialized;
- ctxp->non_static_initialized = init;
- }
- MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
- DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
- }
- }
- lineno = saved_lineno;
-}
-
-/* Generate the method $finit$ that initializes fields initialized
- upon declaration. */
-
-static void
-maybe_generate_finit ()
-{
- tree mdecl, current;
-
- if (!ctxp->non_static_initialized || java_error_count)
- return;
-
- mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
- ACC_PRIVATE, void_type_node,
- finit_identifier_node, end_params_node);
- start_artificial_method_body (mdecl);
-
- ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized);
- for (current = ctxp->non_static_initialized; current;
- current = TREE_CHAIN (current))
- java_method_add_stmt (mdecl,
- build_debugable_stmt (EXPR_WFL_LINECOL (current),
- current));
-
- end_artificial_method_body (mdecl);
- CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1;
- ctxp->non_static_initialized = NULL_TREE;
-}
-
-/* Check whether it is necessary to generate a <clinit> for the class
- we just parsed. */
-
-static void
-maybe_generate_clinit ()
-{
- tree mdecl, c;
-
- if (!ctxp->static_initialized || java_error_count)
- return;
-
- mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
- ACC_STATIC, void_type_node,
- clinit_identifier_node, end_params_node);
- start_artificial_method_body (mdecl);
-
- /* Keep initialization in order to enforce 8.5 */
- ctxp->static_initialized = nreverse (ctxp->static_initialized);
-
- /* We process the list of assignment we produced as the result of
- the declaration of initialized static field and add them as
- statement to the <clinit> method. */
- for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c))
- {
- /* We build the assignment expression that will initialize the
- field to its value. There are strict rules on static
- initializers (8.5). FIXME */
- java_method_add_stmt (mdecl,
- build_debugable_stmt (EXPR_WFL_LINECOL (c), c));
- }
-
- end_artificial_method_body (mdecl);
- ctxp->static_initialized = NULL_TREE;
-}
-
-/* Shared accros method_declarator and method_header to remember the
- patch stage that was reached during the declaration of the method.
- A method DECL is built differently is there is no patch
- (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
- pending on the currently defined method. */
-
-static int patch_stage;
-
-/* Check the method declaration and add the method to its current
- class. If the argument list is known to contain incomplete types,
- the method is partially added and the registration will be resume
- once the method arguments resolved. If TYPE is NULL, we're dealing
- with a constructor. */
-
-static tree
-method_header (flags, type, mdecl, throws)
- int flags;
- tree type, mdecl, throws;
-{
- tree meth = TREE_VALUE (mdecl);
- tree id = TREE_PURPOSE (mdecl);
- tree this_class = TREE_TYPE (ctxp->current_parsed_class);
- tree type_wfl = NULL_TREE;
- tree meth_name = NULL_TREE, current, orig_arg;
- int saved_lineno;
- int constructor_ok = 0, must_chain;
-
- check_modifiers_consistency (flags);
-
- /* There are some forbidden modifiers for an abstract method and its
- class must be abstract as well. */
- if (type && (flags & ACC_ABSTRACT))
- {
- ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private");
- ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static");
- ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final");
- ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native");
- ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized");
- if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
- && !CLASS_INTERFACE (TYPE_NAME (this_class)))
- parse_error_context
- (id, "Class `%s' must be declared abstract to define abstract "
- "method `%s'",
- IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- }
- /* Things to be checked when declaring a constructor */
- if (!type)
- {
- int ec = java_error_count;
- /* 8.6: Constructor declarations: we might be trying to define a
- method without specifying a return type. */
- if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un)
- parse_error_context
- (id, "Invalid method declaration, return type required");
- /* 8.6.3: Constructor modifiers */
- else
- {
- JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract");
- JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static");
- JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final");
- JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native");
- JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized");
- }
- /* If we found error here, we don't consider it's OK to tread
- the method definition as a constructor, for the rest of this
- function */
- if (ec == java_error_count)
- constructor_ok = 1;
- }
-
- /* Method declared within the scope of an interface are implicitly
- abstract and public. Conflicts with other erroneously provided
- modifiers are checked right after. */
-
- if (CLASS_INTERFACE (TYPE_NAME (this_class)))
- {
- /* If FLAGS isn't set because of a modifier, turn the
- corresponding modifier WFL to NULL so we issue a warning on
- the obsolete use of the modifier */
- if (!(flags & ACC_PUBLIC))
- MODIFIER_WFL (PUBLIC_TK) = NULL;
- if (!(flags & ACC_ABSTRACT))
- MODIFIER_WFL (ABSTRACT_TK) = NULL;
- flags |= ACC_PUBLIC;
- flags |= ACC_ABSTRACT;
- }
-
- /* Modifiers context reset moved up, so abstract method declaration
- modifiers can be later checked. */
-
- /* Set constructor returned type to void and method name to <init>,
- unless we found an error identifier the constructor (in which
- case we retain the original name) */
- if (!type)
- {
- type = void_type_node;
- if (constructor_ok)
- meth_name = init_identifier_node;
- }
- else
- meth_name = EXPR_WFL_NODE (id);
-
- /* Do the returned type resolution and registration if necessary */
- SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
-
- if (meth_name)
- type = build_array_from_name (type, type_wfl, meth_name, &meth_name);
- EXPR_WFL_NODE (id) = meth_name;
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
-
- if (must_chain)
- {
- patch_stage = JDEP_METHOD_RETURN;
- register_incomplete_type (patch_stage, type_wfl, id, type);
- TREE_TYPE (meth) = GET_REAL_TYPE (type);
- }
- else
- TREE_TYPE (meth) = type;
-
- saved_lineno = lineno;
- /* When defining an abstract or interface method, the curly
- bracket at level 1 doesn't exist because there is no function
- body */
- lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
- EXPR_WFL_LINENO (id));
-
- /* Remember the original argument list */
- orig_arg = TYPE_ARG_TYPES (meth);
-
- if (patch_stage) /* includes ret type and/or all args */
- {
- jdep *jdep;
- meth = add_method_1 (this_class, flags, meth_name, meth);
- /* Patch for the return type */
- if (patch_stage == JDEP_METHOD_RETURN)
- {
- jdep = CLASSD_LAST (ctxp->classd_list);
- JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth));
- }
- /* This is the stop JDEP. METH allows the function's signature
- to be computed. */
- register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
- }
- else
- meth = add_method (this_class, flags, meth_name,
- build_java_signature (meth));
-
- /* Fix the method argument list so we have the argument name
- information */
- fix_method_argument_names (orig_arg, meth);
-
- /* Register the parameter number and re-install the current line
- number */
- DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1;
- lineno = saved_lineno;
-
- /* Register exception specified by the `throws' keyword for
- resolution and set the method decl appropriate field to the list.
- Note: the grammar ensures that what we get here are class
- types. */
- if (throws)
- {
- throws = nreverse (throws);
- for (current = throws; current; current = TREE_CHAIN (current))
- {
- register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current),
- NULL_TREE, NULL_TREE);
- JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
- &TREE_VALUE (current);
- }
- DECL_FUNCTION_THROWS (meth) = throws;
- }
-
- /* We set the DECL_NAME to ID so we can track the location where
- the function was declared. This allow us to report
- redefinition error accurately. When method are verified,
- DECL_NAME is reinstalled properly (using the content of the
- WFL node ID) (see check_method_redefinition). We don't do that
- when Object is being defined. Constructor <init> names will be
- reinstalled the same way. */
- if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node)
- DECL_NAME (meth) = id;
-
- /* Set the flag if we correctly processed a constructor */
- if (constructor_ok)
- DECL_CONSTRUCTOR_P (meth) = 1;
-
- /* Eventually set the @deprecated tag flag */
- CHECK_DEPRECATED (meth);
-
- /* If doing xref, store column and line number information instead
- of the line number only. */
- if (flag_emit_xref)
- DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id);
-
- return meth;
-}
-
-static void
-fix_method_argument_names (orig_arg, meth)
- tree orig_arg, meth;
-{
- tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth));
- if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE)
- {
- TREE_PURPOSE (arg) = this_identifier_node;
- arg = TREE_CHAIN (arg);
- }
- while (orig_arg != end_params_node)
- {
- TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
- orig_arg = TREE_CHAIN (orig_arg);
- arg = TREE_CHAIN (arg);
- }
-}
-
-/* Complete the method declaration with METHOD_BODY. */
-
-static void
-finish_method_declaration (method_body)
- tree method_body;
-{
- int flags = get_access_flags_from_decl (current_function_decl);
-
- /* 8.4.5 Method Body */
- if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
- {
- tree wfl = DECL_NAME (current_function_decl);
- parse_error_context (wfl,
- "%s method `%s' can't have a body defined",
- (METHOD_NATIVE (current_function_decl) ?
- "Native" : "Abstract"),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- method_body = NULL_TREE;
- }
- else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
- {
- tree wfl = DECL_NAME (current_function_decl);
- parse_error_context (wfl,
- "Non native and non abstract method `%s' must "
- "have a body defined",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- method_body = NULL_TREE;
- }
-
- if (flag_emit_class_files && method_body
- && TREE_CODE (method_body) == NOP_EXPR
- && TREE_TYPE (current_function_decl)
- && TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node)
- method_body = build1 (RETURN_EXPR, void_type_node, NULL);
-
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
- maybe_absorb_scoping_blocks ();
- /* Exit function's body */
- exit_block ();
- /* Merge last line of the function with first line, directly in the
- function decl. It will be used to emit correct debug info. */
- if (!flag_emit_xref)
- DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1);
- /* So we don't have an irrelevant function declaration context for
- the next static block we'll see. */
- current_function_decl = NULL_TREE;
-}
-
-/* Build a an error message for constructor circularity errors. */
-
-static char *
-constructor_circularity_msg (from, to)
- tree from, to;
-{
- static char string [4096];
- char *t = strdup (lang_printable_name (from, 0));
- sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
- free (t);
- return string;
-}
-
-/* Verify a circular call to METH. Return 1 if an error is found, 0
- otherwise. */
-
-static int
-verify_constructor_circularity (meth, current)
- tree meth, current;
-{
- static tree list = NULL_TREE;
- tree c;
- for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
- {
- if (TREE_VALUE (c) == meth)
- {
- char *t;
- if (list)
- {
- tree liste;
- list = nreverse (list);
- for (liste = list; liste; liste = TREE_CHAIN (liste))
- {
- parse_error_context
- (TREE_PURPOSE (TREE_PURPOSE (liste)),
- constructor_circularity_msg
- (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
- java_error_count--;
- }
- }
- t = strdup (lang_printable_name (meth, 0));
- parse_error_context (TREE_PURPOSE (c),
- "%s: recursive invocation of constructor `%s'",
- constructor_circularity_msg (current, meth), t);
- free (t);
- list = NULL_TREE;
- return 1;
- }
- }
- for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
- {
- list = tree_cons (c, current, list);
- if (verify_constructor_circularity (meth, TREE_VALUE (c)))
- return 1;
- list = TREE_CHAIN (list);
- }
- return 0;
-}
-
-/* Check modifiers that can be declared but exclusively */
-
-static void
-check_modifiers_consistency (flags)
- int flags;
-{
- int acc_count = 0;
- tree cl = NULL_TREE;
-
- THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
- if (acc_count > 1)
- parse_error_context
- (cl, "Inconsistent member declaration. At most one of `public', "
- "`private', or `protected' may be specified");
-}
-
-/* Check the methode header METH for abstract specifics features */
-
-static void
-check_abstract_method_header (meth)
- tree meth;
-{
- int flags = get_access_flags_from_decl (meth);
- /* DECL_NAME might still be a WFL node */
- tree name = GET_METHOD_NAME (meth);
-
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK), flags,
- ACC_ABSTRACT, "abstract method `%s'",
- IDENTIFIER_POINTER (name));
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), flags,
- ACC_PUBLIC, "abstract method `%s'",
- IDENTIFIER_POINTER (name));
-
- check_modifiers ("Illegal modifier `%s' for interface method",
- flags, INTERFACE_METHOD_MODIFIERS);
-}
-
-/* Create a FUNCTION_TYPE node and start augmenting it with the
- declared function arguments. Arguments type that can't be resolved
- are left as they are, but the returned node is marked as containing
- incomplete types. */
-
-static tree
-method_declarator (id, list)
- tree id, list;
-{
- tree arg_types = NULL_TREE, current, node;
- tree meth = make_node (FUNCTION_TYPE);
- jdep *jdep;
-
- patch_stage = JDEP_NO_PATCH;
-
- for (current = list; current; current = TREE_CHAIN (current))
- {
- int must_chain = 0;
- tree wfl_name = TREE_PURPOSE (current);
- tree type = TREE_VALUE (current);
- tree name = EXPR_WFL_NODE (wfl_name);
- tree already, arg_node;
- tree type_wfl = NULL_TREE;
- tree real_type;
-
- /* Obtain a suitable type for resolution, if necessary */
- SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
-
- /* Process NAME, as it may specify extra dimension(s) for it */
- type = build_array_from_name (type, type_wfl, name, &name);
- EXPR_WFL_NODE (wfl_name) = name;
-
- real_type = GET_REAL_TYPE (type);
- if (TREE_CODE (real_type) == RECORD_TYPE)
- {
- real_type = promote_type (real_type);
- if (TREE_CODE (type) == TREE_LIST)
- TREE_PURPOSE (type) = real_type;
- }
-
- /* Check redefinition */
- for (already = arg_types; already; already = TREE_CHAIN (already))
- if (TREE_PURPOSE (already) == name)
- {
- parse_error_context
- (wfl_name, "Variable `%s' is used more than once in the "
- "argument list of method `%s'", IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- break;
- }
-
- /* If we've an incomplete argument type, we know there is a location
- to patch when the type get resolved, later. */
- jdep = NULL;
- if (must_chain)
- {
- patch_stage = JDEP_METHOD;
- type = register_incomplete_type (patch_stage,
- type_wfl, wfl_name, type);
- jdep = CLASSD_LAST (ctxp->classd_list);
- JDEP_MISC (jdep) = id;
- }
-
- /* The argument node: a name and a (possibly) incomplete type */
- arg_node = build_tree_list (name, real_type);
- if (jdep)
- JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
- TREE_CHAIN (arg_node) = arg_types;
- arg_types = arg_node;
- }
- TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node);
- node = build_tree_list (id, meth);
- return node;
-}
-
-static int
-unresolved_type_p (wfl, returned)
- tree wfl;
- tree *returned;
-
-{
- if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
- {
- tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
- if (returned)
- *returned = (decl ? TREE_TYPE (decl) : NULL_TREE);
- return 1;
- }
- if (returned)
- *returned = wfl;
- return 0;
-}
-
-/* From NAME, build a qualified identifier node using the
- qualification from the current package definition. */
-
-static tree
-parser_qualified_classname (name)
- tree name;
-{
- if (ctxp->package)
- return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name));
- else
- return EXPR_WFL_NODE (name);
-}
-
-/* Called once the type a interface extends is resolved. Returns 0 if
- everything is OK. */
-
-static int
-parser_check_super_interface (super_decl, this_decl, this_wfl)
- tree super_decl, this_decl, this_wfl;
-{
- tree super_type = TREE_TYPE (super_decl);
-
- /* Has to be an interface */
- if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl))))
- {
- parse_error_context
- (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'",
- (TYPE_ARRAY_P (super_type) ? "array" : "class"),
- IDENTIFIER_POINTER (DECL_NAME (super_decl)),
- (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
- "interface" : "class"),
- IDENTIFIER_POINTER (DECL_NAME (this_decl)));
- return 1;
- }
-
- /* Check scope: same package OK, other package: OK if public */
- if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl)))
- return 1;
-
- SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
- IDENTIFIER_POINTER (DECL_NAME (this_decl)),
- IDENTIFIER_POINTER (DECL_NAME (super_decl))));
- return 0;
-}
-
-/* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
- 0 if everthing is OK. */
-
-static int
-parser_check_super (super_decl, this_decl, wfl)
- tree super_decl, this_decl, wfl;
-{
- tree super_type = TREE_TYPE (super_decl);
-
- /* SUPER should be a CLASS (neither an array nor an interface) */
- if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
- {
- parse_error_context
- (wfl, "Class `%s' can't subclass %s `%s'",
- IDENTIFIER_POINTER (DECL_NAME (this_decl)),
- (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
- IDENTIFIER_POINTER (DECL_NAME (super_decl)));
- return 1;
- }
-
- if (CLASS_FINAL (TYPE_NAME (super_type)))
- {
- parse_error_context (wfl, "Can't subclass final classes: %s",
- IDENTIFIER_POINTER (DECL_NAME (super_decl)));
- return 1;
- }
-
- /* Check scope: same package OK, other package: OK if public */
- if (check_pkg_class_access (DECL_NAME (super_decl), wfl))
- return 1;
-
- SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
- IDENTIFIER_POINTER (DECL_NAME (this_decl)),
- IDENTIFIER_POINTER (DECL_NAME (super_decl))));
- return 0;
-}
-
-/* Create a new dependency list and link it (in a LIFO manner) to the
- CTXP list of type dependency list. */
-
-static void
-create_jdep_list (ctxp)
- struct parser_ctxt *ctxp;
-{
- jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));
- new->first = new->last = NULL;
- new->next = ctxp->classd_list;
- ctxp->classd_list = new;
-}
-
-static jdeplist *
-reverse_jdep_list (ctxp)
- struct parser_ctxt *ctxp;
-{
- register jdeplist *prev = NULL, *current, *next;
- for (current = ctxp->classd_list; current; current = next)
- {
- next = current->next;
- current->next = prev;
- prev = current;
- }
- return prev;
-}
-
-/* Create a fake pointer based on the ID stored in
- TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
- registered again. */
-
-static tree
-obtain_incomplete_type (type_name)
- tree type_name;
-{
- tree ptr, name;
-
- if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (type_name);
- else if (INCOMPLETE_TYPE_P (type_name))
- name = TYPE_NAME (type_name);
- else
- fatal ("invalid type name - obtain_incomplete_type");
-
- for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr))
- if (TYPE_NAME (ptr) == name)
- break;
-
- if (!ptr)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- BUILD_PTR_FROM_NAME (ptr, name);
- layout_type (ptr);
- pop_obstacks ();
- TREE_CHAIN (ptr) = ctxp->incomplete_class;
- ctxp->incomplete_class = ptr;
- }
-
- return ptr;
-}
-
-/* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
- non NULL instead of computing a new fake type based on WFL. The new
- dependency is inserted in the current type dependency list, in FIFO
- manner. */
-
-static tree
-register_incomplete_type (kind, wfl, decl, ptr)
- int kind;
- tree wfl, decl, ptr;
-{
- jdep *new = (jdep *)xmalloc (sizeof (jdep));
-
- if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */
- ptr = obtain_incomplete_type (wfl);
-
- JDEP_KIND (new) = kind;
- JDEP_DECL (new) = decl;
- JDEP_SOLV (new) = ptr;
- JDEP_WFL (new) = wfl;
- JDEP_CHAIN (new) = NULL;
- JDEP_MISC (new) = NULL_TREE;
- JDEP_GET_PATCH (new) = (tree *)NULL;
-
- JDEP_INSERT (ctxp->classd_list, new);
-
- return ptr;
-}
-
-void
-java_check_circular_reference ()
-{
- tree current;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree type = TREE_TYPE (current);
- if (CLASS_INTERFACE (TYPE_NAME (type)))
- {
- /* Check all interfaces this class extends */
- tree basetype_vec = TYPE_BINFO_BASETYPES (type);
- int n, i;
-
- if (!basetype_vec)
- return;
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
- if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node
- && interface_of_p (type, BINFO_TYPE (vec_elt)))
- parse_error_context (lookup_cl (current),
- "Cyclic interface inheritance");
- }
- }
- else
- if (inherits_from_p (CLASSTYPE_SUPER (type), type))
- parse_error_context (lookup_cl (current),
- "Cyclic class inheritance");
- }
-}
-
-/* safe_layout_class just makes sure that we can load a class without
- disrupting the current_class, input_file, lineno, etc, information
- about the class processed currently. */
-
-void
-safe_layout_class (class)
- tree class;
-{
- tree save_current_class = current_class;
- char *save_input_filename = input_filename;
- int save_lineno = lineno;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- layout_class (class);
- pop_obstacks ();
-
- current_class = save_current_class;
- input_filename = save_input_filename;
- lineno = save_lineno;
- CLASS_LOADED_P (class) = 1;
-}
-
-static tree
-jdep_resolve_class (dep)
- jdep *dep;
-{
- tree decl;
-
- if (JDEP_RESOLVED_P (dep))
- decl = JDEP_RESOLVED_DECL (dep);
- else
- {
- decl = resolve_class (JDEP_TO_RESOLVE (dep),
- JDEP_DECL (dep), JDEP_WFL (dep));
- JDEP_RESOLVED (dep, decl);
- }
-
- if (!decl)
- complete_class_report_errors (dep);
-
- return decl;
-}
-
-/* Complete unsatisfied class declaration and their dependencies */
-
-void
-java_complete_class ()
-{
- tree cclass;
- jdeplist *cclassd;
- int error_found;
- tree type;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- /* Process imports and reverse the import on demand list */
- process_imports ();
- if (ctxp->import_demand_list)
- ctxp->import_demand_list = nreverse (ctxp->import_demand_list);
-
- /* Rever things so we have the right order */
- ctxp->class_list = nreverse (ctxp->class_list);
- ctxp->classd_list = reverse_jdep_list (ctxp);
-
- for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
- cclass && cclassd;
- cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
- {
- jdep *dep;
- for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep))
- {
- tree decl;
- if (!(decl = jdep_resolve_class (dep)))
- continue;
-
- /* Now it's time to patch */
- switch (JDEP_KIND (dep))
- {
- case JDEP_SUPER:
- /* Simply patch super */
- if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
- continue;
- BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
- (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
- break;
-
- case JDEP_FIELD:
- {
- /* We do part of the job done in add_field */
- tree field_decl = JDEP_DECL (dep);
- tree field_type = TREE_TYPE (decl);
- push_obstacks (&permanent_obstack, &permanent_obstack);
- if (TREE_CODE (field_type) == RECORD_TYPE)
- field_type = promote_type (field_type);
- pop_obstacks ();
- TREE_TYPE (field_decl) = field_type;
- DECL_ALIGN (field_decl) = 0;
- layout_decl (field_decl, 0);
- SOURCE_FRONTEND_DEBUG
- (("Completed field/var decl `%s' with `%s'",
- IDENTIFIER_POINTER (DECL_NAME (field_decl)),
- IDENTIFIER_POINTER (DECL_NAME (decl))));
- break;
- }
- case JDEP_METHOD: /* We start patching a method */
- case JDEP_METHOD_RETURN:
- error_found = 0;
- while (1)
- {
- if (decl)
- {
- type = TREE_TYPE(decl);
- if (TREE_CODE (type) == RECORD_TYPE)
- type = promote_type (type);
- JDEP_APPLY_PATCH (dep, type);
- SOURCE_FRONTEND_DEBUG
- (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
- "Completing fct `%s' with ret type `%s'":
- "Completing arg `%s' with type `%s'"),
- IDENTIFIER_POINTER (EXPR_WFL_NODE
- (JDEP_DECL_WFL (dep))),
- IDENTIFIER_POINTER (DECL_NAME (decl))));
- }
- else
- error_found = 1;
- dep = JDEP_CHAIN (dep);
- if (JDEP_KIND (dep) == JDEP_METHOD_END)
- break;
- else
- decl = jdep_resolve_class (dep);
- }
- if (!error_found)
- {
- tree mdecl = JDEP_DECL (dep), signature;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- /* Recompute and reset the signature */
- signature = build_java_signature (TREE_TYPE (mdecl));
- set_java_signature (TREE_TYPE (mdecl), signature);
- pop_obstacks ();
- }
- else
- continue;
- break;
-
- case JDEP_INTERFACE:
- if (parser_check_super_interface (decl, JDEP_DECL (dep),
- JDEP_WFL (dep)))
- continue;
- parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep));
- break;
-
- case JDEP_PARM:
- case JDEP_VARIABLE:
- type = TREE_TYPE(decl);
- if (TREE_CODE (type) == RECORD_TYPE)
- type = promote_type (type);
- JDEP_APPLY_PATCH (dep, type);
- break;
-
- case JDEP_TYPE:
- JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
- SOURCE_FRONTEND_DEBUG
- (("Completing a random type dependency on a '%s' node",
- tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
- break;
-
- case JDEP_EXCEPTION:
- JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
- SOURCE_FRONTEND_DEBUG
- (("Completing `%s' `throws' argument node",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))));
- break;
-
- default:
- fatal ("Can't handle patch code %d - java_complete_class",
- JDEP_KIND (dep));
- }
- }
- }
- pop_obstacks ();
- return;
-}
-
-/* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
- array. */
-
-static tree
-resolve_class (class_type, decl, cl)
- tree class_type, decl, cl;
-{
- char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type));
- char *base = name;
- tree resolved_type = TREE_TYPE (class_type);
- tree resolved_type_decl;
-
- if (resolved_type != NULL_TREE)
- {
- tree resolved_type_decl = TYPE_NAME (resolved_type);
- if (resolved_type_decl == NULL_TREE
- || TREE_CODE (resolved_type_decl) == IDENTIFIER_NODE)
- {
- resolved_type_decl = build_decl (TYPE_DECL,
- TYPE_NAME (class_type),
- resolved_type);
- }
- return resolved_type_decl;
- }
-
- /* 1- Check to see if we have an array. If true, find what we really
- want to resolve */
- while (name[0] == '[')
- name++;
- if (base != name)
- TYPE_NAME (class_type) = get_identifier (name);
-
- /* 2- Resolve the bare type */
- if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl)))
- return NULL_TREE;
- resolved_type = TREE_TYPE (resolved_type_decl);
-
- /* 3- If we have and array, reconstruct the array down to its nesting */
- if (base != name)
- {
- while (base != name)
- {
- if (TREE_CODE (resolved_type) == RECORD_TYPE)
- resolved_type = promote_type (resolved_type);
- resolved_type = build_java_array_type (resolved_type, -1);
- CLASS_LOADED_P (resolved_type) = 1;
- name--;
- }
- /* Build a fake decl for this, since this is what is expected to
- be returned. */
- resolved_type_decl =
- build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type);
- /* Figure how those two things are important for error report. FIXME */
- DECL_SOURCE_LINE (resolved_type_decl) = 0;
- DECL_SOURCE_FILE (resolved_type_decl) = input_filename;
- TYPE_NAME (class_type) = TYPE_NAME (resolved_type);
- }
- TREE_TYPE (class_type) = resolved_type;
- return resolved_type_decl;
-}
-
-/* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
- are used to report error messages. */
-
-tree
-do_resolve_class (class_type, decl, cl)
- tree class_type;
- tree decl;
- tree cl;
-{
- tree new_class_decl;
- tree original_name = NULL_TREE;
-
- /* Do not try to replace TYPE_NAME (class_type) by a variable, since
- its is changed by find_in_imports{_on_demand} */
-
- /* 1- Check for the type in single imports */
- if (find_in_imports (class_type))
- return NULL_TREE;
-
- /* 2- And check for the type in the current compilation unit. If it fails,
- try with a name qualified with the package name if appropriate. */
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
- !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
- load_class (TYPE_NAME (class_type), 0);
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- }
-
- original_name = TYPE_NAME (class_type);
- if (!QUALIFIED_P (TYPE_NAME (class_type)) && ctxp->package)
- TYPE_NAME (class_type) = merge_qualified_name (ctxp->package,
- TYPE_NAME (class_type));
-#if 1
- if (!(new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- load_class (TYPE_NAME (class_type), 0);
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
- !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
- load_class (TYPE_NAME (class_type), 0);
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- }
-#else
- new_name = TYPE_NAME (class_type);
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_name)) != NULL_TREE)
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
- !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
- load_class (new_name, 0);
- return IDENTIFIER_CLASS_VALUE (new_name);
- }
- else
- {
- tree class = read_class (new_name);
- if (class != NULL_TREE)
- {
- tree decl = IDENTIFIER_CLASS_VALUE (new_name);
- if (decl == NULL_TREE)
- decl = push_class (class, new_name);
- return decl;
- }
- }
-#endif
- TYPE_NAME (class_type) = original_name;
-
- /* 3- Check an other compilation unit that bears the name of type */
- load_class (TYPE_NAME (class_type), 0);
- if (check_pkg_class_access (TYPE_NAME (class_type),
- (cl ? cl : lookup_cl (decl))))
- return NULL_TREE;
-
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- return new_class_decl;
-
- /* 4- Check the import on demands. Don't allow bar.baz to be
- imported from foo.* */
- if (!QUALIFIED_P (TYPE_NAME (class_type)))
- if (find_in_imports_on_demand (class_type))
- return NULL_TREE;
-
- /* 5- Last call for a resolution */
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
-}
-
-/* Resolve NAME and lay it out (if not done and if not the current
- parsed class). Return a decl node. This function is meant to be
- called when type resolution is necessary during the walk pass. */
-
-static tree
-resolve_and_layout (something, cl)
- tree something;
- tree cl;
-{
- tree decl;
-
- /* Don't do that on the current class */
- if (something == current_class)
- return TYPE_NAME (current_class);
-
- /* Don't do anything for void and other primitive types */
- if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
- return NULL_TREE;
-
- /* Pointer types can be reall pointer types or fake pointers. When
- finding a real pointer, recheck for primitive types */
- if (TREE_CODE (something) == POINTER_TYPE)
- {
- if (TREE_TYPE (something))
- {
- something = TREE_TYPE (something);
- if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
- return NULL_TREE;
- }
- else
- something = TYPE_NAME (something);
- }
-
- /* Don't do anything for arrays of primitive types */
- if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something)
- && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something)))
- return NULL_TREE;
-
- /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
- or a real TYPE */
- if (TREE_CODE (something) != IDENTIFIER_NODE)
- something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ?
- DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something));
-
- if (!(decl = resolve_no_layout (something, cl)))
- return NULL_TREE;
-
- /* Resolve and layout if necessary */
- layout_class_methods (TREE_TYPE (decl));
- if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))
- CHECK_METHODS (decl);
- if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
- safe_layout_class (TREE_TYPE (decl));
-
- return decl;
-}
-
-/* Resolve a class, returns its decl but doesn't perform any
- layout. The current parsing context is saved and restored */
-
-static tree
-resolve_no_layout (name, cl)
- tree name, cl;
-{
- tree ptr, decl;
- BUILD_PTR_FROM_NAME (ptr, name);
- java_parser_context_save_global ();
- decl = resolve_class (ptr, NULL_TREE, cl);
- java_parser_context_restore_global ();
-
- return decl;
-}
-
-/* Called when reporting errors. Skip leader '[' in a complex array
- type description that failed to be resolved. */
-
-static char *
-purify_type_name (name)
- char *name;
-{
- while (*name && *name == '[')
- name++;
- return name;
-}
-
-/* The type CURRENT refers to can't be found. We print error messages. */
-
-static void
-complete_class_report_errors (dep)
- jdep *dep;
-{
- char *name;
-
- if (!JDEP_WFL (dep))
- return;
-
- name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)));
- switch (JDEP_KIND (dep))
- {
- case JDEP_SUPER:
- parse_error_context
- (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
- purify_type_name (name),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_FIELD:
- parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'",
- purify_type_name (name),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_METHOD: /* Covers arguments */
- parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "argument `%s' of method `%s'",
- purify_type_name (name),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
- break;
- case JDEP_METHOD_RETURN: /* Covers return type */
- parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "return type of method `%s'",
- purify_type_name (name),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
- break;
- case JDEP_INTERFACE:
- parse_error_context
- (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
- (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_VARIABLE:
- parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "local variable `%s'",
- purify_type_name (IDENTIFIER_POINTER
- (EXPR_WFL_NODE (JDEP_WFL (dep)))),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_EXCEPTION: /* As specified by `throws' */
- parse_error_context
- (JDEP_WFL (dep), "Class `%s' not found in `throws'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))));
- break;
- default:
- /* Fix for -Wall. Just break doing nothing. The error will be
- caught later */
- break;
- }
-}
-
-/* Check uninitialized final. */
-
-void
-java_check_final ()
-{
-}
-
-/* Return a static string containing the DECL prototype string. If
- DECL is a constructor, use the class name instead of the form
- <init> */
-
-static char *
-get_printable_method_name (decl)
- tree decl;
-{
- char *to_return;
- tree name = NULL_TREE;
-
- if (DECL_CONSTRUCTOR_P (decl))
- {
- name = DECL_NAME (decl);
- DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
- }
-
- to_return = lang_printable_name (decl, 0);
- if (DECL_CONSTRUCTOR_P (decl))
- DECL_NAME (decl) = name;
-
- return to_return;
-}
-
-/* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
- nevertheless needs to be verfied, 1 otherwise. */
-
-static int
-reset_method_name (method)
- tree method;
-{
- if (!IS_CLINIT (method) && DECL_NAME (method) != finit_identifier_node)
- {
- /* NAME is just the plain name when Object is being defined */
- if (DECL_CONTEXT (method) != object_type_node)
- DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ?
- init_identifier_node : GET_METHOD_NAME (method));
- return 0;
- }
- else
- return 1;
-}
-
-/* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
-
-tree
-java_get_real_method_name (method_decl)
- tree method_decl;
-{
- tree method_name = DECL_NAME (method_decl);
- if (DECL_CONSTRUCTOR_P (method_decl))
- return init_identifier_node;
-
- /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
- and still can be a constructor. FIXME */
-
- /* Don't confuse method only bearing the name of their class as
- constructors */
- else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl))
- && ctxp
- && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name)
- && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED
- && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node)
- return init_identifier_node;
- else
- return EXPR_WFL_NODE (method_name);
-}
-
-/* Track method being redefined inside the same class. As a side
- effect, set DECL_NAME to an IDENTIFIER (prior entering this
- function it's a FWL, so we can track errors more accurately */
-
-static int
-check_method_redefinition (class, method)
- tree class, method;
-{
- tree redef, name;
- tree cl = DECL_NAME (method);
- tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
- /* decl name of artificial <clinit> and $finit$ doesn't need to be
- fixed and checked */
-
- /* Reset the method name before running the check. If it returns 1,
- the method doesn't need to be verified with respect to method
- redeclaration and we return 0 */
- if (reset_method_name (method))
- return 0;
-
- name = DECL_NAME (method);
- for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
- {
- if (redef == method)
- break;
- if (DECL_NAME (redef) == name
- && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef)))
- {
- parse_error_context
- (cl, "Duplicate %s declaration `%s'",
- (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
- get_printable_method_name (redef));
- return 1;
- }
- }
- return 0;
-}
-
-/* Check all the methods of CLASS. Methods are first completed then
- checked according to regular method existance rules.
- If no constructor were encountered, then build its declaration. */
-
-static void
-java_check_regular_methods (class_decl)
- tree class_decl;
-{
- int saw_constructor = 0;
- tree method;
- tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl));
- tree super_class = CLASSTYPE_SUPER (class);
- tree saved_found_wfl = NULL_TREE, found = NULL_TREE;
- tree mthrows;
-
- /* It is not necessary to check methods defined in java.lang.Object */
- if (class == object_type_node)
- return;
-
- if (!TYPE_NVIRTUALS (class))
- TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
-
- /* Should take interfaces into account. FIXME */
- for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
- {
- tree sig;
- tree method_wfl = DECL_NAME (method);
- int aflags;
-
- /* If we previously found something and its name was saved,
- reinstall it now */
- if (found && saved_found_wfl)
- {
- DECL_NAME (found) = saved_found_wfl;
- saved_found_wfl = NULL_TREE;
- }
-
- /* Check for redefinitions */
- if (check_method_redefinition (class, method))
- continue;
-
- /* If we see one constructor a mark so we don't generate the
- default one. Also skip other verifications: constructors
- can't be inherited hence hiden or overriden */
- if (DECL_CONSTRUCTOR_P (method))
- {
- saw_constructor = 1;
- continue;
- }
-
- /* We verify things thrown by the method. They must inherits from
- java.lang.Throwable */
- for (mthrows = DECL_FUNCTION_THROWS (method);
- mthrows; mthrows = TREE_CHAIN (mthrows))
- {
- if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
- parse_error_context
- (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be "
- "a subclass of class `java.lang.Throwable'",
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
- }
-
- sig = build_java_argument_signature (TREE_TYPE (method));
- found = lookup_argument_method (super_class, DECL_NAME (method), sig);
-
- /* Nothing overrides or it's a private method. */
- if (!found)
- continue;
- if (METHOD_PRIVATE (found))
- {
- found = NULL_TREE;
- continue;
- }
-
- /* If found wasn't verified, it's DECL_NAME won't be set properly.
- We set it temporarily for the sake of the error report. */
- saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
-
- /* Can't override a method with the same name and different return
- types. */
- if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
- {
- char *t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)),
- 0));
- parse_error_context
- (method_wfl,
- "Method `%s' was defined with return type `%s' in class `%s'",
- lang_printable_name (found, 0), t,
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- free (t);
- }
-
- aflags = get_access_flags_from_decl (found);
- /* If the method has default, access in an other package, then
- issue a warning that the current method doesn't override the
- one that was found elsewhere. Do not issue this warning when
- the match was found in java.lang.Object. */
- if (DECL_CONTEXT (found) != object_type_node
- && ((aflags & 0x7) == 0)
- && !class_in_current_package (DECL_CONTEXT (found))
- && DECL_NAME (found) != clinit_identifier_node
- && flag_not_overriding)
- {
- parse_warning_context
- (method_wfl, "Method `%s' in class `%s' does not "
- "override the corresponding method in class `%s', which is "
- "private to a different package",
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- IDENTIFIER_POINTER (DECL_NAME
- (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* Can't override final. Can't override static. */
- if (METHOD_FINAL (found) || METHOD_STATIC (found))
- {
- /* Static *can* override static */
- if (METHOD_STATIC (found) && METHOD_STATIC (method))
- continue;
- parse_error_context
- (method_wfl,
- "%s methods can't be overriden. Method `%s' is %s in class `%s'",
- (METHOD_FINAL (found) ? "Final" : "Static"),
- lang_printable_name (found, 0),
- (METHOD_FINAL (found) ? "final" : "static"),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* Static method can't override instance method. */
- if (METHOD_STATIC (method))
- {
- parse_error_context
- (method_wfl,
- "Instance methods can't be overriden by a static method. Method "
- "`%s' is an instance method in class `%s'",
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* - Overriding/hiding public must be public
- - Overriding/hiding protected must be protected or public
- - If the overriden or hidden method has default (package)
- access, then the overriding or hiding method must not be
- private; otherwise, a compile-time error occurs */
- if ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method))
- || (METHOD_PROTECTED (found)
- && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method)))
- || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC))
- && METHOD_PRIVATE (method)))
- {
- parse_error_context
- (method_wfl,
- "Methods can't be overridden to be more private. Method `%s' is "
- "not %s in class `%s'", lang_printable_name (method, 0),
- (METHOD_PUBLIC (method) ? "public" :
- (METHOD_PRIVATE (method) ? "private" : "protected")),
- IDENTIFIER_POINTER (DECL_NAME
- (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* Overriding methods must have compatible `throws' clauses on checked
- exceptions, if any */
- check_throws_clauses (method, method_wfl, found);
-
- /* Inheriting multiple methods with the same signature. FIXME */
- }
-
- /* Don't forget eventual pending found and saved_found_wfl. Take
- into account that we might have exited because we saw an
- aritifical method as the last entry. */
-
- if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
- DECL_NAME (found) = saved_found_wfl;
-
- if (!TYPE_NVIRTUALS (class))
- TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
-
- if (!saw_constructor)
- {
- /* No constructor seen, we craft one, at line 0. Since this
- operation takes place after we laid methods out
- (layout_class_methods), we prepare the its DECL
- appropriately. */
- int flags;
- tree decl;
-
- /* If the class is declared PUBLIC, the default constructor is
- PUBLIC otherwise it has default access implied by no access
- modifiers. */
- flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ?
- ACC_PUBLIC : 0);
- decl = create_artificial_method (class, flags, void_type_node,
- init_identifier_node, end_params_node);
- DECL_CONSTRUCTOR_P (decl) = 1;
- layout_class_method (TREE_TYPE (class_decl), NULL_TREE, decl, NULL_TREE);
- }
-}
-
-/* Return a non zero value if the `throws' clause of METHOD (if any)
- is incompatible with the `throws' clause of FOUND (if any). */
-
-static void
-check_throws_clauses (method, method_wfl, found)
- tree method, method_wfl, found;
-{
- tree mthrows, fthrows;
-
- /* Can't check these things with class loaded from bytecode. FIXME */
- if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found)))
- return;
-
- for (mthrows = DECL_FUNCTION_THROWS (method);
- mthrows; mthrows = TREE_CHAIN (mthrows))
- {
- /* We don't verify unchecked expressions */
- if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows)))
- continue;
- /* Checked expression must be compatible */
- for (fthrows = DECL_FUNCTION_THROWS (found);
- fthrows; fthrows = TREE_CHAIN (fthrows))
- if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows)))
- break;
- if (!fthrows)
- {
- parse_error_context
- (method_wfl, "Invalid checked exception class `%s' in "
- "`throws' clause. The exception must be a subclass of an "
- "exception thrown by `%s' from class `%s'",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- }
- }
-}
-
-/* Check abstract method of interface INTERFACE */
-
-static void
-java_check_abstract_methods (interface_decl)
- tree interface_decl;
-{
- int i, n;
- tree method, basetype_vec, found;
- tree interface = TREE_TYPE (interface_decl);
-
- for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
- {
- tree method_wfl = DECL_NAME (method);
-
- /* 2- Check for double definition inside the defining interface */
- if (check_method_redefinition (interface, method))
- continue;
-
- /* 3- Overriding is OK as far as we preserve the return type and
- the thrown exceptions (FIXME) */
- found = lookup_java_interface_method2 (interface, method);
- if (found)
- {
- char *t;
- tree saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
- t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
- parse_error_context
- (method_wfl,
- "Method `%s' was defined with return type `%s' in class `%s'",
- lang_printable_name (found, 0), t,
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- free (t);
- continue;
-
- DECL_NAME (found) = saved_found_wfl;
- }
- }
-
- /* 4- Inherited methods can't differ by their returned types */
- if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
- return;
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree sub_interface_method, sub_interface;
- tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
- if (!vec_elt)
- continue;
- sub_interface = BINFO_TYPE (vec_elt);
- for (sub_interface_method = TYPE_METHODS (sub_interface);
- sub_interface_method;
- sub_interface_method = TREE_CHAIN (sub_interface_method))
- {
- found = lookup_java_interface_method2 (interface,
- sub_interface_method);
- if (found && (found != sub_interface_method))
- {
- tree saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
- parse_error_context
- (lookup_cl (sub_interface_method),
- "Interface `%s' inherits method `%s' from interface `%s'. "
- "This method is redefined with a different return type in "
- "interface `%s'",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME
- (DECL_CONTEXT (sub_interface_method)))),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- DECL_NAME (found) = saved_found_wfl;
- }
- }
- }
-}
-
-/* Lookup methods in interfaces using their name and partial
- signature. Return a matching method only if their types differ. */
-
-static tree
-lookup_java_interface_method2 (class, method_decl)
- tree class, method_decl;
-{
- int i, n;
- tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
-
- if (!basetype_vec)
- return NULL_TREE;
-
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
- if ((BINFO_TYPE (vec_elt) != object_type_node)
- && (to_return =
- lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
- return to_return;
- }
- for (i = 0; i < n; i++)
- {
- to_return = lookup_java_interface_method2
- (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
- if (to_return)
- return to_return;
- }
-
- return NULL_TREE;
-}
-
-/* Lookup method using their name and partial signature. Return a
- matching method only if their types differ. */
-
-static tree
-lookup_java_method2 (clas, method_decl, do_interface)
- tree clas, method_decl;
- int do_interface;
-{
- tree method, method_signature, method_name, method_type, name;
-
- method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
- name = DECL_NAME (method_decl);
- method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
- EXPR_WFL_NODE (name) : name);
- method_type = TREE_TYPE (TREE_TYPE (method_decl));
-
- while (clas != NULL_TREE)
- {
- for (method = TYPE_METHODS (clas);
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- tree method_sig = build_java_argument_signature (TREE_TYPE (method));
- tree name = DECL_NAME (method);
- if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
- EXPR_WFL_NODE (name) : name) == method_name
- && method_sig == method_signature
- && TREE_TYPE (TREE_TYPE (method)) != method_type)
- return method;
- }
- clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas));
- }
- return NULL_TREE;
-}
-
-/* Return the line that matches DECL line number. Used during error
- report */
-
-static tree
-lookup_cl (decl)
- tree decl;
-{
- static tree cl = NULL_TREE;
-
- if (!decl)
- return NULL_TREE;
-
- if (cl == NULL_TREE)
- cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
-
- EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
- EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
-
- return cl;
-}
-
-/* Look for a simple name in the single-type import list */
-
-static tree
-find_name_in_single_imports (name)
- tree name;
-{
- tree node;
-
- for (node = ctxp->import_list; node; node = TREE_CHAIN (node))
- if (TREE_VALUE (node) == name)
- return (EXPR_WFL_NODE (TREE_PURPOSE (node)));
-
- return NULL_TREE;
-}
-
-/* Process all single-type import. */
-
-static int
-process_imports ()
-{
- tree import;
- int error_found;
-
- for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
- {
- tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
-
- /* Don't load twice something already defined. */
- if (IDENTIFIER_CLASS_VALUE (to_be_found))
- continue;
- QUALIFIED_P (to_be_found) = 1;
- load_class (to_be_found, 0);
- error_found =
- check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
- if (!IDENTIFIER_CLASS_VALUE (to_be_found))
- {
- parse_error_context (TREE_PURPOSE (import),
- "Class or interface `%s' not found in import",
- IDENTIFIER_POINTER (to_be_found));
- return 1;
- }
- if (error_found)
- return 1;
- }
- return 0;
-}
-
-/* Possibly find a class imported by a single-type import statement. Return
- 1 if an error occured, 0 otherwise. */
-
-static int
-find_in_imports (class_type)
- tree class_type;
-{
- tree import;
-
- for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
- if (TREE_VALUE (import) == TYPE_NAME (class_type))
- {
- TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
- QUALIFIED_P (TYPE_NAME (class_type)) = 1;
- }
- return 0;
-}
-
-static int
-note_possible_classname (name, len)
- char *name;
- int len;
-{
- tree node;
- if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0)
- len = len - 5;
- else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0)
- len = len - 6;
- else
- return 0;
- node = ident_subst (name, len, "", '/', '.', "");
- IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
- QUALIFIED_P (node) = strchr (name, '/') ? 1 : 0;
- return 1;
-}
-
-/* Read a import directory, gathering potential match for further type
- references. Indifferently reads a filesystem or a ZIP archive
- directory. */
-
-static void
-read_import_dir (wfl)
- tree wfl;
-{
- tree package_id = EXPR_WFL_NODE (wfl);
- char *package_name = IDENTIFIER_POINTER (package_id);
- int package_length = IDENTIFIER_LENGTH (package_id);
- DIR *dirp = NULL;
- JCF *saved_jcf = current_jcf;
-
- int found = 0;
- int k;
- void *entry;
- struct buffer filename[1];
-
-
- if (IS_AN_IMPORT_ON_DEMAND_P (package_id))
- return;
- IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1;
-
- BUFFER_INIT (filename);
- buffer_grow (filename, package_length + 100);
-
- for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
- {
- char *entry_name = jcf_path_name (entry);
- int entry_length = strlen (entry_name);
- if (jcf_path_is_zipfile (entry))
- {
- ZipFile *zipf;
- buffer_grow (filename, entry_length);
- memcpy (filename->data, entry_name, entry_length - 1);
- filename->data[entry_length-1] = '\0';
- zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
- if (zipf == NULL)
- error ("malformed .zip archive in CLASSPATH: %s", entry_name);
- else
- {
- ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory;
- BUFFER_RESET (filename);
- for (k = 0; k < package_length; k++)
- {
- char ch = package_name[k];
- *filename->ptr++ = ch == '.' ? '/' : ch;
- }
- *filename->ptr++ = '/';
-
- for (k = 0; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd))
- {
- char *current_entry = ZIPDIR_FILENAME (zipd);
- int current_entry_len = zipd->filename_length;
-
- if (current_entry_len >= BUFFER_LENGTH (filename)
- && strncmp (filename->data, current_entry,
- BUFFER_LENGTH (filename)) != 0)
- continue;
- found |= note_possible_classname (current_entry,
- current_entry_len);
- }
- }
- }
- else
- {
- BUFFER_RESET (filename);
- buffer_grow (filename, entry_length + package_length + 4);
- strcpy (filename->data, entry_name);
- filename->ptr = filename->data + entry_length;
- for (k = 0; k < package_length; k++)
- {
- char ch = package_name[k];
- *filename->ptr++ = ch == '.' ? '/' : ch;
- }
- *filename->ptr = '\0';
-
- dirp = opendir (filename->data);
- if (dirp == NULL)
- continue;
- *filename->ptr++ = '/';
- for (;;)
- {
- int len;
- char *d_name;
- struct dirent *direntp = readdir (dirp);
- if (!direntp)
- break;
- d_name = direntp->d_name;
- len = strlen (direntp->d_name);
- buffer_grow (filename, len+1);
- strcpy (filename->ptr, d_name);
- found |= note_possible_classname (filename->data + entry_length,
- package_length+len+1);
- }
- if (dirp)
- closedir (dirp);
- }
- }
-
- free (filename->data);
-
- /* Here we should have a unified way of retrieving an entry, to be
- indexed. */
- if (!found)
- {
- static int first = 1;
- if (first)
- {
- char buffer [256];
- sprintf (buffer, "Can't find default package `%s'. Check "
- "the CLASSPATH environment variable and the access to the "
- "archives.", package_name);
- error (buffer);
- java_error_count++;
- first = 0;
- }
- else
- parse_error_context (wfl, "Package `%s' not found in import",
- package_name);
- current_jcf = saved_jcf;
- return;
- }
- current_jcf = saved_jcf;
-}
-
-/* Possibly find a type in the import on demands specified
- types. Returns 1 if an error occured, 0 otherwise. Run throught the
- entire list, to detected potential double definitions. */
-
-static int
-find_in_imports_on_demand (class_type)
- tree class_type;
-{
- tree node, import, node_to_use = NULL_TREE;
- int seen_once = -1;
- tree cl = NULL_TREE;
-
- for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import))
- {
- char *id_name;
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
- obstack_1grow (&temporary_obstack, '.');
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (TYPE_NAME (class_type)),
- IDENTIFIER_LENGTH (TYPE_NAME (class_type)));
- id_name = obstack_finish (&temporary_obstack);
-
- node = maybe_get_identifier (id_name);
- if (node && IS_A_CLASSFILE_NAME (node))
- {
- if (seen_once < 0)
- {
- cl = TREE_PURPOSE (import);
- seen_once = 1;
- node_to_use = node;
- }
- else
- {
- seen_once++;
- parse_error_context
- (import, "Type `%s' also potentially defined in package `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (class_type)),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))));
- }
- }
- }
-
- if (seen_once == 1)
- {
- /* Setup lineno so that it refers to the line of the import (in
- case we parse a class file and encounter errors */
- tree decl;
- int saved_lineno = lineno;
- lineno = EXPR_WFL_LINENO (cl);
- TYPE_NAME (class_type) = node_to_use;
- QUALIFIED_P (TYPE_NAME (class_type)) = 1;
- decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- /* If there is no DECL set for the class or if the class isn't
- loaded and not seen in source yet, the load */
- if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl))
- && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
- load_class (node_to_use, 0);
- lineno = saved_lineno;
- return check_pkg_class_access (TYPE_NAME (class_type), cl);
- }
- else
- return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
-}
-
-static tree
-resolve_package (pkg, next)
- tree pkg, *next;
-{
- tree current;
- tree type_name = NULL_TREE;
- char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg));
-
- /* The trick is to determine when the package name stops and were
- the name of something contained in the package starts. Then we
- return a fully qualified name of what we want to get. */
-
- /* Do a quick search on well known package names */
- if (!strncmp (name, "java.lang.reflect", 17))
- {
- *next =
- TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))));
- type_name = lookup_package_type (name, 17);
- }
- else if (!strncmp (name, "java.lang", 9))
- {
- *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)));
- type_name = lookup_package_type (name, 9);
- }
-
- /* If we found something here, return */
- if (type_name)
- return type_name;
-
- *next = EXPR_WFL_QUALIFICATION (pkg);
-
- /* Try the current package. */
- if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package),
- IDENTIFIER_LENGTH (ctxp->package)))
- {
- type_name =
- lookup_package_type_and_set_next (name,
- IDENTIFIER_LENGTH (ctxp->package),
- next );
- if (type_name)
- return type_name;
- }
-
- /* Search in imported package */
- for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
- {
- tree current_pkg_name = EXPR_WFL_NODE (TREE_PURPOSE (current));
- int len = IDENTIFIER_LENGTH (current_pkg_name);
- if (!strncmp (name, IDENTIFIER_POINTER (current_pkg_name), len))
- {
- tree left, dummy;
-
- breakdown_qualified (&left, &dummy, current_pkg_name);
- len = IDENTIFIER_LENGTH (left);
- type_name = lookup_package_type_and_set_next (name, len, next);
- if (type_name)
- break;
- }
- }
-
- return type_name;
-}
-
-static tree
-lookup_package_type_and_set_next (name, len, next)
- char *name;
- int len;
- tree *next;
-{
- char *ptr;
- tree type_name = lookup_package_type (name, len);
-
- if (!type_name)
- return NULL;
-
- ptr = IDENTIFIER_POINTER (type_name);
- while (ptr && (ptr = strchr (ptr, '.')))
- {
- *next = TREE_CHAIN (*next);
- ptr++;
- }
- return type_name;
-}
-
-static tree
-lookup_package_type (name, from)
- char *name;
- int from;
-{
- char subname [128];
- char *sub = &name[from+1];
- while (*sub != '.' && *sub)
- sub++;
- strncpy (subname, name, sub-name);
- subname [sub-name] = '\0';
- return get_identifier (subname);
-}
-
-/* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
- access violations were found, 1 otherwise. */
-
-static int
-check_pkg_class_access (class_name, cl)
- tree class_name;
- tree cl;
-{
- tree type;
-
- if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name))
- return 0;
-
- if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name))))
- return 0;
-
- if (!CLASS_PUBLIC (TYPE_NAME (type)))
- {
- /* Access to a private class within the same package is
- allowed. */
- tree l, r;
- breakdown_qualified (&l, &r, class_name);
- if (l == ctxp->package)
- return 0;
-
- parse_error_context
- (cl, "Can't access %s `%s'. Only public classes and interfaces in "
- "other packages can be accessed",
- (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
- IDENTIFIER_POINTER (class_name));
- return 1;
- }
- return 0;
-}
-
-/* Local variable declaration. */
-
-static void
-declare_local_variables (modifier, type, vlist)
- int modifier;
- tree type;
- tree vlist;
-{
- tree decl, current, saved_type;
- tree type_wfl = NULL_TREE;
- int must_chain = 0;
-
- /* Push a new block if statements were seen between the last time we
- pushed a block and now. Keep a cound of block to close */
- if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
- {
- tree body = GET_CURRENT_BLOCK (current_function_decl);
- tree b = enter_block ();
- BLOCK_EXPR_ORIGIN (b) = body;
- }
-
- if (modifier)
- {
- int i;
- for (i = 0; i <= 10; i++) if (1 << i & modifier) break;
- if (modifier == ACC_FINAL)
- {
- if (flag_static_local_jdk1_1)
- parse_warning_context (ctxp->modifier_ctx [i],
- "Unsupported JDK1.1 `final' local variable "
- "(treated as non final)");
- }
- else
- {
- parse_error_context
- (ctxp->modifier_ctx [i],
- "Only `final' is allowed as a local variables modifier");
- return;
- }
- }
-
- /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
- hold the TYPE value if a new incomplete has to be created (as
- opposed to being found already existing and reused). */
- SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
-
- /* If TYPE is fully resolved and we don't have a reference, make one */
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
-
- /* Go through all the declared variables */
- for (current = vlist, saved_type = type; current;
- current = TREE_CHAIN (current), type = saved_type)
- {
- tree other, real_type;
- tree wfl = TREE_PURPOSE (current);
- tree name = EXPR_WFL_NODE (wfl);
- tree init = TREE_VALUE (current);
-
- /* Process NAME, as it may specify extra dimension(s) for it */
- type = build_array_from_name (type, type_wfl, name, &name);
-
- /* Variable redefinition check */
- if ((other = lookup_name_in_blocks (name)))
- {
- variable_redefinition_error (wfl, name, TREE_TYPE (other),
- DECL_SOURCE_LINE (other));
- continue;
- }
-
- /* Type adjustment. We may have just readjusted TYPE because
- the variable specified more dimensions. Make sure we have
- a reference if we can and don't have one already. */
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
-
- real_type = GET_REAL_TYPE (type);
- /* Never layout this decl. This will be done when its scope
- will be entered */
- decl = build_decl (VAR_DECL, name, real_type);
- BLOCK_CHAIN_DECL (decl);
-
- /* If doing xreferencing, replace the line number with the WFL
- compound value */
- if (flag_emit_xref)
- DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl);
-
- /* Don't try to use an INIT statement when an error was found */
- if (init && java_error_count)
- init = NULL_TREE;
-
- /* Add the initialization function to the current function's code */
- if (init)
- {
- /* Name might have been readjusted */
- EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name;
- MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
- java_method_add_stmt (current_function_decl,
- build_debugable_stmt (EXPR_WFL_LINECOL (init),
- init));
- }
-
- /* Setup dependency the type of the decl */
- if (must_chain)
- {
- jdep *dep;
- register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type);
- dep = CLASSD_LAST (ctxp->classd_list);
- JDEP_GET_PATCH (dep) = &TREE_TYPE (decl);
- }
- }
- SOURCE_FRONTEND_DEBUG (("Defined locals"));
-}
-
-/* Called during parsing. Build decls from argument list. */
-
-static void
-source_start_java_method (fndecl)
- tree fndecl;
-{
- tree tem;
- tree parm_decl;
- int i;
-
- current_function_decl = fndecl;
-
- /* New scope for the function */
- enter_block ();
- for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
- tem != end_params_node; tem = TREE_CHAIN (tem), i++)
- {
- tree type = TREE_VALUE (tem);
- tree name = TREE_PURPOSE (tem);
-
- /* If type is incomplete. Create an incomplete decl and ask for
- the decl to be patched later */
- if (INCOMPLETE_TYPE_P (type))
- {
- jdep *jdep;
- tree real_type = GET_REAL_TYPE (type);
- parm_decl = build_decl (PARM_DECL, name, real_type);
- type = obtain_incomplete_type (type);
- register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type);
- jdep = CLASSD_LAST (ctxp->classd_list);
- JDEP_MISC (jdep) = name;
- JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl);
- }
- else
- parm_decl = build_decl (PARM_DECL, name, type);
-
- BLOCK_CHAIN_DECL (parm_decl);
- }
- tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
- BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
- nreverse (tem);
- DECL_ARG_SLOT_COUNT (current_function_decl) = i;
-}
-
-/* Called during parsing. Creates an artificial method declaration. */
-
-static tree
-create_artificial_method (class, flags, type, name, args)
- tree class;
- int flags;
- tree type, name, args;
-{
- int saved_lineno = lineno;
- tree mdecl;
-
- lineno = 0;
- mdecl = make_node (FUNCTION_TYPE);
- TREE_TYPE (mdecl) = type;
- TYPE_ARG_TYPES (mdecl) = args;
- mdecl = add_method (class, flags, name, build_java_signature (mdecl));
- lineno = saved_lineno;
- DECL_ARTIFICIAL (mdecl) = 1;
- return mdecl;
-}
-
-/* Starts the body if an artifical method. */
-
-static void
-start_artificial_method_body (mdecl)
- tree mdecl;
-{
- DECL_SOURCE_LINE (mdecl) = 1;
- DECL_SOURCE_LINE_MERGE (mdecl, 1);
- source_start_java_method (mdecl);
- enter_block ();
-}
-
-static void
-end_artificial_method_body (mdecl)
- tree mdecl;
-{
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block ();
- exit_block ();
-}
-
-/* Called during expansion. Push decls formerly built from argument
- list so they're usable during expansion. */
-
-static void
-expand_start_java_method (fndecl)
- tree fndecl;
-{
- tree tem, *ptr;
-
- current_function_decl = fndecl;
-
- announce_function (fndecl);
- pushlevel (1); /* Push parameters */
- ptr = &DECL_ARGUMENTS (fndecl);
- tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
- while (tem)
- {
- tree next = TREE_CHAIN (tem);
- tree type = TREE_TYPE (tem);
-#ifdef PROMOTE_PROTOTYPES
- if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
- && INTEGRAL_TYPE_P (type))
- type = integer_type_node;
-#endif
- DECL_ARG_TYPE (tem) = type;
- layout_decl (tem, 0);
- pushdecl (tem);
- *ptr = tem;
- ptr = &TREE_CHAIN (tem);
- tem = next;
- }
- *ptr = NULL_TREE;
- pushdecl_force_head (DECL_ARGUMENTS (fndecl));
- lineno = DECL_SOURCE_LINE_FIRST (fndecl);
-}
-
-/* Terminate a function and expand its body. */
-
-static void
-source_end_java_method ()
-{
- tree fndecl = current_function_decl;
- int flag_asynchronous_exceptions = asynchronous_exceptions;
-
- java_parser_context_save_global ();
- lineno = ctxp->last_ccb_indent1;
-
- /* Set EH language codes */
- java_set_exception_lang_code ();
-
- /* Turn function bodies with only a NOP expr null, so they don't get
- generated at all and we won't get warnings when using the -W
- -Wall flags. */
- if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node)
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
-
- /* Generate function's code */
- if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
- && ! flag_emit_class_files
- && ! flag_emit_xref)
- expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)));
-
- /* pop out of its parameters */
- pushdecl_force_head (DECL_ARGUMENTS (fndecl));
- poplevel (1, 0, 1);
- BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
-
- /* Generate rtl for function exit. */
- if (! flag_emit_class_files && ! flag_emit_xref)
- {
- lineno = DECL_SOURCE_LINE_LAST (fndecl);
- /* Emit catch-finally clauses */
- emit_handlers ();
- expand_function_end (input_filename, lineno, 0);
-
- /* FIXME: If the current method contains any exception handlers,
- force asynchronous_exceptions: this is necessary because signal
- handlers in libjava may throw exceptions. This is far from being
- a perfect solution, but it's better than doing nothing at all.*/
- if (catch_clauses)
- asynchronous_exceptions = 1;
-
- /* Run the optimizers and output assembler code for this function. */
- rest_of_compilation (fndecl);
- }
-
- current_function_decl = NULL_TREE;
- /* permanent_allocation (1); */
- java_parser_context_restore_global ();
- asynchronous_exceptions = flag_asynchronous_exceptions;
-}
-
-/* Record EXPR in the current function block. Complements compound
- expression second operand if necessary. */
-
-tree
-java_method_add_stmt (fndecl, expr)
- tree fndecl, expr;
-{
- return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
-}
-
-static tree
-add_stmt_to_block (b, type, stmt)
- tree b, type, stmt;
-{
- tree body = BLOCK_EXPR_BODY (b), c;
-
- if (java_error_count)
- return body;
-
- if ((c = add_stmt_to_compound (body, type, stmt)) == body)
- return body;
-
- BLOCK_EXPR_BODY (b) = c;
- TREE_SIDE_EFFECTS (c) = 1;
- return c;
-}
-
-/* Add STMT to EXISTING if possible, otherwise create a new
- COMPOUND_EXPR and add STMT to it. */
-
-static tree
-add_stmt_to_compound (existing, type, stmt)
- tree existing, type, stmt;
-{
- if (existing)
- return build (COMPOUND_EXPR, type, existing, stmt);
- else
- return stmt;
-}
-
-/* Hold THIS for the scope of the current public method decl. */
-static tree current_this;
-
-void java_layout_seen_class_methods ()
-{
- tree previous_list = all_class_list;
- tree end = NULL_TREE;
- tree current;
-
- while (1)
- {
- for (current = previous_list;
- current != end; current = TREE_CHAIN (current))
- layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
-
- if (previous_list != all_class_list)
- {
- end = previous_list;
- previous_list = all_class_list;
- }
- else
- break;
- }
-}
-
-/* Layout the methods of all classes loaded in one way on an
- other. Check methods of source parsed classes. Then reorder the
- fields and layout the classes or the type of all source parsed
- classes */
-
-void
-java_layout_classes ()
-{
- tree current;
- int save_error_count = java_error_count;
-
- /* Layout the methods of all classes seen so far */
- java_layout_seen_class_methods ();
- java_parse_abort_on_error ();
- all_class_list = NULL_TREE;
-
- /* Then check the methods of all parsed classes */
- for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
- if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
- CHECK_METHODS (TREE_VALUE (current));
- java_parse_abort_on_error ();
-
- for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
- {
- current_class = TREE_TYPE (TREE_VALUE (current));
-
- /* Reverse the fields, but leave the dummy field in front.
- Fields are already ordered for Object and Class */
- if (TYPE_FIELDS (current_class) && current_class != object_type_node
- && current_class != class_type_node)
- {
- /* If the dummy field is there, reverse the right fields and
- just layout the type for proper fields offset */
- if (!DECL_NAME (TYPE_FIELDS (current_class)))
- {
- tree fields = TYPE_FIELDS (current_class);
- TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
- TYPE_SIZE (current_class) = NULL_TREE;
- layout_type (current_class);
- }
- /* We don't have a dummy field, we need to layout the class,
- after having reversed the fields */
- else
- {
- TYPE_FIELDS (current_class) =
- nreverse (TYPE_FIELDS (current_class));
- TYPE_SIZE (current_class) = NULL_TREE;
- layout_class (current_class);
- }
- }
- else
- layout_class (current_class);
-
- /* From now on, the class is considered completely loaded */
- CLASS_LOADED_P (current_class) = 1;
-
- /* Error reported by the caller */
- if (java_error_count)
- return;
- }
-
- /* We might have reloaded classes durign the process of laying out
- classes for code generation. We must layout the methods of those
- late additions, as constructor checks might use them */
- java_layout_seen_class_methods ();
- java_parse_abort_on_error ();
-}
-
-/* Expand all methods in all registered classes. */
-
-void
-java_complete_expand_methods ()
-{
- tree current;
-
- do_not_fold = flag_emit_xref;
-
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- int is_interface;
- tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current));
- tree decl;
-
- current_class = TREE_TYPE (current);
- is_interface = CLASS_INTERFACE (TYPE_NAME (current_class));
-
- /* Initialize a new constant pool */
- init_outgoing_cpool ();
-
- /* We want <clinit> (if any) to be processed first. */
- decl = tree_last (TYPE_METHODS (class_type));
- if (IS_CLINIT (decl))
- {
- tree fbody = DECL_FUNCTION_BODY (decl);
- tree list;
- if (fbody != NULL_TREE)
- {
- /* First check if we can ignore empty <clinit> */
- tree block_body = BLOCK_EXPR_BODY (fbody);
-
- current_this = NULL_TREE;
- current_function_decl = decl;
- if (block_body != NULL_TREE)
- {
- /* Prevent the use of `this' inside <clinit> */
- ctxp->explicit_constructor_p = 1;
-
- block_body = java_complete_tree (block_body);
- ctxp->explicit_constructor_p = 0;
- BLOCK_EXPR_BODY (fbody) = block_body;
- if (block_body != NULL_TREE
- && TREE_CODE (block_body) == BLOCK
- && BLOCK_EXPR_BODY (block_body) == empty_stmt_node)
- decl = NULL_TREE;
- }
- }
- list = nreverse (TREE_CHAIN (nreverse (TYPE_METHODS (class_type))));
- if (decl != NULL_TREE)
- {
- TREE_CHAIN (decl) = list;
- TYPE_METHODS (class_type) = decl;
- }
- else
- TYPE_METHODS (class_type) = list;
- }
-
- for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
- {
- current_function_decl = decl;
- /* Don't generate debug info on line zero when expanding a
- generated constructor. */
- if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl))
- {
- /* If we found errors, it's too dangerous to try to
- generate and expand a constructor */
- if (!java_error_count)
- {
- restore_line_number_status (1);
- java_complete_expand_method (decl);
- restore_line_number_status (0);
- }
- }
- else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl))
- continue;
- else
- java_complete_expand_method (decl);
- }
-
- /* Now verify constructor circularity (stop after the first one
- we find) */
- if (!is_interface)
- for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
- if (DECL_CONSTRUCTOR_P (decl) &&
- verify_constructor_circularity (decl, decl))
- break;
-
- /* Make the class data, register it and run the rest of decl
- compilation on it */
- if (!java_error_count)
- {
- if (flag_emit_class_files)
- write_classfile (current_class);
- if (flag_emit_xref)
- expand_xref (current_class);
- else if (! flag_syntax_only)
- finish_class (current_class);
- }
- }
-}
-
-/* Hold a list of catch clauses list. The first element of this list is
- the list of the catch clauses of the currently analysed try block. */
-static tree currently_caught_type_list;
-
-/* Complete and expand a method. */
-
-static void
-java_complete_expand_method (mdecl)
- tree mdecl;
-{
- /* Fix constructors before expanding them */
- if (DECL_CONSTRUCTOR_P (mdecl))
- fix_constructors (mdecl);
-
- /* Expand functions that have a body */
- if (DECL_FUNCTION_BODY (mdecl))
- {
- tree fbody = DECL_FUNCTION_BODY (mdecl);
- tree block_body = BLOCK_EXPR_BODY (fbody);
- tree exception_copy;
- expand_start_java_method (mdecl);
- build_result_decl (mdecl);
-
- current_this
- = (!METHOD_STATIC (mdecl) ?
- BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
-
- /* Purge the `throws' list of unchecked exceptions. If we're
- doing xref, save a copy of the list and re-install it
- later. */
- if (flag_emit_xref)
- exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl));
-
- purge_unchecked_exceptions (mdecl);
-
- /* Install exceptions thrown with `throws' */
- PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
-
- if (block_body != NULL_TREE)
- {
- block_body = java_complete_tree (block_body);
- if (!flag_emit_xref)
- check_for_initialization (block_body);
- ctxp->explicit_constructor_p = 0;
- }
- BLOCK_EXPR_BODY (fbody) = block_body;
-
- if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
- && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE
- && !flag_emit_xref)
- missing_return_error (current_function_decl);
-
- complete_start_java_method (mdecl);
-
- /* Don't go any further if we've found error(s) during the
- expansion */
- if (!java_error_count)
- source_end_java_method ();
- else
- {
- pushdecl_force_head (DECL_ARGUMENTS (mdecl));
- poplevel (1, 0, 1);
- }
-
- /* Pop the exceptions and sanity check */
- POP_EXCEPTIONS();
- if (currently_caught_type_list)
- fatal ("Exception list non empty - java_complete_expand_method");
-
- if (flag_emit_xref)
- DECL_FUNCTION_THROWS (mdecl) = exception_copy;
- }
-}
-
-/* Craft a body for default constructor. Patch existing constructor
- bodies with call to super() and field initialization statements if
- necessary. */
-
-static void
-fix_constructors (mdecl)
- tree mdecl;
-{
- tree body = DECL_FUNCTION_BODY (mdecl);
-
- if (!body)
- {
- /* The constructor body must be crafted by hand. It's the
- constructor we defined when we realize we didn't have the
- CLASSNAME() constructor */
-
- tree compound;
-
- /* It is an error for the compiler to generate a default
- constructor if the superclass doesn't have a constructor that
- takes no argument */
- if (verify_constructor_super ())
- {
- tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class));
- char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
- parse_error_context (lookup_cl (TYPE_NAME (current_class)),
- "No constructor matching `%s()' found in "
- "class `%s'", n, n);
- }
-
- start_artificial_method_body (mdecl);
-
- /* We don't generate a super constructor invocation if we're
- compiling java.lang.Object. build_super_invocation takes care
- of that. */
- compound = java_method_add_stmt (mdecl, build_super_invocation ());
-
- end_artificial_method_body (mdecl);
- }
- /* Search for an explicit constructor invocation */
- else
- {
- int found = 0;
- tree main_block = BLOCK_EXPR_BODY (body);
- tree compound = NULL_TREE;
-
- while (body)
- switch (TREE_CODE (body))
- {
- case CALL_EXPR:
- found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
- body = NULL_TREE;
- break;
- case COMPOUND_EXPR:
- case EXPR_WITH_FILE_LOCATION:
- body = TREE_OPERAND (body, 0);
- break;
- case BLOCK:
- body = BLOCK_EXPR_BODY (body);
- break;
- default:
- found = 0;
- body = NULL_TREE;
- }
- /* The constructor is missing an invocation of super() */
- if (!found)
- compound = add_stmt_to_compound (compound, NULL_TREE,
- build_super_invocation ());
-
- /* Fix the constructor main block if we're adding extra stmts */
- if (compound)
- {
- compound = add_stmt_to_compound (compound, NULL_TREE,
- BLOCK_EXPR_BODY (main_block));
- BLOCK_EXPR_BODY (main_block) = compound;
- }
- }
-}
-
-/* Browse constructors in the super class, searching for a constructor
- that doesn't take any argument. Return 0 if one is found, 1
- otherwise. */
-
-static int
-verify_constructor_super ()
-{
- tree class = CLASSTYPE_SUPER (current_class);
- if (!class)
- return 0;
-
- if (class)
- {
- tree mdecl;
- for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
- {
- if (DECL_CONSTRUCTOR_P (mdecl)
- && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
- return 0;
- }
- }
- return 1;
-}
-
-/* Expand finals. */
-
-void
-java_expand_finals ()
-{
-}
-
-/* Generate code for all context remembered for code generation. */
-
-void
-java_expand_classes ()
-{
- int save_error_count = 0;
- java_parse_abort_on_error ();
- if (!(ctxp = ctxp_for_generation))
- return;
- java_layout_classes ();
- java_parse_abort_on_error ();
-
- for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
- {
- ctxp = ctxp_for_generation;
- lang_init_source (2); /* Error msgs have method prototypes */
- java_complete_expand_methods (); /* Complete and expand method bodies */
- java_parse_abort_on_error ();
- java_expand_finals (); /* Expand and check the finals */
- java_parse_abort_on_error ();
- java_check_final (); /* Check unitialized final */
- java_parse_abort_on_error ();
- }
-}
-
-/* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
- a tree list node containing RIGHT. Fore coming RIGHTs will be
- chained to this hook. LOCATION contains the location of the
- separating `.' operator. */
-
-static tree
-make_qualified_primary (primary, right, location)
- tree primary, right;
- int location;
-{
- tree wfl;
-
- /* We want to process THIS . xxx symbolicaly, to keep it consistent
- with the way we're processing SUPER. A THIS from a primary as a
- different form than a SUPER. Turn THIS into something symbolic */
- if (TREE_CODE (primary) == THIS_EXPR)
- {
- wfl = build_wfl_node (this_identifier_node);
- EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
- wfl = make_qualified_name (wfl, right, location);
- PRIMARY_P (wfl) = 1;
- return wfl;
- }
- /* Other non WFL node are wrapped around a WFL */
- else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
- {
- wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
- EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
- EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE);
- }
- else
- {
- wfl = primary;
- if (!EXPR_WFL_QUALIFICATION (primary))
- EXPR_WFL_QUALIFICATION (primary) =
- build_tree_list (primary, NULL_TREE);
- }
-
- EXPR_WFL_LINECOL (right) = location;
- chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE));
- PRIMARY_P (wfl) = 1;
- return wfl;
-}
-
-/* Simple merge of two name separated by a `.' */
-
-static tree
-merge_qualified_name (left, right)
- tree left, right;
-{
- tree node;
- obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left),
- IDENTIFIER_LENGTH (left));
- obstack_1grow (&temporary_obstack, '.');
- obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right),
- IDENTIFIER_LENGTH (right));
- node = get_identifier (obstack_base (&temporary_obstack));
- obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
- QUALIFIED_P (node) = 1;
- return node;
-}
-
-/* Merge the two parts of a qualified name into LEFT. Set the
- location information of the resulting node to LOCATION, usually
- inherited from the location information of the `.' operator. */
-
-static tree
-make_qualified_name (left, right, location)
- tree left, right;
- int location;
-{
-#ifdef USE_COMPONENT_REF
- tree node = build (COMPONENT_REF, NULL_TREE, left, right);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-#else
- tree left_id = EXPR_WFL_NODE (left);
- tree right_id = EXPR_WFL_NODE (right);
- tree wfl, merge;
-
- merge = merge_qualified_name (left_id, right_id);
-
- /* Left wasn't qualified and is now qualified */
- if (!QUALIFIED_P (left_id))
- {
- tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0);
- EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
- EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
- }
-
- wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
- EXPR_WFL_LINECOL (wfl) = location;
- chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
-
- EXPR_WFL_NODE (left) = merge;
- return left;
-#endif
-}
-
-/* Extract the last identifier component of the qualified in WFL. The
- last identifier is removed from the linked list */
-
-static tree
-cut_identifier_in_qualified (wfl)
- tree wfl;
-{
- tree q;
- tree previous = NULL_TREE;
- for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q))
- if (!TREE_CHAIN (q))
- {
- if (!previous)
- fatal ("Operating on a non qualified qualified WFL - "
- "cut_identifier_in_qualified");
- TREE_CHAIN (previous) = NULL_TREE;
- return TREE_PURPOSE (q);
- }
-}
-
-/* Resolve the expression name NAME. Return its decl. */
-
-static tree
-resolve_expression_name (id, orig)
- tree id;
- tree *orig;
-{
- tree name = EXPR_WFL_NODE (id);
- tree decl;
-
- /* 6.5.5.1: Simple expression names */
- if (!PRIMARY_P (id) && !QUALIFIED_P (name))
- {
- /* 15.13.1: NAME can appear within the scope of a local variable
- declaration */
- if ((decl = IDENTIFIER_LOCAL_VALUE (name)))
- return decl;
-
- /* 15.13.1: NAME can appear within a class declaration */
- else
- {
- decl = lookup_field_wrapper (current_class, name);
- if (decl)
- {
- int fs = FIELD_STATIC (decl);
- /* Instance variable (8.3.1.1) can't appear within
- static method, static initializer or initializer for
- a static variable. */
- if (!fs && METHOD_STATIC (current_function_decl))
- {
- static_ref_err (id, name, current_class);
- return error_mark_node;
- }
- /* Instance variables can't appear as an argument of
- an explicit constructor invocation */
- if (!fs && ctxp->explicit_constructor_p)
- {
- parse_error_context
- (id, "Can't reference `%s' before the superclass "
- "constructor has been called", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
-
- /* Otherwise build what it takes to access the field */
- decl = build_field_ref ((fs ? NULL_TREE : current_this),
- DECL_CONTEXT (decl), name);
- if (fs && !flag_emit_class_files && !flag_emit_xref)
- decl = build_class_init (DECL_CONTEXT (decl), decl);
- /* We may be asked to save the real field access node */
- if (orig)
- *orig = decl;
- /* And we return what we got */
- return decl;
- }
- /* Fall down to error report on undefined variable */
- }
- }
- /* 6.5.5.2 Qualified Expression Names */
- else
- {
- if (orig)
- *orig = NULL_TREE;
- qualify_ambiguous_name (id);
- /* 15.10.1 Field Access Using a Primary and/or Expression Name */
- /* 15.10.2: Accessing Superclass Members using super */
- return resolve_field_access (id, NULL, NULL);
- }
-
- /* We've got an error here */
- parse_error_context (id, "Undefined variable `%s'",
- IDENTIFIER_POINTER (name));
-
- return error_mark_node;
-}
-
-static void
-static_ref_err (wfl, field_id, class_type)
- tree wfl, field_id, class_type;
-{
- parse_error_context
- (wfl,
- "Can't make a static reference to nonstatic variable `%s' in class `%s'",
- IDENTIFIER_POINTER (field_id),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
-}
-
-/* 15.10.1 Field Acess Using a Primary and/or Expression Name.
- We return something suitable to generate the field access. We also
- return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
- recipient's address can be null. */
-
-static tree
-resolve_field_access (qual_wfl, field_decl, field_type)
- tree qual_wfl;
- tree *field_decl, *field_type;
-{
- int is_static = 0;
- tree field_ref;
- tree decl, where_found, type_found;
-
- if (resolve_qualified_expression_name (qual_wfl, &decl,
- &where_found, &type_found))
- return error_mark_node;
-
- /* Resolve the LENGTH field of an array here */
- if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found)
- && ! flag_emit_class_files && ! flag_emit_xref)
- {
- tree length = build_java_array_length_access (where_found);
- field_ref =
- build_java_arraynull_check (type_found, length, int_type_node);
- }
- /* We might have been trying to resolve field.method(). In which
- case, the resolution is over and decl is the answer */
- else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
- field_ref = decl;
- else if (JDECL_P (decl))
- {
- int static_final_found = 0;
- if (!type_found)
- type_found = DECL_CONTEXT (decl);
- is_static = JDECL_P (decl) && FIELD_STATIC (decl);
- if (FIELD_FINAL (decl)
- && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
- && DECL_LANG_SPECIFIC (decl)
- && DECL_INITIAL (decl))
- {
- field_ref = DECL_INITIAL (decl);
- static_final_found = 1;
- }
- else
- field_ref = build_field_ref ((is_static && !flag_emit_xref?
- NULL_TREE : where_found),
- type_found, DECL_NAME (decl));
- if (field_ref == error_mark_node)
- return error_mark_node;
- if (is_static && !static_final_found
- && !flag_emit_class_files && !flag_emit_xref)
- {
- field_ref = build_class_init (type_found, field_ref);
- /* If the static field was identified by an expression that
- needs to be generated, make the field access a compound
- expression whose first part is the evaluation of the
- field selector part. */
- if (where_found && TREE_CODE (where_found) != TYPE_DECL
- && TREE_CODE (where_found) != RECORD_TYPE)
- {
- tree type = QUAL_DECL_TYPE (field_ref);
- if (TREE_CODE (type) == RECORD_TYPE)
- type = build_pointer_type (type);
- field_ref = build (COMPOUND_EXPR, type, where_found, field_ref);
- }
- }
- }
- else
- field_ref = decl;
-
- if (field_decl)
- *field_decl = decl;
- if (field_type)
- *field_type = (QUAL_DECL_TYPE (decl) ?
- QUAL_DECL_TYPE (decl) : TREE_TYPE (decl));
- return field_ref;
-}
-
-/* If NODE is an access to f static field, strip out the class
- initialization part and return the field decl, otherwise, return
- NODE. */
-
-static tree
-strip_out_static_field_access_decl (node)
- tree node;
-{
- if (TREE_CODE (node) == COMPOUND_EXPR)
- {
- tree op1 = TREE_OPERAND (node, 1);
- if (TREE_CODE (op1) == COMPOUND_EXPR)
- {
- tree call = TREE_OPERAND (op1, 0);
- if (TREE_CODE (call) == CALL_EXPR
- && TREE_CODE (TREE_OPERAND (call, 0)) == ADDR_EXPR
- && TREE_OPERAND (TREE_OPERAND (call, 0), 0)
- == soft_initclass_node)
- return TREE_OPERAND (op1, 1);
- }
- }
- return node;
-}
-
-/* 6.5.5.2: Qualified Expression Names */
-
-static int
-resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
- tree wfl;
- tree *found_decl, *type_found, *where_found;
-{
- int from_type = 0; /* Field search initiated from a type */
- int from_super = 0, from_cast = 0;
- int previous_call_static = 0;
- int is_static;
- tree decl = NULL_TREE, type = NULL_TREE, q;
- *type_found = *where_found = NULL_TREE;
-
- for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
- {
- tree qual_wfl = QUAL_WFL (q);
-
- /* 15.10.1 Field Access Using a Primary */
- switch (TREE_CODE (qual_wfl))
- {
- case CALL_EXPR:
- case NEW_CLASS_EXPR:
- /* If the access to the function call is a non static field,
- build the code to access it. */
- if (JDECL_P (decl) && !FIELD_STATIC (decl))
- {
- decl = maybe_access_field (decl, *where_found,
- DECL_CONTEXT (decl));
- if (decl == error_mark_node)
- return 1;
- }
- /* And code for the function call */
- if (complete_function_arguments (qual_wfl))
- return 1;
- if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
- CALL_USING_SUPER (qual_wfl) = 1;
- *where_found =
- patch_method_invocation (qual_wfl, decl, type, &is_static, NULL);
- if (*where_found == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (*where_found);
-
- /* If the previous call was static and this one is too,
- build a compound expression to hold the two (because in
- that case, previous function calls aren't transported as
- forcoming function's argument. */
- if (previous_call_static && is_static)
- {
- decl = build (COMPOUND_EXPR, type, decl, *where_found);
- TREE_SIDE_EFFECTS (decl) = 1;
- }
- else
- {
- previous_call_static = is_static;
- decl = *where_found;
- }
- continue;
-
- case NEW_ARRAY_EXPR:
- *where_found = decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- CLASS_LOADED_P (type) = 1;
- continue;
-
- case CONVERT_EXPR:
- *where_found = decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- from_cast = 1;
- continue;
-
- case CONDITIONAL_EXPR:
- case STRING_CST:
- *where_found = decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- continue;
-
- case ARRAY_REF:
- /* If the access to the function call is a non static field,
- build the code to access it. */
- if (JDECL_P (decl) && !FIELD_STATIC (decl))
- {
- decl = maybe_access_field (decl, *where_found, type);
- if (decl == error_mark_node)
- return 1;
- }
- /* And code for the array reference expression */
- decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- type = QUAL_DECL_TYPE (decl);
- continue;
-
- default:
- /* Fix for -Wall Just go to the next statement. Don't
- continue */
- break;
- }
-
- /* If we fall here, we weren't processing a (static) function call. */
- previous_call_static = 0;
-
- /* It can be the keyword THIS */
- if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
- {
- if (!current_this)
- {
- parse_error_context
- (wfl, "Keyword `this' used outside allowed context");
- return 1;
- }
- /* We have to generate code for intermediate acess */
- *where_found = decl = current_this;
- *type_found = type = QUAL_DECL_TYPE (decl);
- continue;
- }
-
- /* 15.10.2 Accessing Superclass Members using SUPER */
- if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
- {
- tree node;
- /* Check on the restricted use of SUPER */
- if (METHOD_STATIC (current_function_decl)
- || current_class == object_type_node)
- {
- parse_error_context
- (wfl, "Keyword `super' used outside allowed context");
- return 1;
- }
- /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
- node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
- CLASSTYPE_SUPER (current_class),
- build_this (EXPR_WFL_LINECOL (qual_wfl)));
- *where_found = decl = java_complete_tree (node);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- from_super = from_type = 1;
- continue;
- }
-
- /* 15.13.1: Can't search for field name in packages, so we
- assume a variable/class name was meant. */
- if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
- {
- tree name = resolve_package (wfl, &q);
- if (name)
- {
- *where_found = decl = resolve_no_layout (name, qual_wfl);
- /* We wan't to be absolutely that the class is laid
- out. We're going to search something inside it. */
- *type_found = type = TREE_TYPE (decl);
- layout_class (type);
- from_type = 1;
- /* Should be a list, really. FIXME */
- RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1;
- RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0;
- }
- else
- {
- if (from_super || from_cast)
- parse_error_context
- ((from_cast ? qual_wfl : wfl),
- "No variable `%s' defined in class `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- lang_printable_name (type, 0));
- else
- parse_error_context
- (qual_wfl, "Undefined variable or class name: `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)));
- return 1;
- }
- }
-
- /* We have a type name. It's been already resolved when the
- expression was qualified. */
- else if (RESOLVE_TYPE_NAME_P (qual_wfl))
- {
- if (!(decl = QUAL_RESOLUTION (q)))
- return 1; /* Error reported already */
-
- if (not_accessible_p (TREE_TYPE (decl), decl, 0))
- {
- parse_error_context
- (qual_wfl, "Can't access %s field `%s.%s' from `%s'",
- java_accstring_lookup (get_access_flags_from_decl (decl)),
- GET_TYPE_NAME (type),
- IDENTIFIER_POINTER (DECL_NAME (decl)),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- return 1;
- }
- check_deprecation (qual_wfl, decl);
-
- type = TREE_TYPE (decl);
- from_type = 1;
- }
- /* We resolve and expression name */
- else
- {
- tree field_decl;
-
- /* If there exists an early resolution, use it. That occurs
- only once and we know that there are more things to
- come. Don't do that when processing something after SUPER
- (we need more thing to be put in place below */
- if (!from_super && QUAL_RESOLUTION (q))
- {
- decl = QUAL_RESOLUTION (q);
- if (!type)
- {
- if (TREE_CODE (decl) == FIELD_DECL && !FIELD_STATIC (decl))
- {
- if (current_this)
- *where_found = current_this;
- else
- {
- static_ref_err (qual_wfl, DECL_NAME (decl),
- current_class);
- return 1;
- }
- }
- else
- {
- *where_found = TREE_TYPE (decl);
- if (TREE_CODE (*where_found) == POINTER_TYPE)
- *where_found = TREE_TYPE (*where_found);
- }
- }
- }
-
- /* We have to search for a field, knowing the type of its
- container. The flag FROM_TYPE indicates that we resolved
- the last member of the expression as a type name, which
- means that for the resolution of this field, we'll look
- for other errors than if it was resolved as a member of
- an other field. */
- else
- {
- int is_static;
- tree field_decl_type; /* For layout */
-
- if (!from_type && !JREFERENCE_TYPE_P (type))
- {
- parse_error_context
- (qual_wfl, "Attempt to reference field `%s' in `%s %s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- lang_printable_name (type, 0),
- IDENTIFIER_POINTER (DECL_NAME (field_decl)));
- return 1;
- }
-
- field_decl = lookup_field_wrapper (type,
- EXPR_WFL_NODE (qual_wfl));
- if (field_decl == NULL_TREE)
- {
- parse_error_context
- (qual_wfl, "No variable `%s' defined in type `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- GET_TYPE_NAME (type));
- return 1;
- }
- if (field_decl == error_mark_node)
- return 1;
-
- /* Layout the type of field_decl, since we may need
- it. Don't do primitive types or loaded classes. The
- situation of non primitive arrays may not handled
- properly here. FIXME */
- if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE)
- field_decl_type = TREE_TYPE (TREE_TYPE (field_decl));
- else
- field_decl_type = TREE_TYPE (field_decl);
- if (!JPRIMITIVE_TYPE_P (field_decl_type)
- && !CLASS_LOADED_P (field_decl_type)
- && !TYPE_ARRAY_P (field_decl_type))
- resolve_and_layout (field_decl_type, NULL_TREE);
- if (TYPE_ARRAY_P (field_decl_type))
- CLASS_LOADED_P (field_decl_type) = 1;
-
- /* Check on accessibility here */
- if (not_accessible_p (type, field_decl, from_super))
- {
- parse_error_context
- (qual_wfl,
- "Can't access %s field `%s.%s' from `%s'",
- java_accstring_lookup
- (get_access_flags_from_decl (field_decl)),
- GET_TYPE_NAME (type),
- IDENTIFIER_POINTER (DECL_NAME (field_decl)),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (current_class))));
- return 1;
- }
- check_deprecation (qual_wfl, field_decl);
-
- /* There are things to check when fields are accessed
- from type. There are no restrictions on a static
- declaration of the field when it is accessed from an
- interface */
- is_static = FIELD_STATIC (field_decl);
- if (!from_super && from_type
- && !TYPE_INTERFACE_P (type) && !is_static)
- {
- static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
- return 1;
- }
- from_cast = from_super = 0;
-
- /* If we need to generate something to get a proper
- handle on what this field is accessed from, do it
- now. */
- if (!is_static)
- {
- decl = maybe_access_field (decl, *where_found, *type_found);
- if (decl == error_mark_node)
- return 1;
- }
-
- /* We want to keep the location were found it, and the type
- we found. */
- *where_found = decl;
- *type_found = type;
-
- /* This is the decl found and eventually the next one to
- search from */
- decl = field_decl;
- }
- from_type = 0;
- type = QUAL_DECL_TYPE (decl);
- }
- }
- *found_decl = decl;
- return 0;
-}
-
-/* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
- can't be accessed from REFERENCE (a record type). */
-
-int not_accessible_p (reference, member, from_super)
- tree reference, member;
- int from_super;
-{
- int access_flag = get_access_flags_from_decl (member);
-
- /* Access always granted for members declared public */
- if (access_flag & ACC_PUBLIC)
- return 0;
-
- /* Check access on protected members */
- if (access_flag & ACC_PROTECTED)
- {
- /* Access granted if it occurs from within the package
- containing the class in which the protected member is
- declared */
- if (class_in_current_package (DECL_CONTEXT (member)))
- return 0;
-
- /* If accessed with the form `super.member', then access is granted */
- if (from_super)
- return 0;
-
- /* Otherwise, access is granted if occuring from the class where
- member is declared or a subclass of it */
- if (inherits_from_p (reference, current_class))
- return 0;
- return 1;
- }
-
- /* Check access on private members. Access is granted only if it
- occurs from within the class in witch it is declared */
- if (access_flag & ACC_PRIVATE)
- return (current_class == DECL_CONTEXT (member) ? 0 : 1);
-
- /* Default access are permitted only when occuring within the
- package in which the type (REFERENCE) is declared. In other words,
- REFERENCE is defined in the current package */
- if (ctxp->package)
- return !class_in_current_package (reference);
-
- /* Otherwise, access is granted */
- return 0;
-}
-
-/* Test deprecated decl access. */
-static void
-check_deprecation (wfl, decl)
- tree wfl, decl;
-{
- char *file = DECL_SOURCE_FILE (decl);
- /* Complain if the field is deprecated and the file it was defined
- in isn't compiled at the same time the file which contains its
- use is */
- if (DECL_DEPRECATED (decl)
- && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file)))
- {
- char the [20];
- switch (TREE_CODE (decl))
- {
- case FUNCTION_DECL:
- strcpy (the, "method");
- break;
- case FIELD_DECL:
- strcpy (the, "field");
- break;
- case TYPE_DECL:
- strcpy (the, "class");
- break;
- default:
- fatal ("unexpected DECL code - check_deprecation");
- }
- parse_warning_context
- (wfl, "The %s `%s' in class `%s' has been deprecated",
- the, lang_printable_name (decl, 0),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))));
- }
-}
-
-/* Returns 1 if class was declared in the current package, 0 otherwise */
-
-static int
-class_in_current_package (class)
- tree class;
-{
- static tree cache = NULL_TREE;
- int qualified_flag;
- tree left;
-
- if (cache == class)
- return 1;
-
- qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
-
- /* If the current package is empty and the name of CLASS is
- qualified, class isn't in the current package. If there is a
- current package and the name of the CLASS is not qualified, class
- isn't in the current package */
- if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag))
- return 0;
-
- /* If there is not package and the name of CLASS isn't qualified,
- they belong to the same unnamed package */
- if (!ctxp->package && !qualified_flag)
- return 1;
-
- /* Compare the left part of the name of CLASS with the package name */
- breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
- if (ctxp->package == left)
- {
- cache = class;
- return 1;
- }
- return 0;
-}
-
-/* This function may generate code to access DECL from WHERE. This is
- done only if certain conditions meet. */
-
-static tree
-maybe_access_field (decl, where, type)
- tree decl, where, type;
-{
- if (TREE_CODE (decl) == FIELD_DECL && decl != current_this
- && !FIELD_STATIC (decl))
- decl = build_field_ref (where ? where : current_this,
- (type ? type : DECL_CONTEXT (decl)),
- DECL_NAME (decl));
- return decl;
-}
-
-/* Build a method invocation, by patching PATCH. If non NULL
- and according to the situation, PRIMARY and WHERE may be
- used. IS_STATIC is set to 1 if the invoked function is static. */
-
-static tree
-patch_method_invocation (patch, primary, where, is_static, ret_decl)
- tree patch, primary, where;
- int *is_static;
- tree *ret_decl;
-{
- tree wfl = TREE_OPERAND (patch, 0);
- tree args = TREE_OPERAND (patch, 1);
- tree name = EXPR_WFL_NODE (wfl);
- tree list;
- int is_static_flag = 0;
- int is_super_init = 0;
- tree this_arg = NULL_TREE;
-
- /* Should be overriden if everything goes well. Otherwise, if
- something fails, it should keep this value. It stop the
- evaluation of a bogus assignment. See java_complete_tree,
- MODIFY_EXPR: for the reasons why we sometimes want to keep on
- evaluating an assignment */
- TREE_TYPE (patch) = error_mark_node;
-
- /* Since lookup functions are messing with line numbers, save the
- context now. */
- java_parser_context_save_global ();
-
- /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
-
- /* Resolution of qualified name, excluding constructors */
- if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch))
- {
- tree class_decl, identifier, identifier_wfl;
- /* Extract the last IDENTIFIER of the qualified
- expression. This is a wfl and we will use it's location
- data during error report. */
- identifier_wfl = cut_identifier_in_qualified (wfl);
- identifier = EXPR_WFL_NODE (identifier_wfl);
-
- /* Given the context, IDENTIFIER is syntactically qualified
- as a MethodName. We need to qualify what's before */
- qualify_ambiguous_name (wfl);
-
- /* Package resolution */
- if (RESOLVE_PACKAGE_NAME_P (wfl))
- {
- tree next, decl, name = resolve_package (wfl, &next);
-
- if (!name)
- {
- tree remainder;
- breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
- parse_error_context (wfl, "Can't search method `%s' in package "
- "`%s'",IDENTIFIER_POINTER (identifier),
- IDENTIFIER_POINTER (remainder));
- PATCH_METHOD_RETURN_ERROR ();
- }
- RESOLVE_PACKAGE_NAME_P (wfl) = 0;
- if ((decl = resolve_no_layout (name, QUAL_WFL (next))))
- {
- QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)) = decl;
- RESOLVE_EXPRESSION_NAME_P (wfl) = 0;
- RESOLVE_TYPE_NAME_P (wfl) = 1;
- }
- else
- {
- RESOLVE_EXPRESSION_NAME_P (wfl) = 1;
- RESOLVE_TYPE_NAME_P (wfl) = 0;
- }
- }
-
- /* We're resolving a call from a type */
- if (RESOLVE_TYPE_NAME_P (wfl))
- {
- tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl));
- tree name = DECL_NAME (decl);
- tree type;
-
- class_decl = resolve_and_layout (name, wfl);
- if (CLASS_INTERFACE (decl))
- {
- parse_error_context
- (identifier_wfl, "Can't make static reference to method "
- "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier),
- IDENTIFIER_POINTER (name));
- PATCH_METHOD_RETURN_ERROR ();
- }
- /* Look the method up in the type selector. The method ought
- to be static. */
- type = TREE_TYPE (class_decl);
- list = lookup_method_invoke (0, wfl, type, identifier, args);
- if (list && !METHOD_STATIC (list))
- {
- char *fct_name = strdup (lang_printable_name (list, 0));
- parse_error_context
- (identifier_wfl,
- "Can't make static reference to method `%s %s' in class `%s'",
- lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
- fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
- free (fct_name);
- PATCH_METHOD_RETURN_ERROR ();
- }
- args = nreverse (args);
- }
- /* We're resolving an expression name */
- else
- {
- tree field, type;
-
- /* 1- Find the field to which the call applies */
- field = resolve_field_access (wfl, NULL, &type);
- if (field == error_mark_node)
- PATCH_METHOD_RETURN_ERROR ();
- /* field is used in lieu of a primary. It alows us not to
- report errors on erroneous use of `this' in
- constructors. */
- primary = field;
-
- /* 2- Do the layout of the class where the last field
- was found, so we can search it. */
- class_decl = resolve_and_layout (type, NULL_TREE);
- if (class_decl != NULL_TREE)
- type = TREE_TYPE (class_decl);
-
- /* 3- Retrieve a filtered list of method matches, Refine
- if necessary. In any cases, point out errors. */
- list = lookup_method_invoke (0, identifier_wfl, type,
- identifier, args);
-
- /* 4- Add the field as an argument */
- args = nreverse (args);
- this_arg = field;
- }
-
- /* IDENTIFIER_WFL will be used to report any problem further */
- wfl = identifier_wfl;
- }
- /* Resolution of simple names, names generated after a primary: or
- constructors */
- else
- {
- tree class_to_search;
- int lc; /* Looking for Constructor */
-
- /* We search constructor in their target class */
- if (CALL_CONSTRUCTOR_P (patch))
- {
- if (TREE_CODE (patch) == NEW_CLASS_EXPR)
- class_to_search = EXPR_WFL_NODE (wfl);
- else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
- this_identifier_node)
- class_to_search = NULL_TREE;
- else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
- super_identifier_node)
- {
- is_super_init = 1;
- if (CLASSTYPE_SUPER (current_class))
- class_to_search =
- DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
- else
- {
- parse_error_context (wfl, "Can't invoke super constructor "
- "on java.lang.Object");
- PATCH_METHOD_RETURN_ERROR ();
- }
- }
-
- /* Class to search is NULL if we're searching the current one */
- if (class_to_search)
- {
- class_to_search = resolve_and_layout (class_to_search,
- NULL_TREE);
- if (!class_to_search)
- {
- parse_error_context
- (wfl, "Class `%s' not found in type declaration",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- PATCH_METHOD_RETURN_ERROR ();
- }
-
- /* Can't instantiate an abstract class, but we can
- invoke it's constructor. It's use within the `new'
- context is denied here. */
- if (CLASS_ABSTRACT (class_to_search)
- && TREE_CODE (patch) == NEW_CLASS_EXPR)
- {
- parse_error_context
- (wfl, "Class `%s' is an abstract class. It can't be "
- "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- PATCH_METHOD_RETURN_ERROR ();
- }
- class_to_search = TREE_TYPE (class_to_search);
- }
- else
- class_to_search = current_class;
- lc = 1;
- }
- /* This is a regular search in the local class, unless an
- alternate class is specified. */
- else
- {
- class_to_search = (where ? where : current_class);
- lc = 0;
- }
-
- /* NAME is a simple identifier or comes from a primary. Search
- in the class whose declaration contain the method being
- invoked. */
- resolve_and_layout (class_to_search, NULL_TREE);
- list = lookup_method_invoke (lc, wfl, class_to_search, name, args);
-
- /* Don't continue if no method were found, as the next statement
- can't be executed then. */
- if (!list)
- PATCH_METHOD_RETURN_ERROR ();
-
- /* Check for static reference if non static methods */
- if (check_for_static_method_reference (wfl, patch, list,
- class_to_search, primary))
- PATCH_METHOD_RETURN_ERROR ();
-
- /* Non static methods are called with the current object extra
- argument. If patch a `new TYPE()', the argument is the value
- returned by the object allocator. If method is resolved as a
- primary, use the primary otherwise use the current THIS. */
- args = nreverse (args);
- if (TREE_CODE (patch) != NEW_CLASS_EXPR)
- this_arg = primary ? primary : current_this;
- }
-
- /* Merge point of all resolution schemes. If we have nothing, this
- is an error, already signaled */
- if (!list)
- PATCH_METHOD_RETURN_ERROR ();
-
- /* Check accessibility, position the is_static flag, build and
- return the call */
- if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0))
- {
- char *fct_name = strdup (lang_printable_name (list, 0));
- parse_error_context
- (wfl, "Can't access %s method `%s %s.%s' from `%s'",
- java_accstring_lookup (get_access_flags_from_decl (list)),
- lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))),
- fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- free (fct_name);
- PATCH_METHOD_RETURN_ERROR ();
- }
- check_deprecation (wfl, list);
-
- is_static_flag = METHOD_STATIC (list);
- if (! METHOD_STATIC (list) && this_arg != NULL_TREE)
- args = tree_cons (NULL_TREE, this_arg, args);
-
- /* In the context of an explicit constructor invocation, we can't
- invoke any method relying on `this'. Exceptions are: we're
- invoking a static function, primary exists and is not the current
- this, we're creating a new object. */
- if (ctxp->explicit_constructor_p
- && !is_static_flag
- && (!primary || primary == current_this)
- && (TREE_CODE (patch) != NEW_CLASS_EXPR))
- {
- parse_error_context
- (wfl, "Can't reference `this' before the superclass constructor has "
- "been called");
- PATCH_METHOD_RETURN_ERROR ();
- }
- java_parser_context_restore_global ();
- if (is_static)
- *is_static = is_static_flag;
- /* Sometimes, we want the decl of the selected method. Such as for
- EH checking */
- if (ret_decl)
- *ret_decl = list;
- patch = patch_invoke (patch, list, args);
- if (is_super_init && CLASS_HAS_FINIT_P (current_class))
- {
- /* Generate the code used to initialize fields declared with an
- initialization statement. For now, it returns a call the the
- artificial function $finit$, if required. */
-
- tree finit_call =
- build_method_invocation (build_expr_wfl (finit_identifier_node,
- input_filename, 0, 0),
- NULL_TREE);
- patch = build (COMPOUND_EXPR, void_type_node, patch,
- java_complete_tree (finit_call));
- CAN_COMPLETE_NORMALLY (patch) = 1;
- }
- return patch;
-}
-
-/* Check that we're not trying to do a static reference to a method in
- non static method. Return 1 if it's the case, 0 otherwise. */
-
-static int
-check_for_static_method_reference (wfl, node, method, where, primary)
- tree wfl, node, method, where, primary;
-{
- if (METHOD_STATIC (current_function_decl)
- && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
- {
- char *fct_name = strdup (lang_printable_name (method, 0));
- parse_error_context
- (wfl, "Can't make static reference to method `%s %s' in class `%s'",
- lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
- free (fct_name);
- return 1;
- }
- return 0;
-}
-
-/* Patch an invoke expression METHOD and ARGS, based on its invocation
- mode. */
-
-static tree
-patch_invoke (patch, method, args)
- tree patch, method, args;
-{
- tree dtable, func;
- tree original_call, t, ta;
-
- /* Last step for args: convert build-in types. If we're dealing with
- a new TYPE() type call, the first argument to the constructor
- isn't found in the incomming argument list, but delivered by
- `new' */
- t = TYPE_ARG_TYPES (TREE_TYPE (method));
- if (TREE_CODE (patch) == NEW_CLASS_EXPR)
- t = TREE_CHAIN (t);
- for (ta = args; t != end_params_node && ta;
- t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
- if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
- TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
- TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
-
- if (flag_emit_class_files || flag_emit_xref)
- func = method;
- else
- {
- tree signature = build_java_signature (TREE_TYPE (method));
- switch (invocation_mode (method, CALL_USING_SUPER (patch)))
- {
- case INVOKE_VIRTUAL:
- dtable = invoke_build_dtable (0, args);
- func = build_invokevirtual (dtable, method);
- break;
-
- case INVOKE_SUPER:
- case INVOKE_STATIC:
- func = build_known_method_ref (method, TREE_TYPE (method),
- DECL_CONTEXT (method),
- signature, args);
- break;
-
- case INVOKE_INTERFACE:
- dtable = invoke_build_dtable (1, args);
- func = build_invokeinterface (dtable, DECL_NAME (method), signature);
- break;
-
- default:
- fatal ("internal error - unknown invocation_mode result");
- }
-
- /* Ensure self_type is initialized, (invokestatic). FIXME */
- func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
- }
-
- TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
- TREE_OPERAND (patch, 0) = func;
- TREE_OPERAND (patch, 1) = args;
- original_call = patch;
-
- /* We're processing a `new TYPE ()' form. New is called an its
- returned value is the first argument to the constructor. We build
- a COMPOUND_EXPR and use saved expression so that the overall NEW
- expression value is a pointer to a newly created and initialized
- class. */
- if (TREE_CODE (original_call) == NEW_CLASS_EXPR)
- {
- tree class = DECL_CONTEXT (method);
- tree c1, saved_new, size, new;
- if (flag_emit_class_files || flag_emit_xref)
- {
- TREE_TYPE (patch) = build_pointer_type (class);
- return patch;
- }
- if (!TYPE_SIZE (class))
- safe_layout_class (class);
- size = size_in_bytes (class);
- new = build (CALL_EXPR, promote_type (class),
- build_address_of (alloc_object_node),
- tree_cons (NULL_TREE, build_class_ref (class),
- build_tree_list (NULL_TREE,
- size_in_bytes (class))),
- NULL_TREE);
- saved_new = save_expr (new);
- c1 = build_tree_list (NULL_TREE, saved_new);
- TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1);
- TREE_OPERAND (original_call, 1) = c1;
- TREE_SET_CODE (original_call, CALL_EXPR);
- patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
- }
- return patch;
-}
-
-static int
-invocation_mode (method, super)
- tree method;
- int super;
-{
- int access = get_access_flags_from_decl (method);
-
- if (super)
- return INVOKE_SUPER;
-
- if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE)
- return INVOKE_STATIC;
-
- if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
- return INVOKE_STATIC;
-
- if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
- return INVOKE_INTERFACE;
-
- if (DECL_CONSTRUCTOR_P (method))
- return INVOKE_STATIC;
-
- return INVOKE_VIRTUAL;
-}
-
-/* Retrieve a refined list of matching methods. It covers the step
- 15.11.2 (Compile-Time Step 2) */
-
-static tree
-lookup_method_invoke (lc, cl, class, name, arg_list)
- int lc;
- tree cl;
- tree class, name, arg_list;
-{
- tree atl = end_params_node; /* Arg Type List */
- tree method, signature, list, node;
- char *candidates; /* Used for error report */
-
- /* Fix the arguments */
- for (node = arg_list; node; node = TREE_CHAIN (node))
- {
- tree current_arg = TREE_TYPE (TREE_VALUE (node));
- /* Non primitive type may have to be resolved */
- if (!JPRIMITIVE_TYPE_P (current_arg))
- resolve_and_layout (current_arg, NULL_TREE);
- /* And promoted */
- if (TREE_CODE (current_arg) == RECORD_TYPE)
- current_arg = promote_type (current_arg);
- atl = tree_cons (NULL_TREE, current_arg, atl);
- }
-
- /* Find all candidates and then refine the list, searching for the
- most specific method. */
- list = find_applicable_accessible_methods_list (lc, class, name, atl);
- list = find_most_specific_methods_list (list);
- if (list && !TREE_CHAIN (list))
- return TREE_VALUE (list);
-
- /* Issue an error. List candidates if any. Candidates are listed
- only if accessible (non accessible methods may end-up here for
- the sake of a better error report). */
- candidates = NULL;
- if (list)
- {
- tree current;
- obstack_grow (&temporary_obstack, ". Candidates are:\n", 18);
- for (current = list; current; current = TREE_CHAIN (current))
- {
- tree cm = TREE_VALUE (current);
- char string [4096];
- if (!cm || not_accessible_p (class, cm, 0))
- continue;
- sprintf
- (string, " `%s' in `%s'%s",
- get_printable_method_name (cm),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))),
- (TREE_CHAIN (current) ? "\n" : ""));
- obstack_grow (&temporary_obstack, string, strlen (string));
- }
- obstack_1grow (&temporary_obstack, '\0');
- candidates = obstack_finish (&temporary_obstack);
- }
- /* Issue the error message */
- method = make_node (FUNCTION_TYPE);
- TYPE_ARG_TYPES (method) = atl;
- signature = build_java_argument_signature (method);
- parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s",
- (lc ? "constructor" : "method"),
- (lc ?
- IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
- IDENTIFIER_POINTER (name)),
- IDENTIFIER_POINTER (signature),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
- (candidates ? candidates : ""));
- return NULL_TREE;
-}
-
-/* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
- when we're looking for a constructor. */
-
-static tree
-find_applicable_accessible_methods_list (lc, class, name, arglist)
- int lc;
- tree class, name, arglist;
-{
- tree list = NULL_TREE, all_list = NULL_TREE;
-
- /* Search interfaces */
- if (CLASS_INTERFACE (TYPE_NAME (class)))
- {
- static tree searched_interfaces = NULL_TREE;
- static int search_not_done = 0;
- int i, n;
- tree basetype_vec = TYPE_BINFO_BASETYPES (class);
-
- /* Have we searched this interface already? */
- if (searched_interfaces)
- {
- tree current;
- for (current = searched_interfaces;
- current; current = TREE_CHAIN (current))
- if (TREE_VALUE (current) == class)
- return NULL;
- }
- searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces);
-
- search_applicable_methods_list
- (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
-
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
- tree rlist;
-
- /* Skip java.lang.Object (we'll search it once later.) */
- if (t == object_type_node)
- continue;
-
- search_not_done++;
- rlist = find_applicable_accessible_methods_list (lc, t, name,
- arglist);
- all_list = chainon (rlist, (list ? list : all_list));
- search_not_done--;
- }
-
- /* We're done. Reset the searched interfaces list and finally search
- java.lang.Object */
- if (!search_not_done)
- {
- searched_interfaces = NULL_TREE;
- search_applicable_methods_list (lc, TYPE_METHODS (object_type_node),
- name, arglist, &list, &all_list);
- }
- }
- /* Search classes */
- else
- while (class != NULL_TREE)
- {
- search_applicable_methods_list
- (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
- class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class));
- }
-
- /* Either return the list obtained or all selected (but
- inaccessible) methods for better error report. */
- return (!list ? all_list : list);
-}
-
-/* Effectively search for the approriate method in method */
-
-static void
-search_applicable_methods_list(lc, method, name, arglist, list, all_list)
- int lc;
- tree method, name, arglist;
- tree *list, *all_list;
-{
- for (; method; method = TREE_CHAIN (method))
- {
- /* When dealing with constructor, stop here, otherwise search
- other classes */
- if (lc && !DECL_CONSTRUCTOR_P (method))
- continue;
- else if (!lc && (DECL_CONSTRUCTOR_P (method)
- || (GET_METHOD_NAME (method) != name)))
- continue;
-
- if (argument_types_convertible (method, arglist))
- {
- /* Retain accessible methods only */
- if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
- method, 0))
- *list = tree_cons (NULL_TREE, method, *list);
- else
- /* Also retain all selected method here */
- *all_list = tree_cons (NULL_TREE, method, *list);
- }
- }
-}
-
-/* 15.11.2.2 Choose the Most Specific Method */
-
-static tree
-find_most_specific_methods_list (list)
- tree list;
-{
- int max = 0;
- tree current, new_list = NULL_TREE;
- for (current = list; current; current = TREE_CHAIN (current))
- {
- tree method;
- DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0;
-
- for (method = list; method; method = TREE_CHAIN (method))
- {
- /* Don't test a method against itself */
- if (method == current)
- continue;
-
- /* Compare arguments and location where method where declared */
- if (argument_types_convertible (TREE_VALUE (method),
- TREE_VALUE (current))
- && valid_method_invocation_conversion_p
- (DECL_CONTEXT (TREE_VALUE (method)),
- DECL_CONTEXT (TREE_VALUE (current))))
- {
- int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current));
- max = (v > max ? v : max);
- }
- }
- }
-
- /* Review the list and select the maximally specific methods */
- for (current = list; current; current = TREE_CHAIN (current))
- if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
- new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
-
- /* If we can't find one, lower expectations and try to gather multiple
- maximally specific methods */
- while (!new_list)
- {
- while (--max > 0)
- {
- if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
- new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
- }
- return new_list;
- }
-
- return new_list;
-}
-
-/* Make sure that the type of each M2_OR_ARGLIST arguments can be
- converted by method invocation conversion (5.3) to the type of the
- corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
- to change less often than M1. */
-
-static int
-argument_types_convertible (m1, m2_or_arglist)
- tree m1, m2_or_arglist;
-{
- static tree m2_arg_value = NULL_TREE;
- static tree m2_arg_cache = NULL_TREE;
-
- register tree m1_arg, m2_arg;
-
- m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1));
- if (!METHOD_STATIC (m1))
- m1_arg = TREE_CHAIN (m1_arg);
-
- if (m2_arg_value == m2_or_arglist)
- m2_arg = m2_arg_cache;
- else
- {
- /* M2_OR_ARGLIST can be a function DECL or a raw list of
- argument types */
- if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL)
- {
- m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist));
- if (!METHOD_STATIC (m2_or_arglist))
- m2_arg = TREE_CHAIN (m2_arg);
- }
- else
- m2_arg = m2_or_arglist;
-
- m2_arg_value = m2_or_arglist;
- m2_arg_cache = m2_arg;
- }
-
- while (m1_arg != end_params_node && m2_arg != end_params_node)
- {
- resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE);
- if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg),
- TREE_VALUE (m2_arg)))
- break;
- m1_arg = TREE_CHAIN (m1_arg);
- m2_arg = TREE_CHAIN (m2_arg);
- }
- return m1_arg == end_params_node && m2_arg == end_params_node;
-}
-
-/* Qualification routines */
-
-static void
-qualify_ambiguous_name (id)
- tree id;
-{
- tree qual, qual_wfl, name, decl, ptr_type, saved_current_class;
- int again, super_found = 0, this_found = 0, new_array_found = 0;
- int code;
-
- /* We first qualify the first element, then derive qualification of
- others based on the first one. If the first element is qualified
- by a resolution (field or type), this resolution is stored in the
- QUAL_RESOLUTION of the qual element being examined. We need to
- save the current_class since the use of SUPER might change the
- its value. */
- saved_current_class = current_class;
- qual = EXPR_WFL_QUALIFICATION (id);
- do {
-
- /* Simple qualified expression feature a qual_wfl that is a
- WFL. Expression derived from a primary feature more complicated
- things like a CALL_EXPR. Expression from primary need to be
- worked out to extract the part on which the qualification will
- take place. */
- qual_wfl = QUAL_WFL (qual);
- switch (TREE_CODE (qual_wfl))
- {
- case CALL_EXPR:
- qual_wfl = TREE_OPERAND (qual_wfl, 0);
- if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
- {
- qual = EXPR_WFL_QUALIFICATION (qual_wfl);
- qual_wfl = QUAL_WFL (qual);
- }
- break;
- case NEW_ARRAY_EXPR:
- qual = TREE_CHAIN (qual);
- new_array_found = 1;
- continue;
- case NEW_CLASS_EXPR:
- case CONVERT_EXPR:
- qual_wfl = TREE_OPERAND (qual_wfl, 0);
- break;
- case ARRAY_REF:
- while (TREE_CODE (qual_wfl) == ARRAY_REF)
- qual_wfl = TREE_OPERAND (qual_wfl, 0);
- break;
- case STRING_CST:
- qual = TREE_CHAIN (qual);
- qual_wfl = QUAL_WFL (qual);
- break;
- default:
- /* Fix for -Wall. Just break doing nothing */
- break;
- }
-
- ptr_type = current_class;
- again = 0;
- code = TREE_CODE (qual_wfl);
-
- /* Pos evaluation: non WFL leading expression nodes */
- if (code == CONVERT_EXPR
- && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
-
- else if (code == ARRAY_REF &&
- TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
-
- else if (code == CALL_EXPR &&
- TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
-
- else if (code == STRING_CST || code == CONDITIONAL_EXPR)
- {
- qual = TREE_CHAIN (qual);
- qual_wfl = QUAL_WFL (qual);
- again = 1;
- }
- else
- name = EXPR_WFL_NODE (qual_wfl);
-
- /* If we have a THIS (from a primary), we set the context accordingly */
- if (name == this_identifier_node)
- {
- qual = TREE_CHAIN (qual);
- qual_wfl = QUAL_WFL (qual);
- if (TREE_CODE (qual_wfl) == CALL_EXPR)
- again = 1;
- else
- name = EXPR_WFL_NODE (qual_wfl);
- this_found = 1;
- }
- /* If we have a SUPER, we set the context accordingly */
- if (name == super_identifier_node)
- {
- current_class = CLASSTYPE_SUPER (ptr_type);
- /* Check that there is such a thing as a super class. If not,
- return. The error will be caught later on, during the
- resolution */
- if (!current_class)
- {
- current_class = saved_current_class;
- return;
- }
- qual = TREE_CHAIN (qual);
- /* Do one more interation to set things up */
- super_found = again = 1;
- }
- } while (again);
-
- /* If name appears within the scope of a location variable
- declaration or parameter declaration, then it is an expression
- name. We don't carry this test out if we're in the context of the
- use of SUPER or THIS */
- if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
- {
- RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
- QUAL_RESOLUTION (qual) = decl;
- }
-
- /* If within the class/interface NAME was found to be used there
- exists a (possibly inherited) field named NAME, then this is an
- expression name. If we saw a NEW_ARRAY_EXPR before and want to
- address length, it is OK. */
- else if ((decl = lookup_field_wrapper (ptr_type, name))
- || (new_array_found && name == length_identifier_node))
- {
- RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
- QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
- }
-
- /* We reclassify NAME as a type name if:
- - NAME is a class/interface declared within the compilation
- unit containing NAME,
- - NAME is imported via a single-type-import declaration,
- - NAME is declared in an another compilation unit of the package
- of the compilation unit containing NAME,
- - NAME is declared by exactly on type-import-on-demand declaration
- of the compilation unit containing NAME. */
- else if ((decl = resolve_and_layout (name, NULL_TREE)))
- {
- RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
- QUAL_RESOLUTION (qual) = decl;
- }
-
- /* Method call are expression name */
- else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
- || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF
- || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR)
- RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
-
- /* Check here that NAME isn't declared by more than one
- type-import-on-demand declaration of the compilation unit
- containing NAME. FIXME */
-
- /* Otherwise, NAME is reclassified as a package name */
- else
- RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
-
- /* Propagate the qualification accross other components of the
- qualified name */
- for (qual = TREE_CHAIN (qual); qual;
- qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual))
- {
- if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
- RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
- else
- RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
- }
-
- /* Store the global qualification for the ambiguous part of ID back
- into ID fields */
- if (RESOLVE_EXPRESSION_NAME_P (qual_wfl))
- RESOLVE_EXPRESSION_NAME_P (id) = 1;
- else if (RESOLVE_TYPE_NAME_P (qual_wfl))
- RESOLVE_TYPE_NAME_P (id) = 1;
- else if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
- RESOLVE_PACKAGE_NAME_P (id) = 1;
-
- /* Restore the current class */
- current_class = saved_current_class;
-}
-
-static int
-breakdown_qualified (left, right, source)
- tree *left, *right, source;
-{
- char *p = IDENTIFIER_POINTER (source), *base;
- int l = IDENTIFIER_LENGTH (source);
-
- /* Breakdown NAME into REMAINDER . IDENTIFIER */
- base = p;
- p += (l-1);
- while (*p != '.' && p != base)
- p--;
-
- /* We didn't find a '.'. Return an error */
- if (p == base)
- return 1;
-
- *p = '\0';
- if (right)
- *right = get_identifier (p+1);
- *left = get_identifier (IDENTIFIER_POINTER (source));
- *p = '.';
-
- return 0;
-}
-
-/* Patch tree nodes in a function body. When a BLOCK is found, push
- local variable decls if present.
- Same as java_complete_lhs, but does resolve static finals to values. */
-
-static tree
-java_complete_tree (node)
- tree node;
-{
- node = java_complete_lhs (node);
- if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node)
- && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE
- && !flag_emit_xref)
- {
- tree value = DECL_INITIAL (node);
- DECL_INITIAL (node) = NULL_TREE;
- value = fold_constant_for_init (value, node);
- DECL_INITIAL (node) = value;
- if (value != NULL_TREE)
- return value;
- }
- return node;
-}
-
-static tree
-java_stabilize_reference (node)
- tree node;
-{
- if (TREE_CODE (node) == COMPOUND_EXPR)
- {
- tree op0 = TREE_OPERAND (node, 0);
- tree op1 = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 0) = save_expr (op0);
- TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
- return node;
- }
- else
- return stabilize_reference (node);
-}
-
-/* Patch tree nodes in a function body. When a BLOCK is found, push
- local variable decls if present.
- Same as java_complete_tree, but does not resolve static finals to values. */
-
-static tree
-java_complete_lhs (node)
- tree node;
-{
- tree nn, cn, wfl_op1, wfl_op2, wfl_op3;
- int flag;
-
- /* CONVERT_EXPR always has its type set, even though it needs to be
- worked out. */
- if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR)
- return node;
-
- /* The switch block implements cases processing container nodes
- first. Contained nodes are always written back. Leaves come
- next and return a value. */
- switch (TREE_CODE (node))
- {
- case BLOCK:
-
- /* 1- Block section.
- Set the local values on decl names so we can identify them
- faster when they're referenced. At that stage, identifiers
- are legal so we don't check for declaration errors. */
- for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
- {
- DECL_CONTEXT (cn) = current_function_decl;
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn;
- }
- if (BLOCK_EXPR_BODY (node) == NULL_TREE)
- CAN_COMPLETE_NORMALLY (node) = 1;
- else
- {
- tree stmt = BLOCK_EXPR_BODY (node);
- tree *ptr;
- int error_seen = 0;
- if (TREE_CODE (stmt) == COMPOUND_EXPR)
- {
- /* Re-order from (((A; B); C); ...; Z) to
- (A; (B; (C ; (...; Z)))).
- This makes it easier to scan the statements left-to-right
- without using recursion (which might overflow the stack
- if the block has many statements. */
- for (;;)
- {
- tree left = TREE_OPERAND (stmt, 0);
- if (TREE_CODE (left) != COMPOUND_EXPR)
- break;
- TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1);
- TREE_OPERAND (left, 1) = stmt;
- stmt = left;
- }
- BLOCK_EXPR_BODY (node) = stmt;
- }
-
- /* Now do the actual complete, without deep recursion for
- long blocks. */
- ptr = &BLOCK_EXPR_BODY (node);
- while (TREE_CODE (*ptr) == COMPOUND_EXPR
- && TREE_OPERAND (*ptr, 1) != empty_stmt_node)
- {
- tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
- tree *next = &TREE_OPERAND (*ptr, 1);
- TREE_OPERAND (*ptr, 0) = cur;
- if (cur == empty_stmt_node)
- {
- /* Optimization; makes it easier to detect empty bodies.
- Most useful for <clinit> with all-constant initializer. */
- *ptr = *next;
- continue;
- }
- if (TREE_CODE (cur) == ERROR_MARK)
- error_seen++;
- else if (! CAN_COMPLETE_NORMALLY (cur))
- {
- wfl_op2 = *next;
- for (;;)
- {
- if (TREE_CODE (wfl_op2) == BLOCK)
- wfl_op2 = BLOCK_EXPR_BODY (wfl_op2);
- else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR)
- wfl_op2 = TREE_OPERAND (wfl_op2, 0);
- else
- break;
- }
- if (TREE_CODE (wfl_op2) != CASE_EXPR
- && TREE_CODE (wfl_op2) != DEFAULT_EXPR)
- unreachable_stmt_error (*ptr);
- }
- ptr = next;
- }
- *ptr = java_complete_tree (*ptr);
-
- if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0)
- return error_mark_node;
- CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr);
- }
- /* Turn local bindings to null */
- for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE;
-
- TREE_TYPE (node) = void_type_node;
- break;
-
- /* 2- They are expressions but ultimately deal with statements */
-
- case THROW_EXPR:
- wfl_op1 = TREE_OPERAND (node, 0);
- COMPLETE_CHECK_OP_0 (node);
- /* CAN_COMPLETE_NORMALLY (node) = 0; */
- return patch_throw_statement (node, wfl_op1);
-
- case SYNCHRONIZED_EXPR:
- wfl_op1 = TREE_OPERAND (node, 0);
- return patch_synchronized_statement (node, wfl_op1);
-
- case TRY_EXPR:
- return patch_try_statement (node);
-
- case TRY_FINALLY_EXPR:
- COMPLETE_CHECK_OP_0 (node);
- COMPLETE_CHECK_OP_1 (node);
- CAN_COMPLETE_NORMALLY (node)
- = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))
- && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)));
- TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0));
- return node;
-
- case CLEANUP_POINT_EXPR:
- COMPLETE_CHECK_OP_0 (node);
- TREE_TYPE (node) = void_type_node;
- CAN_COMPLETE_NORMALLY (node) =
- CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
- return node;
-
- case WITH_CLEANUP_EXPR:
- COMPLETE_CHECK_OP_0 (node);
- COMPLETE_CHECK_OP_2 (node);
- CAN_COMPLETE_NORMALLY (node) =
- CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
- TREE_TYPE (node) = void_type_node;
- return node;
-
- case LABELED_BLOCK_EXPR:
- PUSH_LABELED_BLOCK (node);
- if (LABELED_BLOCK_BODY (node))
- COMPLETE_CHECK_OP_1 (node);
- TREE_TYPE (node) = void_type_node;
- POP_LABELED_BLOCK ();
-
- if (LABELED_BLOCK_BODY (node) == empty_stmt_node)
- {
- LABELED_BLOCK_BODY (node) = NULL_TREE;
- CAN_COMPLETE_NORMALLY (node) = 1;
- }
- else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node)))
- CAN_COMPLETE_NORMALLY (node) = 1;
- return node;
-
- case EXIT_BLOCK_EXPR:
- /* We don't complete operand 1, because it's the return value of
- the EXIT_BLOCK_EXPR which doesn't exist it Java */
- return patch_bc_statement (node);
-
- case CASE_EXPR:
- cn = java_complete_tree (TREE_OPERAND (node, 0));
- if (cn == error_mark_node)
- return cn;
-
- /* First, the case expression must be constant. Values of final
- fields are accepted. */
- cn = fold (cn);
- if ((TREE_CODE (cn) == COMPOUND_EXPR || TREE_CODE (cn) == COMPONENT_REF)
- && JDECL_P (TREE_OPERAND (cn, 1))
- && FIELD_FINAL (TREE_OPERAND (cn, 1))
- && DECL_INITIAL (TREE_OPERAND (cn, 1)))
- cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
- TREE_OPERAND (cn, 1));
-
- if (!TREE_CONSTANT (cn) && !flag_emit_xref)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (node, "Constant expression required");
- return error_mark_node;
- }
-
- nn = ctxp->current_loop;
-
- /* It must be assignable to the type of the switch expression. */
- if (!try_builtin_assignconv (NULL_TREE,
- TREE_TYPE (TREE_OPERAND (nn, 0)), cn))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context
- (wfl_operator,
- "Incompatible type for case. Can't convert `%s' to `int'",
- lang_printable_name (TREE_TYPE (cn), 0));
- return error_mark_node;
- }
-
- cn = fold (convert (int_type_node, cn));
-
- /* Multiple instance of a case label bearing the same
- value is checked during code generation. The case
- expression is allright so far. */
- TREE_OPERAND (node, 0) = cn;
- TREE_TYPE (node) = void_type_node;
- CAN_COMPLETE_NORMALLY (node) = 1;
- TREE_SIDE_EFFECTS (node) = 1;
- break;
-
- case DEFAULT_EXPR:
- nn = ctxp->current_loop;
- /* Only one default label is allowed per switch statement */
- if (SWITCH_HAS_DEFAULT (nn))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator,
- "Duplicate case label: `default'");
- return error_mark_node;
- }
- else
- SWITCH_HAS_DEFAULT (nn) = 1;
- TREE_TYPE (node) = void_type_node;
- TREE_SIDE_EFFECTS (node) = 1;
- CAN_COMPLETE_NORMALLY (node) = 1;
- break;
-
- case SWITCH_EXPR:
- case LOOP_EXPR:
- PUSH_LOOP (node);
- /* Check whether the loop was enclosed in a labeled
- statement. If not, create one, insert the loop in it and
- return the node */
- nn = patch_loop_statement (node);
-
- /* Anyways, walk the body of the loop */
- if (TREE_CODE (node) == LOOP_EXPR)
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- /* Switch statement: walk the switch expression and the cases */
- else
- node = patch_switch_statement (node);
-
- if (TREE_OPERAND (node, 0) == error_mark_node)
- nn = error_mark_node;
- else
- {
- TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node;
- /* If we returned something different, that's because we
- inserted a label. Pop the label too. */
- if (nn != node)
- {
- if (CAN_COMPLETE_NORMALLY (node))
- CAN_COMPLETE_NORMALLY (nn) = 1;
- POP_LABELED_BLOCK ();
- }
- }
- POP_LOOP ();
- return nn;
-
- case EXIT_EXPR:
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- return patch_exit_expr (node);
-
- case COND_EXPR:
- /* Condition */
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
- /* then-else branches */
- TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
- if (TREE_OPERAND (node, 1) == error_mark_node)
- return error_mark_node;
- TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2));
- if (TREE_OPERAND (node, 2) == error_mark_node)
- return error_mark_node;
- return patch_if_else_statement (node);
- break;
-
- case CONDITIONAL_EXPR:
- /* Condition */
- wfl_op1 = TREE_OPERAND (node, 0);
- COMPLETE_CHECK_OP_0 (node);
- wfl_op2 = TREE_OPERAND (node, 1);
- COMPLETE_CHECK_OP_1 (node);
- wfl_op3 = TREE_OPERAND (node, 2);
- COMPLETE_CHECK_OP_2 (node);
- return patch_conditional_expr (node, wfl_op1, wfl_op2);
-
- /* 3- Expression section */
- case COMPOUND_EXPR:
- wfl_op2 = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 0) = nn =
- java_complete_tree (TREE_OPERAND (node, 0));
- if (wfl_op2 == empty_stmt_node)
- CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn);
- else
- {
- if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK)
- {
- /* An unreachable condition in a do-while statement
- is *not* (technically) an unreachable statement. */
- nn = wfl_op2;
- if (TREE_CODE (nn) == EXPR_WITH_FILE_LOCATION)
- nn = EXPR_WFL_NODE (nn);
- if (TREE_CODE (nn) != EXIT_EXPR)
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
- parse_error_context (wfl_operator, "Unreachable statement");
- }
- }
- TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
- if (TREE_OPERAND (node, 1) == error_mark_node)
- return error_mark_node;
- CAN_COMPLETE_NORMALLY (node)
- = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1));
- }
- TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1));
- break;
-
- case RETURN_EXPR:
- /* CAN_COMPLETE_NORMALLY (node) = 0; */
- return patch_return (node);
-
- case EXPR_WITH_FILE_LOCATION:
- if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
- || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
- {
- tree wfl = node;
- node = resolve_expression_name (node, NULL);
- if (node == error_mark_node)
- return node;
- /* Keep line number information somewhere were it doesn't
- disrupt the completion process. */
- if (flag_emit_xref && TREE_CODE (node) != CALL_EXPR)
- {
- EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 1) = wfl;
- }
- CAN_COMPLETE_NORMALLY (node) = 1;
- }
- else
- {
- tree body;
- int save_lineno = lineno;
- lineno = EXPR_WFL_LINENO (node);
- body = java_complete_tree (EXPR_WFL_NODE (node));
- lineno = save_lineno;
- EXPR_WFL_NODE (node) = body;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
- CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
- if (body == empty_stmt_node)
- {
- /* Optimization; makes it easier to detect empty bodies. */
- return body;
- }
- if (body == error_mark_node)
- {
- /* Its important for the evaluation of assignment that
- this mark on the TREE_TYPE is propagated. */
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
- else
- TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
-
- }
- break;
-
- case NEW_ARRAY_EXPR:
- /* Patch all the dimensions */
- flag = 0;
- for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
- {
- int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
- tree dim = java_complete_tree (TREE_VALUE (cn));
- if (dim == error_mark_node)
- {
- flag = 1;
- continue;
- }
- else
- {
- TREE_VALUE (cn) = dim;
- /* Setup the location of the current dimension, for
- later error report. */
- TREE_PURPOSE (cn) =
- build_expr_wfl (NULL_TREE, input_filename, 0, 0);
- EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
- }
- }
- /* They complete the array creation expression, if no errors
- were found. */
- CAN_COMPLETE_NORMALLY (node) = 1;
- return (flag ? error_mark_node
- : force_evaluation_order (patch_newarray (node)));
-
- case NEW_CLASS_EXPR:
- case CALL_EXPR:
- /* Complete function's argument(s) first */
- if (complete_function_arguments (node))
- return error_mark_node;
- else
- {
- tree decl, wfl = TREE_OPERAND (node, 0);
- int in_this = CALL_THIS_CONSTRUCTOR_P (node);
-
- node = patch_method_invocation (node, NULL_TREE,
- NULL_TREE, 0, &decl);
- if (node == error_mark_node)
- return error_mark_node;
-
- check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl);
- /* If we call this(...), register signature and positions */
- if (in_this)
- DECL_CONSTRUCTOR_CALLS (current_function_decl) =
- tree_cons (wfl, decl,
- DECL_CONSTRUCTOR_CALLS (current_function_decl));
- CAN_COMPLETE_NORMALLY (node) = 1;
- return force_evaluation_order (node);
- }
-
- case MODIFY_EXPR:
- /* Save potential wfls */
- wfl_op1 = TREE_OPERAND (node, 0);
- TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1);
- if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)
- && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
- && DECL_INITIAL (nn) != NULL_TREE)
- {
- tree value = fold_constant_for_init (nn, nn);
- if (value != NULL_TREE)
- {
- tree type = TREE_TYPE (value);
- if (JPRIMITIVE_TYPE_P (type) || type == string_ptr_type_node)
- return empty_stmt_node;
- }
- DECL_INITIAL (nn) = NULL_TREE;
- }
- wfl_op2 = TREE_OPERAND (node, 1);
-
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
-
- if (COMPOUND_ASSIGN_P (wfl_op2))
- {
- tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
-
- /* Hand stablize the lhs on both places */
- TREE_OPERAND (node, 0) = lvalue;
- TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
-
- /* Now complete the RHS. We write it back later on. */
- nn = java_complete_tree (TREE_OPERAND (node, 1));
-
- if ((cn = patch_string (nn)))
- nn = cn;
-
- /* The last part of the rewrite for E1 op= E2 is to have
- E1 = (T)(E1 op E2), with T being the type of E1. */
- nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
- TREE_TYPE (lvalue), nn));
- }
-
- /* If we're about to patch a NEW_ARRAY_INIT, we call a special
- function to complete this RHS */
- else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT)
- nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)),
- TREE_OPERAND (node, 1));
- /* Otherwise we simply complete the RHS */
- else
- nn = java_complete_tree (TREE_OPERAND (node, 1));
-
- if (nn == error_mark_node)
- return error_mark_node;
-
- /* Write back the RHS as we evaluated it. */
- TREE_OPERAND (node, 1) = nn;
-
- /* In case we're handling = with a String as a RHS, we need to
- produce a String out of the RHS (it might still be a
- STRING_CST or a StringBuffer at this stage */
- if ((nn = patch_string (TREE_OPERAND (node, 1))))
- TREE_OPERAND (node, 1) = nn;
- node = patch_assignment (node, wfl_op1, wfl_op2);
- CAN_COMPLETE_NORMALLY (node) = 1;
- return node;
-
- case MULT_EXPR:
- case PLUS_EXPR:
- case MINUS_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case URSHIFT_EXPR:
- case BIT_AND_EXPR:
- case BIT_XOR_EXPR:
- case BIT_IOR_EXPR:
- case TRUNC_MOD_EXPR:
- case RDIV_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- /* Operands 0 and 1 are WFL in certain cases only. patch_binop
- knows how to handle those cases. */
- wfl_op1 = TREE_OPERAND (node, 0);
- wfl_op2 = TREE_OPERAND (node, 1);
-
- CAN_COMPLETE_NORMALLY (node) = 1;
- /* Don't complete string nodes if dealing with the PLUS operand. */
- if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1))
- {
- nn = java_complete_tree (wfl_op1);
- if (nn == error_mark_node)
- return error_mark_node;
- if ((cn = patch_string (nn)))
- nn = cn;
- TREE_OPERAND (node, 0) = nn;
- }
- if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
- {
- nn = java_complete_tree (wfl_op2);
- if (nn == error_mark_node)
- return error_mark_node;
- if ((cn = patch_string (nn)))
- nn = cn;
- TREE_OPERAND (node, 1) = nn;
- }
- return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2));
-
- case INSTANCEOF_EXPR:
- wfl_op1 = TREE_OPERAND (node, 0);
- COMPLETE_CHECK_OP_0 (node);
- if (flag_emit_xref)
- {
- TREE_TYPE (node) = boolean_type_node;
- return node;
- }
- return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1));
-
- case UNARY_PLUS_EXPR:
- case NEGATE_EXPR:
- case TRUTH_NOT_EXPR:
- case BIT_NOT_EXPR:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case CONVERT_EXPR:
- /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
- how to handle those cases. */
- wfl_op1 = TREE_OPERAND (node, 0);
- CAN_COMPLETE_NORMALLY (node) = 1;
- TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
- node = patch_unaryop (node, wfl_op1);
- CAN_COMPLETE_NORMALLY (node) = 1;
- break;
-
- case ARRAY_REF:
- /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
- how to handle those cases. */
- wfl_op1 = TREE_OPERAND (node, 0);
- TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
- if (!flag_emit_class_files && !flag_emit_xref)
- TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0));
- /* The same applies to wfl_op2 */
- wfl_op2 = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
- if (TREE_OPERAND (node, 1) == error_mark_node)
- return error_mark_node;
- if (!flag_emit_class_files && !flag_emit_xref)
- TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
- return patch_array_ref (node);
-
- case RECORD_TYPE:
- return node;;
-
- case COMPONENT_REF:
- /* The first step in the re-write of qualified name handling. FIXME.
- So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
- {
- tree name = TREE_OPERAND (node, 1);
- tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
- if (field == NULL_TREE)
- {
- error ("missing static field `%s'", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- if (! FIELD_STATIC (field))
- {
- error ("not a static field `%s'", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- return field;
- }
- else
- fatal ("unimplemented java_complete_tree for COMPONENT_REF");
- break;
-
- case THIS_EXPR:
- /* Can't use THIS in a static environment */
- if (!current_this)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator, "Keyword `this' used outside "
- "allowed context");
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
- if (ctxp->explicit_constructor_p)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context
- (wfl_operator, "Can't reference `this' or `super' before the "
- "superclass constructor has been called");
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
- return current_this;
-
- default:
- CAN_COMPLETE_NORMALLY (node) = 1;
- /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
- and it's time to turn it into the appropriate String object
- */
- if ((node = patch_string (node)))
- return node;
- fatal ("No case for tree code `%s' - java_complete_tree\n",
- tree_code_name [TREE_CODE (node)]);
- }
- return node;
-}
-
-/* Complete function call's argument. Return a non zero value is an
- error was found. */
-
-static int
-complete_function_arguments (node)
- tree node;
-{
- int flag = 0;
- tree cn;
-
- ctxp->explicit_constructor_p += (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
- for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
- {
- tree wfl = TREE_VALUE (cn), parm, temp;
- parm = java_complete_tree (wfl);
- if (parm == error_mark_node)
- {
- flag = 1;
- continue;
- }
- /* If have a string literal that we haven't transformed yet or a
- crafted string buffer, as a result of use of the the String
- `+' operator. Build `parm.toString()' and expand it. */
- if ((temp = patch_string (parm)))
- parm = temp;
- /* Inline PRIMTYPE.TYPE read access */
- parm = maybe_build_primttype_type_ref (parm, wfl);
-
- TREE_VALUE (cn) = parm;
- }
- ctxp->explicit_constructor_p -= (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
- return flag;
-}
-
-/* Sometimes (for loops and variable initialized during their
- declaration), we want to wrap a statement around a WFL and turn it
- debugable. */
-
-static tree
-build_debugable_stmt (location, stmt)
- int location;
- tree stmt;
-{
- if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
- {
- stmt = build_expr_wfl (stmt, input_filename, 0, 0);
- EXPR_WFL_LINECOL (stmt) = location;
- }
- JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
- return stmt;
-}
-
-static tree
-build_expr_block (body, decls)
- tree body, decls;
-{
- tree node = make_node (BLOCK);
- BLOCK_EXPR_DECLS (node) = decls;
- BLOCK_EXPR_BODY (node) = body;
- if (body)
- TREE_TYPE (node) = TREE_TYPE (body);
- TREE_SIDE_EFFECTS (node) = 1;
- return node;
-}
-
-/* Create a new function block and link it approriately to current
- function block chain */
-
-static tree
-enter_block ()
-{
- return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE)));
-}
-
-/* Link block B supercontext to the previous block. The current
- function DECL is used as supercontext when enter_a_block is called
- for the first time for a given function. The current function body
- (DECL_FUNCTION_BODY) is set to be block B. */
-
-static tree
-enter_a_block (b)
- tree b;
-{
- tree fndecl = current_function_decl;
-
- if (!fndecl) {
- BLOCK_SUPERCONTEXT (b) = current_static_block;
- current_static_block = b;
- }
-
- else if (!DECL_FUNCTION_BODY (fndecl))
- {
- BLOCK_SUPERCONTEXT (b) = fndecl;
- DECL_FUNCTION_BODY (fndecl) = b;
- }
- else
- {
- BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl);
- DECL_FUNCTION_BODY (fndecl) = b;
- }
- return b;
-}
-
-/* Exit a block by changing the current function body
- (DECL_FUNCTION_BODY) to the current block super context, only if
- the block being exited isn't the method's top level one. */
-
-static tree
-exit_block ()
-{
- tree b;
- if (current_function_decl)
- {
- b = DECL_FUNCTION_BODY (current_function_decl);
- if (BLOCK_SUPERCONTEXT (b) != current_function_decl)
- DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b);
- }
- else
- {
- b = current_static_block;
-
- if (BLOCK_SUPERCONTEXT (b))
- current_static_block = BLOCK_SUPERCONTEXT (b);
- }
- return b;
-}
-
-/* Lookup for NAME in the nested function's blocks, all the way up to
- the current toplevel one. It complies with Java's local variable
- scoping rules. */
-
-static tree
-lookup_name_in_blocks (name)
- tree name;
-{
- tree b = GET_CURRENT_BLOCK (current_function_decl);
-
- while (b != current_function_decl)
- {
- tree current;
-
- /* Paranoid sanity check. To be removed */
- if (TREE_CODE (b) != BLOCK)
- fatal ("non block expr function body - lookup_name_in_blocks");
-
- for (current = BLOCK_EXPR_DECLS (b); current;
- current = TREE_CHAIN (current))
- if (DECL_NAME (current) == name)
- return current;
- b = BLOCK_SUPERCONTEXT (b);
- }
- return NULL_TREE;
-}
-
-static void
-maybe_absorb_scoping_blocks ()
-{
- while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl)))
- {
- tree b = exit_block ();
- java_method_add_stmt (current_function_decl, b);
- SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno));
- }
-}
-
-
-/* This section of the source is reserved to build_* functions that
- are building incomplete tree nodes and the patch_* functions that
- are completing them. */
-
-/* Build a super() constructor invocation. Returns empty_stmt_node if
- we're currently dealing with the class java.lang.Object. */
-
-static tree
-build_super_invocation ()
-{
- if (current_class == object_type_node)
- return empty_stmt_node;
- else
- {
- tree super_wfl = build_wfl_node (super_identifier_node);
- return build_method_invocation (super_wfl, NULL_TREE);
- }
-}
-
-/* Build a SUPER/THIS qualified method invocation. */
-
-static tree
-build_this_super_qualified_invocation (use_this, name, args, lloc, rloc)
- int use_this;
- tree name, args;
- int lloc, rloc;
-
-{
- tree invok;
- tree wfl =
- build_wfl_node (use_this ? this_identifier_node : super_identifier_node);
- EXPR_WFL_LINECOL (wfl) = lloc;
- invok = build_method_invocation (name, args);
- return make_qualified_primary (wfl, invok, rloc);
-}
-
-/* Build an incomplete CALL_EXPR node. */
-
-static tree
-build_method_invocation (name, args)
- tree name;
- tree args;
-{
- tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
- return call;
-}
-
-/* Build an incomplete new xxx(...) node. */
-
-static tree
-build_new_invocation (name, args)
- tree name, args;
-{
- tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
- return call;
-}
-
-/* Build an incomplete assignment expression. */
-
-static tree
-build_assignment (op, op_location, lhs, rhs)
- int op, op_location;
- tree lhs, rhs;
-{
- tree assignment;
- /* Build the corresponding binop if we deal with a Compound
- Assignment operator. Mark the binop sub-tree as part of a
- Compound Assignment expression */
- if (op != ASSIGN_TK)
- {
- rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs);
- COMPOUND_ASSIGN_P (rhs) = 1;
- }
- assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs);
- TREE_SIDE_EFFECTS (assignment) = 1;
- EXPR_WFL_LINECOL (assignment) = op_location;
- return assignment;
-}
-
-/* Print an INTEGER_CST node in a static buffer, and return the buffer. */
-
-char *
-print_int_node (node)
- tree node;
-{
- static char buffer [80];
- if (TREE_CONSTANT_OVERFLOW (node))
- sprintf (buffer, "<overflow>");
-
- if (TREE_INT_CST_HIGH (node) == 0)
- sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
- TREE_INT_CST_LOW (node));
- else if (TREE_INT_CST_HIGH (node) == -1
- && TREE_INT_CST_LOW (node) != 0)
- {
- buffer [0] = '-';
- sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED,
- -TREE_INT_CST_LOW (node));
- }
- else
- sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
- TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
-
- return buffer;
-}
-
-/* Return 1 if an assignment to a FINAL is attempted in a non suitable
- context. */
-
-static int
-check_final_assignment (lvalue, wfl)
- tree lvalue, wfl;
-{
- if (JDECL_P (lvalue)
- && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl))
- {
- parse_error_context
- (wfl, "Can't assign a value to the final variable `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- return 1;
- }
- return 0;
-}
-
-/* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
- read. This is needed to avoid circularities in the implementation
- of these fields in libjava. */
-
-static tree
-maybe_build_primttype_type_ref (rhs, wfl)
- tree rhs, wfl;
-{
- tree to_return = NULL_TREE;
- tree rhs_type = TREE_TYPE (rhs);
- if (TREE_CODE (rhs) == COMPOUND_EXPR)
- {
- tree n = TREE_OPERAND (rhs, 1);
- if (TREE_CODE (n) == VAR_DECL
- && DECL_NAME (n) == TYPE_identifier_node
- && rhs_type == class_ptr_type)
- {
- char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
- if (!strncmp (self_name, "java.lang.", 10))
- to_return = build_primtype_type_ref (self_name);
- }
- }
- return (to_return ? to_return : rhs );
-}
-
-/* 15.25 Assignment operators. */
-
-static tree
-patch_assignment (node, wfl_op1, wfl_op2)
- tree node;
- tree wfl_op1;
- tree wfl_op2;
-{
- tree rhs = TREE_OPERAND (node, 1);
- tree lvalue = TREE_OPERAND (node, 0), llvalue;
- tree lhs_type, rhs_type, new_rhs = NULL_TREE;
- int error_found = 0;
- int lvalue_from_array = 0;
-
- /* Can't assign to a final. */
- if (check_final_assignment (lvalue, wfl_op1))
- error_found = 1;
-
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* Lhs can be a named variable */
- if (JDECL_P (lvalue))
- {
- lhs_type = TREE_TYPE (lvalue);
- }
- /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
- comment on reason why */
- else if (TREE_CODE (wfl_op1) == ARRAY_REF)
- {
- lhs_type = TREE_TYPE (lvalue);
- lvalue_from_array = 1;
- }
- /* Or a field access */
- else if (TREE_CODE (lvalue) == COMPONENT_REF)
- lhs_type = TREE_TYPE (lvalue);
- /* Or a function return slot */
- else if (TREE_CODE (lvalue) == RESULT_DECL)
- lhs_type = TREE_TYPE (lvalue);
- /* Otherwise, we might want to try to write into an optimized static
- final, this is an of a different nature, reported further on. */
- else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
- && resolve_expression_name (wfl_op1, &llvalue))
- {
- if (check_final_assignment (llvalue, wfl_op1))
- {
- /* What we should do instead is resetting the all the flags
- previously set, exchange lvalue for llvalue and continue. */
- error_found = 1;
- return error_mark_node;
- }
- else
- lhs_type = TREE_TYPE (lvalue);
- }
- else
- {
- parse_error_context (wfl_op1, "Invalid left hand side of assignment");
- error_found = 1;
- }
-
- rhs_type = TREE_TYPE (rhs);
- /* 5.1 Try the assignment conversion for builtin type. */
- new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs);
-
- /* 5.2 If it failed, try a reference conversion */
- if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs)))
- lhs_type = promote_type (rhs_type);
-
- /* 15.25.2 If we have a compound assignment, convert RHS into the
- type of the LHS */
- else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
- new_rhs = convert (lhs_type, rhs);
-
- /* Explicit cast required. This is an error */
- if (!new_rhs)
- {
- char *t1 = strdup (lang_printable_name (TREE_TYPE (rhs), 0));
- char *t2 = strdup (lang_printable_name (lhs_type, 0));
- tree wfl;
- char operation [32]; /* Max size known */
-
- /* If the assignment is part of a declaration, we use the WFL of
- the declared variable to point out the error and call it a
- declaration problem. If the assignment is a genuine =
- operator, we call is a operator `=' problem, otherwise we
- call it an assignment problem. In both of these last cases,
- we use the WFL of the operator to indicate the error. */
-
- if (MODIFY_EXPR_FROM_INITIALIZATION_P (node))
- {
- wfl = wfl_op1;
- strcpy (operation, "declaration");
- }
- else
- {
- wfl = wfl_operator;
- if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
- strcpy (operation, "assignment");
- else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL)
- strcpy (operation, "`return'");
- else
- strcpy (operation, "`='");
- }
-
- parse_error_context
- (wfl, (!valid_cast_to_p (rhs_type, lhs_type) ?
- "Incompatible type for %s. Can't convert `%s' to `%s'" :
- "Incompatible type for %s. Explicit cast "
- "needed to convert `%s' to `%s'"), operation, t1, t2);
- free (t1); free (t2);
- error_found = 1;
- }
-
- /* Inline read access to java.lang.PRIMTYPE.TYPE */
- if (new_rhs)
- new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2);
-
- if (error_found)
- return error_mark_node;
-
- /* 10.10: Array Store Exception runtime check */
- if (!flag_emit_class_files
- && !flag_emit_xref
- && lvalue_from_array
- && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type))
- && !CLASS_FINAL (TYPE_NAME (GET_SKIP_TYPE (rhs_type))))
- {
- tree check;
- tree base = lvalue;
-
- /* We need to retrieve the right argument for _Jv_CheckArrayStore */
- if (TREE_CODE (lvalue) == COMPOUND_EXPR)
- base = TREE_OPERAND (lvalue, 0);
- else
- {
- if (flag_bounds_check)
- base = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base, 0), 1), 0);
- else
- base = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
- }
-
- /* Build the invocation of _Jv_CheckArrayStore */
- new_rhs = save_expr (new_rhs);
- check = build (CALL_EXPR, void_type_node,
- build_address_of (soft_checkarraystore_node),
- tree_cons (NULL_TREE, base,
- build_tree_list (NULL_TREE, new_rhs)),
- NULL_TREE);
- TREE_SIDE_EFFECTS (check) = 1;
-
- /* We have to decide on an insertion point */
- if (TREE_CODE (lvalue) == COMPOUND_EXPR)
- {
- tree t;
- if (flag_bounds_check)
- {
- t = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0);
- TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0) =
- build (COMPOUND_EXPR, void_type_node, t, check);
- }
- else
- TREE_OPERAND (lvalue, 1) = build (COMPOUND_EXPR, lhs_type,
- check, TREE_OPERAND (lvalue, 1));
- }
- else
- {
- /* Make sure the bound check will happen before the store check */
- if (flag_bounds_check)
- TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0) =
- build (COMPOUND_EXPR, void_type_node,
- TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0), check);
- else
- lvalue = build (COMPOUND_EXPR, lhs_type, check, lvalue);
- }
- }
-
- TREE_OPERAND (node, 0) = lvalue;
- TREE_OPERAND (node, 1) = new_rhs;
- TREE_TYPE (node) = lhs_type;
- return node;
-}
-
-/* Check that type SOURCE can be cast into type DEST. If the cast
- can't occur at all, return 0 otherwise 1. This function is used to
- produce accurate error messages on the reasons why an assignment
- failed. */
-
-static tree
-try_reference_assignconv (lhs_type, rhs)
- tree lhs_type, rhs;
-{
- tree new_rhs = NULL_TREE;
- tree rhs_type = TREE_TYPE (rhs);
-
- if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type))
- {
- /* `null' may be assigned to any reference type */
- if (rhs == null_pointer_node)
- new_rhs = null_pointer_node;
- /* Try the reference assignment conversion */
- else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
- new_rhs = rhs;
- /* This is a magic assignment that we process differently */
- else if (rhs == soft_exceptioninfo_call_node)
- new_rhs = rhs;
- }
- return new_rhs;
-}
-
-/* Check that RHS can be converted into LHS_TYPE by the assignment
- conversion (5.2), for the cases of RHS being a builtin type. Return
- NULL_TREE if the conversion fails or if because RHS isn't of a
- builtin type. Return a converted RHS if the conversion is possible. */
-
-static tree
-try_builtin_assignconv (wfl_op1, lhs_type, rhs)
- tree wfl_op1, lhs_type, rhs;
-{
- tree new_rhs = NULL_TREE;
- tree rhs_type = TREE_TYPE (rhs);
-
- /* Zero accepted everywhere */
- if (TREE_CODE (rhs) == INTEGER_CST
- && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0
- && JPRIMITIVE_TYPE_P (rhs_type))
- new_rhs = convert (lhs_type, rhs);
-
- /* 5.1.1 Try Identity Conversion,
- 5.1.2 Try Widening Primitive Conversion */
- else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
- new_rhs = convert (lhs_type, rhs);
-
- /* Try a narrowing primitive conversion (5.1.3):
- - expression is a constant expression of type int AND
- - variable is byte, short or char AND
- - The value of the expression is representable in the type of the
- variable */
- else if (rhs_type == int_type_node && TREE_CONSTANT (rhs)
- && (lhs_type == byte_type_node || lhs_type == char_type_node
- || lhs_type == short_type_node))
- {
- if (int_fits_type_p (rhs, lhs_type))
- new_rhs = convert (lhs_type, rhs);
- else if (wfl_op1) /* Might be called with a NULL */
- parse_warning_context
- (wfl_op1, "Constant expression `%s' to wide for narrowing "
- "primitive conversion to `%s'",
- print_int_node (rhs), lang_printable_name (lhs_type, 0));
- /* Reported a warning that will turn into an error further
- down, so we don't return */
- }
-
- return new_rhs;
-}
-
-/* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
- conversion (5.1.1) or widening primitve conversion (5.1.2). Return
- 0 is the conversion test fails. This implements parts the method
- invocation convertion (5.3). */
-
-static int
-valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)
- tree lhs_type, rhs_type;
-{
- /* 5.1.1: This is the identity conversion part. */
- if (lhs_type == rhs_type)
- return 1;
-
- /* Reject non primitive types */
- if (!JPRIMITIVE_TYPE_P (lhs_type) || !JPRIMITIVE_TYPE_P (rhs_type))
- return 0;
-
- /* 5.1.2: widening primitive conversion. byte, even if it's smaller
- than a char can't be converted into a char. Short can't too, but
- the < test below takes care of that */
- if (lhs_type == char_type_node && rhs_type == byte_type_node)
- return 0;
-
- /* Accept all promoted type here. Note, we can't use <= in the test
- below, because we still need to bounce out assignments of short
- to char and the likes */
- if (lhs_type == int_type_node
- && (rhs_type == promoted_byte_type_node
- || rhs_type == promoted_short_type_node
- || rhs_type == promoted_char_type_node
- || rhs_type == promoted_boolean_type_node))
- return 1;
-
- /* From here, an integral is widened if its precision is smaller
- than the precision of the LHS or if the LHS is a floating point
- type, or the RHS is a float and the RHS a double. */
- if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type)
- && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
- || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type))
- || (rhs_type == float_type_node && lhs_type == double_type_node))
- return 1;
-
- return 0;
-}
-
-/* Check that something of SOURCE type can be assigned or cast to
- something of DEST type at runtime. Return 1 if the operation is
- valid, 0 otherwise. If CAST is set to 1, we're treating the case
- were SOURCE is cast into DEST, which borrows a lot of the
- assignment check. */
-
-static int
-valid_ref_assignconv_cast_p (source, dest, cast)
- tree source;
- tree dest;
- int cast;
-{
- /* SOURCE or DEST might be null if not from a declared entity. */
- if (!source || !dest)
- return 0;
- if (JNULLP_TYPE_P (source))
- return 1;
- if (TREE_CODE (source) == POINTER_TYPE)
- source = TREE_TYPE (source);
- if (TREE_CODE (dest) == POINTER_TYPE)
- dest = TREE_TYPE (dest);
- /* Case where SOURCE is a class type */
- if (TYPE_CLASS_P (source))
- {
- if (TYPE_CLASS_P (dest))
- return source == dest || inherits_from_p (source, dest)
- || (cast && inherits_from_p (dest, source));
- if (TYPE_INTERFACE_P (dest))
- {
- /* If doing a cast and SOURCE is final, the operation is
- always correct a compile time (because even if SOURCE
- does not implement DEST, a subclass of SOURCE might). */
- if (cast && !CLASS_FINAL (TYPE_NAME (source)))
- return 1;
- /* Otherwise, SOURCE must implement DEST */
- return interface_of_p (dest, source);
- }
- /* DEST is an array, cast permited if SOURCE is of Object type */
- return (cast && source == object_type_node ? 1 : 0);
- }
- if (TYPE_INTERFACE_P (source))
- {
- if (TYPE_CLASS_P (dest))
- {
- /* If not casting, DEST must be the Object type */
- if (!cast)
- return dest == object_type_node;
- /* We're doing a cast. The cast is always valid is class
- DEST is not final, otherwise, DEST must implement SOURCE */
- else if (!CLASS_FINAL (TYPE_NAME (dest)))
- return 1;
- else
- return interface_of_p (source, dest);
- }
- if (TYPE_INTERFACE_P (dest))
- {
- /* If doing a cast, then if SOURCE and DEST contain method
- with the same signature but different return type, then
- this is a (compile time) error */
- if (cast)
- {
- tree method_source, method_dest;
- tree source_type;
- tree source_sig;
- tree source_name;
- for (method_source = TYPE_METHODS (source); method_source;
- method_source = TREE_CHAIN (method_source))
- {
- source_sig =
- build_java_argument_signature (TREE_TYPE (method_source));
- source_type = TREE_TYPE (TREE_TYPE (method_source));
- source_name = DECL_NAME (method_source);
- for (method_dest = TYPE_METHODS (dest);
- method_dest; method_dest = TREE_CHAIN (method_dest))
- if (source_sig ==
- build_java_argument_signature (TREE_TYPE (method_dest))
- && source_name == DECL_NAME (method_dest)
- && source_type != TREE_TYPE (TREE_TYPE (method_dest)))
- return 0;
- }
- return 1;
- }
- else
- return source == dest || interface_of_p (dest, source);
- }
- else /* Array */
- return (cast ?
- (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0);
- }
- if (TYPE_ARRAY_P (source))
- {
- if (TYPE_CLASS_P (dest))
- return dest == object_type_node;
- /* Can't cast an array to an interface unless the interface is
- java.lang.Cloneable */
- if (TYPE_INTERFACE_P (dest))
- return (DECL_NAME (TYPE_NAME (dest)) == java_lang_cloneable ? 1 : 0);
- else /* Arrays */
- {
- tree source_element_type = TYPE_ARRAY_ELEMENT (source);
- tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
-
- /* In case of severe errors, they turn out null */
- if (!dest_element_type || !source_element_type)
- return 0;
- if (source_element_type == dest_element_type)
- return 1;
- return valid_ref_assignconv_cast_p (source_element_type,
- dest_element_type, cast);
- }
- return 0;
- }
- return 0;
-}
-
-static int
-valid_cast_to_p (source, dest)
- tree source;
- tree dest;
-{
- if (TREE_CODE (source) == POINTER_TYPE)
- source = TREE_TYPE (source);
- if (TREE_CODE (dest) == POINTER_TYPE)
- dest = TREE_TYPE (dest);
-
- if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE)
- return valid_ref_assignconv_cast_p (source, dest, 1);
-
- else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest))
- return 1;
-
- return 0;
-}
-
-/* Method invocation conversion test. Return 1 if type SOURCE can be
- converted to type DEST through the methond invocation conversion
- process (5.3) */
-
-static tree
-do_unary_numeric_promotion (arg)
- tree arg;
-{
- tree type = TREE_TYPE (arg);
- if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32
- : TREE_CODE (type) == CHAR_TYPE)
- arg = convert (int_type_node, arg);
- return arg;
-}
-
-/* Return a non zero value if SOURCE can be converted into DEST using
- the method invocation conversion rule (5.3). */
-static int
-valid_method_invocation_conversion_p (dest, source)
- tree dest, source;
-{
- return ((JPRIMITIVE_TYPE_P (source) && JPRIMITIVE_TYPE_P (dest)
- && valid_builtin_assignconv_identity_widening_p (dest, source))
- || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source))
- && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest))
- && valid_ref_assignconv_cast_p (source, dest, 0)));
-}
-
-/* Build an incomplete binop expression. */
-
-static tree
-build_binop (op, op_location, op1, op2)
- enum tree_code op;
- int op_location;
- tree op1, op2;
-{
- tree binop = build (op, NULL_TREE, op1, op2);
- TREE_SIDE_EFFECTS (binop) = 1;
- /* Store the location of the operator, for better error report. The
- string of the operator will be rebuild based on the OP value. */
- EXPR_WFL_LINECOL (binop) = op_location;
- return binop;
-}
-
-/* Build the string of the operator retained by NODE. If NODE is part
- of a compound expression, add an '=' at the end of the string. This
- function is called when an error needs to be reported on an
- operator. The string is returned as a pointer to a static character
- buffer. */
-
-static char *
-operator_string (node)
- tree node;
-{
-#define BUILD_OPERATOR_STRING(S) \
- { \
- sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
- return buffer; \
- }
-
- static char buffer [10];
- switch (TREE_CODE (node))
- {
- case MULT_EXPR: BUILD_OPERATOR_STRING ("*");
- case RDIV_EXPR: BUILD_OPERATOR_STRING ("/");
- case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%");
- case PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
- case MINUS_EXPR: BUILD_OPERATOR_STRING ("-");
- case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<");
- case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>");
- case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>");
- case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&");
- case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^");
- case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|");
- case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&");
- case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||");
- case EQ_EXPR: BUILD_OPERATOR_STRING ("==");
- case NE_EXPR: BUILD_OPERATOR_STRING ("!=");
- case GT_EXPR: BUILD_OPERATOR_STRING (">");
- case GE_EXPR: BUILD_OPERATOR_STRING (">=");
- case LT_EXPR: BUILD_OPERATOR_STRING ("<");
- case LE_EXPR: BUILD_OPERATOR_STRING ("<=");
- case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
- case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-");
- case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!");
- case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~");
- case PREINCREMENT_EXPR: /* Fall through */
- case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++");
- case PREDECREMENT_EXPR: /* Fall through */
- case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--");
- default:
- fatal ("unregistered operator %s - operator_string",
- tree_code_name [TREE_CODE (node)]);
- }
- return NULL;
-#undef BUILD_OPERATOR_STRING
-}
-
-/* Binary operators (15.16 up to 15.18). We return error_mark_node on
- errors but we modify NODE so that it contains the type computed
- according to the expression, when it's fixed. Otherwise, we write
- error_mark_node as the type. It allows us to further the analysis
- of remaining nodes and detects more errors in certain cases. */
-
-static tree
-patch_binop (node, wfl_op1, wfl_op2)
- tree node;
- tree wfl_op1;
- tree wfl_op2;
-{
- tree op1 = TREE_OPERAND (node, 0);
- tree op2 = TREE_OPERAND (node, 1);
- tree op1_type = TREE_TYPE (op1);
- tree op2_type = TREE_TYPE (op2);
- tree prom_type = NULL_TREE;
- int code = TREE_CODE (node);
-
- /* If 1, tell the routine that we have to return error_mark_node
- after checking for the initialization of the RHS */
- int error_found = 0;
-
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- switch (code)
- {
- /* 15.16 Multiplicative operators */
- case MULT_EXPR: /* 15.16.1 Multiplication Operator * */
- case RDIV_EXPR: /* 15.16.2 Division Operator / */
- case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */
- if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
- {
- if (!JPRIMITIVE_TYPE_P (op1_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
- if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- break;
- }
- prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
- /* Change the division operator if necessary */
- if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
- TREE_SET_CODE (node, TRUNC_DIV_EXPR);
-
- /* This one is more complicated. FLOATs are processed by a
- function call to soft_fmod. Duplicate the value of the
- COMPOUND_ASSIGN_P flag. */
- if (code == TRUNC_MOD_EXPR)
- {
- tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
- COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node);
- TREE_SIDE_EFFECTS (mod)
- = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
- return mod;
- }
- break;
-
- /* 15.17 Additive Operators */
- case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */
-
- /* Operation is valid if either one argument is a string
- constant, a String object or a StringBuffer crafted for the
- purpose of the a previous usage of the String concatenation
- operator */
-
- if (TREE_CODE (op1) == STRING_CST
- || TREE_CODE (op2) == STRING_CST
- || JSTRING_TYPE_P (op1_type)
- || JSTRING_TYPE_P (op2_type)
- || IS_CRAFTED_STRING_BUFFER_P (op1)
- || IS_CRAFTED_STRING_BUFFER_P (op2))
- return build_string_concatenation (op1, op2);
-
- case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for
- Numeric Types */
- if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
- {
- if (!JPRIMITIVE_TYPE_P (op1_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
- if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- break;
- }
- prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
- break;
-
- /* 15.18 Shift Operators */
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case URSHIFT_EXPR:
- if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type))
- {
- if (!JINTEGRAL_TYPE_P (op1_type))
- ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
- else
- parse_error_context
- (wfl_operator, (JPRIMITIVE_TYPE_P (op2_type) ?
- "Incompatible type for `%s'. Explicit cast needed to convert "
- "shift distance from `%s' to integral" :
- "Incompatible type for `%s'. Can't convert shift distance from "
- "`%s' to integral"),
- operator_string (node), lang_printable_name (op2_type, 0));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- break;
- }
-
- /* Unary numeric promotion (5.6.1) is performed on each operand
- separatly */
- op1 = do_unary_numeric_promotion (op1);
- op2 = do_unary_numeric_promotion (op2);
-
- /* The type of the shift expression is the type of the promoted
- type of the left-hand operand */
- prom_type = TREE_TYPE (op1);
-
- /* Shift int only up to 0x1f and long up to 0x3f */
- if (prom_type == int_type_node)
- op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
- build_int_2 (0x1f, 0)));
- else
- op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
- build_int_2 (0x3f, 0)));
-
- /* The >>> operator is a >> operating on unsigned quantities */
- if (code == URSHIFT_EXPR && ! flag_emit_class_files)
- {
- tree to_return;
- tree utype = unsigned_type (prom_type);
- op1 = convert (utype, op1);
- TREE_SET_CODE (node, RSHIFT_EXPR);
- TREE_OPERAND (node, 0) = op1;
- TREE_OPERAND (node, 1) = op2;
- TREE_TYPE (node) = utype;
- to_return = convert (prom_type, node);
- /* Copy the original value of the COMPOUND_ASSIGN_P flag */
- COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node);
- TREE_SIDE_EFFECTS (to_return)
- = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
- return to_return;
- }
- break;
-
- /* 15.19.1 Type Comparison Operator instaceof */
- case INSTANCEOF_EXPR:
-
- TREE_TYPE (node) = boolean_type_node;
-
- if (!(op2_type = resolve_type_during_patch (op2)))
- return error_mark_node;
-
- /* The first operand must be a reference type or the null type */
- if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node)
- error_found = 1; /* Error reported further below */
-
- /* The second operand must be a reference type */
- if (!JREFERENCE_TYPE_P (op2_type))
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
- parse_error_context
- (wfl_operator, "Invalid argument `%s' for `instanceof'",
- lang_printable_name (op2_type, 0));
- error_found = 1;
- }
-
- if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1))
- {
- /* If the first operand is null, the result is always false */
- if (op1 == null_pointer_node)
- return boolean_false_node;
- else if (flag_emit_class_files)
- {
- TREE_OPERAND (node, 1) = op2_type;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1);
- return node;
- }
- /* Otherwise we have to invoke instance of to figure it out */
- else
- {
- tree call =
- build (CALL_EXPR, boolean_type_node,
- build_address_of (soft_instanceof_node),
- tree_cons
- (NULL_TREE, op1,
- build_tree_list (NULL_TREE,
- build_class_ref (op2_type))),
- NULL_TREE);
- TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1);
- return call;
- }
- }
- /* There is no way the expression operand can be an instance of
- the type operand. This is a compile time error. */
- else
- {
- char *t1 = strdup (lang_printable_name (op1_type, 0));
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context
- (wfl_operator, "Impossible for `%s' to be instance of `%s'",
- t1, lang_printable_name (op2_type, 0));
- free (t1);
- error_found = 1;
- }
-
- break;
-
- /* 15.21 Bitwise and Logical Operators */
- case BIT_AND_EXPR:
- case BIT_XOR_EXPR:
- case BIT_IOR_EXPR:
- if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type))
- /* Binary numeric promotion is performed on both operand and the
- expression retain that type */
- prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
-
- else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
- && TREE_CODE (op1_type) == BOOLEAN_TYPE)
- /* The type of the bitwise operator expression is BOOLEAN */
- prom_type = boolean_type_node;
- else
- {
- if (!JINTEGRAL_TYPE_P (op1_type))
- ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
- if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type))
- ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- /* Insert a break here if adding thing before the switch's
- break for this case */
- }
- break;
-
- /* 15.22 Conditional-And Operator */
- case TRUTH_ANDIF_EXPR:
- /* 15.23 Conditional-Or Operator */
- case TRUTH_ORIF_EXPR:
- /* Operands must be of BOOLEAN type */
- if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
- TREE_CODE (op2_type) != BOOLEAN_TYPE)
- {
- if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
- ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type);
- if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type))
- ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type);
- TREE_TYPE (node) = boolean_type_node;
- error_found = 1;
- break;
- }
- /* The type of the conditional operators is BOOLEAN */
- prom_type = boolean_type_node;
- break;
-
- /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
- case LT_EXPR:
- case GT_EXPR:
- case LE_EXPR:
- case GE_EXPR:
- /* The type of each of the operands must be a primitive numeric
- type */
- if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type))
- {
- if (!JNUMERIC_TYPE_P (op1_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
- if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
- TREE_TYPE (node) = boolean_type_node;
- error_found = 1;
- break;
- }
- /* Binary numeric promotion is performed on the operands */
- binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
- /* The type of the relation expression is always BOOLEAN */
- prom_type = boolean_type_node;
- break;
-
- /* 15.20 Equality Operator */
- case EQ_EXPR:
- case NE_EXPR:
- /* 15.20.1 Numerical Equality Operators == and != */
- /* Binary numeric promotion is performed on the operands */
- if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
- binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
-
- /* 15.20.2 Boolean Equality Operators == and != */
- else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
- TREE_CODE (op2_type) == BOOLEAN_TYPE)
- ; /* Nothing to do here */
-
- /* 15.20.3 Reference Equality Operators == and != */
- /* Types have to be either references or the null type. If
- they're references, it must be possible to convert either
- type to the other by casting conversion. */
- else if (op1 == null_pointer_node || op2 == null_pointer_node
- || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type)
- && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1)
- || valid_ref_assignconv_cast_p (op2_type,
- op1_type, 1))))
- ; /* Nothing to do here */
-
- /* Else we have an error figure what can't be converted into
- what and report the error */
- else
- {
- char *t1;
- t1 = strdup (lang_printable_name (op1_type, 0));
- parse_error_context
- (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' "
- "to `%s'", operator_string (node), t1,
- lang_printable_name (op2_type, 0));
- free (t1);
- TREE_TYPE (node) = boolean_type_node;
- error_found = 1;
- break;
- }
- prom_type = boolean_type_node;
- break;
- }
-
- if (error_found)
- return error_mark_node;
-
- TREE_OPERAND (node, 0) = op1;
- TREE_OPERAND (node, 1) = op2;
- TREE_TYPE (node) = prom_type;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
-
- if (flag_emit_xref)
- return node;
-
- /* fold does not respect side-effect order as required for Java but not C.
- * Also, it sometimes create SAVE_EXPRs which are bad when emitting
- * bytecode.
- */
- if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2))
- : ! TREE_SIDE_EFFECTS (node))
- node = fold (node);
- return node;
-}
-
-/* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
- zero value, the value of CSTE comes after the valude of STRING */
-
-static tree
-do_merge_string_cste (cste, string, string_len, after)
- tree cste;
- char *string;
- int string_len, after;
-{
- int len = TREE_STRING_LENGTH (cste) + string_len;
- char *old = TREE_STRING_POINTER (cste);
- TREE_STRING_LENGTH (cste) = len;
- TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
- if (after)
- {
- strcpy (TREE_STRING_POINTER (cste), string);
- strcat (TREE_STRING_POINTER (cste), old);
- }
- else
- {
- strcpy (TREE_STRING_POINTER (cste), old);
- strcat (TREE_STRING_POINTER (cste), string);
- }
- return cste;
-}
-
-/* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
- new STRING_CST on success, NULL_TREE on failure */
-
-static tree
-merge_string_cste (op1, op2, after)
- tree op1, op2;
- int after;
-{
- /* Handle two string constants right away */
- if (TREE_CODE (op2) == STRING_CST)
- return do_merge_string_cste (op1, TREE_STRING_POINTER (op2),
- TREE_STRING_LENGTH (op2), after);
-
- /* Reasonable integer constant can be treated right away */
- if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2))
- {
- static char *boolean_true = "true";
- static char *boolean_false = "false";
- static char *null_pointer = "null";
- char ch[3];
- char *string;
-
- if (op2 == boolean_true_node)
- string = boolean_true;
- else if (op2 == boolean_false_node)
- string = boolean_false;
- else if (op2 == null_pointer_node)
- string = null_pointer;
- else if (TREE_TYPE (op2) == char_type_node)
- {
- ch[0] = (char )TREE_INT_CST_LOW (op2);
- ch[1] = '\0';
- string = ch;
- }
- else
- string = print_int_node (op2);
-
- return do_merge_string_cste (op1, string, strlen (string), after);
- }
- return NULL_TREE;
-}
-
-/* Tries to statically concatenate OP1 and OP2 if possible. Either one
- has to be a STRING_CST and the other part must be a STRING_CST or a
- INTEGRAL constant. Return a new STRING_CST if the operation
- succeed, NULL_TREE otherwise.
-
- If the case we want to optimize for space, we might want to return
- NULL_TREE for each invocation of this routine. FIXME */
-
-static tree
-string_constant_concatenation (op1, op2)
- tree op1, op2;
-{
- if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST))
- {
- tree string, rest;
- int invert;
-
- string = (TREE_CODE (op1) == STRING_CST ? op1 : op2);
- rest = (string == op1 ? op2 : op1);
- invert = (string == op1 ? 0 : 1 );
-
- /* Walk REST, only if it looks reasonable */
- if (TREE_CODE (rest) != STRING_CST
- && !IS_CRAFTED_STRING_BUFFER_P (rest)
- && !JSTRING_TYPE_P (TREE_TYPE (rest))
- && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION)
- {
- rest = java_complete_tree (rest);
- if (rest == error_mark_node)
- return error_mark_node;
- rest = fold (rest);
- }
- return merge_string_cste (string, rest, invert);
- }
- return NULL_TREE;
-}
-
-/* Implement the `+' operator. Does static optimization if possible,
- otherwise create (if necessary) and append elements to a
- StringBuffer. The StringBuffer will be carried around until it is
- used for a function call or an assignment. Then toString() will be
- called on it to turn it into a String object. */
-
-static tree
-build_string_concatenation (op1, op2)
- tree op1, op2;
-{
- tree result;
- int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
-
- if (flag_emit_xref)
- return build (PLUS_EXPR, string_type_node, op1, op2);
-
- /* Try to do some static optimization */
- if ((result = string_constant_concatenation (op1, op2)))
- return result;
-
- /* Discard empty strings on either side of the expression */
- if (TREE_CODE (op1) == STRING_CST && TREE_STRING_LENGTH (op1) == 0)
- {
- op1 = op2;
- op2 = NULL_TREE;
- }
- else if (TREE_CODE (op2) == STRING_CST && TREE_STRING_LENGTH (op2) == 0)
- op2 = NULL_TREE;
-
- /* If operands are string constant, turn then into object references */
- if (TREE_CODE (op1) == STRING_CST)
- op1 = patch_string_cst (op1);
- if (op2 && TREE_CODE (op2) == STRING_CST)
- op2 = patch_string_cst (op2);
-
- /* If either one of the constant is null and the other non null
- operand is a String object, return it. */
- if (JSTRING_TYPE_P (TREE_TYPE (op1)) && !op2)
- return op1;
-
- /* If OP1 isn't already a StringBuffer, create and
- initialize a new one */
- if (!IS_CRAFTED_STRING_BUFFER_P (op1))
- {
- /* Two solutions here:
- 1) OP1 is a string reference, we call new StringBuffer(OP1)
- 2) OP1 is something else, we call new StringBuffer().append(OP1). */
- if (JSTRING_TYPE_P (TREE_TYPE (op1)))
- op1 = BUILD_STRING_BUFFER (op1);
- else
- {
- tree aNew = BUILD_STRING_BUFFER (NULL_TREE);
- op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0);
- }
- }
-
- if (op2)
- {
- /* OP1 is no longer the last node holding a crafted StringBuffer */
- IS_CRAFTED_STRING_BUFFER_P (op1) = 0;
- /* Create a node for `{new...,xxx}.append (op2)' */
- if (op2)
- op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
- }
-
- /* Mark the last node holding a crafted StringBuffer */
- IS_CRAFTED_STRING_BUFFER_P (op1) = 1;
-
- TREE_SIDE_EFFECTS (op1) = side_effects;
- return op1;
-}
-
-/* Patch the string node NODE. NODE can be a STRING_CST of a crafted
- StringBuffer. If no string were found to be patched, return
- NULL. */
-
-static tree
-patch_string (node)
- tree node;
-{
- if (node == error_mark_node)
- return error_mark_node;
- if (TREE_CODE (node) == STRING_CST)
- return patch_string_cst (node);
- else if (IS_CRAFTED_STRING_BUFFER_P (node))
- {
- int saved = ctxp->explicit_constructor_p;
- tree invoke = build_method_invocation (wfl_to_string, NULL_TREE);
- tree ret;
- /* Temporary disable forbid the use of `this'. */
- ctxp->explicit_constructor_p = 0;
- ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
- /* Restore it at its previous value */
- ctxp->explicit_constructor_p = saved;
- return ret;
- }
- return NULL_TREE;
-}
-
-/* Build the internal representation of a string constant. */
-
-static tree
-patch_string_cst (node)
- tree node;
-{
- int location;
- if (! flag_emit_class_files)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- node = get_identifier (TREE_STRING_POINTER (node));
- location = alloc_name_constant (CONSTANT_String, node);
- node = build_ref_from_constant_pool (location);
- }
- TREE_TYPE (node) = string_ptr_type_node;
- TREE_CONSTANT (node) = 1;
- return node;
-}
-
-/* Build an incomplete unary operator expression. */
-
-static tree
-build_unaryop (op_token, op_location, op1)
- int op_token, op_location;
- tree op1;
-{
- enum tree_code op;
- tree unaryop;
- switch (op_token)
- {
- case PLUS_TK: op = UNARY_PLUS_EXPR; break;
- case MINUS_TK: op = NEGATE_EXPR; break;
- case NEG_TK: op = TRUTH_NOT_EXPR; break;
- case NOT_TK: op = BIT_NOT_EXPR; break;
- default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
- op_token);
- }
-
- unaryop = build1 (op, NULL_TREE, op1);
- TREE_SIDE_EFFECTS (unaryop) = 1;
- /* Store the location of the operator, for better error report. The
- string of the operator will be rebuild based on the OP value. */
- EXPR_WFL_LINECOL (unaryop) = op_location;
- return unaryop;
-}
-
-/* Special case for the ++/-- operators, since they require an extra
- argument to build, which is set to NULL and patched
- later. IS_POST_P is 1 if the operator, 0 otherwise. */
-
-static tree
-build_incdec (op_token, op_location, op1, is_post_p)
- int op_token, op_location;
- tree op1;
- int is_post_p;
-{
- static enum tree_code lookup [2][2] =
- {
- { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
- { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
- };
- tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
- NULL_TREE, op1, NULL_TREE);
- TREE_SIDE_EFFECTS (node) = 1;
- /* Store the location of the operator, for better error report. The
- string of the operator will be rebuild based on the OP value. */
- EXPR_WFL_LINECOL (node) = op_location;
- return node;
-}
-
-/* Build an incomplete cast operator, based on the use of the
- CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
- set. java_complete_tree is trained to walk a CONVERT_EXPR even
- though its type is already set. */
-
-static tree
-build_cast (location, type, exp)
- int location;
- tree type, exp;
-{
- tree node = build1 (CONVERT_EXPR, type, exp);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* 15.14 Unary operators. We return error_mark_node in case of error,
- but preserve the type of NODE if the type is fixed. */
-
-static tree
-patch_unaryop (node, wfl_op)
- tree node;
- tree wfl_op;
-{
- tree op = TREE_OPERAND (node, 0);
- tree op_type = TREE_TYPE (op);
- tree prom_type = NULL_TREE, value, decl;
- int code = TREE_CODE (node);
- int error_found = 0;
-
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- switch (code)
- {
- /* 15.13.2 Postfix Increment Operator ++ */
- case POSTINCREMENT_EXPR:
- /* 15.13.3 Postfix Increment Operator -- */
- case POSTDECREMENT_EXPR:
- /* 15.14.1 Prefix Increment Operator ++ */
- case PREINCREMENT_EXPR:
- /* 15.14.2 Prefix Decrement Operator -- */
- case PREDECREMENT_EXPR:
- decl = strip_out_static_field_access_decl (op);
- /* We really should have a JAVA_ARRAY_EXPR to avoid this */
- if (!JDECL_P (decl)
- && TREE_CODE (decl) != COMPONENT_REF
- && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF)
- && TREE_CODE (decl) != INDIRECT_REF
- && !(TREE_CODE (decl) == COMPOUND_EXPR
- && TREE_OPERAND (decl, 1)
- && (TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF)))
- {
- tree lvalue;
- /* Before screaming, check that we're not in fact trying to
- increment a optimized static final access, in which case
- we issue an different error message. */
- if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION
- && resolve_expression_name (wfl_op, &lvalue)
- && check_final_assignment (lvalue, wfl_op)))
- parse_error_context (wfl_operator, "Invalid argument to `%s'",
- operator_string (node));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- else if (check_final_assignment (op, wfl_op))
- error_found = 1;
-
- /* From now on, we know that op if a variable and that it has a
- valid wfl. We use wfl_op to locate errors related to the
- ++/-- operand. */
- else if (!JNUMERIC_TYPE_P (op_type))
- {
- parse_error_context
- (wfl_op, "Invalid argument type `%s' to `%s'",
- lang_printable_name (op_type, 0), operator_string (node));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- else
- {
- /* Before the addition, binary numeric promotion is performed on
- both operands */
- value = build_int_2 (1, 0);
- TREE_TYPE (node) =
- binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value);
- /* And write the promoted incremented and increment */
- TREE_OPERAND (node, 0) = op;
- TREE_OPERAND (node, 1) = value;
- /* Convert the overall back into its original type. */
- return fold (convert (op_type, node));
- }
- break;
-
- /* 15.14.3 Unary Plus Operator + */
- case UNARY_PLUS_EXPR:
- /* 15.14.4 Unary Minus Operator - */
- case NEGATE_EXPR:
- if (!JNUMERIC_TYPE_P (op_type))
- {
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- /* Unary numeric promotion is performed on operand */
- else
- {
- op = do_unary_numeric_promotion (op);
- prom_type = TREE_TYPE (op);
- if (code == UNARY_PLUS_EXPR)
- return fold (op);
- }
- break;
-
- /* 15.14.5 Bitwise Complement Operator ~ */
- case BIT_NOT_EXPR:
- if (!JINTEGRAL_TYPE_P (op_type))
- {
- ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- else
- {
- op = do_unary_numeric_promotion (op);
- prom_type = TREE_TYPE (op);
- }
- break;
-
- /* 15.14.6 Logical Complement Operator ! */
- case TRUTH_NOT_EXPR:
- if (TREE_CODE (op_type) != BOOLEAN_TYPE)
- {
- ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type);
- /* But the type is known. We will report an error if further
- attempt of a assignment is made with this rhs */
- TREE_TYPE (node) = boolean_type_node;
- error_found = 1;
- }
- else
- prom_type = boolean_type_node;
- break;
-
- /* 15.15 Cast Expression */
- case CONVERT_EXPR:
- value = patch_cast (node, wfl_operator);
- if (value == error_mark_node)
- {
- /* If this cast is part of an assignment, we tell the code
- that deals with it not to complain about a mismatch,
- because things have been cast, anyways */
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- else
- {
- value = fold (value);
- TREE_SIDE_EFFECTS (value) = TREE_SIDE_EFFECTS (op);
- return value;
- }
- break;
- }
-
- if (error_found)
- return error_mark_node;
-
- /* There are cases where node has been replaced by something else
- and we don't end up returning here: UNARY_PLUS_EXPR,
- CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
- TREE_OPERAND (node, 0) = fold (op);
- TREE_TYPE (node) = prom_type;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op);
- return fold (node);
-}
-
-/* Generic type resolution that sometimes takes place during node
- patching. Returned the resolved type or generate an error
- message. Return the resolved type or NULL_TREE. */
-
-static tree
-resolve_type_during_patch (type)
- tree type;
-{
- if (unresolved_type_p (type, NULL))
- {
- tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE);
- if (!type_decl)
- {
- parse_error_context (type,
- "Class `%s' not found in type declaration",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
- return NULL_TREE;
- }
- else
- {
- CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1;
- return TREE_TYPE (type_decl);
- }
- }
- return type;
-}
-/* 5.5 Casting Conversion. error_mark_node is returned if an error is
- found. Otherwise NODE or something meant to replace it is returned. */
-
-static tree
-patch_cast (node, wfl_operator)
- tree node;
- tree wfl_operator;
-{
- tree op = TREE_OPERAND (node, 0);
- tree op_type = TREE_TYPE (op);
- tree cast_type = TREE_TYPE (node);
- char *t1;
-
- /* First resolve OP_TYPE if unresolved */
- if (!(cast_type = resolve_type_during_patch (cast_type)))
- return error_mark_node;
-
- /* Check on cast that are proven correct at compile time */
- if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
- {
- static tree convert_narrow ();
- /* Same type */
- if (cast_type == op_type)
- return node;
-
- /* float and double type are converted to the original type main
- variant and then to the target type. */
- if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE)
- op = convert (integer_type_node, op);
-
- /* Try widening/narowwing convertion. Potentially, things need
- to be worked out in gcc so we implement the extreme cases
- correctly. fold_convert() needs to be fixed. */
- return convert (cast_type, op);
- }
-
- /* It's also valid to cast a boolean into a boolean */
- if (op_type == boolean_type_node && cast_type == boolean_type_node)
- return node;
-
- /* null can be casted to references */
- if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type))
- return build_null_of_type (cast_type);
-
- /* The remaining legal casts involve conversion between reference
- types. Check for their compile time correctness. */
- if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
- && valid_ref_assignconv_cast_p (op_type, cast_type, 1))
- {
- TREE_TYPE (node) = promote_type (cast_type);
- /* Now, the case can be determined correct at compile time if
- OP_TYPE can be converted into CAST_TYPE by assignment
- conversion (5.2) */
-
- if (valid_ref_assignconv_cast_p (op_type, cast_type, 0))
- {
- TREE_SET_CODE (node, NOP_EXPR);
- return node;
- }
-
- if (flag_emit_class_files)
- {
- TREE_SET_CODE (node, CONVERT_EXPR);
- return node;
- }
-
- /* The cast requires a run-time check */
- return build (CALL_EXPR, promote_type (cast_type),
- build_address_of (soft_checkcast_node),
- tree_cons (NULL_TREE, build_class_ref (cast_type),
- build_tree_list (NULL_TREE, op)),
- NULL_TREE);
- }
-
- /* Any other casts are proven incorrect at compile time */
- t1 = strdup (lang_printable_name (op_type, 0));
- parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
- t1, lang_printable_name (cast_type, 0));
- free (t1);
- return error_mark_node;
-}
-
-/* Build a null constant and give it the type TYPE. */
-
-static tree
-build_null_of_type (type)
- tree type;
-{
- tree node = build_int_2 (0, 0);
- TREE_TYPE (node) = promote_type (type);
- return node;
-}
-
-/* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
- a list of indices. */
-static tree
-build_array_ref (location, array, index)
- int location;
- tree array, index;
-{
- tree node = build (ARRAY_REF, NULL_TREE, array, index);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* 15.12 Array Access Expression */
-
-static tree
-patch_array_ref (node)
- tree node;
-{
- tree array = TREE_OPERAND (node, 0);
- tree array_type = TREE_TYPE (array);
- tree index = TREE_OPERAND (node, 1);
- tree index_type = TREE_TYPE (index);
- int error_found = 0;
-
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- if (TREE_CODE (array_type) == POINTER_TYPE)
- array_type = TREE_TYPE (array_type);
-
- /* The array reference must be an array */
- if (!TYPE_ARRAY_P (array_type))
- {
- parse_error_context
- (wfl_operator, "`[]' can only be applied to arrays. It can't be "
- "applied to `%s'", lang_printable_name (array_type, 0));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
-
- /* The array index underdoes unary numeric promotion. The promoted
- type must be int */
- index = do_unary_numeric_promotion (index);
- if (TREE_TYPE (index) != int_type_node)
- {
- int could_cast = valid_cast_to_p (index_type, int_type_node);
- parse_error_context
- (wfl_operator,
- (could_cast ? "Incompatible type for `[]'. Explicit cast needed to "
- "convert `%s' to `int'" : "Incompatible type for `[]'. "
- "Can't convert `%s' to `int'"),
- lang_printable_name (index_type, 0));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
-
- if (error_found)
- return error_mark_node;
-
- array_type = TYPE_ARRAY_ELEMENT (array_type);
-
- if (flag_emit_class_files || flag_emit_xref)
- {
- TREE_OPERAND (node, 0) = array;
- TREE_OPERAND (node, 1) = index;
- }
- else
- {
- /* The save_expr is for correct evaluation order. It would be cleaner
- to use force_evaluation_order (see comment there), but that is
- difficult when we also have to deal with bounds checking. */
- if (TREE_SIDE_EFFECTS (index))
- array = save_expr (array);
- node = build_java_arrayaccess (array, array_type, index);
- if (TREE_SIDE_EFFECTS (index))
- node = build (COMPOUND_EXPR, array_type, array, node);
- }
- TREE_TYPE (node) = array_type;
- return node;
-}
-
-/* 15.9 Array Creation Expressions */
-
-static tree
-build_newarray_node (type, dims, extra_dims)
- tree type;
- tree dims;
- int extra_dims;
-{
- tree node =
- build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims),
- build_int_2 (extra_dims, 0));
- return node;
-}
-
-static tree
-patch_newarray (node)
- tree node;
-{
- tree type = TREE_OPERAND (node, 0);
- tree dims = TREE_OPERAND (node, 1);
- tree cdim, array_type;
- int error_found = 0;
- int ndims = 0;
- int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2));
-
- /* Dimension types are verified. It's better for the types to be
- verified in order. */
- for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ )
- {
- int dim_error = 0;
- tree dim = TREE_VALUE (cdim);
-
- /* Dim might have been saved during its evaluation */
- dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim);
-
- /* The type of each specified dimension must be an integral type. */
- if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim)))
- dim_error = 1;
-
- /* Each expression undergoes an unary numeric promotion (5.6.1) and the
- promoted type must be int. */
- else
- {
- dim = do_unary_numeric_promotion (dim);
- if (TREE_TYPE (dim) != int_type_node)
- dim_error = 1;
- }
-
- /* Report errors on types here */
- if (dim_error)
- {
- parse_error_context
- (TREE_PURPOSE (cdim),
- "Incompatible type for dimension in array creation expression. "
- "%s convert `%s' to `int'",
- (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
- "Explicit cast needed to" : "Can't"),
- lang_printable_name (TREE_TYPE (dim), 0));
- error_found = 1;
- }
-
- TREE_PURPOSE (cdim) = NULL_TREE;
- }
-
- /* Resolve array base type if unresolved */
- if (!(type = resolve_type_during_patch (type)))
- error_found = 1;
-
- if (error_found)
- {
- /* We don't want further evaluation of this bogus array creation
- operation */
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
-
- /* Set array_type to the actual (promoted) array type of the result. */
- if (TREE_CODE (type) == RECORD_TYPE)
- type = build_pointer_type (type);
- while (--xdims >= 0)
- {
- type = promote_type (build_java_array_type (type, -1));
- }
- dims = nreverse (dims);
- array_type = type;
- for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim))
- {
- type = array_type;
- array_type = build_java_array_type (type,
- TREE_CODE (cdim) == INTEGER_CST ?
- TREE_INT_CST_LOW (cdim) : -1);
- array_type = promote_type (array_type);
- }
- dims = nreverse (dims);
-
- /* The node is transformed into a function call. Things are done
- differently according to the number of dimensions. If the number
- of dimension is equal to 1, then the nature of the base type
- (primitive or not) matters. */
- if (ndims == 1)
- return build_new_array (type, TREE_VALUE (dims));
-
- /* Can't reuse what's already written in expr.c because it uses the
- JVM stack representation. Provide a build_multianewarray. FIXME */
- return build (CALL_EXPR, array_type,
- build_address_of (soft_multianewarray_node),
- tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)),
- tree_cons (NULL_TREE,
- build_int_2 (ndims, 0), dims )),
- NULL_TREE);
-}
-
-/* 10.6 Array initializer. */
-
-/* Build a wfl for array element that don't have one, so we can
- pin-point errors. */
-
-static tree
-maybe_build_array_element_wfl (node)
- tree node;
-{
- if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
- return build_expr_wfl (NULL_TREE, ctxp->filename,
- ctxp->elc.line, ctxp->elc.prev_col);
- else
- return NULL_TREE;
-}
-
-/* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
- identification of initialized arrays easier to detect during walk
- and expansion. */
-
-static tree
-build_new_array_init (location, values)
- int location;
- tree values;
-{
- tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values);
- tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor);
- EXPR_WFL_LINECOL (to_return) = location;
- return to_return;
-}
-
-/* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
- occurred. Otherwise return NODE after having set its type
- appropriately. */
-
-static tree
-patch_new_array_init (type, node)
- tree type, node;
-{
- int error_seen = 0;
- tree current, element_type;
- HOST_WIDE_INT length;
- int all_constant = 1;
- tree init = TREE_OPERAND (node, 0);
-
- if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type)))
- {
- parse_error_context (node,
- "Invalid array initializer for non-array type `%s'",
- lang_printable_name (type, 1));
- return error_mark_node;
- }
- type = TREE_TYPE (type);
- element_type = TYPE_ARRAY_ELEMENT (type);
-
- CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init));
-
- for (length = 0, current = CONSTRUCTOR_ELTS (init);
- current; length++, current = TREE_CHAIN (current))
- {
- tree elt = TREE_VALUE (current);
- if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
- {
- error_seen |= array_constructor_check_entry (element_type, current);
- elt = TREE_VALUE (current);
- /* When compiling to native code, STRING_CST is converted to
- INDIRECT_REF, but still with a TREE_CONSTANT flag. */
- if (! TREE_CONSTANT (elt) || TREE_CODE (elt) == INDIRECT_REF)
- all_constant = 0;
- }
- else
- {
- TREE_VALUE (current) = patch_new_array_init (element_type, elt);
- TREE_PURPOSE (current) = NULL_TREE;
- all_constant = 0;
- }
- if (elt && TREE_VALUE (elt) == error_mark_node)
- error_seen = 1;
- }
-
- if (error_seen)
- return error_mark_node;
-
- /* Create a new type. We can't reuse the one we have here by
- patching its dimension because it originally is of dimension -1
- hence reused by gcc. This would prevent triangular arrays. */
- type = build_java_array_type (element_type, length);
- TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
- TREE_TYPE (node) = promote_type (type);
- TREE_CONSTANT (init) = all_constant;
- TREE_CONSTANT (node) = all_constant;
- return node;
-}
-
-/* Verify that one entry of the initializer element list can be
- assigned to the array base type. Report 1 if an error occurred, 0
- otherwise. */
-
-static int
-array_constructor_check_entry (type, entry)
- tree type, entry;
-{
- char *array_type_string = NULL; /* For error reports */
- tree value, type_value, new_value, wfl_value, patched;
- int error_seen = 0;
-
- new_value = NULL_TREE;
- wfl_value = TREE_VALUE (entry);
-
- value = java_complete_tree (TREE_VALUE (entry));
- /* patch_string return error_mark_node if arg is error_mark_node */
- if ((patched = patch_string (value)))
- value = patched;
- if (value == error_mark_node)
- return 1;
-
- type_value = TREE_TYPE (value);
-
- /* At anytime, try_builtin_assignconv can report a warning on
- constant overflow during narrowing. */
- SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value);
- new_value = try_builtin_assignconv (wfl_operator, type, value);
- if (!new_value && (new_value = try_reference_assignconv (type, value)))
- type_value = promote_type (type);
-
- /* Check and report errors */
- if (!new_value)
- {
- char *msg = (!valid_cast_to_p (type_value, type) ?
- "Can't" : "Explicit cast needed to");
- if (!array_type_string)
- array_type_string = strdup (lang_printable_name (type, 1));
- parse_error_context
- (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
- msg, lang_printable_name (type_value, 1), array_type_string);
- error_seen = 1;
- }
-
- if (new_value)
- {
- new_value = maybe_build_primttype_type_ref (new_value, wfl_operator);
- TREE_VALUE (entry) = new_value;
- }
-
- if (array_type_string)
- free (array_type_string);
-
- TREE_PURPOSE (entry) = NULL_TREE;
- return error_seen;
-}
-
-static tree
-build_this (location)
- int location;
-{
- tree node = build_wfl_node (this_identifier_node);
- TREE_SET_CODE (node, THIS_EXPR);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* 14.15 The return statement. It builds a modify expression that
- assigns the returned value to the RESULT_DECL that hold the value
- to be returned. */
-
-static tree
-build_return (location, op)
- int location;
- tree op;
-{
- tree node = build1 (RETURN_EXPR, NULL_TREE, op);
- EXPR_WFL_LINECOL (node) = location;
- node = build_debugable_stmt (location, node);
- return node;
-}
-
-static tree
-patch_return (node)
- tree node;
-{
- tree return_exp = TREE_OPERAND (node, 0);
- tree meth = current_function_decl;
- tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl));
- int error_found = 0;
-
- TREE_TYPE (node) = error_mark_node;
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* It's invalid to have a return value within a function that is
- declared with the keyword void or that is a constructor */
- if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth)))
- error_found = 1;
-
- /* It's invalid to use a return statement in a static block */
- if (IS_CLINIT (current_function_decl))
- error_found = 1;
-
- /* It's invalid to have a no return value within a function that
- isn't declared with the keyword `void' */
- if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
- error_found = 2;
-
- if (error_found)
- {
- if (IS_CLINIT (current_function_decl))
- parse_error_context (wfl_operator,
- "`return' inside static initializer.");
-
- else if (!DECL_CONSTRUCTOR_P (meth))
- {
- char *t = strdup (lang_printable_name (mtype, 0));
- parse_error_context (wfl_operator,
- "`return' with%s value from `%s %s'",
- (error_found == 1 ? "" : "out"),
- t, lang_printable_name (meth, 0));
- free (t);
- }
- else
- parse_error_context (wfl_operator,
- "`return' with value from constructor `%s'",
- lang_printable_name (meth, 0));
- return error_mark_node;
- }
-
- /* If we have a return_exp, build a modify expression and expand
- it. Note: at that point, the assignment is declared valid, but we
- may want to carry some more hacks */
- if (return_exp)
- {
- tree exp = java_complete_tree (return_exp);
- tree modify, patched;
-
- /* If the function returned value and EXP are booleans, EXP has
- to be converted into the type of DECL_RESULT, which is integer
- (see complete_start_java_method) */
- if (TREE_TYPE (exp) == boolean_type_node &&
- TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node)
- exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp);
-
- /* `null' can be assigned to a function returning a reference */
- if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) &&
- exp == null_pointer_node)
- exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth)));
-
- if ((patched = patch_string (exp)))
- exp = patched;
-
- modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp);
- EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
- modify = java_complete_tree (modify);
-
- if (modify != error_mark_node)
- {
- TREE_SIDE_EFFECTS (modify) = 1;
- TREE_OPERAND (node, 0) = modify;
- }
- else
- return error_mark_node;
- }
- TREE_TYPE (node) = void_type_node;
- TREE_SIDE_EFFECTS (node) = 1;
- return node;
-}
-
-/* 14.8 The if Statement */
-
-static tree
-build_if_else_statement (location, expression, if_body, else_body)
- int location;
- tree expression, if_body, else_body;
-{
- tree node;
- if (!else_body)
- else_body = empty_stmt_node;
- node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
- EXPR_WFL_LINECOL (node) = location;
- node = build_debugable_stmt (location, node);
- return node;
-}
-
-static tree
-patch_if_else_statement (node)
- tree node;
-{
- tree expression = TREE_OPERAND (node, 0);
-
- TREE_TYPE (node) = error_mark_node;
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* The type of expression must be boolean */
- if (TREE_TYPE (expression) != boolean_type_node
- && TREE_TYPE (expression) != promoted_boolean_type_node)
- {
- parse_error_context
- (wfl_operator,
- "Incompatible type for `if'. Can't convert `%s' to `boolean'",
- lang_printable_name (TREE_TYPE (expression), 0));
- return error_mark_node;
- }
-
- TREE_TYPE (node) = void_type_node;
- TREE_SIDE_EFFECTS (node) = 1;
- CAN_COMPLETE_NORMALLY (node)
- = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
- | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2));
- return node;
-}
-
-/* 14.6 Labeled Statements */
-
-/* Action taken when a lableled statement is parsed. a new
- LABELED_BLOCK_EXPR is created. No statement is attached to the
- label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */
-
-static tree
-build_labeled_block (location, label)
- int location;
- tree label;
-{
- tree label_name ;
- tree label_decl, node;
- if (label == NULL_TREE || label == continue_identifier_node)
- label_name = label;
- else
- {
- label_name = merge_qualified_name (label_id, label);
- /* Issue an error if we try to reuse a label that was previously
- declared */
- if (IDENTIFIER_LOCAL_VALUE (label_name))
- {
- EXPR_WFL_LINECOL (wfl_operator) = location;
- parse_error_context (wfl_operator, "Declaration of `%s' shadows "
- "a previous label declaration",
- IDENTIFIER_POINTER (label));
- EXPR_WFL_LINECOL (wfl_operator) =
- EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
- parse_error_context (wfl_operator, "This is the location of the "
- "previous declaration of label `%s'",
- IDENTIFIER_POINTER (label));
- java_error_count--;
- }
- }
-
- label_decl = create_label_decl (label_name);
- node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE);
- EXPR_WFL_LINECOL (node) = location;
- TREE_SIDE_EFFECTS (node) = 1;
- return node;
-}
-
-/* A labeled statement LBE is attached a statement. */
-
-static tree
-finish_labeled_statement (lbe, statement)
- tree lbe; /* Labeled block expr */
- tree statement;
-{
- /* In anyways, tie the loop to its statement */
- LABELED_BLOCK_BODY (lbe) = statement;
- pop_labeled_block ();
- POP_LABELED_BLOCK ();
- return lbe;
-}
-
-/* 14.10, 14.11, 14.12 Loop Statements */
-
-/* Create an empty LOOP_EXPR and make it the last in the nested loop
- list. */
-
-static tree
-build_new_loop (loop_body)
- tree loop_body;
-{
- tree loop = build (LOOP_EXPR, NULL_TREE, loop_body);
- TREE_SIDE_EFFECTS (loop) = 1;
- PUSH_LOOP (loop);
- return loop;
-}
-
-/* Create a loop body according to the following structure:
- COMPOUND_EXPR
- COMPOUND_EXPR (loop main body)
- EXIT_EXPR (this order is for while/for loops.
- LABELED_BLOCK_EXPR the order is reversed for do loops)
- LABEL_DECL (a continue occuring here branches at the
- BODY end of this labeled block)
- INCREMENT (if any)
-
- REVERSED, if non zero, tells that the loop condition expr comes
- after the body, like in the do-while loop.
-
- To obtain a loop, the loop body structure described above is
- encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
-
- LABELED_BLOCK_EXPR
- LABEL_DECL (use this label to exit the loop)
- LOOP_EXPR
- <structure described above> */
-
-static tree
-build_loop_body (location, condition, reversed)
- int location;
- tree condition;
- int reversed;
-{
- tree first, second, body;
-
- condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */
- EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */
- condition = build_debugable_stmt (location, condition);
- TREE_SIDE_EFFECTS (condition) = 1;
-
- body = build_labeled_block (0, continue_identifier_node);
- first = (reversed ? body : condition);
- second = (reversed ? condition : body);
- return
- build (COMPOUND_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
-}
-
-/* Install CONDITION (if any) and loop BODY (using REVERSED to tell
- their order) on the current loop. Unlink the current loop from the
- loop list. */
-
-static tree
-finish_loop_body (location, condition, body, reversed)
- int location;
- tree condition, body;
- int reversed;
-{
- tree to_return = ctxp->current_loop;
- tree loop_body = LOOP_EXPR_BODY (to_return);
- if (condition)
- {
- tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed);
- /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
- The real EXIT_EXPR is one operand further. */
- EXPR_WFL_LINECOL (cnode) = location;
- /* This one is for accurate error reports */
- EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location;
- TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition;
- }
- LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body;
- POP_LOOP ();
- return to_return;
-}
-
-/* Tailored version of finish_loop_body for FOR loops, when FOR
- loops feature the condition part */
-
-static tree
-finish_for_loop (location, condition, update, body)
- int location;
- tree condition, update, body;
-{
- /* Put the condition and the loop body in place */
- tree loop = finish_loop_body (location, condition, body, 0);
- /* LOOP is the current loop which has been now popped of the loop
- stack. Install the update block */
- LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
- return loop;
-}
-
-/* If the loop isn't surrounded by a labeled statement, create one and
- insert LOOP as its body. */
-
-static tree
-patch_loop_statement (loop)
- tree loop;
-{
- tree loop_label;
- tree block = ctxp->current_labeled_block;
- TREE_TYPE (loop) = void_type_node;
- if (block != NULL_TREE)
- {
- tree block_body = LABELED_BLOCK_BODY (block);
- if (IS_FOR_LOOP_P (loop))
- {
- if (TREE_CODE (block_body) == BLOCK)
- {
- block_body = BLOCK_EXPR_BODY (block_body);
- if (block_body == loop
- || (TREE_CODE (block_body) == COMPOUND_EXPR
- && TREE_OPERAND (block_body, 1) == loop))
- return loop;
- }
- }
- else
- {
- if (block_body == loop)
- return loop;
- }
- }
- loop_label = build_labeled_block (0, NULL_TREE);
- LABELED_BLOCK_BODY (loop_label) = loop;
- PUSH_LABELED_BLOCK (loop_label);
- loop = loop_label;
- return loop;
-}
-
-/* 14.13, 14.14: break and continue Statements */
-
-/* Build a break or a continue statement. a null NAME indicates an
- unlabeled break/continue statement. */
-
-static tree
-build_bc_statement (location, is_break, name)
- int location, is_break;
- tree name;
-{
- tree break_continue, label_block_expr = NULL_TREE;
-
- if (name)
- {
- if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
- (merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
- /* Null means that we don't have a target for this named
- break/continue. In this case, we make the target to be the
- label name, so that the error can be reported accuratly in
- patch_bc_statement. */
- label_block_expr = EXPR_WFL_NODE (name);
- }
- /* Unlabeled break/continue will be handled during the
- break/continue patch operation */
- break_continue
- = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
-
- IS_BREAK_STMT_P (break_continue) = is_break;
- TREE_SIDE_EFFECTS (break_continue) = 1;
- EXPR_WFL_LINECOL (break_continue) = location;
- break_continue = build_debugable_stmt (location, break_continue);
- return break_continue;
-}
-
-/* Verification of a break/continue statement. */
-
-static tree
-patch_bc_statement (node)
- tree node;
-{
- tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
- tree labeled_block = ctxp->current_labeled_block;
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* Having an identifier here means that the target is unknown. */
- if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE)
- {
- parse_error_context (wfl_operator, "No label definition found for `%s'",
- IDENTIFIER_POINTER (bc_label));
- return error_mark_node;
- }
- if (! IS_BREAK_STMT_P (node))
- {
- /* It's a continue statement. */
- for (;; labeled_block = TREE_CHAIN (labeled_block))
- {
- if (labeled_block == NULL_TREE)
- {
- if (bc_label == NULL_TREE)
- parse_error_context (wfl_operator,
- "`continue' must be in loop");
- else
- parse_error_context
- (wfl_operator, "continue label `%s' does not name a loop",
- IDENTIFIER_POINTER (bc_label));
- return error_mark_node;
- }
- if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block))
- == continue_identifier_node)
- && (bc_label == NULL_TREE
- || TREE_CHAIN (labeled_block) == bc_label))
- {
- bc_label = labeled_block;
- break;
- }
- }
- }
- else if (!bc_label)
- {
- for (;; labeled_block = TREE_CHAIN (labeled_block))
- {
- if (labeled_block == NULL_TREE)
- {
- parse_error_context (wfl_operator,
- "`break' must be in loop or switch");
- return error_mark_node;
- }
- target_stmt = LABELED_BLOCK_BODY (labeled_block);
- if (TREE_CODE (target_stmt) == SWITCH_EXPR
- || TREE_CODE (target_stmt) == LOOP_EXPR)
- {
- bc_label = labeled_block;
- break;
- }
- }
- }
-
- EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
- CAN_COMPLETE_NORMALLY (bc_label) = 1;
-
- /* Our break/continue don't return values. */
- TREE_TYPE (node) = void_type_node;
- /* Encapsulate the break within a compound statement so that it's
- expanded all the times by expand_expr (and not clobered
- sometimes, like after a if statement) */
- node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
- TREE_SIDE_EFFECTS (node) = 1;
- return node;
-}
-
-/* Process the exit expression belonging to a loop. Its type must be
- boolean. */
-
-static tree
-patch_exit_expr (node)
- tree node;
-{
- tree expression = TREE_OPERAND (node, 0);
- TREE_TYPE (node) = error_mark_node;
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* The type of expression must be boolean */
- if (TREE_TYPE (expression) != boolean_type_node)
- {
- parse_error_context
- (wfl_operator,
- "Incompatible type for loop conditional. Can't convert `%s' to "
- "`boolean'",
- lang_printable_name (TREE_TYPE (expression), 0));
- return error_mark_node;
- }
- /* Now we know things are allright, invert the condition, fold and
- return */
- TREE_OPERAND (node, 0) =
- fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
-
- if (! integer_zerop (TREE_OPERAND (node, 0))
- && ctxp->current_loop != NULL_TREE
- && TREE_CODE (ctxp->current_loop) == LOOP_EXPR)
- CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1;
- if (! integer_onep (TREE_OPERAND (node, 0)))
- CAN_COMPLETE_NORMALLY (node) = 1;
-
-
- TREE_TYPE (node) = void_type_node;
- return node;
-}
-
-/* 14.9 Switch statement */
-
-static tree
-patch_switch_statement (node)
- tree node;
-{
- tree se = TREE_OPERAND (node, 0), se_type;
-
- /* Complete the switch expression */
- se = TREE_OPERAND (node, 0) = java_complete_tree (se);
- se_type = TREE_TYPE (se);
- /* The type of the switch expression must be char, byte, short or
- int */
- if (!JINTEGRAL_TYPE_P (se_type))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator, "Incompatible type for `switch'. "
- "Can't convert `%s' to `int'",
- lang_printable_name (se_type, 0));
- /* This is what java_complete_tree will check */
- TREE_OPERAND (node, 0) = error_mark_node;
- return error_mark_node;
- }
-
- TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
-
- /* Ready to return */
- if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK)
- {
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
- TREE_TYPE (node) = void_type_node;
- TREE_SIDE_EFFECTS (node) = 1;
- CAN_COMPLETE_NORMALLY (node)
- = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
- || ! SWITCH_HAS_DEFAULT (node);
- return node;
-}
-
-/* 14.18 The try statement */
-
-static tree
-build_try_statement (location, try_block, catches)
- int location;
- tree try_block, catches;
-{
- tree node = build (TRY_EXPR, NULL_TREE, try_block, catches);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-static tree
-build_try_finally_statement (location, try_block, finally)
- int location;
- tree try_block, finally;
-{
- tree node = build (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-static tree
-patch_try_statement (node)
- tree node;
-{
- int error_found = 0;
- tree try = TREE_OPERAND (node, 0);
- /* Exception handlers are considered in left to right order */
- tree catch = nreverse (TREE_OPERAND (node, 1));
- tree current, caught_type_list = NULL_TREE;
-
- /* Check catch clauses, if any. Every time we find an error, we try
- to process the next catch clause. We process the catch clause before
- the try block so that when processing the try block we can check thrown
- exceptions againts the caught type list. */
- for (current = catch; current; current = TREE_CHAIN (current))
- {
- tree carg_decl, carg_type;
- tree sub_current, catch_block, catch_clause;
- int unreachable;
-
- /* At this point, the structure of the catch clause is
- CATCH_EXPR (catch node)
- BLOCK (with the decl of the parameter)
- COMPOUND_EXPR
- MODIFY_EXPR (assignment of the catch parameter)
- BLOCK (catch clause block)
- */
- catch_clause = TREE_OPERAND (current, 0);
- carg_decl = BLOCK_EXPR_DECLS (catch_clause);
- carg_type = TREE_TYPE (TREE_TYPE (carg_decl));
-
- /* Catch clauses can't have more than one parameter declared,
- but it's already enforced by the grammar. Make sure that the
- only parameter of the clause statement in of class Throwable
- or a subclass of Throwable, but that was done earlier. The
- catch clause parameter type has also been resolved. */
-
- /* Just make sure that the catch clause parameter type inherits
- from java.lang.Throwable */
- if (!inherits_from_p (carg_type, throwable_type_node))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
- parse_error_context (wfl_operator,
- "Can't catch class `%s'. Catch clause "
- "parameter type must be a subclass of "
- "class `java.lang.Throwable'",
- lang_printable_name (carg_type, 0));
- error_found = 1;
- continue;
- }
-
- /* Partial check for unreachable catch statement: The catch
- clause is reachable iff is no earlier catch block A in
- the try statement such that the type of the catch
- clause's parameter is the same as or a subclass of the
- type of A's parameter */
- unreachable = 0;
- for (sub_current = catch;
- sub_current != current; sub_current = TREE_CHAIN (sub_current))
- {
- tree sub_catch_clause, decl;
- sub_catch_clause = TREE_OPERAND (sub_current, 0);
- decl = BLOCK_EXPR_DECLS (sub_catch_clause);
-
- if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl))))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
- parse_error_context
- (wfl_operator, "`catch' not reached because of the catch "
- "clause at line %d", EXPR_WFL_LINENO (sub_current));
- unreachable = error_found = 1;
- break;
- }
- }
- /* Complete the catch clause block */
- catch_block = java_complete_tree (TREE_OPERAND (current, 0));
- if (catch_block == error_mark_node)
- {
- error_found = 1;
- continue;
- }
- if (CAN_COMPLETE_NORMALLY (catch_block))
- CAN_COMPLETE_NORMALLY (node) = 1;
- TREE_OPERAND (current, 0) = catch_block;
-
- if (unreachable)
- continue;
-
- /* Things to do here: the exception must be thrown */
-
- /* Link this type to the caught type list */
- caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list);
- }
-
- PUSH_EXCEPTIONS (caught_type_list);
- if ((try = java_complete_tree (try)) == error_mark_node)
- error_found = 1;
- if (CAN_COMPLETE_NORMALLY (try))
- CAN_COMPLETE_NORMALLY (node) = 1;
- POP_EXCEPTIONS ();
-
- /* Verification ends here */
- if (error_found)
- return error_mark_node;
-
- TREE_OPERAND (node, 0) = try;
- TREE_OPERAND (node, 1) = catch;
- TREE_TYPE (node) = void_type_node;
- return node;
-}
-
-/* 14.17 The synchronized Statement */
-
-static tree
-patch_synchronized_statement (node, wfl_op1)
- tree node, wfl_op1;
-{
- tree expr = java_complete_tree (TREE_OPERAND (node, 0));
- tree block = TREE_OPERAND (node, 1);
-
- tree enter, exit, expr_decl, assignment;
-
- if (expr == error_mark_node)
- {
- block = java_complete_tree (block);
- return expr;
- }
-
- /* The TYPE of expr must be a reference type */
- if (!JREFERENCE_TYPE_P (TREE_TYPE (expr)))
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Incompatible type for `synchronized'"
- ". Can't convert `%s' to `java.lang.Object'",
- lang_printable_name (TREE_TYPE (expr), 0));
- return error_mark_node;
- }
-
- if (flag_emit_xref)
- {
- TREE_OPERAND (node, 0) = expr;
- TREE_OPERAND (node, 1) = java_complete_tree (block);
- CAN_COMPLETE_NORMALLY (node) = 1;
- return node;
- }
-
- /* Generate a try-finally for the synchronized statement, except
- that the handler that catches all throw exception calls
- _Jv_MonitorExit and then rethrow the exception.
- The synchronized statement is then implemented as:
- TRY
- {
- _Jv_MonitorEnter (expression)
- synchronized_block
- _Jv_MonitorExit (expression)
- }
- CATCH_ALL
- {
- e = _Jv_exception_info ();
- _Jv_MonitorExit (expression)
- Throw (e);
- } */
-
- expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr));
- BUILD_MONITOR_ENTER (enter, expr_decl);
- BUILD_MONITOR_EXIT (exit, expr_decl);
- CAN_COMPLETE_NORMALLY (enter) = 1;
- CAN_COMPLETE_NORMALLY (exit) = 1;
- assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
- TREE_SIDE_EFFECTS (assignment) = 1;
- node = build1 (CLEANUP_POINT_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE,
- build (WITH_CLEANUP_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE,
- assignment, enter),
- NULL_TREE, exit),
- block));
- node = build_expr_block (node, expr_decl);
-
- return java_complete_tree (node);
-}
-
-/* 14.16 The throw Statement */
-
-static tree
-patch_throw_statement (node, wfl_op1)
- tree node, wfl_op1;
-{
- tree expr = TREE_OPERAND (node, 0);
- tree type = TREE_TYPE (expr);
- int unchecked_ok = 0, tryblock_throws_ok = 0;
-
- /* Thrown expression must be assignable to java.lang.Throwable */
- if (!try_reference_assignconv (throwable_type_node, expr))
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Can't throw `%s'; it must be a "
- "subclass of class `java.lang.Throwable'",
- lang_printable_name (type, 0));
- /* If the thrown expression was a reference, we further the
- compile-time check. */
- if (!JREFERENCE_TYPE_P (type))
- return error_mark_node;
- }
-
- /* At least one of the following must be true */
-
- /* The type of the throw expression is a not checked exception,
- i.e. is a unchecked expression. */
- unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type));
-
- /* Throw is contained in a try statement and at least one catch
- clause can receive the thrown expression or the current method is
- declared to throw such an exception. Or, the throw statement is
- contained in a method or constructor declaration and the type of
- the Expression is assignable to at least one type listed in the
- throws clause the declaration. */
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- if (!unchecked_ok)
- tryblock_throws_ok = check_thrown_exceptions_do (TREE_TYPE (expr));
- if (!(unchecked_ok || tryblock_throws_ok))
- {
- /* If there is a surrounding try block that has no matching
- clatch clause, report it first. A surrounding try block exits
- only if there is something after the list of checked
- exception thrown by the current function (if any). */
- if (IN_TRY_BLOCK_P ())
- parse_error_context (wfl_operator, "Checked exception `%s' can't be "
- "caught by any of the catch clause(s) "
- "of the surrounding `try' block",
- lang_printable_name (type, 0));
- /* If we have no surrounding try statement and the method doesn't have
- any throws, report it now. FIXME */
-
- /* We report that the exception can't be throw from a try block
- in all circumstances but when the `throw' is inside a static
- block. */
- else if (!EXCEPTIONS_P (currently_caught_type_list)
- && !tryblock_throws_ok)
- {
- if (IS_CLINIT (current_function_decl))
- parse_error_context (wfl_operator, "Checked exception `%s' can't "
- "be thrown in initializer",
- lang_printable_name (type, 0));
- else
- parse_error_context (wfl_operator, "Checked exception `%s' isn't "
- "thrown from a `try' block",
- lang_printable_name (type, 0));
- }
- /* Otherwise, the current method doesn't have the appropriate
- throws declaration */
- else
- parse_error_context (wfl_operator, "Checked exception `%s' doesn't "
- "match any of current method's `throws' "
- "declaration(s)",
- lang_printable_name (type, 0));
- return error_mark_node;
- }
-
- if (! flag_emit_class_files && ! flag_emit_xref)
- BUILD_THROW (node, expr);
-
- /* If doing xrefs, keep the location where the `throw' was seen. */
- if (flag_emit_xref)
- EXPR_WFL_LINECOL (node) = EXPR_WFL_LINECOL (wfl_op1);
- return node;
-}
-
-/* Check that exception said to be thrown by method DECL can be
- effectively caught from where DECL is invoked. */
-
-static void
-check_thrown_exceptions (location, decl)
- int location;
- tree decl;
-{
- tree throws;
- /* For all the unchecked exceptions thrown by DECL */
- for (throws = DECL_FUNCTION_THROWS (decl); throws;
- throws = TREE_CHAIN (throws))
- if (!check_thrown_exceptions_do (TREE_VALUE (throws)))
- {
-#if 1
- /* Temporary hack to suppresses errors about cloning arrays. FIXME */
- if (DECL_NAME (decl) == get_identifier ("clone"))
- continue;
-#endif
- EXPR_WFL_LINECOL (wfl_operator) = location;
- parse_error_context
- (wfl_operator, "Exception `%s' must be caught, or it must be "
- "declared in the `throws' clause of `%s'",
- lang_printable_name (TREE_VALUE (throws), 0),
- IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
- }
-}
-
-/* Return 1 if checked EXCEPTION is caught at the current nesting level of
- try-catch blocks, OR is listed in the `throws' clause of the
- current method. */
-
-static int
-check_thrown_exceptions_do (exception)
- tree exception;
-{
- tree list = currently_caught_type_list;
- resolve_and_layout (exception, NULL_TREE);
- /* First, all the nested try-catch-finally at that stage. The
- last element contains `throws' clause exceptions, if any. */
- if (IS_UNCHECKED_EXCEPTION_P (exception))
- return 1;
- while (list)
- {
- tree caught;
- for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught))
- if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0))
- return 1;
- list = TREE_CHAIN (list);
- }
- return 0;
-}
-
-static void
-purge_unchecked_exceptions (mdecl)
- tree mdecl;
-{
- tree throws = DECL_FUNCTION_THROWS (mdecl);
- tree new = NULL_TREE;
-
- while (throws)
- {
- tree next = TREE_CHAIN (throws);
- if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws)))
- {
- TREE_CHAIN (throws) = new;
- new = throws;
- }
- throws = next;
- }
- /* List is inverted here, but it doesn't matter */
- DECL_FUNCTION_THROWS (mdecl) = new;
-}
-
-/* 15.24 Conditional Operator ?: */
-
-static tree
-patch_conditional_expr (node, wfl_cond, wfl_op1)
- tree node, wfl_cond, wfl_op1;
-{
- tree cond = TREE_OPERAND (node, 0);
- tree op1 = TREE_OPERAND (node, 1);
- tree op2 = TREE_OPERAND (node, 2);
- tree resulting_type = NULL_TREE;
- tree t1, t2, patched;
- int error_found = 0;
-
- /* Operands of ?: might be StringBuffers crafted as a result of a
- string concatenation. Obtain a descent operand here. */
- if ((patched = patch_string (op1)))
- TREE_OPERAND (node, 1) = op1 = patched;
- if ((patched = patch_string (op2)))
- TREE_OPERAND (node, 2) = op2 = patched;
-
- t1 = TREE_TYPE (op1);
- t2 = TREE_TYPE (op2);
-
- /* The first expression must be a boolean */
- if (TREE_TYPE (cond) != boolean_type_node)
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);
- parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
- "convert `%s' to `boolean'",
- lang_printable_name (TREE_TYPE (cond), 0));
- error_found = 1;
- }
-
- /* Second and third can be numeric, boolean (i.e. primitive),
- references or null. Anything else results in an error */
- if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))
- || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node)
- && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))
- || (t1 == boolean_type_node && t2 == boolean_type_node)))
- error_found = 1;
-
- /* Determine the type of the conditional expression. Same types are
- easy to deal with */
- else if (t1 == t2)
- resulting_type = t1;
-
- /* There are different rules for numeric types */
- else if (JNUMERIC_TYPE_P (t1))
- {
- /* if byte/short found, the resulting type is short */
- if ((t1 == byte_type_node && t2 == short_type_node)
- || (t1 == short_type_node && t2 == byte_type_node))
- resulting_type = short_type_node;
-
- /* If t1 is a constant int and t2 is of type byte, short or char
- and t1's value fits in t2, then the resulting type is t2 */
- else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1)))
- && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2))
- resulting_type = t2;
-
- /* If t2 is a constant int and t1 is of type byte, short or char
- and t2's value fits in t1, then the resulting type is t1 */
- else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2)))
- && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1))
- resulting_type = t1;
-
- /* Otherwise, binary numeric promotion is applied and the
- resulting type is the promoted type of operand 1 and 2 */
- else
- resulting_type = binary_numeric_promotion (t1, t2,
- &TREE_OPERAND (node, 1),
- &TREE_OPERAND (node, 2));
- }
-
- /* Cases of a reference and a null type */
- else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node)
- resulting_type = t1;
-
- else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node)
- resulting_type = t2;
-
- /* Last case: different reference types. If a type can be converted
- into the other one by assignment conversion, the latter
- determines the type of the expression */
- else if ((resulting_type = try_reference_assignconv (t1, op2)))
- resulting_type = promote_type (t1);
-
- else if ((resulting_type = try_reference_assignconv (t2, op1)))
- resulting_type = promote_type (t2);
-
- /* If we don't have any resulting type, we're in trouble */
- if (!resulting_type)
- {
- char *t = strdup (lang_printable_name (t1, 0));
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
- "convert `%s' to `%s'", t,
- lang_printable_name (t2, 0));
- free (t);
- error_found = 1;
- }
-
- if (error_found)
- {
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
-
- TREE_TYPE (node) = resulting_type;
- TREE_SET_CODE (node, COND_EXPR);
- CAN_COMPLETE_NORMALLY (node) = 1;
- return node;
-}
-
-/* Try to constant fold NODE.
- If NODE is not a constant expression, return NULL_EXPR.
- CONTEXT is a static final VAR_DECL whose initializer we are folding. */
-
-static tree
-fold_constant_for_init (node, context)
- tree node;
- tree context;
-{
- tree op0, op1, val;
- enum tree_code code = TREE_CODE (node);
-
- if (code == STRING_CST)
- return node;
-
- if (code == INTEGER_CST || code == REAL_CST)
- return convert (TREE_TYPE (context), node);
- if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
- return NULL_TREE;
-
- switch (code)
- {
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_MOD_EXPR:
- case RDIV_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case URSHIFT_EXPR:
- case BIT_AND_EXPR:
- case BIT_XOR_EXPR:
- case BIT_IOR_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- op0 = TREE_OPERAND (node, 0);
- op1 = TREE_OPERAND (node, 1);
- val = fold_constant_for_init (op0, context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 0) = val;
- val = fold_constant_for_init (op1, context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 1) = val;
- return patch_binop (node, op0, op1);
-
- case UNARY_PLUS_EXPR:
- case NEGATE_EXPR:
- case TRUTH_NOT_EXPR:
- case BIT_NOT_EXPR:
- case CONVERT_EXPR:
- op0 = TREE_OPERAND (node, 0);
- val = fold_constant_for_init (op0, context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 0) = val;
- return patch_unaryop (node, op0);
- break;
-
- case COND_EXPR:
- val = fold_constant_for_init (TREE_OPERAND (node, 0), context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 0) = val;
- val = fold_constant_for_init (TREE_OPERAND (node, 1), context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 1) = val;
- val = fold_constant_for_init (TREE_OPERAND (node, 2), context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 2) = val;
- return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1)
- : TREE_OPERAND (node, 2);
-
- case VAR_DECL:
- case FIELD_DECL:
- if (! FIELD_FINAL (node)
- || DECL_INITIAL (node) == NULL_TREE)
- return NULL_TREE;
- val = DECL_INITIAL (node);
- /* Guard against infinite recursion. */
- DECL_INITIAL (node) = NULL_TREE;
- val = fold_constant_for_init (val, node);
- DECL_INITIAL (node) = val;
- return val;
-
- case EXPR_WITH_FILE_LOCATION:
- /* Compare java_complete_tree and resolve_expression_name. */
- if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
- || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
- {
- tree name = EXPR_WFL_NODE (node);
- tree decl;
- if (PRIMARY_P (node))
- return NULL_TREE;
- else if (! QUALIFIED_P (name))
- {
- decl = lookup_field_wrapper (DECL_CONTEXT (context), name);
- if (decl == NULL_TREE
- || (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl)))
- return NULL_TREE;
- return fold_constant_for_init (decl, decl);
- }
- else
- {
- /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
- qualify_ambiguous_name (node);
- if (resolve_field_access (node, &decl, NULL)
- && decl != NULL_TREE)
- return fold_constant_for_init (decl, decl);
- return NULL_TREE;
- }
- }
- else
- {
- op0 = TREE_OPERAND (node, 0);
- val = fold_constant_for_init (op0, context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 0) = val;
- return val;
- }
-
-#ifdef USE_COMPONENT_REF
- case IDENTIFIER:
- case COMPONENT_REF:
- ?;
-#endif
-
- default:
- return NULL_TREE;
- }
-}
-
-#ifdef USE_COMPONENT_REF
-/* Context is 'T' for TypeName, 'P' for PackageName,
- 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
-
-tree
-resolve_simple_name (name, context)
- tree name;
- int context;
-{
-}
-
-tree
-resolve_qualified_name (name, context)
- tree name;
- int context;
-{
-}
-#endif
diff --git a/gnu/dist/toolchain/gcc/java/parse.h b/gnu/dist/toolchain/gcc/java/parse.h
deleted file mode 100644
index 56bcbf4c541..00000000000
--- a/gnu/dist/toolchain/gcc/java/parse.h
+++ /dev/null
@@ -1,679 +0,0 @@
-/* Language parser definitions for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#ifndef JV_LANG_H
-#define JV_LANG_H
-
-#include "lex.h"
-
-/* Extern global variable declarations */
-extern int java_error_count;
-extern struct obstack temporary_obstack;
-extern struct obstack permanent_obstack;
-extern int quiet_flag;
-
-#ifndef JC1_LITE
-/* Function extern to java/ */
-extern int int_fits_type_p PROTO ((tree, tree));
-extern tree stabilize_reference PROTO ((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) \
- {if (!quiet_flag) {printf ("* "); printf X; putchar ('\n');} }
-#else
-#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 != lineno)
-
-/* Accepted modifiers */
-#define CLASS_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_FINAL
-#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
-#define INTERFACE_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT
-#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 */
-#define THIS_MODIFIER_ONLY(f, m, v, count, l) \
- if ((f) & (m)) \
- { \
- tree node = ctxp->modifier_ctx [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++; \
- }
-
-#define ABSTRACT_CHECK(FLAG, V, CL, S) \
- if ((FLAG) & (V)) \
- parse_error_context ((CL), S " method can't be abstract");
-
-#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() \
- { \
- pop_obstacks (); \
- 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)
-
-#define GET_METHOD_NAME(METHOD) \
- (TREE_CODE (DECL_NAME (METHOD)) == EXPR_WITH_FILE_LOCATION ? \
- EXPR_WFL_NODE (DECL_NAME (METHOD)) : DECL_NAME (METHOD))
-
-/* 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 a interface method */
-#define OBSOLETE_MODIFIER_WARNING(cl, flags, modifier, format, arg) \
- { \
- if (flag_redundant && (cl) && ((flags) & (modifier))) \
- parse_warning_context (cl, \
- "Discouraged redundant use of `%s' modifier " \
- "in declaration of " format, \
- java_accstring_lookup (modifier), arg); \
- }
-
-/* Quickly build a temporary pointer on hypothetical type NAME. */
-#define BUILD_PTR_FROM_NAME(ptr, name) \
- { \
- ptr = build (POINTER_TYPE, NULL_TREE); \
- TYPE_NAME (ptr) = name; \
- }
-
-#define INCOMPLETE_TYPE_P(NODE) \
- ((TREE_CODE (NODE) == POINTER_TYPE) \
- && !TREE_TYPE (NODE) \
- && TREE_CODE (TYPE_NAME (NODE)) == IDENTIFIER_NODE)
-
-/* 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) \
- (debug_info_level != DINFO_LEVEL_NONE ? \
- EXPR_WFL_EMIT_LINE_NOTE (node) = 1, node : node)
-
-/* 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) \
- && (TREE_CODE ((TYPE)) == INTEGER_TYPE \
- || TREE_CODE ((TYPE)) == CHAR_TYPE))
-#define JNUMERIC_TYPE_P(TYPE) ((TYPE) \
- && (JFLOAT_TYPE_P ((TYPE)) \
- || JINTEGRAL_TYPE_P ((TYPE))))
-#define JPRIMITIVE_TYPE_P(TYPE) ((TYPE) \
- && (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 predicate */
-#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)))
-
-/* Standard error messages */
-#define ERROR_CANT_CONVERT_TO_BOOLEAN(OPERATOR, NODE, TYPE) \
- parse_error_context \
- ((OPERATOR), "Incompatible type for `%s'. Can't convert `%s' 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 `%s'. Can't convert `%s' to " \
- "numeric type", operator_string ((NODE)), lang_printable_name ((TYPE), 0))
-
-#define ERROR_CAST_NEEDED_TO_INTEGRAL(OPERATOR, NODE, TYPE) \
- parse_error_context \
- ((OPERATOR), (JPRIMITIVE_TYPE_P (TYPE) ? \
- "Incompatible type for `%s'. Explicit cast needed to convert " \
- "`%s' to integral" : "Incompatible type for `%s'. Can't convert " \
- "`%s' to integral"), operator_string ((NODE)), \
- lang_printable_name ((TYPE), 0))
-
-#define ERROR_VARIABLE_NOT_INITIALIZED(WFL, V) \
- parse_error_context \
- ((WFL), "Variable `%s' 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)
-
-/* Invocation modes, as returned by invocation_mode (). */
-enum {
- INVOKE_STATIC,
- INVOKE_NONVIRTUAL,
- INVOKE_SUPER,
- INVOKE_INTERFACE,
- INVOKE_VIRTUAL
-};
-
-/* We need the resolution stuff only if we compile jc1 */
-#ifndef JC1_LITE
-
-/* 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' */
-};
-
-typedef struct _jdep {
-#ifdef ONLY_INT_FIELDS
- int kind : 8; /* Type of patch */
-#else
- enum jdep_code kind : 8;
-#endif
-
- 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 *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_SOLV(J) ((J)->solv)
-#define JDEP_WFL(J) ((J)->wfl)
-#define JDEP_MISC(J) ((J)->misc)
-#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)
-
-typedef struct _jdeplist {
- jdep *first;
- jdep *last;
- struct _jdeplist *next;
-} jdeplist;
-
-#endif /* JC1_LITE */
-
-#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 (ctxp->current_parsed_class) == 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 \
- { \
- (SAVE) = (TYPE); \
- (TYPE) = obtain_incomplete_type (TYPE); \
- CHAIN = 1; \
- } \
- } \
- } \
- }
-/* 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)
-
-/* For an artificial BLOCK (created to house a local variable declaration not
- at the start of an existing block), the parent block; otherwise NULL. */
-#define BLOCK_EXPR_ORIGIN(NODE) BLOCK_ABSTRACT_ORIGIN(NODE)
-
-/* Merge an other line to the source line number of a decl. Used to
- remember function's end. */
-#define DECL_SOURCE_LINE_MERGE(DECL,NO) DECL_SOURCE_LINE(DECL) |= (NO << 16)
-
-/* Retrieve those two info separately. */
-#define DECL_SOURCE_LINE_FIRST(DECL) (DECL_SOURCE_LINE(DECL) & 0x0000ffff)
-#define DECL_SOURCE_LINE_LAST(DECL) (DECL_SOURCE_LINE(DECL) >> 16)
-
-/* Retrieve line/column from a WFL. */
-#define EXPR_WFL_GET_LINECOL(V,LINE,COL) \
- { \
- (LINE) = (V) >> 12; \
- (COL) = (V) & 0xfff; \
- }
-/* Add X to the column number information */
-#define EXPR_WFL_ADD_COL(V, X) \
- (V) = (((V) & 0xfffff000) | ((((V) & 0xfff) + (X)) & 0xfff))
-
-/* Build a WFL for expression nodes */
-#define BUILD_EXPR_WFL(NODE, WFL) \
- build_expr_wfl ((NODE), input_filename, EXPR_WFL_LINENO ((WFL)), \
- EXPR_WFL_COLNO ((WFL)))
-
-#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))
-
-/* For exception handling, build diverse function calls */
-#define BUILD_ASSIGN_EXCEPTION_INFO(WHERE, TO) \
- { \
- (WHERE) = build (MODIFY_EXPR, void_type_node, (TO), \
- soft_exceptioninfo_call_node); \
- TREE_SIDE_EFFECTS (WHERE) = 1; \
- }
-
-#define BUILD_THROW(WHERE, WHAT) \
- { \
- (WHERE) = build (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 */
-#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))
-
-#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)); \
- }
-
-/* 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; \
- node = build_tree_list ((WHOLE), (NAME)); \
- TREE_CHAIN (node) = ctxp->import_list; \
- ctxp->import_list = node; \
-}
-
-/* Safe check that DECL is <clinit> */
-#define IS_CLINIT(DECL) \
- (DECL != NULL_TREE && DECL_NAME (DECL) == clinit_identifier_node)
-
-/* Macro to access the osb (opening square bracket) count */
-#define CURRENT_OSB(C) (C)->osb_number [(C)->osb_depth]
-
-/* Macro for the xreferencer */
-#define DECL_END_SOURCE_LINE(DECL) DECL_FRAME_SIZE (DECL)
-#define DECL_INHERITED_SOURCE_LINE(DECL) DECL_FIELD_SIZE (DECL)
-
-/* Parser context data structure. */
-struct parser_ctxt {
-
- char *filename; /* Current filename */
- FILE *finput; /* Current file input stream */
- struct parser_ctxt *next;
-
- struct java_line *p_line, *c_line; /* Previous and current line */
- java_lc elc; /* Error's line column info */
- unicode_t unget_utf8_value; /* An unget utf8 value */
- int ccb_indent; /* Keep track of {} indent, lexer */
- int first_ccb_indent1; /* First { at ident level 1 */
- int 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 *osb_number; /* Keep track of ['s */
- int minus_seen; /* Integral literal overflow */
- int lineno; /* Current lineno */
- int java_error_flag; /* Report error when true */
- int deprecated; /* @deprecated tag seen */
-
- /* This section is defined only if we compile jc1 */
-#ifndef JC1_LITE
- tree modifier_ctx [11]; /* WFL of modifiers */
- tree current_class; /* Current class */
- tree current_function_decl; /* Current function decl, save/restore */
-
- struct JCF *current_jcf; /* CU jcf */
-
- int prevent_ese; /* Prevent expression statement error */
- int class_err; /* Flag to report certain errors */
-
- int formal_parameter_number; /* Number of parameters found */
- int interface_number; /* # itfs declared to extend an itf def */
-
- tree package; /* Defined package ID */
-
- /* Those tow list are saved accross file traversal */
- tree incomplete_class; /* List of non-complete classes */
- tree gclass_list; /* All classes seen from source code */
-
- /* These two lists won't survive file traversal */
- tree class_list; /* List of classes in a CU */
- jdeplist *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 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; /* True when processing an explicit
- constructor. This flag is used to trap
- illegal argument usage during an
- explicit constructor invocation. */
-#endif /* JC1_LITE */
-};
-
-#ifndef JC1_LITE
-void safe_layout_class PROTO ((tree));
-void java_complete_class PROTO ((void));
-void java_check_circular_reference PROTO ((void));
-void java_check_final PROTO ((void));
-void java_layout_classes PROTO ((void));
-tree java_method_add_stmt PROTO ((tree, tree));
-void java_expand_switch PROTO ((tree));
-int java_report_errors PROTO (());
-extern tree do_resolve_class PROTO ((tree, tree, tree));
-#endif
-char *java_get_line_col PROTO ((char *, int, int));
-extern void reset_report PROTO ((void));
-
-/* Always in use, no matter what you compile */
-void java_push_parser_context PROTO ((void));
-void java_pop_parser_context PROTO ((int));
-void java_init_lex PROTO ((void));
-extern void java_parser_context_save_global PROTO ((void));
-extern void java_parser_context_restore_global PROTO ((void));
-int yyparse PROTO ((void));
-extern int java_parse PROTO ((void));
-int yylex ();
-void yyerror PROTO ((char *));
-extern void java_expand_classes PROTO ((void));
-#endif
diff --git a/gnu/dist/toolchain/gcc/java/parse.y b/gnu/dist/toolchain/gcc/java/parse.y
deleted file mode 100644
index 8abd4a7c079..00000000000
--- a/gnu/dist/toolchain/gcc/java/parse.y
+++ /dev/null
@@ -1,11775 +0,0 @@
-/* Source code parsing and tree node generation for the GNU compiler
- for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* This file parses java source code and issues a tree node image
-suitable for code generation (byte code and targeted CPU assembly
-language).
-
-The grammar conforms to the Java grammar described in "The Java(TM)
-Language Specification. J. Gosling, B. Joy, G. Steele. Addison Wesley
-1996, ISBN 0-201-63451-1"
-
-The following modifications were brought to the original grammar:
-
-method_body: added the rule '| block SC_TK'
-static_initializer: added the rule 'static block SC_TK'.
-
-Note: All the extra rules described above should go away when the
- empty_statement rule will work.
-
-statement_nsi: 'nsi' should be read no_short_if.
-
-Some rules have been modified to support JDK1.1 inner classes
-definitions and other extensions. */
-
-%{
-#include "config.h"
-#include "system.h"
-#include <dirent.h>
-#include "tree.h"
-#include "rtl.h"
-#include "obstack.h"
-#include "toplev.h"
-#include "flags.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "lex.h"
-#include "parse.h"
-#include "zipfile.h"
-#include "convert.h"
-#include "buffer.h"
-#include "xref.h"
-#include "except.h"
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-/* Local function prototypes */
-static char *java_accstring_lookup PROTO ((int));
-static void classitf_redefinition_error PROTO ((char *,tree, tree, tree));
-static void variable_redefinition_error PROTO ((tree, tree, tree, int));
-static void check_modifiers PROTO ((char *, int, int));
-static tree create_class PROTO ((int, tree, tree, tree));
-static tree create_interface PROTO ((int, tree, tree));
-static tree find_field PROTO ((tree, tree));
-static tree lookup_field_wrapper PROTO ((tree, tree));
-static int duplicate_declaration_error_p PROTO ((tree, tree, tree));
-static void register_fields PROTO ((int, tree, tree));
-static tree parser_qualified_classname PROTO ((tree));
-static int parser_check_super PROTO ((tree, tree, tree));
-static int parser_check_super_interface PROTO ((tree, tree, tree));
-static void check_modifiers_consistency PROTO ((int));
-static tree lookup_cl PROTO ((tree));
-static tree lookup_java_method2 PROTO ((tree, tree, int));
-static tree method_header PROTO ((int, tree, tree, tree));
-static void fix_method_argument_names PROTO ((tree ,tree));
-static tree method_declarator PROTO ((tree, tree));
-static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
- ATTRIBUTE_PRINTF_2;
-static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
-static tree parse_jdk1_1_error PROTO ((char *));
-static void complete_class_report_errors PROTO ((jdep *));
-static int process_imports PROTO ((void));
-static void read_import_dir PROTO ((tree));
-static int find_in_imports_on_demand PROTO ((tree));
-static int find_in_imports PROTO ((tree));
-static int check_pkg_class_access PROTO ((tree, tree));
-static tree resolve_package PROTO ((tree, tree *));
-static tree lookup_package_type PROTO ((char *, int));
-static tree lookup_package_type_and_set_next PROTO ((char *, int, tree *));
-static tree resolve_class PROTO ((tree, tree, tree));
-static void declare_local_variables PROTO ((int, tree, tree));
-static void source_start_java_method PROTO ((tree));
-static void source_end_java_method PROTO ((void));
-static void expand_start_java_method PROTO ((tree));
-static tree find_name_in_single_imports PROTO ((tree));
-static void check_abstract_method_header PROTO ((tree));
-static tree lookup_java_interface_method2 PROTO ((tree, tree));
-static tree resolve_expression_name PROTO ((tree, tree *));
-static tree maybe_create_class_interface_decl PROTO ((tree, tree, tree));
-static int check_class_interface_creation PROTO ((int, int, tree,
- tree, tree, tree));
-static tree patch_method_invocation PROTO ((tree, tree, tree,
- int *, tree *));
-static int breakdown_qualified PROTO ((tree *, tree *, tree));
-static tree resolve_and_layout PROTO ((tree, tree));
-static tree resolve_no_layout PROTO ((tree, tree));
-static int invocation_mode PROTO ((tree, int));
-static tree find_applicable_accessible_methods_list PROTO ((int, tree,
- tree, tree));
-static void search_applicable_methods_list PROTO ((int, tree, tree, tree,
- tree *, tree *));
-static tree find_most_specific_methods_list PROTO ((tree));
-static int argument_types_convertible PROTO ((tree, tree));
-static tree patch_invoke PROTO ((tree, tree, tree));
-static tree lookup_method_invoke PROTO ((int, tree, tree, tree, tree));
-static tree register_incomplete_type PROTO ((int, tree, tree, tree));
-static tree obtain_incomplete_type PROTO ((tree));
-static tree java_complete_lhs PROTO ((tree));
-static tree java_complete_tree PROTO ((tree));
-static void java_complete_expand_method PROTO ((tree));
-static int unresolved_type_p PROTO ((tree, tree *));
-static void create_jdep_list PROTO ((struct parser_ctxt *));
-static tree build_expr_block PROTO ((tree, tree));
-static tree enter_block PROTO ((void));
-static tree enter_a_block PROTO ((tree));
-static tree exit_block PROTO ((void));
-static tree lookup_name_in_blocks PROTO ((tree));
-static void maybe_absorb_scoping_blocks PROTO ((void));
-static tree build_method_invocation PROTO ((tree, tree));
-static tree build_new_invocation PROTO ((tree, tree));
-static tree build_assignment PROTO ((int, int, tree, tree));
-static tree build_binop PROTO ((enum tree_code, int, tree, tree));
-static int check_final_assignment PROTO ((tree ,tree));
-static tree patch_assignment PROTO ((tree, tree, tree ));
-static tree patch_binop PROTO ((tree, tree, tree));
-static tree build_unaryop PROTO ((int, int, tree));
-static tree build_incdec PROTO ((int, int, tree, int));
-static tree patch_unaryop PROTO ((tree, tree));
-static tree build_cast PROTO ((int, tree, tree));
-static tree build_null_of_type PROTO ((tree));
-static tree patch_cast PROTO ((tree, tree));
-static int valid_ref_assignconv_cast_p PROTO ((tree, tree, int));
-static int valid_builtin_assignconv_identity_widening_p PROTO ((tree, tree));
-static int valid_cast_to_p PROTO ((tree, tree));
-static int valid_method_invocation_conversion_p PROTO ((tree, tree));
-static tree try_builtin_assignconv PROTO ((tree, tree, tree));
-static tree try_reference_assignconv PROTO ((tree, tree));
-static tree build_unresolved_array_type PROTO ((tree));
-static tree build_array_from_name PROTO ((tree, tree, tree, tree *));
-static tree build_array_ref PROTO ((int, tree, tree));
-static tree patch_array_ref PROTO ((tree));
-static tree make_qualified_name PROTO ((tree, tree, int));
-static tree merge_qualified_name PROTO ((tree, tree));
-static tree make_qualified_primary PROTO ((tree, tree, int));
-static int resolve_qualified_expression_name PROTO ((tree, tree *,
- tree *, tree *));
-static void qualify_ambiguous_name PROTO ((tree));
-static void maybe_generate_clinit PROTO ((void));
-static tree resolve_field_access PROTO ((tree, tree *, tree *));
-static tree build_newarray_node PROTO ((tree, tree, int));
-static tree patch_newarray PROTO ((tree));
-static tree resolve_type_during_patch PROTO ((tree));
-static tree build_this PROTO ((int));
-static tree build_return PROTO ((int, tree));
-static tree patch_return PROTO ((tree));
-static tree maybe_access_field PROTO ((tree, tree, tree));
-static int complete_function_arguments PROTO ((tree));
-static int check_for_static_method_reference PROTO ((tree, tree, tree, tree, tree));
-static int not_accessible_p PROTO ((tree, tree, int));
-static void check_deprecation PROTO ((tree, tree));
-static int class_in_current_package PROTO ((tree));
-static tree build_if_else_statement PROTO ((int, tree, tree, tree));
-static tree patch_if_else_statement PROTO ((tree));
-static tree add_stmt_to_compound PROTO ((tree, tree, tree));
-static tree add_stmt_to_block PROTO ((tree, tree, tree));
-static tree patch_exit_expr PROTO ((tree));
-static tree build_labeled_block PROTO ((int, tree));
-static tree finish_labeled_statement PROTO ((tree, tree));
-static tree build_bc_statement PROTO ((int, int, tree));
-static tree patch_bc_statement PROTO ((tree));
-static tree patch_loop_statement PROTO ((tree));
-static tree build_new_loop PROTO ((tree));
-static tree build_loop_body PROTO ((int, tree, int));
-static tree finish_loop_body PROTO ((int, tree, tree, int));
-static tree build_debugable_stmt PROTO ((int, tree));
-static tree finish_for_loop PROTO ((int, tree, tree, tree));
-static tree patch_switch_statement PROTO ((tree));
-static tree string_constant_concatenation PROTO ((tree, tree));
-static tree build_string_concatenation PROTO ((tree, tree));
-static tree patch_string_cst PROTO ((tree));
-static tree patch_string PROTO ((tree));
-static tree build_try_statement PROTO ((int, tree, tree));
-static tree build_try_finally_statement PROTO ((int, tree, tree));
-static tree patch_try_statement PROTO ((tree));
-static tree patch_synchronized_statement PROTO ((tree, tree));
-static tree patch_throw_statement PROTO ((tree, tree));
-static void check_thrown_exceptions PROTO ((int, tree));
-static int check_thrown_exceptions_do PROTO ((tree));
-static void purge_unchecked_exceptions PROTO ((tree));
-static void check_throws_clauses PROTO ((tree, tree, tree));
-static void finish_method_declaration PROTO ((tree));
-static tree build_super_invocation PROTO (());
-static int verify_constructor_circularity PROTO ((tree, tree));
-static char *constructor_circularity_msg PROTO ((tree, tree));
-static tree build_this_super_qualified_invocation PROTO ((int, tree, tree,
- int, int));
-static char *get_printable_method_name PROTO ((tree));
-static tree patch_conditional_expr PROTO ((tree, tree, tree));
-static void maybe_generate_finit PROTO (());
-static void fix_constructors PROTO ((tree));
-static int verify_constructor_super PROTO (());
-static tree create_artificial_method PROTO ((tree, int, tree, tree, tree));
-static void start_artificial_method_body PROTO ((tree));
-static void end_artificial_method_body PROTO ((tree));
-static int check_method_redefinition PROTO ((tree, tree));
-static int reset_method_name PROTO ((tree));
-static void java_check_regular_methods PROTO ((tree));
-static void java_check_abstract_methods PROTO ((tree));
-static tree maybe_build_primttype_type_ref PROTO ((tree, tree));
-static void unreachable_stmt_error PROTO ((tree));
-static tree find_expr_with_wfl PROTO ((tree));
-static void missing_return_error PROTO ((tree));
-static tree build_new_array_init PROTO ((int, tree));
-static tree patch_new_array_init PROTO ((tree, tree));
-static tree maybe_build_array_element_wfl PROTO ((tree));
-static int array_constructor_check_entry PROTO ((tree, tree));
-static char *purify_type_name PROTO ((char *));
-static tree fold_constant_for_init PROTO ((tree, tree));
-static tree strip_out_static_field_access_decl PROTO ((tree));
-static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
-static void static_ref_err PROTO ((tree, tree, tree));
-
-/* Number of error found so far. */
-int java_error_count;
-/* Number of warning found so far. */
-int java_warning_count;
-/* Tell when not to fold, when doing xrefs */
-int do_not_fold;
-
-/* The current parser context */
-struct parser_ctxt *ctxp;
-
-/* List of things that were analyzed for which code will be generated */
-static struct parser_ctxt *ctxp_for_generation = NULL;
-
-/* binop_lookup maps token to tree_code. It is used where binary
- operations are involved and required by the parser. RDIV_EXPR
- covers both integral/floating point division. The code is changed
- once the type of both operator is worked out. */
-
-static enum tree_code binop_lookup[19] =
- {
- PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
- LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
- BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
- TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
- EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
- };
-#define BINOP_LOOKUP(VALUE) \
- binop_lookup [((VALUE) - PLUS_TK)% \
- (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
-
-/* Fake WFL used to report error message. It is initialized once if
- needed and reused with it's location information is overriden. */
-tree wfl_operator = NULL_TREE;
-
-/* The "$L" identifier we use to create labels. */
-static tree label_id = NULL_TREE;
-
-/* The "StringBuffer" identifier used for the String `+' operator. */
-static tree wfl_string_buffer = NULL_TREE;
-
-/* The "append" identifier used for String `+' operator. */
-static tree wfl_append = NULL_TREE;
-
-/* The "toString" identifier used for String `+' operator. */
-static tree wfl_to_string = NULL_TREE;
-
-/* The "java.lang" import qualified name. */
-static tree java_lang_id = NULL_TREE;
-
-/* The "java.lang.Cloneable" qualified name. */
-static tree java_lang_cloneable = NULL_TREE;
-
-/* Context and flag for static blocks */
-static tree current_static_block = NULL_TREE;
-
-%}
-
-%union {
- tree node;
- int sub_token;
- struct {
- int token;
- int location;
- } operator;
- int value;
-}
-
-%{
-#include "lex.c"
-%}
-
-%pure_parser
-
-/* Things defined here have to match the order of what's in the
- binop_lookup table. */
-
-%token PLUS_TK MINUS_TK MULT_TK DIV_TK REM_TK
-%token LS_TK SRS_TK ZRS_TK
-%token AND_TK XOR_TK OR_TK
-%token BOOL_AND_TK BOOL_OR_TK
-%token EQ_TK NEQ_TK GT_TK GTE_TK LT_TK LTE_TK
-
-/* This maps to the same binop_lookup entry than the token above */
-
-%token PLUS_ASSIGN_TK MINUS_ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
-%token REM_ASSIGN_TK
-%token LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK
-%token AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK
-
-
-/* Modifier TOKEN have to be kept in this order. Don't scramble it */
-
-%token PUBLIC_TK PRIVATE_TK PROTECTED_TK
-%token STATIC_TK FINAL_TK SYNCHRONIZED_TK
-%token VOLATILE_TK TRANSIENT_TK NATIVE_TK
-%token PAD_TK ABSTRACT_TK MODIFIER_TK
-
-/* Keep those two in order, too */
-%token DECR_TK INCR_TK
-
-/* From now one, things can be in any order */
-
-%token DEFAULT_TK IF_TK THROW_TK
-%token BOOLEAN_TK DO_TK IMPLEMENTS_TK
-%token THROWS_TK BREAK_TK IMPORT_TK
-%token ELSE_TK INSTANCEOF_TK RETURN_TK
-%token VOID_TK CATCH_TK INTERFACE_TK
-%token CASE_TK EXTENDS_TK FINALLY_TK
-%token SUPER_TK WHILE_TK CLASS_TK
-%token SWITCH_TK CONST_TK TRY_TK
-%token FOR_TK NEW_TK CONTINUE_TK
-%token GOTO_TK PACKAGE_TK THIS_TK
-
-%token BYTE_TK SHORT_TK INT_TK LONG_TK
-%token CHAR_TK INTEGRAL_TK
-
-%token FLOAT_TK DOUBLE_TK FP_TK
-
-%token ID_TK
-
-%token REL_QM_TK REL_CL_TK NOT_TK NEG_TK
-
-%token ASSIGN_ANY_TK ASSIGN_TK
-%token OP_TK CP_TK OCB_TK CCB_TK OSB_TK CSB_TK SC_TK C_TK DOT_TK
-
-%token STRING_LIT_TK CHAR_LIT_TK INT_LIT_TK FP_LIT_TK
-%token TRUE_TK FALSE_TK BOOL_LIT_TK NULL_TK
-
-%type <value> modifiers MODIFIER_TK
-
-%type <node> super ID_TK identifier
-%type <node> name simple_name qualified_name
-%type <node> class_declaration type_declaration compilation_unit
- field_declaration method_declaration extends_interfaces
- interfaces interface_type_list
- interface_declaration class_member_declaration
- import_declarations package_declaration
- type_declarations interface_body
- interface_member_declaration constant_declaration
- interface_member_declarations interface_type
- abstract_method_declaration interface_type_list
-%type <node> class_body_declaration class_member_declaration
- static_initializer constructor_declaration block
-%type <node> class_body_declarations constructor_header
-%type <node> class_or_interface_type class_type class_type_list
- constructor_declarator explicit_constructor_invocation
-%type <node> dim_expr dim_exprs this_or_super throws
-
-%type <node> variable_declarator_id variable_declarator
- variable_declarators variable_initializer
- variable_initializers constructor_body
- array_initializer
-
-%type <node> class_body block_end constructor_block_end
-%type <node> statement statement_without_trailing_substatement
- labeled_statement if_then_statement label_decl
- if_then_else_statement while_statement for_statement
- statement_nsi labeled_statement_nsi do_statement
- if_then_else_statement_nsi while_statement_nsi
- for_statement_nsi statement_expression_list for_init
- for_update statement_expression expression_statement
- primary_no_new_array expression primary
- array_creation_expression array_type
- class_instance_creation_expression field_access
- method_invocation array_access something_dot_new
- argument_list postfix_expression while_expression
- post_increment_expression post_decrement_expression
- unary_expression_not_plus_minus unary_expression
- pre_increment_expression pre_decrement_expression
- unary_expression_not_plus_minus cast_expression
- multiplicative_expression additive_expression
- shift_expression relational_expression
- equality_expression and_expression
- exclusive_or_expression inclusive_or_expression
- conditional_and_expression conditional_or_expression
- conditional_expression assignment_expression
- left_hand_side assignment for_header for_begin
- constant_expression do_statement_begin empty_statement
- switch_statement synchronized_statement throw_statement
- try_statement switch_expression switch_block
- catches catch_clause catch_clause_parameter finally
-%type <node> return_statement break_statement continue_statement
-
-%type <operator> ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
-%type <operator> REM_ASSIGN_TK PLUS_ASSIGN_TK MINUS_ASSIGN_TK
-%type <operator> LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK
-%type <operator> AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK
-%type <operator> ASSIGN_ANY_TK assignment_operator
-%token <operator> EQ_TK GTE_TK ZRS_TK SRS_TK GT_TK LTE_TK LS_TK
-%token <operator> BOOL_AND_TK AND_TK BOOL_OR_TK OR_TK INCR_TK PLUS_TK
-%token <operator> DECR_TK MINUS_TK MULT_TK DIV_TK XOR_TK REM_TK NEQ_TK
-%token <operator> NEG_TK REL_QM_TK REL_CL_TK NOT_TK LT_TK OCB_TK CCB_TK
-%token <operator> OP_TK OSB_TK DOT_TK THROW_TK INSTANCEOF_TK
-%type <operator> THIS_TK SUPER_TK RETURN_TK BREAK_TK CONTINUE_TK
-%type <operator> CASE_TK DEFAULT_TK TRY_TK CATCH_TK SYNCHRONIZED_TK
-
-%type <node> method_body
-
-%type <node> literal INT_LIT_TK FP_LIT_TK BOOL_LIT_TK CHAR_LIT_TK
- STRING_LIT_TK NULL_TK VOID_TK
-
-%type <node> IF_TK WHILE_TK FOR_TK
-
-%type <node> formal_parameter_list formal_parameter
- method_declarator method_header
-
-%type <node> primitive_type reference_type type
- BOOLEAN_TK INTEGRAL_TK FP_TK
-
-%%
-/* 19.2 Production from 2.3: The Syntactic Grammar */
-goal:
- compilation_unit
- {}
-;
-
-/* 19.3 Productions from 3: Lexical structure */
-literal:
- INT_LIT_TK
-| FP_LIT_TK
-| BOOL_LIT_TK
-| CHAR_LIT_TK
-| STRING_LIT_TK
-| NULL_TK
-;
-
-/* 19.4 Productions from 4: Types, Values and Variables */
-type:
- primitive_type
-| reference_type
-;
-
-primitive_type:
- INTEGRAL_TK
-| FP_TK
-| BOOLEAN_TK
-;
-
-reference_type:
- class_or_interface_type
-| array_type
-;
-
-class_or_interface_type:
- name
-;
-
-class_type:
- class_or_interface_type /* Default rule */
-;
-
-interface_type:
- class_or_interface_type
-;
-
-array_type:
- primitive_type OSB_TK CSB_TK
- {
- $$ = build_java_array_type ($1, -1);
- CLASS_LOADED_P ($$) = 1;
- }
-| name OSB_TK CSB_TK
- { $$ = build_unresolved_array_type ($1); }
-| array_type OSB_TK CSB_TK
- { $$ = build_unresolved_array_type ($1); }
-| primitive_type OSB_TK error
- {RULE ("']' expected"); RECOVER;}
-| array_type OSB_TK error
- {RULE ("']' expected"); RECOVER;}
-;
-
-/* 19.5 Productions from 6: Names */
-name:
- simple_name /* Default rule */
-| qualified_name /* Default rule */
-;
-
-simple_name:
- identifier /* Default rule */
-;
-
-qualified_name:
- name DOT_TK identifier
- { $$ = make_qualified_name ($1, $3, $2.location); }
-;
-
-identifier:
- ID_TK
-;
-
-/* 19.6: Production from 7: Packages */
-compilation_unit:
- {$$ = NULL;}
-| package_declaration
-| import_declarations
-| type_declarations
-| package_declaration import_declarations
-| package_declaration type_declarations
-| import_declarations type_declarations
-| package_declaration import_declarations type_declarations
-;
-
-import_declarations:
- import_declaration
- {
- $$ = NULL;
- }
-| import_declarations import_declaration
- {
- $$ = NULL;
- }
-;
-
-type_declarations:
- type_declaration
-| type_declarations type_declaration
-;
-
-package_declaration:
- PACKAGE_TK name SC_TK
- { ctxp->package = EXPR_WFL_NODE ($2); }
-| PACKAGE_TK error
- {yyerror ("Missing name"); RECOVER;}
-| PACKAGE_TK name error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-import_declaration:
- single_type_import_declaration
-| type_import_on_demand_declaration
-;
-
-single_type_import_declaration:
- IMPORT_TK name SC_TK
- {
- tree name = EXPR_WFL_NODE ($2), node, last_name;
- int i = IDENTIFIER_LENGTH (name)-1;
- char *last = &IDENTIFIER_POINTER (name)[i];
- while (last != IDENTIFIER_POINTER (name))
- {
- if (last [0] == '.')
- break;
- last--;
- }
- last_name = get_identifier (++last);
- if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name))
- {
- tree err = find_name_in_single_imports (last_name);
- if (err && err != name)
- parse_error_context
- ($2, "Ambiguous class: `%s' and `%s'",
- IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (err));
- else
- REGISTER_IMPORT ($2, last_name)
- }
- else
- REGISTER_IMPORT ($2, last_name);
- }
-| IMPORT_TK error
- {yyerror ("Missing name"); RECOVER;}
-| IMPORT_TK name error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-type_import_on_demand_declaration:
- IMPORT_TK name DOT_TK MULT_TK SC_TK
- {
- tree name = EXPR_WFL_NODE ($2);
- /* Don't import java.lang.* twice. */
- if (name != java_lang_id)
- {
- tree node = build_tree_list ($2, NULL_TREE);
- read_import_dir ($2);
- TREE_CHAIN (node) = ctxp->import_demand_list;
- ctxp->import_demand_list = node;
- }
- }
-| IMPORT_TK name DOT_TK error
- {yyerror ("'*' expected"); RECOVER;}
-| IMPORT_TK name DOT_TK MULT_TK error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-type_declaration:
- class_declaration
- {
- maybe_generate_finit ();
- maybe_generate_clinit ();
- $$ = $1;
- }
-| interface_declaration
- {
- maybe_generate_clinit ();
- $$ = $1;
- }
-| SC_TK
- { $$ = NULL; }
-| error
- {
- YYERROR_NOW;
- yyerror ("Class or interface declaration expected");
- }
-;
-
-/* 19.7 Shortened from the original:
- modifiers: modifier | modifiers modifier
- modifier: any of public... */
-modifiers:
- MODIFIER_TK
- {
- $$ = (1 << $1);
- }
-| modifiers MODIFIER_TK
- {
- int acc = (1 << $2);
- if ($$ & acc)
- parse_error_context
- (ctxp->modifier_ctx [$2], "Modifier `%s' declared twice",
- java_accstring_lookup (acc));
- else
- {
- $$ |= acc;
- }
- }
-;
-
-/* 19.8.1 Production from $8.1: Class Declaration */
-class_declaration:
- modifiers CLASS_TK identifier super interfaces
- { create_class ($1, $3, $4, $5); }
- class_body
- {
- $$ = $7;
- }
-| CLASS_TK identifier super interfaces
- { create_class (0, $2, $3, $4); }
- class_body
- {
- $$ = $6;
- }
-| modifiers CLASS_TK error
- {yyerror ("Missing class name"); RECOVER;}
-| CLASS_TK error
- {yyerror ("Missing class name"); RECOVER;}
-| CLASS_TK identifier error
- {
- if (!ctxp->class_err) yyerror ("'{' expected");
- DRECOVER(class1);
- }
-| modifiers CLASS_TK identifier error
- {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;}
-;
-
-super:
- { $$ = NULL; }
-| EXTENDS_TK class_type
- { $$ = $2; }
-| EXTENDS_TK class_type error
- {yyerror ("'{' expected"); ctxp->class_err=1;}
-| EXTENDS_TK error
- {yyerror ("Missing super class name"); ctxp->class_err=1;}
-;
-
-interfaces:
- { $$ = NULL_TREE; }
-| IMPLEMENTS_TK interface_type_list
- { $$ = $2; }
-| IMPLEMENTS_TK error
- {
- ctxp->class_err=1;
- yyerror ("Missing interface name");
- }
-;
-
-interface_type_list:
- interface_type
- {
- ctxp->interface_number = 1;
- $$ = build_tree_list ($1, NULL_TREE);
- }
-| interface_type_list C_TK interface_type
- {
- ctxp->interface_number++;
- $$ = chainon ($1, build_tree_list ($3, NULL_TREE));
- }
-| interface_type_list C_TK error
- {yyerror ("Missing interface name"); RECOVER;}
-;
-
-class_body:
- OCB_TK CCB_TK
- {
- /* Store the location of the `}' when doing xrefs */
- if (flag_emit_xref)
- DECL_END_SOURCE_LINE (ctxp->current_parsed_class) =
- EXPR_WFL_ADD_COL ($2.location, 1);
- $$ = ctxp->current_parsed_class;
- }
-| OCB_TK class_body_declarations CCB_TK
- {
- /* Store the location of the `}' when doing xrefs */
- if (flag_emit_xref)
- DECL_END_SOURCE_LINE (ctxp->current_parsed_class) =
- EXPR_WFL_ADD_COL ($3.location, 1);
- $$ = ctxp->current_parsed_class;
- }
-;
-
-class_body_declarations:
- class_body_declaration
-| class_body_declarations class_body_declaration
-;
-
-class_body_declaration:
- class_member_declaration
-| static_initializer
-| constructor_declaration
-| block /* Added, JDK1.1, instance initializer */
- { $$ = parse_jdk1_1_error ("instance initializer"); }
-;
-
-class_member_declaration:
- field_declaration
-| field_declaration SC_TK
- { $$ = $1; }
-| method_declaration
-| class_declaration /* Added, JDK1.1 inner classes */
- { $$ = parse_jdk1_1_error ("inner classe declaration"); }
-| interface_declaration /* Added, JDK1.1 inner classes */
- { $$ = parse_jdk1_1_error ("inner interface declaration"); }
-;
-
-/* 19.8.2 Productions from 8.3: Field Declarations */
-field_declaration:
- type variable_declarators SC_TK
- { register_fields (0, $1, $2); }
-| modifiers type variable_declarators SC_TK
- {
- check_modifiers
- ("Illegal modifier `%s' for field declaration",
- $1, FIELD_MODIFIERS);
- check_modifiers_consistency ($1);
- register_fields ($1, $2, $3);
- }
-;
-
-variable_declarators:
- /* Should we use build_decl_list () instead ? FIXME */
- variable_declarator /* Default rule */
-| variable_declarators C_TK variable_declarator
- { $$ = chainon ($1, $3); }
-| variable_declarators C_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-variable_declarator:
- variable_declarator_id
- { $$ = build_tree_list ($1, NULL_TREE); }
-| variable_declarator_id ASSIGN_TK variable_initializer
- {
- if (java_error_count)
- $3 = NULL_TREE;
- $$ = build_tree_list
- ($1, build_assignment ($2.token, $2.location, $1, $3));
- }
-| variable_declarator_id ASSIGN_TK error
- {
- yyerror ("Missing variable initializer");
- $$ = build_tree_list ($1, NULL_TREE);
- RECOVER;
- }
-| variable_declarator_id ASSIGN_TK variable_initializer error
- {
- yyerror ("';' expected");
- $$ = build_tree_list ($1, NULL_TREE);
- RECOVER;
- }
-;
-
-variable_declarator_id:
- identifier
-| variable_declarator_id OSB_TK CSB_TK
- { $$ = build_unresolved_array_type ($1); }
-| identifier error
- {yyerror ("Invalid declaration"); DRECOVER(vdi);}
-| variable_declarator_id OSB_TK error
- {yyerror ("']' expected"); DRECOVER(vdi);}
-| variable_declarator_id CSB_TK error
- {yyerror ("Unbalanced ']'"); DRECOVER(vdi);}
-;
-
-variable_initializer:
- expression
-| array_initializer
-;
-
-/* 19.8.3 Productions from 8.4: Method Declarations */
-method_declaration:
- method_header
- {
- current_function_decl = $1;
- source_start_java_method (current_function_decl);
- }
- method_body
- { finish_method_declaration ($3); }
-| method_header error
- {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;}
-;
-
-method_header:
- type method_declarator throws
- { $$ = method_header (0, $1, $2, $3); }
-| VOID_TK method_declarator throws
- { $$ = method_header (0, void_type_node, $2, $3); }
-| modifiers type method_declarator throws
- { $$ = method_header ($1, $2, $3, $4); }
-| modifiers VOID_TK method_declarator throws
- { $$ = method_header ($1, void_type_node, $3, $4); }
-| type error
- {RECOVER;}
-| modifiers type error
- {RECOVER;}
-| VOID_TK error
- {yyerror ("Identifier expected"); RECOVER;}
-| modifiers VOID_TK error
- {yyerror ("Identifier expected"); RECOVER;}
-| modifiers error
- {
- yyerror ("Invalid method declaration, return type required");
- RECOVER;
- }
-;
-
-method_declarator:
- identifier OP_TK CP_TK
- { $$ = method_declarator ($1, NULL_TREE); }
-| identifier OP_TK formal_parameter_list CP_TK
- { $$ = method_declarator ($1, $3); }
-| method_declarator OSB_TK CSB_TK
- {
- EXPR_WFL_LINECOL (wfl_operator) = $2.location;
- TREE_PURPOSE ($1) =
- build_unresolved_array_type (TREE_PURPOSE ($1));
- parse_warning_context
- (wfl_operator,
- "Discouraged form of returned type specification");
- }
-| identifier OP_TK error
- {yyerror ("')' expected"); DRECOVER(method_declarator);}
-| method_declarator OSB_TK error
- {yyerror ("']' expected"); RECOVER;}
-;
-
-formal_parameter_list:
- formal_parameter
- {
- ctxp->formal_parameter_number = 1;
- }
-| formal_parameter_list C_TK formal_parameter
- {
- ctxp->formal_parameter_number += 1;
- $$ = chainon ($1, $3);
- }
-| formal_parameter_list C_TK error
- {yyerror ("Missing formal parameter term"); RECOVER;}
-;
-
-formal_parameter:
- type variable_declarator_id
- {
- $$ = build_tree_list ($2, $1);
- }
-| modifiers type variable_declarator_id /* Added, JDK1.1 final parms */
- {
- parse_jdk1_1_error ("final parameters");
- $$ = build_tree_list ($3, $2);
- }
-| type error
- {yyerror ("Missing identifier"); RECOVER;}
-| modifiers type error
- {
- SOURCE_FRONTEND_DEBUG (("Modifiers: %d", $1));
- yyerror ("Missing identifier"); RECOVER;
- }
-;
-
-throws:
- { $$ = NULL_TREE; }
-| THROWS_TK class_type_list
- { $$ = $2; }
-| THROWS_TK error
- {yyerror ("Missing class type term"); RECOVER;}
-;
-
-class_type_list:
- class_type
- { $$ = build_tree_list ($1, $1); }
-| class_type_list C_TK class_type
- { $$ = tree_cons ($3, $3, $1); }
-| class_type_list C_TK error
- {yyerror ("Missing class type term"); RECOVER;}
-;
-
-method_body:
- block
-| block SC_TK
-| SC_TK
- { $$ = NULL_TREE; } /* Probably not the right thing to do. */
-;
-
-/* 19.8.4 Productions from 8.5: Static Initializers */
-static_initializer:
- static block
- {
- TREE_CHAIN ($2) = ctxp->static_initialized;
- ctxp->static_initialized = $2;
- }
-| static block SC_TK /* Shouldn't be here. FIXME */
- {
- TREE_CHAIN ($2) = ctxp->static_initialized;
- ctxp->static_initialized = $2;
- }
-;
-
-static: /* Test lval.sub_token here */
- MODIFIER_TK
- {
- SOURCE_FRONTEND_DEBUG (("Modifiers: %d", $1));
- }
-;
-
-/* 19.8.5 Productions from 8.6: Constructor Declarations */
-constructor_declaration:
- constructor_header
- {
- current_function_decl = $1;
- source_start_java_method (current_function_decl);
- }
- constructor_body
- { finish_method_declaration ($3); }
-;
-
-constructor_header:
- constructor_declarator throws
- { $$ = method_header (0, NULL_TREE, $1, $2); }
-| modifiers constructor_declarator throws
- { $$ = method_header ($1, NULL_TREE, $2, $3); }
-;
-
-constructor_declarator:
- simple_name OP_TK CP_TK
- { $$ = method_declarator ($1, NULL_TREE); }
-| simple_name OP_TK formal_parameter_list CP_TK
- { $$ = method_declarator ($1, $3); }
-;
-
-constructor_body:
- /* Unlike regular method, we always need a complete (empty)
- body so we can safely perform all the required code
- addition (super invocation and field initialization) */
- block_begin constructor_block_end
- {
- BLOCK_EXPR_BODY ($2) = empty_stmt_node;
- $$ = $2;
- }
-| block_begin explicit_constructor_invocation constructor_block_end
- { $$ = $3; }
-| block_begin block_statements constructor_block_end
- { $$ = $3; }
-| block_begin explicit_constructor_invocation block_statements constructor_block_end
- { $$ = $4; }
-;
-
-constructor_block_end:
- block_end
-| block_end SC_TK
-
-/* Error recovery for that rule moved down expression_statement: rule. */
-explicit_constructor_invocation:
- this_or_super OP_TK CP_TK SC_TK
- {
- $$ = build_method_invocation ($1, NULL_TREE);
- $$ = build_debugable_stmt (EXPR_WFL_LINECOL ($1), $$);
- $$ = java_method_add_stmt (current_function_decl, $$);
- }
-| this_or_super OP_TK argument_list CP_TK SC_TK
- {
- $$ = build_method_invocation ($1, $3);
- $$ = build_debugable_stmt (EXPR_WFL_LINECOL ($1), $$);
- $$ = java_method_add_stmt (current_function_decl, $$);
- }
- /* Added, JDK1.1 inner classes. Modified because the rule
- 'primary' couldn't work. */
-| name DOT_TK SUPER_TK OP_TK argument_list CP_TK SC_TK
- {$$ = parse_jdk1_1_error ("explicit constructor invocation"); }
-| name DOT_TK SUPER_TK OP_TK CP_TK SC_TK
- {$$ = parse_jdk1_1_error ("explicit constructor invocation"); }
-;
-
-this_or_super: /* Added, simplifies error diagnostics */
- THIS_TK
- {
- tree wfl = build_wfl_node (this_identifier_node);
- EXPR_WFL_LINECOL (wfl) = $1.location;
- $$ = wfl;
- }
-| SUPER_TK
- {
- tree wfl = build_wfl_node (super_identifier_node);
- EXPR_WFL_LINECOL (wfl) = $1.location;
- $$ = wfl;
- }
-;
-
-/* 19.9 Productions from 9: Interfaces */
-/* 19.9.1 Productions from 9.1: Interfaces Declarations */
-interface_declaration:
- INTERFACE_TK identifier
- { create_interface (0, $2, NULL_TREE); }
- interface_body
- {
- $$ = $4;
- }
-| modifiers INTERFACE_TK identifier
- { create_interface ($1, $3, NULL_TREE); }
- interface_body
- {
- $$ = $5;
- }
-| INTERFACE_TK identifier extends_interfaces
- { create_interface (0, $2, $3); }
- interface_body
- {
- $$ = $5;
- }
-| modifiers INTERFACE_TK identifier extends_interfaces
- { create_interface ($1, $3, $4); }
- interface_body
- {
- $$ = $6;
- }
-| INTERFACE_TK identifier error
- {yyerror ("'{' expected"); RECOVER;}
-| modifiers INTERFACE_TK identifier error
- {yyerror ("'{' expected"); RECOVER;}
-;
-
-extends_interfaces:
- EXTENDS_TK interface_type
- {
- ctxp->interface_number = 1;
- $$ = build_tree_list ($2, NULL_TREE);
- }
-| extends_interfaces C_TK interface_type
- {
- ctxp->interface_number++;
- $$ = chainon ($1, build_tree_list ($3, NULL_TREE));
- }
-| EXTENDS_TK error
- {yyerror ("Invalid interface type"); RECOVER;}
-| extends_interfaces C_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-interface_body:
- OCB_TK CCB_TK
- { $$ = NULL_TREE; }
-| OCB_TK interface_member_declarations CCB_TK
- { $$ = NULL_TREE; }
-;
-
-interface_member_declarations:
- interface_member_declaration
-| interface_member_declarations interface_member_declaration
-;
-
-interface_member_declaration:
- constant_declaration
-| abstract_method_declaration
-| class_declaration /* Added, JDK1.1 inner classes */
- { $$ = parse_jdk1_1_error ("inner class declaration"); }
-| interface_declaration /* Added, JDK1.1 inner classes */
- { $$ = parse_jdk1_1_error ("inner interface declaration"); }
-;
-
-constant_declaration:
- field_declaration
-;
-
-abstract_method_declaration:
- method_header SC_TK
- {
- check_abstract_method_header ($1);
- current_function_decl = NULL_TREE; /* FIXME ? */
- }
-| method_header error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-/* 19.10 Productions from 10: Arrays */
-array_initializer:
- OCB_TK CCB_TK
- { $$ = build_new_array_init ($1.location, NULL_TREE); }
-| OCB_TK variable_initializers CCB_TK
- { $$ = build_new_array_init ($1.location, $2); }
-| OCB_TK variable_initializers C_TK CCB_TK
- { $$ = build_new_array_init ($1.location, $2); }
-;
-
-variable_initializers:
- variable_initializer
- {
- $$ = tree_cons (maybe_build_array_element_wfl ($1),
- $1, NULL_TREE);
- }
-| variable_initializers C_TK variable_initializer
- {
- $$ = tree_cons (maybe_build_array_element_wfl ($3), $3, $1);
- }
-| variable_initializers C_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-/* 19.11 Production from 14: Blocks and Statements */
-block:
- OCB_TK CCB_TK
- {
- /* Store the location of the `}' when doing xrefs */
- if (current_function_decl && flag_emit_xref)
- DECL_END_SOURCE_LINE (current_function_decl) =
- EXPR_WFL_ADD_COL ($2.location, 1);
- $$ = empty_stmt_node;
- }
-| block_begin block_statements block_end
- { $$ = $3; }
-;
-
-block_begin:
- OCB_TK
- { enter_block (); }
-;
-
-block_end:
- CCB_TK
- {
- maybe_absorb_scoping_blocks ();
- /* Store the location of the `}' when doing xrefs */
- if (current_function_decl && flag_emit_xref)
- DECL_END_SOURCE_LINE (current_function_decl) =
- EXPR_WFL_ADD_COL ($1.location, 1);
- $$ = exit_block ();
- }
-;
-
-block_statements:
- block_statement
-| block_statements block_statement
-;
-
-block_statement:
- local_variable_declaration_statement
-| statement
- { java_method_add_stmt (current_function_decl, $1); }
-| class_declaration /* Added, JDK1.1 inner classes */
- { parse_jdk1_1_error ("inner class declaration"); }
-;
-
-local_variable_declaration_statement:
- local_variable_declaration SC_TK /* Can't catch missing ';' here */
-;
-
-local_variable_declaration:
- type variable_declarators
- { declare_local_variables (0, $1, $2); }
-| modifiers type variable_declarators /* Added, JDK1.1 final locals */
- { declare_local_variables ($1, $2, $3); }
-;
-
-statement:
- statement_without_trailing_substatement
-| labeled_statement
-| if_then_statement
-| if_then_else_statement
-| while_statement
-| for_statement
- { $$ = exit_block (); }
-;
-
-statement_nsi:
- statement_without_trailing_substatement
-| labeled_statement_nsi
-| if_then_else_statement_nsi
-| while_statement_nsi
-| for_statement_nsi
- { $$ = exit_block (); }
-;
-
-statement_without_trailing_substatement:
- block
-| empty_statement
-| expression_statement
-| switch_statement
-| do_statement
-| break_statement
-| continue_statement
-| return_statement
-| synchronized_statement
-| throw_statement
-| try_statement
-;
-
-empty_statement:
- SC_TK
- { $$ = empty_stmt_node; }
-;
-
-label_decl:
- identifier REL_CL_TK
- {
- $$ = build_labeled_block (EXPR_WFL_LINECOL ($1),
- EXPR_WFL_NODE ($1));
- pushlevel (2);
- push_labeled_block ($$);
- PUSH_LABELED_BLOCK ($$);
- }
-;
-
-labeled_statement:
- label_decl statement
- { $$ = finish_labeled_statement ($1, $2); }
-| identifier error
- {yyerror ("':' expected"); RECOVER;}
-;
-
-labeled_statement_nsi:
- label_decl statement_nsi
- { $$ = finish_labeled_statement ($1, $2); }
-;
-
-/* We concentrate here a bunch of error handling rules that we couldn't write
- earlier, because expression_statement catches a missing ';'. */
-expression_statement:
- statement_expression SC_TK
- {
- /* We have a statement. Generate a WFL around it so
- we can debug it */
- $$ = build_expr_wfl ($1, input_filename, lineno, 0);
- /* We know we have a statement, so set the debug
- info to be eventually generate here. */
- $$ = JAVA_MAYBE_GENERATE_DEBUG_INFO ($$);
- }
-| error SC_TK
- {
- if (ctxp->prevent_ese != lineno)
- yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- }
-| error OCB_TK
- {
- if (ctxp->prevent_ese != lineno)
- yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- }
-| error CCB_TK
- {
- if (ctxp->prevent_ese != lineno)
- yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- }
-| this_or_super OP_TK error
- {yyerror ("')' expected"); RECOVER;}
-| this_or_super OP_TK CP_TK error
- {
- yyerror ("Constructor invocation must be first "
- "thing in a constructor");
- RECOVER;
- }
-| this_or_super OP_TK argument_list error
- {yyerror ("')' expected"); RECOVER;}
-| this_or_super OP_TK argument_list CP_TK error
- {
- yyerror ("Constructor invocation must be first "
- "thing in a constructor");
- RECOVER;
- }
-| name DOT_TK SUPER_TK error
- {yyerror ("'(' expected"); RECOVER;}
-| name DOT_TK SUPER_TK OP_TK error
- {yyerror ("')' expected"); RECOVER;}
-| name DOT_TK SUPER_TK OP_TK argument_list error
- {yyerror ("')' expected"); RECOVER;}
-| name DOT_TK SUPER_TK OP_TK argument_list CP_TK error
- {yyerror ("';' expected"); RECOVER;}
-| name DOT_TK SUPER_TK OP_TK CP_TK error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-statement_expression:
- assignment
-| pre_increment_expression
-| pre_decrement_expression
-| post_increment_expression
-| post_decrement_expression
-| method_invocation
-| class_instance_creation_expression
-;
-
-if_then_statement:
- IF_TK OP_TK expression CP_TK statement
- {
- $$ = build_if_else_statement ($2.location, $3,
- $5, NULL_TREE);
- }
-| IF_TK error
- {yyerror ("'(' expected"); RECOVER;}
-| IF_TK OP_TK error
- {yyerror ("Missing term"); RECOVER;}
-| IF_TK OP_TK expression error
- {yyerror ("')' expected"); RECOVER;}
-;
-
-if_then_else_statement:
- IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement
- { $$ = build_if_else_statement ($2.location, $3, $5, $7); }
-;
-
-if_then_else_statement_nsi:
- IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement_nsi
- { $$ = build_if_else_statement ($2.location, $3, $5, $7); }
-;
-
-switch_statement:
- switch_expression
- {
- enter_block ();
- }
- switch_block
- {
- /* Make into "proper list" of COMPOUND_EXPRs.
- I.e. make the last statment also have its own
- COMPOUND_EXPR. */
- maybe_absorb_scoping_blocks ();
- TREE_OPERAND ($1, 1) = exit_block ();
- $$ = build_debugable_stmt (EXPR_WFL_LINECOL ($1), $1);
- }
-;
-
-switch_expression:
- SWITCH_TK OP_TK expression CP_TK
- {
- $$ = build (SWITCH_EXPR, NULL_TREE, $3, NULL_TREE);
- EXPR_WFL_LINECOL ($$) = $2.location;
- }
-| SWITCH_TK error
- {yyerror ("'(' expected"); RECOVER;}
-| SWITCH_TK OP_TK error
- {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);}
-| SWITCH_TK OP_TK expression CP_TK error
- {yyerror ("'{' expected"); RECOVER;}
-;
-
-/* Default assignment is there to avoid type node on switch_block
- node. */
-
-switch_block:
- OCB_TK CCB_TK
- { $$ = NULL_TREE; }
-| OCB_TK switch_labels CCB_TK
- { $$ = NULL_TREE; }
-| OCB_TK switch_block_statement_groups CCB_TK
- { $$ = NULL_TREE; }
-| OCB_TK switch_block_statement_groups switch_labels CCB_TK
- { $$ = NULL_TREE; }
-;
-
-switch_block_statement_groups:
- switch_block_statement_group
-| switch_block_statement_groups switch_block_statement_group
-;
-
-switch_block_statement_group:
- switch_labels block_statements
-;
-
-switch_labels:
- switch_label
-| switch_labels switch_label
-;
-
-switch_label:
- CASE_TK constant_expression REL_CL_TK
- {
- tree lab = build1 (CASE_EXPR, NULL_TREE, $2);
- EXPR_WFL_LINECOL (lab) = $1.location;
- java_method_add_stmt (current_function_decl, lab);
- }
-| DEFAULT_TK REL_CL_TK
- {
- tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
- EXPR_WFL_LINECOL (lab) = $1.location;
- java_method_add_stmt (current_function_decl, lab);
- }
-| CASE_TK error
- {yyerror ("Missing or invalid constant expression"); RECOVER;}
-| CASE_TK constant_expression error
- {yyerror ("':' expected"); RECOVER;}
-| DEFAULT_TK error
- {yyerror ("':' expected"); RECOVER;}
-;
-
-while_expression:
- WHILE_TK OP_TK expression CP_TK
- {
- tree body = build_loop_body ($2.location, $3, 0);
- $$ = build_new_loop (body);
- }
-;
-
-while_statement:
- while_expression statement
- { $$ = finish_loop_body (0, NULL_TREE, $2, 0); }
-| WHILE_TK error
- {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;}
-| WHILE_TK OP_TK error
- {yyerror ("Missing term and ')' expected"); RECOVER;}
-| WHILE_TK OP_TK expression error
- {yyerror ("')' expected"); RECOVER;}
-;
-
-while_statement_nsi:
- while_expression statement_nsi
- { $$ = finish_loop_body (0, NULL_TREE, $2, 0); }
-;
-
-do_statement_begin:
- DO_TK
- {
- tree body = build_loop_body (0, NULL_TREE, 1);
- $$ = build_new_loop (body);
- }
- /* Need error handing here. FIXME */
-;
-
-do_statement:
- do_statement_begin statement WHILE_TK OP_TK expression CP_TK SC_TK
- { $$ = finish_loop_body ($4.location, $5, $2, 1); }
-;
-
-for_statement:
- for_begin SC_TK expression SC_TK for_update CP_TK statement
- { $$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7); }
-| for_begin SC_TK SC_TK for_update CP_TK statement
- {
- $$ = finish_for_loop (0, NULL_TREE, $4, $6);
- /* We have not condition, so we get rid of the EXIT_EXPR */
- LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) =
- empty_stmt_node;
- }
-| for_begin SC_TK error
- {yyerror ("Invalid control expression"); RECOVER;}
-| for_begin SC_TK expression SC_TK error
- {yyerror ("Invalid update expression"); RECOVER;}
-| for_begin SC_TK SC_TK error
- {yyerror ("Invalid update expression"); RECOVER;}
-;
-
-for_statement_nsi:
- for_begin SC_TK expression SC_TK for_update CP_TK statement_nsi
- { $$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7);}
-| for_begin SC_TK SC_TK for_update CP_TK statement_nsi
- {
- $$ = finish_for_loop (0, NULL_TREE, $4, $6);
- /* We have not condition, so we get rid of the EXIT_EXPR */
- LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) =
- empty_stmt_node;
- }
-;
-
-for_header:
- FOR_TK OP_TK
- {
- /* This scope defined for local variable that may be
- defined within the scope of the for loop */
- enter_block ();
- }
-| FOR_TK error
- {yyerror ("'(' expected"); DRECOVER(for_1);}
-| FOR_TK OP_TK error
- {yyerror ("Invalid init statement"); RECOVER;}
-;
-
-for_begin:
- for_header for_init
- {
- /* We now declare the loop body. The loop is
- declared as a for loop. */
- tree body = build_loop_body (0, NULL_TREE, 0);
- $$ = build_new_loop (body);
- IS_FOR_LOOP_P ($$) = 1;
- /* The loop is added to the current block the for
- statement is defined within */
- java_method_add_stmt (current_function_decl, $$);
- }
-;
-for_init: /* Can be empty */
- { $$ = empty_stmt_node; }
-| statement_expression_list
- {
- /* Init statement recorded within the previously
- defined block scope */
- $$ = java_method_add_stmt (current_function_decl, $1);
- }
-| local_variable_declaration
- {
- /* Local variable are recorded within the previously
- defined block scope */
- $$ = NULL_TREE;
- }
-| statement_expression_list error
- {yyerror ("';' expected"); DRECOVER(for_init_1);}
-;
-
-for_update: /* Can be empty */
- {$$ = empty_stmt_node;}
-| statement_expression_list
- { $$ = build_debugable_stmt (BUILD_LOCATION (), $1); }
-;
-
-statement_expression_list:
- statement_expression
- { $$ = add_stmt_to_compound (NULL_TREE, NULL_TREE, $1); }
-| statement_expression_list C_TK statement_expression
- { $$ = add_stmt_to_compound ($1, NULL_TREE, $3); }
-| statement_expression_list C_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-break_statement:
- BREAK_TK SC_TK
- { $$ = build_bc_statement ($1.location, 1, NULL_TREE); }
-| BREAK_TK identifier SC_TK
- { $$ = build_bc_statement ($1.location, 1, $2); }
-| BREAK_TK error
- {yyerror ("Missing term"); RECOVER;}
-| BREAK_TK identifier error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-continue_statement:
- CONTINUE_TK SC_TK
- { $$ = build_bc_statement ($1.location, 0, NULL_TREE); }
-| CONTINUE_TK identifier SC_TK
- { $$ = build_bc_statement ($1.location, 0, $2); }
-| CONTINUE_TK error
- {yyerror ("Missing term"); RECOVER;}
-| CONTINUE_TK identifier error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-return_statement:
- RETURN_TK SC_TK
- { $$ = build_return ($1.location, NULL_TREE); }
-| RETURN_TK expression SC_TK
- { $$ = build_return ($1.location, $2); }
-| RETURN_TK error
- {yyerror ("Missing term"); RECOVER;}
-| RETURN_TK expression error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-throw_statement:
- THROW_TK expression SC_TK
- {
- $$ = build1 (THROW_EXPR, NULL_TREE, $2);
- EXPR_WFL_LINECOL ($$) = $1.location;
- }
-| THROW_TK error
- {yyerror ("Missing term"); RECOVER;}
-| THROW_TK expression error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-synchronized_statement:
- synchronized OP_TK expression CP_TK block
- {
- $$ = build (SYNCHRONIZED_EXPR, NULL_TREE, $3, $5);
- EXPR_WFL_LINECOL ($$) =
- EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
- }
-| synchronized OP_TK expression CP_TK error
- {yyerror ("'{' expected"); RECOVER;}
-| synchronized error
- {yyerror ("'(' expected"); RECOVER;}
-| synchronized OP_TK error CP_TK
- {yyerror ("Missing term"); RECOVER;}
-| synchronized OP_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-synchronized:
- MODIFIER_TK
- {
- if ((1 << $1) != ACC_SYNCHRONIZED)
- fatal ("synchronized was '%d' - yyparse", (1 << $1));
- }
-;
-
-try_statement:
- TRY_TK block catches
- { $$ = build_try_statement ($1.location, $2, $3); }
-| TRY_TK block finally
- { $$ = build_try_finally_statement ($1.location, $2, $3); }
-| TRY_TK block catches finally
- { $$ = build_try_finally_statement
- ($1.location, build_try_statement ($1.location,
- $2, $3), $4);
- }
-| TRY_TK error
- {yyerror ("'{' expected"); DRECOVER (try_statement);}
-;
-
-catches:
- catch_clause
-| catches catch_clause
- {
- TREE_CHAIN ($2) = $1;
- $$ = $2;
- }
-;
-
-catch_clause:
- catch_clause_parameter block
- {
- java_method_add_stmt (current_function_decl, $2);
- exit_block ();
- $$ = $1;
- }
-
-catch_clause_parameter:
- CATCH_TK OP_TK formal_parameter CP_TK
- {
- /* We add a block to define a scope for
- formal_parameter (CCBP). The formal parameter is
- declared initialized by the appropriate function
- call */
- tree ccpb = enter_block ();
- tree init = build_assignment (ASSIGN_TK, $2.location,
- TREE_PURPOSE ($3),
- soft_exceptioninfo_call_node);
- declare_local_variables (0, TREE_VALUE ($3),
- build_tree_list (TREE_PURPOSE ($3),
- init));
- $$ = build1 (CATCH_EXPR, NULL_TREE, ccpb);
- EXPR_WFL_LINECOL ($$) = $1.location;
- }
-| CATCH_TK error
- {yyerror ("'(' expected"); RECOVER;}
-| CATCH_TK OP_TK error
- {yyerror ("Missing term or ')' expected"); DRECOVER (2);}
-| CATCH_TK OP_TK error CP_TK /* That's for () */
- {yyerror ("')' expected"); DRECOVER (1);}
-;
-
-finally:
- FINALLY_TK block
- { $$ = $2; }
-| FINALLY_TK error
- {yyerror ("'{' expected"); RECOVER; }
-;
-
-/* 19.12 Production from 15: Expressions */
-primary:
- primary_no_new_array
-| array_creation_expression
-;
-
-primary_no_new_array:
- literal
-| THIS_TK
- { $$ = build_this ($1.location); }
-| OP_TK expression CP_TK
- {$$ = $2;}
-| class_instance_creation_expression
-| field_access
-| method_invocation
-| array_access
- /* type DOT_TK CLASS_TK doens't work. So we split the rule
- 'type' into its components. Missing is something for array,
- which will complete the reference_type part. FIXME */
-| name DOT_TK CLASS_TK /* Added, JDK1.1 class literals */
- { $$ = parse_jdk1_1_error ("named class literals"); }
-| primitive_type DOT_TK CLASS_TK /* Added, JDK1.1 class literals */
- { $$ = build_class_ref ($1); }
-| VOID_TK DOT_TK CLASS_TK /* Added, JDK1.1 class literals */
- { $$ = build_class_ref (void_type_node); }
- /* Added, JDK1.1 inner classes. Documentation is wrong
- refering to a 'ClassName' (class_name) rule that doesn't
- exist. Used name instead. */
-| name DOT_TK THIS_TK
- { $$ = parse_jdk1_1_error ("class literals"); }
-| OP_TK expression error
- {yyerror ("')' expected"); RECOVER;}
-| name DOT_TK error
- {yyerror ("'class' or 'this' expected" ); RECOVER;}
-| primitive_type DOT_TK error
- {yyerror ("'class' expected" ); RECOVER;}
-| VOID_TK DOT_TK error
- {yyerror ("'class' expected" ); RECOVER;}
-;
-
-class_instance_creation_expression:
- NEW_TK class_type OP_TK argument_list CP_TK
- { $$ = build_new_invocation ($2, $4); }
-| NEW_TK class_type OP_TK CP_TK
- { $$ = build_new_invocation ($2, NULL_TREE); }
- /* Added, JDK1.1 inner classes but modified to use
- 'class_type' instead of 'TypeName' (type_name) mentionned
- in the documentation but doesn't exist. */
-| NEW_TK class_type OP_TK argument_list CP_TK class_body
- { $$ = parse_jdk1_1_error ("inner class instance creation"); }
-| NEW_TK class_type OP_TK CP_TK class_body
- { $$ = parse_jdk1_1_error ("inner class instance creation"); }
- /* Added, JDK1.1 inner classes, modified to use name or
- primary instead of primary solely which couldn't work in
- all situations. */
-| something_dot_new identifier OP_TK CP_TK
-| something_dot_new identifier OP_TK CP_TK class_body
-| something_dot_new identifier OP_TK argument_list CP_TK
-| something_dot_new identifier OP_TK argument_list CP_TK class_body
-| NEW_TK error SC_TK
- {yyerror ("'(' expected"); DRECOVER(new_1);}
-| NEW_TK class_type error
- {yyerror ("'(' expected"); RECOVER;}
-| NEW_TK class_type OP_TK error
- {yyerror ("')' or term expected"); RECOVER;}
-| NEW_TK class_type OP_TK argument_list error
- {yyerror ("')' expected"); RECOVER;}
-| something_dot_new error
- {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;}
-| something_dot_new identifier error
- {yyerror ("'(' expected"); RECOVER;}
-;
-
-something_dot_new: /* Added, not part of the specs. */
- name DOT_TK NEW_TK
-| primary DOT_TK NEW_TK
-;
-
-argument_list:
- expression
- {
- $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
- ctxp->formal_parameter_number = 1;
- }
-| argument_list C_TK expression
- {
- ctxp->formal_parameter_number += 1;
- $$ = tree_cons (NULL_TREE, $3, $1);
- }
-| argument_list C_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-array_creation_expression:
- NEW_TK primitive_type dim_exprs
- { $$ = build_newarray_node ($2, $3, 0); }
-| NEW_TK class_or_interface_type dim_exprs
- { $$ = build_newarray_node ($2, $3, 0); }
-| NEW_TK primitive_type dim_exprs dims
- { $$ = build_newarray_node ($2, $3, CURRENT_OSB (ctxp));}
-| NEW_TK class_or_interface_type dim_exprs dims
- { $$ = build_newarray_node ($2, $3, CURRENT_OSB (ctxp));}
- /* Added, JDK1.1 anonymous array. Initial documentation rule
- modified */
-| NEW_TK class_or_interface_type dims array_initializer
- { $$ = parse_jdk1_1_error ("anonymous array"); }
-| NEW_TK primitive_type dims array_initializer
- { $$ = parse_jdk1_1_error ("anonymous array"); }
-| NEW_TK error CSB_TK
- {yyerror ("'[' expected"); DRECOVER ("]");}
-| NEW_TK error OSB_TK
- {yyerror ("']' expected"); RECOVER;}
-;
-
-dim_exprs:
- dim_expr
- { $$ = build_tree_list (NULL_TREE, $1); }
-| dim_exprs dim_expr
- { $$ = tree_cons (NULL_TREE, $2, $$); }
-;
-
-dim_expr:
- OSB_TK expression CSB_TK
- {
- EXPR_WFL_LINECOL ($2) = $1.location;
- $$ = $2;
- }
-| OSB_TK expression error
- {yyerror ("']' expected"); RECOVER;}
-| OSB_TK error
- {
- yyerror ("Missing term");
- yyerror ("']' expected");
- RECOVER;
- }
-;
-
-dims:
- OSB_TK CSB_TK
- {
- int allocate = 0;
- /* If not initialized, allocate memory for the osb
- numbers stack */
- if (!ctxp->osb_limit)
- {
- allocate = ctxp->osb_limit = 32;
- ctxp->osb_depth = -1;
- }
- /* If capacity overflown, reallocate a bigger chuck */
- else if (ctxp->osb_depth+1 == ctxp->osb_limit)
- allocate = ctxp->osb_limit << 1;
-
- if (allocate)
- {
- allocate *= sizeof (int);
- if (ctxp->osb_number)
- ctxp->osb_number = (int *)xrealloc (ctxp->osb_number,
- allocate);
- else
- ctxp->osb_number = (int *)xmalloc (allocate);
- }
- ctxp->osb_depth++;
- CURRENT_OSB (ctxp) = 1;
- }
-| dims OSB_TK CSB_TK
- { CURRENT_OSB (ctxp)++; }
-| dims OSB_TK error
- { yyerror ("']' expected"); RECOVER;}
-;
-
-field_access:
- primary DOT_TK identifier
- { $$ = make_qualified_primary ($1, $3, $2.location); }
- /* FIXME - REWRITE TO:
- { $$ = build_binop (COMPONENT_REF, $2.location, $1, $3); } */
-| SUPER_TK DOT_TK identifier
- {
- tree super_wfl =
- build_wfl_node (super_identifier_node);
- EXPR_WFL_LINECOL (super_wfl) = $1.location;
- $$ = make_qualified_name (super_wfl, $3, $2.location);
- }
-| SUPER_TK error
- {yyerror ("Field expected"); DRECOVER (super_field_acces);}
-;
-
-method_invocation:
- name OP_TK CP_TK
- { $$ = build_method_invocation ($1, NULL_TREE); }
-| name OP_TK argument_list CP_TK
- { $$ = build_method_invocation ($1, $3); }
-| primary DOT_TK identifier OP_TK CP_TK
- {
- if (TREE_CODE ($1) == THIS_EXPR)
- $$ = build_this_super_qualified_invocation
- (1, $3, NULL_TREE, 0, $2.location);
- else
- {
- tree invok = build_method_invocation ($3, NULL_TREE);
- $$ = make_qualified_primary ($1, invok, $2.location);
- }
- }
-| primary DOT_TK identifier OP_TK argument_list CP_TK
- {
- if (TREE_CODE ($1) == THIS_EXPR)
- $$ = build_this_super_qualified_invocation
- (1, $3, $5, 0, $2.location);
- else
- {
- tree invok = build_method_invocation ($3, $5);
- $$ = make_qualified_primary ($1, invok, $2.location);
- }
- }
-| SUPER_TK DOT_TK identifier OP_TK CP_TK
- {
- $$ = build_this_super_qualified_invocation
- (0, $3, NULL_TREE, $1.location, $2.location);
- }
-| SUPER_TK DOT_TK identifier OP_TK argument_list CP_TK
- {
- $$ = build_this_super_qualified_invocation
- (0, $3, $5, $1.location, $2.location);
- }
- /* Screws up thing. I let it here until I'm convinced it can
- be removed. FIXME
-| primary DOT_TK error
- {yyerror ("'(' expected"); DRECOVER(bad);} */
-| SUPER_TK DOT_TK error CP_TK
- { yyerror ("'(' expected"); DRECOVER (method_invocation); }
-| SUPER_TK DOT_TK error DOT_TK
- { yyerror ("'(' expected"); DRECOVER (method_invocation); }
-;
-
-array_access:
- name OSB_TK expression CSB_TK
- { $$ = build_array_ref ($2.location, $1, $3); }
-| primary_no_new_array OSB_TK expression CSB_TK
- { $$ = build_array_ref ($2.location, $1, $3); }
-| name OSB_TK error
- {
- yyerror ("Missing term and ']' expected");
- DRECOVER(array_access);
- }
-| name OSB_TK expression error
- {
- yyerror ("']' expected");
- DRECOVER(array_access);
- }
-| primary_no_new_array OSB_TK error
- {
- yyerror ("Missing term and ']' expected");
- DRECOVER(array_access);
- }
-| primary_no_new_array OSB_TK expression error
- {
- yyerror ("']' expected");
- DRECOVER(array_access);
- }
-;
-
-postfix_expression:
- primary
-| name
-| post_increment_expression
-| post_decrement_expression
-;
-
-post_increment_expression:
- postfix_expression INCR_TK
- { $$ = build_incdec ($2.token, $2.location, $1, 1); }
-;
-
-post_decrement_expression:
- postfix_expression DECR_TK
- { $$ = build_incdec ($2.token, $2.location, $1, 1); }
-;
-
-unary_expression:
- pre_increment_expression
-| pre_decrement_expression
-| PLUS_TK unary_expression
- {$$ = build_unaryop ($1.token, $1.location, $2); }
-| MINUS_TK unary_expression
- {$$ = build_unaryop ($1.token, $1.location, $2); }
-| unary_expression_not_plus_minus
-| PLUS_TK error
- {yyerror ("Missing term"); RECOVER}
-| MINUS_TK error
- {yyerror ("Missing term"); RECOVER}
-;
-
-pre_increment_expression:
- INCR_TK unary_expression
- {$$ = build_incdec ($1.token, $1.location, $2, 0); }
-| INCR_TK error
- {yyerror ("Missing term"); RECOVER}
-;
-
-pre_decrement_expression:
- DECR_TK unary_expression
- {$$ = build_incdec ($1.token, $1.location, $2, 0); }
-| DECR_TK error
- {yyerror ("Missing term"); RECOVER}
-;
-
-unary_expression_not_plus_minus:
- postfix_expression
-| NOT_TK unary_expression
- {$$ = build_unaryop ($1.token, $1.location, $2); }
-| NEG_TK unary_expression
- {$$ = build_unaryop ($1.token, $1.location, $2); }
-| cast_expression
-| NOT_TK error
- {yyerror ("Missing term"); RECOVER}
-| NEG_TK error
- {yyerror ("Missing term"); RECOVER}
-;
-
-cast_expression: /* Error handling here is potentially weak */
- OP_TK primitive_type dims CP_TK unary_expression
- {
- tree type = $2;
- while (CURRENT_OSB (ctxp)--)
- type = build_java_array_type (type, -1);
- ctxp->osb_depth--;
- $$ = build_cast ($1.location, type, $5);
- }
-| OP_TK primitive_type CP_TK unary_expression
- { $$ = build_cast ($1.location, $2, $4); }
-| OP_TK expression CP_TK unary_expression_not_plus_minus
- { $$ = build_cast ($1.location, $2, $4); }
-| OP_TK name dims CP_TK unary_expression_not_plus_minus
- {
- char *ptr;
- while (CURRENT_OSB (ctxp)--)
- obstack_1grow (&temporary_obstack, '[');
- ctxp->osb_depth--;
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE ($2)),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE ($2)));
- ptr = obstack_finish (&temporary_obstack);
- EXPR_WFL_NODE ($2) = get_identifier (ptr);
- $$ = build_cast ($1.location, $2, $5);
- }
-| OP_TK primitive_type OSB_TK error
- {yyerror ("']' expected, invalid type expression");}
-| OP_TK error
- {
- if (ctxp->prevent_ese != lineno)
- yyerror ("Invalid type expression"); RECOVER;
- RECOVER;
- }
-| OP_TK primitive_type dims CP_TK error
- {yyerror ("Missing term"); RECOVER;}
-| OP_TK primitive_type CP_TK error
- {yyerror ("Missing term"); RECOVER;}
-| OP_TK name dims CP_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-multiplicative_expression:
- unary_expression
-| multiplicative_expression MULT_TK unary_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token),
- $2.location, $1, $3);
- }
-| multiplicative_expression DIV_TK unary_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| multiplicative_expression REM_TK unary_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| multiplicative_expression MULT_TK error
- {yyerror ("Missing term"); RECOVER;}
-| multiplicative_expression DIV_TK error
- {yyerror ("Missing term"); RECOVER;}
-| multiplicative_expression REM_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-additive_expression:
- multiplicative_expression
-| additive_expression PLUS_TK multiplicative_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| additive_expression MINUS_TK multiplicative_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| additive_expression PLUS_TK error
- {yyerror ("Missing term"); RECOVER;}
-| additive_expression MINUS_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-shift_expression:
- additive_expression
-| shift_expression LS_TK additive_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| shift_expression SRS_TK additive_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| shift_expression ZRS_TK additive_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| shift_expression LS_TK error
- {yyerror ("Missing term"); RECOVER;}
-| shift_expression SRS_TK error
- {yyerror ("Missing term"); RECOVER;}
-| shift_expression ZRS_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-relational_expression:
- shift_expression
-| relational_expression LT_TK shift_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| relational_expression GT_TK shift_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| relational_expression LTE_TK shift_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| relational_expression GTE_TK shift_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| relational_expression INSTANCEOF_TK reference_type
- { $$ = build_binop (INSTANCEOF_EXPR, $2.location, $1, $3); }
-| relational_expression LT_TK error
- {yyerror ("Missing term"); RECOVER;}
-| relational_expression GT_TK error
- {yyerror ("Missing term"); RECOVER;}
-| relational_expression LTE_TK error
- {yyerror ("Missing term"); RECOVER;}
-| relational_expression GTE_TK error
- {yyerror ("Missing term"); RECOVER;}
-| relational_expression INSTANCEOF_TK error
- {yyerror ("Invalid reference type"); RECOVER;}
-;
-
-equality_expression:
- relational_expression
-| equality_expression EQ_TK relational_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| equality_expression NEQ_TK relational_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| equality_expression EQ_TK error
- {yyerror ("Missing term"); RECOVER;}
-| equality_expression NEQ_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-and_expression:
- equality_expression
-| and_expression AND_TK equality_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| and_expression AND_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-exclusive_or_expression:
- and_expression
-| exclusive_or_expression XOR_TK and_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| exclusive_or_expression XOR_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-inclusive_or_expression:
- exclusive_or_expression
-| inclusive_or_expression OR_TK exclusive_or_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| inclusive_or_expression OR_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-conditional_and_expression:
- inclusive_or_expression
-| conditional_and_expression BOOL_AND_TK inclusive_or_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| conditional_and_expression BOOL_AND_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-conditional_or_expression:
- conditional_and_expression
-| conditional_or_expression BOOL_OR_TK conditional_and_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
- }
-| conditional_or_expression BOOL_OR_TK error
- {yyerror ("Missing term"); RECOVER;}
-;
-
-conditional_expression: /* Error handling here is weak */
- conditional_or_expression
-| conditional_or_expression REL_QM_TK expression REL_CL_TK conditional_expression
- {
- $$ = build (CONDITIONAL_EXPR, NULL_TREE, $1, $3, $5);
- EXPR_WFL_LINECOL ($$) = $2.location;
- }
-| conditional_or_expression REL_QM_TK REL_CL_TK error
- {
- YYERROR_NOW;
- yyerror ("Missing term");
- DRECOVER (1);
- }
-| conditional_or_expression REL_QM_TK error
- {yyerror ("Missing term"); DRECOVER (2);}
-| conditional_or_expression REL_QM_TK expression REL_CL_TK error
- {yyerror ("Missing term"); DRECOVER (3);}
-;
-
-assignment_expression:
- conditional_expression
-| assignment
-;
-
-assignment:
- left_hand_side assignment_operator assignment_expression
- { $$ = build_assignment ($2.token, $2.location, $1, $3); }
-| left_hand_side assignment_operator error
- {
- if (ctxp->prevent_ese != lineno)
- yyerror ("Missing term");
- DRECOVER (assign);
- }
-;
-
-left_hand_side:
- name
-| field_access
-| array_access
-;
-
-assignment_operator:
- ASSIGN_ANY_TK
-| ASSIGN_TK
-;
-
-expression:
- assignment_expression
-;
-
-constant_expression:
- expression
-;
-
-%%
-
-
-/* Flag for the error report routine to issue the error the first time
- it's called (overriding the default behavior which is to drop the
- first invocation and honor the second one, taking advantage of a
- richer context. */
-static int force_error = 0;
-
-/* Create a new parser context and make it the current one. */
-
-void
-java_push_parser_context ()
-{
- struct parser_ctxt *new =
- (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
-
- bzero ((PTR) new, sizeof (struct parser_ctxt));
- new->next = ctxp;
- ctxp = new;
- if (ctxp->next)
- {
- ctxp->incomplete_class = ctxp->next->incomplete_class;
- ctxp->gclass_list = ctxp->next->gclass_list;
- }
-}
-
-/* If the first file of a file list was a class file, no context
- exists for a source file to be parsed. This boolean remembers that
- java_parser_context_save_global might have created a dummy one, so
- that java_parser_context_restore_global can pop it. */
-static int extra_ctxp_pushed_p = 0;
-
-void
-java_parser_context_save_global ()
-{
- if (!ctxp)
- {
- java_push_parser_context ();
- extra_ctxp_pushed_p = 1;
- }
- ctxp->finput = finput;
- ctxp->lineno = lineno;
- ctxp->current_class = current_class;
- ctxp->filename = input_filename;
- ctxp->current_function_decl = current_function_decl;
-}
-
-void
-java_parser_context_restore_global ()
-{
- finput = ctxp->finput;
- lineno = ctxp->lineno;
- current_class = ctxp->current_class;
- input_filename = ctxp->filename;
- current_function_decl = ctxp->current_function_decl;
- if (!ctxp->next && extra_ctxp_pushed_p)
- {
- java_pop_parser_context (0);
- extra_ctxp_pushed_p = 0;
- }
-}
-
-void
-java_pop_parser_context (generate)
- int generate;
-{
- tree current;
- struct parser_ctxt *toFree, *next;
-
- if (!ctxp)
- return;
-
- toFree = ctxp;
- next = ctxp->next;
- if (next)
- {
- next->incomplete_class = ctxp->incomplete_class;
- next->gclass_list = ctxp->gclass_list;
- lineno = ctxp->lineno;
- finput = ctxp->finput;
- current_class = ctxp->current_class;
- }
-
- /* Set the single import class file flag to 0 for the current list
- of imported things */
- for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
- IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0;
-
- /* And restore those of the previous context */
- if ((ctxp = next)) /* Assignment is really meant here */
- for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
- IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1;
-
- if (generate)
- {
- toFree->next = ctxp_for_generation;
- ctxp_for_generation = toFree;
- }
- else
- free (toFree);
-}
-
-/* Reporting JDK1.1 features not implemented */
-
-static tree
-parse_jdk1_1_error (msg)
- char *msg;
-{
- sorry (": `%s' JDK1.1(TM) feature", msg);
- java_error_count++;
- return empty_stmt_node;
-}
-
-static int do_warning = 0;
-
-void
-yyerror (msg)
- char *msg;
-{
- static java_lc elc;
- static int prev_lineno;
- static char *prev_msg;
-
- int save_lineno;
- char *remainder, *code_from_source;
- extern struct obstack temporary_obstack;
-
- if (!force_error && prev_lineno == lineno)
- return;
-
- /* Save current error location but report latter, when the context is
- richer. */
- if (ctxp->java_error_flag == 0)
- {
- ctxp->java_error_flag = 1;
- elc = ctxp->elc;
- /* Do something to use the previous line if we're reaching the
- end of the file... */
-#ifdef VERBOSE_SKELETON
- printf ("* Error detected (%s)\n", (msg ? msg : "(null)"));
-#endif
- return;
- }
-
- /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
- if (!force_error && msg == prev_msg && prev_lineno == elc.line)
- return;
-
- ctxp->java_error_flag = 0;
- if (do_warning)
- java_warning_count++;
- else
- java_error_count++;
-
- if (elc.col == 0 && msg[1] == ';')
- {
- elc.col = ctxp->p_line->char_col-1;
- elc.line = ctxp->p_line->lineno;
- }
-
- save_lineno = lineno;
- prev_lineno = lineno = elc.line;
- prev_msg = msg;
-
- code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
- obstack_grow0 (&temporary_obstack,
- code_from_source, strlen (code_from_source));
- remainder = obstack_finish (&temporary_obstack);
- if (do_warning)
- warning ("%s.\n%s", msg, remainder);
- else
- error ("%s.\n%s", msg, remainder);
-
- /* This allow us to cheaply avoid an extra 'Invalid expression
- statement' error report when errors have been already reported on
- the same line. This occurs when we report an error but don't have
- a synchronization point other than ';', which
- expression_statement is the only one to take care of. */
- ctxp->prevent_ese = lineno = save_lineno;
-}
-
-static void
-issue_warning_error_from_context (cl, msg, ap)
- tree cl;
- const char *msg;
- va_list ap;
-{
- char *saved, *saved_input_filename;
- char buffer [4096];
- vsprintf (buffer, msg, ap);
- force_error = 1;
-
- ctxp->elc.line = EXPR_WFL_LINENO (cl);
- ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 :
- (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl)));
-
- /* We have a CL, that's a good reason for using it if it contains data */
- saved = ctxp->filename;
- if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl))
- ctxp->filename = EXPR_WFL_FILENAME (cl);
- saved_input_filename = input_filename;
- input_filename = ctxp->filename;
- java_error (NULL);
- java_error (buffer);
- ctxp->filename = saved;
- input_filename = saved_input_filename;
- force_error = 0;
-}
-
-/* Issue an error message at a current source line CL */
-
-void
-parse_error_context VPROTO ((tree cl, const char *msg, ...))
-{
-#ifndef ANSI_PROTOTYPES
- tree cl;
- const char *msg;
-#endif
- va_list ap;
-
- VA_START (ap, msg);
-#ifndef ANSI_PROTOTYPES
- cl = va_arg (ap, tree);
- msg = va_arg (ap, const char *);
-#endif
- issue_warning_error_from_context (cl, msg, ap);
- va_end (ap);
-}
-
-/* Issue a warning at a current source line CL */
-
-static void
-parse_warning_context VPROTO ((tree cl, const char *msg, ...))
-{
-#ifndef ANSI_PROTOTYPES
- tree cl;
- const char *msg;
-#endif
- va_list ap;
-
- VA_START (ap, msg);
-#ifndef ANSI_PROTOTYPES
- cl = va_arg (ap, tree);
- msg = va_arg (ap, const char *);
-#endif
-
- force_error = do_warning = 1;
- issue_warning_error_from_context (cl, msg, ap);
- do_warning = force_error = 0;
- va_end (ap);
-}
-
-static tree
-find_expr_with_wfl (node)
- tree node;
-{
- while (node)
- {
- char code;
- tree to_return;
-
- switch (TREE_CODE (node))
- {
- case BLOCK:
- node = BLOCK_EXPR_BODY (node);
- continue;
-
- case COMPOUND_EXPR:
- to_return = find_expr_with_wfl (TREE_OPERAND (node, 0));
- if (to_return)
- return to_return;
- node = TREE_OPERAND (node, 1);
- continue;
-
- case LOOP_EXPR:
- node = TREE_OPERAND (node, 0);
- continue;
-
- case LABELED_BLOCK_EXPR:
- node = TREE_OPERAND (node, 1);
- continue;
-
- default:
- code = TREE_CODE_CLASS (TREE_CODE (node));
- if (((code == '1') || (code == '2') || (code == 'e'))
- && EXPR_WFL_LINECOL (node))
- return node;
- return NULL_TREE;
- }
- }
- return NULL_TREE;
-}
-
-/* Issue a missing return statement error. Uses METHOD to figure the
- last line of the method the error occurs in. */
-
-static void
-missing_return_error (method)
- tree method;
-{
- EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2);
- parse_error_context (wfl_operator, "Missing return statement");
-}
-
-/* Issue an unreachable statement error. From NODE, find the next
- statement to report appropriately. */
-static void
-unreachable_stmt_error (node)
- tree node;
-{
- /* Browse node to find the next expression node that has a WFL. Use
- the location to report the error */
- if (TREE_CODE (node) == COMPOUND_EXPR)
- node = find_expr_with_wfl (TREE_OPERAND (node, 1));
- else
- node = find_expr_with_wfl (node);
-
- if (node)
- {
- EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
- parse_error_context (wfl_operator, "Unreachable statement");
- }
- else
- fatal ("Can't get valid statement - unreachable_stmt_error");
-}
-
-int
-java_report_errors ()
-{
- if (java_error_count)
- fprintf (stderr, "%d error%s",
- java_error_count, (java_error_count == 1 ? "" : "s"));
- if (java_warning_count)
- fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
- java_warning_count, (java_warning_count == 1 ? "" : "s"));
- if (java_error_count || java_warning_count)
- putc ('\n', stderr);
- return java_error_count;
-}
-
-static char *
-java_accstring_lookup (flags)
- int flags;
-{
- static char buffer [80];
-#define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
-
- /* Access modifier looked-up first for easier report on forbidden
- access. */
- if (flags & ACC_PUBLIC) COPY_RETURN ("public");
- if (flags & ACC_PRIVATE) COPY_RETURN ("private");
- if (flags & ACC_PROTECTED) COPY_RETURN ("protected");
- if (flags & ACC_STATIC) COPY_RETURN ("static");
- if (flags & ACC_FINAL) COPY_RETURN ("final");
- if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized");
- if (flags & ACC_VOLATILE) COPY_RETURN ("volatile");
- if (flags & ACC_TRANSIENT) COPY_RETURN ("transient");
- if (flags & ACC_NATIVE) COPY_RETURN ("native");
- if (flags & ACC_INTERFACE) COPY_RETURN ("interface");
- if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract");
-
- buffer [0] = '\0';
- return buffer;
-#undef COPY_RETURN
-}
-
-/* Issuing error messages upon redefinition of classes, interfaces or
- variables. */
-
-static void
-classitf_redefinition_error (context, id, decl, cl)
- char *context;
- tree id, decl, cl;
-{
- parse_error_context (cl, "%s `%s' already defined in %s:%d",
- context, IDENTIFIER_POINTER (id),
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
- /* Here we should point out where its redefined. It's a unicode. FIXME */
-}
-
-static void
-variable_redefinition_error (context, name, type, line)
- tree context, name, type;
- int line;
-{
- char *type_name;
-
- /* Figure a proper name for type. We might haven't resolved it */
- if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type))
- type_name = IDENTIFIER_POINTER (TYPE_NAME (type));
- else
- type_name = lang_printable_name (type, 0);
-
- parse_error_context (context,
- "Variable `%s' is already defined in this method and "
- "was declared `%s %s' at line %d",
- IDENTIFIER_POINTER (name),
- type_name, IDENTIFIER_POINTER (name), line);
-}
-
-static tree
-build_array_from_name (type, type_wfl, name, ret_name)
- tree type, type_wfl, name, *ret_name;
-{
- int more_dims = 0;
- char *string;
-
- /* Eventually get more dims */
- string = IDENTIFIER_POINTER (name);
- while (string [more_dims] == '[')
- more_dims++;
-
- /* If we have, then craft a new type for this variable */
- if (more_dims)
- {
- name = get_identifier (&string [more_dims]);
-
- /* If we have a pointer, use its type */
- if (TREE_CODE (type) == POINTER_TYPE)
- type = TREE_TYPE (type);
-
- /* Building the first dimension of a primitive type uses this
- function */
- if (JPRIMITIVE_TYPE_P (type))
- {
- type = build_java_array_type (type, -1);
- CLASS_LOADED_P (type) = 1;
- more_dims--;
- }
- /* Otherwise, if we have a WFL for this type, use it (the type
- is already an array on an unresolved type, and we just keep
- on adding dimensions) */
- else if (type_wfl)
- type = type_wfl;
-
- /* Add all the dimensions */
- while (more_dims--)
- type = build_unresolved_array_type (type);
-
- /* The type may have been incomplete in the first place */
- if (type_wfl)
- type = obtain_incomplete_type (type);
- }
-
- *ret_name = name;
- return type;
-}
-
-/* Build something that the type identifier resolver will identify as
- being an array to an unresolved type. TYPE_WFL is a WFL on a
- identifier. */
-
-static tree
-build_unresolved_array_type (type_or_wfl)
- tree type_or_wfl;
-{
- char *ptr;
-
- /* TYPE_OR_WFL might be an array on a resolved type. In this case,
- just create a array type */
- if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
- {
- tree type = build_java_array_type (type_or_wfl, -1);
- CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl);
- return type;
- }
-
- obstack_1grow (&temporary_obstack, '[');
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
- ptr = obstack_finish (&temporary_obstack);
- return build_expr_wfl (get_identifier (ptr),
- EXPR_WFL_FILENAME (type_or_wfl),
- EXPR_WFL_LINENO (type_or_wfl),
- EXPR_WFL_COLNO (type_or_wfl));
-}
-
-/* Check modifiers. If one doesn't fit, retrieve it in its declaration line
- and point it out. */
-
-static void
-check_modifiers (message, value, mask)
- char *message;
- int value;
- int mask;
-{
- /* Should point out the one that don't fit. ASCII/unicode,
- going backward. FIXME */
- if (value & ~mask)
- {
- int i, remainder = value & ~mask;
- for (i = 0; i <= 10; i++)
- if ((1 << i) & remainder)
- parse_error_context (ctxp->modifier_ctx [i], message,
- java_accstring_lookup (1 << i));
- }
-}
-
-static void
-parser_add_interface (class_decl, interface_decl, wfl)
- tree class_decl, interface_decl, wfl;
-{
- if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
- parse_error_context (wfl, "Interface `%s' repeated",
- IDENTIFIER_POINTER (DECL_NAME (interface_decl)));
-}
-
-/* Bulk of common class/interface checks. Return 1 if an error was
- encountered. TAG is 0 for a class, 1 for an interface. */
-
-static int
-check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl)
- int is_interface, flags;
- tree raw_name, qualified_name, decl, cl;
-{
- tree node;
-
- if (!quiet_flag)
- fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"),
- IDENTIFIER_POINTER (qualified_name));
-
- /* Scope of an interface/class type name:
- - Can't be imported by a single type import
- - Can't already exists in the package */
- if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name)
- && (node = find_name_in_single_imports (raw_name)))
- {
- parse_error_context
- (cl, "%s name `%s' clashes with imported type `%s'",
- (is_interface ? "Interface" : "Class"),
- IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
- return 1;
- }
- if (decl && CLASS_COMPLETE_P (decl))
- {
- classitf_redefinition_error ((is_interface ? "Interface" : "Class"),
- qualified_name, decl, cl);
- return 1;
- }
-
- /* If public, file name should match class/interface name */
- if (flags & ACC_PUBLIC)
- {
- char *f;
-
- /* Contains OS dependent assumption on path separator. FIXME */
- for (f = &input_filename [strlen (input_filename)];
- f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR;
- f--)
- ;
- if (f[0] == '/' || f[0] == DIR_SEPARATOR)
- f++;
- if (strncmp (IDENTIFIER_POINTER (raw_name),
- f , IDENTIFIER_LENGTH (raw_name)) ||
- f [IDENTIFIER_LENGTH (raw_name)] != '.')
- parse_error_context (cl, "Public %s `%s' must be defined in a file "
- "called `%s.java'",
- (is_interface ? "interface" : "class"),
- IDENTIFIER_POINTER (qualified_name),
- IDENTIFIER_POINTER (raw_name));
- }
-
- check_modifiers ((is_interface ?
- "Illegal modifier `%s' for interface declaration" :
- "Illegal modifier `%s' for class declaration"), flags,
- (is_interface ? INTERFACE_MODIFIERS : CLASS_MODIFIERS));
- return 0;
-}
-
-/* If DECL is NULL, create and push a new DECL, record the current
- line CL and do other maintenance things. */
-
-static tree
-maybe_create_class_interface_decl (decl, qualified_name, cl)
- tree decl, qualified_name, cl;
-{
- if (!decl)
- decl = push_class (make_class (), qualified_name);
-
- /* Take care of the file and line business */
- DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
- /* If we're emiting xrefs, store the line/col number information */
- if (flag_emit_xref)
- DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl);
- else
- DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
- CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
- CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) =
- IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
-
- ctxp->current_parsed_class = decl;
-
- /* Link the declaration to the already seen ones */
- TREE_CHAIN (decl) = ctxp->class_list;
- ctxp->class_list = decl;
-
- /* Create a new nodes in the global lists */
- ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list);
- all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
-
- /* Install a new dependency list element */
- create_jdep_list (ctxp);
-
- SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
- IDENTIFIER_POINTER (qualified_name)));
- return decl;
-}
-
-static void
-add_superinterfaces (decl, interface_list)
- tree decl, interface_list;
-{
- tree node;
- /* Superinterface(s): if present and defined, parser_check_super_interface ()
- takes care of ensuring that:
- - This is an accessible interface type,
- - Circularity detection.
- parser_add_interface is then called. If present but not defined,
- the check operation is delayed until the super interface gets
- defined. */
- for (node = interface_list; node; node = TREE_CHAIN (node))
- {
- tree current = TREE_PURPOSE (node);
- tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current));
- if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl)))
- {
- if (!parser_check_super_interface (idecl, decl, current))
- parser_add_interface (decl, idecl, current);
- }
- else
- register_incomplete_type (JDEP_INTERFACE,
- current, decl, NULL_TREE);
- }
-}
-
-/* Create an interface in pass1 and return its decl. Return the
- interface's decl in pass 2. */
-
-static tree
-create_interface (flags, id, super)
- int flags;
- tree id, super;
-{
- tree raw_name = EXPR_WFL_NODE (id);
- tree q_name = parser_qualified_classname (id);
- tree decl = IDENTIFIER_CLASS_VALUE (q_name);
-
- EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */
-
- /* Basic checks: scope, redefinition, modifiers */
- if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
- return NULL_TREE;
-
- /* Interface modifiers check
- - public/abstract allowed (already done at that point)
- - abstract is obsolete (comes first, it's a warning, or should be)
- - Can't use twice the same (checked in the modifier rule) */
- if ((flags & ACC_ABSTRACT) && flag_redundant)
- parse_warning_context
- (MODIFIER_WFL (ABSTRACT_TK),
- "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
- "abstract", IDENTIFIER_POINTER (raw_name));
-
- /* Create a new decl if DECL is NULL, otherwise fix it */
- decl = maybe_create_class_interface_decl (decl, q_name, id);
-
- /* Set super info and mark the class a complete */
- set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl),
- object_type_node, ctxp->interface_number);
- ctxp->interface_number = 0;
- CLASS_COMPLETE_P (decl) = 1;
- add_superinterfaces (decl, super);
-
- return decl;
-}
-
-/* Create an class in pass1 and return its decl. Return class
- interface's decl in pass 2. */
-
-static tree
-create_class (flags, id, super, interfaces)
- int flags;
- tree id, super, interfaces;
-{
- tree raw_name = EXPR_WFL_NODE (id);
- tree class_id, decl;
- tree super_decl_type;
-
- class_id = parser_qualified_classname (id);
- decl = IDENTIFIER_CLASS_VALUE (class_id);
- ctxp->current_parsed_class_un = EXPR_WFL_NODE (id);
- EXPR_WFL_NODE (id) = class_id;
-
- /* Basic check: scope, redefinition, modifiers */
- if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id))
- return NULL_TREE;
-
- /* Class modifier check:
- - Allowed modifier (already done at that point)
- - abstract AND final forbidden
- - Public classes defined in the correct file */
- if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
- parse_error_context (id, "Class `%s' can't be declared both abstract "
- "and final", IDENTIFIER_POINTER (raw_name));
-
- /* Create a new decl if DECL is NULL, otherwise fix it */
- decl = maybe_create_class_interface_decl (decl, class_id, id);
-
- /* If SUPER exists, use it, otherwise use Object */
- if (super)
- {
- /* Can't extend java.lang.Object */
- if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
- {
- parse_error_context (id, "Can't extend `java.lang.Object'");
- return NULL_TREE;
- }
-
- super_decl_type =
- register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
- }
- else if (TREE_TYPE (decl) != object_type_node)
- super_decl_type = object_type_node;
- /* We're defining java.lang.Object */
- else
- super_decl_type = NULL_TREE;
-
- /* Set super info and mark the class a complete */
- set_super_info (flags, TREE_TYPE (decl), super_decl_type,
- ctxp->interface_number);
- ctxp->interface_number = 0;
- CLASS_COMPLETE_P (decl) = 1;
- add_superinterfaces (decl, interfaces);
-
- /* If doing xref, store the location at which the inherited class
- (if any) was seen. */
- if (flag_emit_xref && super)
- DECL_INHERITED_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (super);
-
- /* Eventually sets the @deprecated tag flag */
- CHECK_DEPRECATED (decl);
-
- return decl;
-}
-
-/* Can't use lookup_field () since we don't want to load the class and
- can't set the CLASS_LOADED_P flag */
-
-static tree
-find_field (class, name)
- tree class;
- tree name;
-{
- tree decl;
- for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl))
- {
- if (DECL_NAME (decl) == name)
- return decl;
- }
- return NULL_TREE;
-}
-
-/* Wrap around lookup_field that doesn't potentially upset the value
- of CLASS */
-
-static tree
-lookup_field_wrapper (class, name)
- tree class, name;
-{
- tree type = class;
- tree decl;
- java_parser_context_save_global ();
- decl = lookup_field (&type, name);
- java_parser_context_restore_global ();
- return decl == error_mark_node ? NULL : decl;
-}
-
-/* Find duplicate field within the same class declarations and report
- the error. Returns 1 if a duplicated field was found, 0
- otherwise. */
-
-static int
-duplicate_declaration_error_p (new_field_name, new_type, cl)
- tree new_field_name, new_type, cl;
-{
- /* This might be modified to work with method decl as well */
- tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class),
- new_field_name);
- if (decl)
- {
- char *t1 = strdup (purify_type_name
- ((TREE_CODE (new_type) == POINTER_TYPE
- && TREE_TYPE (new_type) == NULL_TREE) ?
- IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
- lang_printable_name (new_type, 1)));
- /* The type may not have been completed by the time we report
- the error */
- char *t2 = strdup (purify_type_name
- ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
- && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
- IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
- lang_printable_name (TREE_TYPE (decl), 1)));
- parse_error_context
- (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
- t1, IDENTIFIER_POINTER (new_field_name),
- t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
- free (t1);
- free (t2);
- return 1;
- }
- return 0;
-}
-
-/* Field registration routine. If TYPE doesn't exist, field
- declarations are linked to the undefined TYPE dependency list, to
- be later resolved in java_complete_class () */
-
-static void
-register_fields (flags, type, variable_list)
- int flags;
- tree type, variable_list;
-{
- tree current, saved_type;
- tree class_type = TREE_TYPE (ctxp->current_parsed_class);
- int saved_lineno = lineno;
- int must_chain = 0;
- tree wfl = NULL_TREE;
-
- /* If we're adding fields to interfaces, those fields are public,
- static, final */
- if (CLASS_INTERFACE (TYPE_NAME (class_type)))
- {
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
- flags, ACC_PUBLIC,
- "%s", "interface field(s)");
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
- flags, ACC_STATIC,
- "%s", "interface field(s)");
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
- flags, ACC_FINAL, "%s", "interface field(s)");
- check_modifiers ("Illegal interface member modifier `%s'", flags,
- INTERFACE_FIELD_MODIFIERS);
- flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
- }
-
- /* Obtain a suitable type for resolution, if necessary */
- SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain);
-
- /* If TYPE is fully resolved and we don't have a reference, make one */
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
-
- for (current = variable_list, saved_type = type; current;
- current = TREE_CHAIN (current), type = saved_type)
- {
- tree real_type;
- tree field_decl;
- tree cl = TREE_PURPOSE (current);
- tree init = TREE_VALUE (current);
- tree current_name = EXPR_WFL_NODE (cl);
-
- /* Process NAME, as it may specify extra dimension(s) for it */
- type = build_array_from_name (type, wfl, current_name, &current_name);
-
- /* Type adjustment. We may have just readjusted TYPE because
- the variable specified more dimensions. Make sure we have
- a reference if we can and don't have one already. Also
- change the name if we have an init. */
- if (type != saved_type)
- {
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
- if (init)
- EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name;
- }
-
- real_type = GET_REAL_TYPE (type);
- /* Check for redeclarations */
- if (duplicate_declaration_error_p (current_name, real_type, cl))
- continue;
-
- /* Set lineno to the line the field was found and create a
- declaration for it. Eventually sets the @deprecated tag flag. */
- if (flag_emit_xref)
- lineno = EXPR_WFL_LINECOL (cl);
- else
- lineno = EXPR_WFL_LINENO (cl);
- field_decl = add_field (class_type, current_name, real_type, flags);
- CHECK_DEPRECATED (field_decl);
-
- /* Check if we must chain. */
- if (must_chain)
- register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
-
- /* If we have an initialization value tied to the field */
- if (init)
- {
- /* The field is declared static */
- if (flags & ACC_STATIC)
- {
- /* We include the field and its initialization part into
- a list used to generate <clinit>. After <clinit> is
- walked, field initializations will be processed and
- fields initialized with known constants will be taken
- out of <clinit> and have their DECL_INITIAL set
- appropriately. */
- TREE_CHAIN (init) = ctxp->static_initialized;
- ctxp->static_initialized = init;
- if (TREE_OPERAND (init, 1)
- && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT)
- TREE_STATIC (TREE_OPERAND (init, 1)) = 1;
- }
- /* A non-static field declared with an immediate initialization is
- to be initialized in <init>, if any. This field is remembered
- to be processed at the time of the generation of <init>. */
- else
- {
- TREE_CHAIN (init) = ctxp->non_static_initialized;
- ctxp->non_static_initialized = init;
- }
- MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
- DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
- }
- }
- lineno = saved_lineno;
-}
-
-/* Generate the method $finit$ that initializes fields initialized
- upon declaration. */
-
-static void
-maybe_generate_finit ()
-{
- tree mdecl, current;
-
- if (!ctxp->non_static_initialized || java_error_count)
- return;
-
- mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
- ACC_PRIVATE, void_type_node,
- finit_identifier_node, end_params_node);
- start_artificial_method_body (mdecl);
-
- ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized);
- for (current = ctxp->non_static_initialized; current;
- current = TREE_CHAIN (current))
- java_method_add_stmt (mdecl,
- build_debugable_stmt (EXPR_WFL_LINECOL (current),
- current));
-
- end_artificial_method_body (mdecl);
- CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1;
- ctxp->non_static_initialized = NULL_TREE;
-}
-
-/* Check whether it is necessary to generate a <clinit> for the class
- we just parsed. */
-
-static void
-maybe_generate_clinit ()
-{
- tree mdecl, c;
-
- if (!ctxp->static_initialized || java_error_count)
- return;
-
- mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
- ACC_STATIC, void_type_node,
- clinit_identifier_node, end_params_node);
- start_artificial_method_body (mdecl);
-
- /* Keep initialization in order to enforce 8.5 */
- ctxp->static_initialized = nreverse (ctxp->static_initialized);
-
- /* We process the list of assignment we produced as the result of
- the declaration of initialized static field and add them as
- statement to the <clinit> method. */
- for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c))
- {
- /* We build the assignment expression that will initialize the
- field to its value. There are strict rules on static
- initializers (8.5). FIXME */
- java_method_add_stmt (mdecl,
- build_debugable_stmt (EXPR_WFL_LINECOL (c), c));
- }
-
- end_artificial_method_body (mdecl);
- ctxp->static_initialized = NULL_TREE;
-}
-
-/* Shared accros method_declarator and method_header to remember the
- patch stage that was reached during the declaration of the method.
- A method DECL is built differently is there is no patch
- (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
- pending on the currently defined method. */
-
-static int patch_stage;
-
-/* Check the method declaration and add the method to its current
- class. If the argument list is known to contain incomplete types,
- the method is partially added and the registration will be resume
- once the method arguments resolved. If TYPE is NULL, we're dealing
- with a constructor. */
-
-static tree
-method_header (flags, type, mdecl, throws)
- int flags;
- tree type, mdecl, throws;
-{
- tree meth = TREE_VALUE (mdecl);
- tree id = TREE_PURPOSE (mdecl);
- tree this_class = TREE_TYPE (ctxp->current_parsed_class);
- tree type_wfl = NULL_TREE;
- tree meth_name = NULL_TREE, current, orig_arg;
- int saved_lineno;
- int constructor_ok = 0, must_chain;
-
- check_modifiers_consistency (flags);
-
- /* There are some forbidden modifiers for an abstract method and its
- class must be abstract as well. */
- if (type && (flags & ACC_ABSTRACT))
- {
- ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private");
- ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static");
- ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final");
- ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native");
- ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized");
- if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
- && !CLASS_INTERFACE (TYPE_NAME (this_class)))
- parse_error_context
- (id, "Class `%s' must be declared abstract to define abstract "
- "method `%s'",
- IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- }
- /* Things to be checked when declaring a constructor */
- if (!type)
- {
- int ec = java_error_count;
- /* 8.6: Constructor declarations: we might be trying to define a
- method without specifying a return type. */
- if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un)
- parse_error_context
- (id, "Invalid method declaration, return type required");
- /* 8.6.3: Constructor modifiers */
- else
- {
- JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract");
- JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static");
- JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final");
- JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native");
- JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized");
- }
- /* If we found error here, we don't consider it's OK to tread
- the method definition as a constructor, for the rest of this
- function */
- if (ec == java_error_count)
- constructor_ok = 1;
- }
-
- /* Method declared within the scope of an interface are implicitly
- abstract and public. Conflicts with other erroneously provided
- modifiers are checked right after. */
-
- if (CLASS_INTERFACE (TYPE_NAME (this_class)))
- {
- /* If FLAGS isn't set because of a modifier, turn the
- corresponding modifier WFL to NULL so we issue a warning on
- the obsolete use of the modifier */
- if (!(flags & ACC_PUBLIC))
- MODIFIER_WFL (PUBLIC_TK) = NULL;
- if (!(flags & ACC_ABSTRACT))
- MODIFIER_WFL (ABSTRACT_TK) = NULL;
- flags |= ACC_PUBLIC;
- flags |= ACC_ABSTRACT;
- }
-
- /* Modifiers context reset moved up, so abstract method declaration
- modifiers can be later checked. */
-
- /* Set constructor returned type to void and method name to <init>,
- unless we found an error identifier the constructor (in which
- case we retain the original name) */
- if (!type)
- {
- type = void_type_node;
- if (constructor_ok)
- meth_name = init_identifier_node;
- }
- else
- meth_name = EXPR_WFL_NODE (id);
-
- /* Do the returned type resolution and registration if necessary */
- SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
-
- if (meth_name)
- type = build_array_from_name (type, type_wfl, meth_name, &meth_name);
- EXPR_WFL_NODE (id) = meth_name;
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
-
- if (must_chain)
- {
- patch_stage = JDEP_METHOD_RETURN;
- register_incomplete_type (patch_stage, type_wfl, id, type);
- TREE_TYPE (meth) = GET_REAL_TYPE (type);
- }
- else
- TREE_TYPE (meth) = type;
-
- saved_lineno = lineno;
- /* When defining an abstract or interface method, the curly
- bracket at level 1 doesn't exist because there is no function
- body */
- lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
- EXPR_WFL_LINENO (id));
-
- /* Remember the original argument list */
- orig_arg = TYPE_ARG_TYPES (meth);
-
- if (patch_stage) /* includes ret type and/or all args */
- {
- jdep *jdep;
- meth = add_method_1 (this_class, flags, meth_name, meth);
- /* Patch for the return type */
- if (patch_stage == JDEP_METHOD_RETURN)
- {
- jdep = CLASSD_LAST (ctxp->classd_list);
- JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth));
- }
- /* This is the stop JDEP. METH allows the function's signature
- to be computed. */
- register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
- }
- else
- meth = add_method (this_class, flags, meth_name,
- build_java_signature (meth));
-
- /* Fix the method argument list so we have the argument name
- information */
- fix_method_argument_names (orig_arg, meth);
-
- /* Register the parameter number and re-install the current line
- number */
- DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1;
- lineno = saved_lineno;
-
- /* Register exception specified by the `throws' keyword for
- resolution and set the method decl appropriate field to the list.
- Note: the grammar ensures that what we get here are class
- types. */
- if (throws)
- {
- throws = nreverse (throws);
- for (current = throws; current; current = TREE_CHAIN (current))
- {
- register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current),
- NULL_TREE, NULL_TREE);
- JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
- &TREE_VALUE (current);
- }
- DECL_FUNCTION_THROWS (meth) = throws;
- }
-
- /* We set the DECL_NAME to ID so we can track the location where
- the function was declared. This allow us to report
- redefinition error accurately. When method are verified,
- DECL_NAME is reinstalled properly (using the content of the
- WFL node ID) (see check_method_redefinition). We don't do that
- when Object is being defined. Constructor <init> names will be
- reinstalled the same way. */
- if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node)
- DECL_NAME (meth) = id;
-
- /* Set the flag if we correctly processed a constructor */
- if (constructor_ok)
- DECL_CONSTRUCTOR_P (meth) = 1;
-
- /* Eventually set the @deprecated tag flag */
- CHECK_DEPRECATED (meth);
-
- /* If doing xref, store column and line number information instead
- of the line number only. */
- if (flag_emit_xref)
- DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id);
-
- return meth;
-}
-
-static void
-fix_method_argument_names (orig_arg, meth)
- tree orig_arg, meth;
-{
- tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth));
- if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE)
- {
- TREE_PURPOSE (arg) = this_identifier_node;
- arg = TREE_CHAIN (arg);
- }
- while (orig_arg != end_params_node)
- {
- TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
- orig_arg = TREE_CHAIN (orig_arg);
- arg = TREE_CHAIN (arg);
- }
-}
-
-/* Complete the method declaration with METHOD_BODY. */
-
-static void
-finish_method_declaration (method_body)
- tree method_body;
-{
- int flags = get_access_flags_from_decl (current_function_decl);
-
- /* 8.4.5 Method Body */
- if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
- {
- tree wfl = DECL_NAME (current_function_decl);
- parse_error_context (wfl,
- "%s method `%s' can't have a body defined",
- (METHOD_NATIVE (current_function_decl) ?
- "Native" : "Abstract"),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- method_body = NULL_TREE;
- }
- else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
- {
- tree wfl = DECL_NAME (current_function_decl);
- parse_error_context (wfl,
- "Non native and non abstract method `%s' must "
- "have a body defined",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- method_body = NULL_TREE;
- }
-
- if (flag_emit_class_files && method_body
- && TREE_CODE (method_body) == NOP_EXPR
- && TREE_TYPE (current_function_decl)
- && TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node)
- method_body = build1 (RETURN_EXPR, void_type_node, NULL);
-
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
- maybe_absorb_scoping_blocks ();
- /* Exit function's body */
- exit_block ();
- /* Merge last line of the function with first line, directly in the
- function decl. It will be used to emit correct debug info. */
- if (!flag_emit_xref)
- DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1);
- /* So we don't have an irrelevant function declaration context for
- the next static block we'll see. */
- current_function_decl = NULL_TREE;
-}
-
-/* Build a an error message for constructor circularity errors. */
-
-static char *
-constructor_circularity_msg (from, to)
- tree from, to;
-{
- static char string [4096];
- char *t = strdup (lang_printable_name (from, 0));
- sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
- free (t);
- return string;
-}
-
-/* Verify a circular call to METH. Return 1 if an error is found, 0
- otherwise. */
-
-static int
-verify_constructor_circularity (meth, current)
- tree meth, current;
-{
- static tree list = NULL_TREE;
- tree c;
- for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
- {
- if (TREE_VALUE (c) == meth)
- {
- char *t;
- if (list)
- {
- tree liste;
- list = nreverse (list);
- for (liste = list; liste; liste = TREE_CHAIN (liste))
- {
- parse_error_context
- (TREE_PURPOSE (TREE_PURPOSE (liste)),
- constructor_circularity_msg
- (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
- java_error_count--;
- }
- }
- t = strdup (lang_printable_name (meth, 0));
- parse_error_context (TREE_PURPOSE (c),
- "%s: recursive invocation of constructor `%s'",
- constructor_circularity_msg (current, meth), t);
- free (t);
- list = NULL_TREE;
- return 1;
- }
- }
- for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
- {
- list = tree_cons (c, current, list);
- if (verify_constructor_circularity (meth, TREE_VALUE (c)))
- return 1;
- list = TREE_CHAIN (list);
- }
- return 0;
-}
-
-/* Check modifiers that can be declared but exclusively */
-
-static void
-check_modifiers_consistency (flags)
- int flags;
-{
- int acc_count = 0;
- tree cl = NULL_TREE;
-
- THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
- if (acc_count > 1)
- parse_error_context
- (cl, "Inconsistent member declaration. At most one of `public', "
- "`private', or `protected' may be specified");
-}
-
-/* Check the methode header METH for abstract specifics features */
-
-static void
-check_abstract_method_header (meth)
- tree meth;
-{
- int flags = get_access_flags_from_decl (meth);
- /* DECL_NAME might still be a WFL node */
- tree name = GET_METHOD_NAME (meth);
-
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK), flags,
- ACC_ABSTRACT, "abstract method `%s'",
- IDENTIFIER_POINTER (name));
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), flags,
- ACC_PUBLIC, "abstract method `%s'",
- IDENTIFIER_POINTER (name));
-
- check_modifiers ("Illegal modifier `%s' for interface method",
- flags, INTERFACE_METHOD_MODIFIERS);
-}
-
-/* Create a FUNCTION_TYPE node and start augmenting it with the
- declared function arguments. Arguments type that can't be resolved
- are left as they are, but the returned node is marked as containing
- incomplete types. */
-
-static tree
-method_declarator (id, list)
- tree id, list;
-{
- tree arg_types = NULL_TREE, current, node;
- tree meth = make_node (FUNCTION_TYPE);
- jdep *jdep;
-
- patch_stage = JDEP_NO_PATCH;
-
- for (current = list; current; current = TREE_CHAIN (current))
- {
- int must_chain = 0;
- tree wfl_name = TREE_PURPOSE (current);
- tree type = TREE_VALUE (current);
- tree name = EXPR_WFL_NODE (wfl_name);
- tree already, arg_node;
- tree type_wfl = NULL_TREE;
- tree real_type;
-
- /* Obtain a suitable type for resolution, if necessary */
- SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
-
- /* Process NAME, as it may specify extra dimension(s) for it */
- type = build_array_from_name (type, type_wfl, name, &name);
- EXPR_WFL_NODE (wfl_name) = name;
-
- real_type = GET_REAL_TYPE (type);
- if (TREE_CODE (real_type) == RECORD_TYPE)
- {
- real_type = promote_type (real_type);
- if (TREE_CODE (type) == TREE_LIST)
- TREE_PURPOSE (type) = real_type;
- }
-
- /* Check redefinition */
- for (already = arg_types; already; already = TREE_CHAIN (already))
- if (TREE_PURPOSE (already) == name)
- {
- parse_error_context
- (wfl_name, "Variable `%s' is used more than once in the "
- "argument list of method `%s'", IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- break;
- }
-
- /* If we've an incomplete argument type, we know there is a location
- to patch when the type get resolved, later. */
- jdep = NULL;
- if (must_chain)
- {
- patch_stage = JDEP_METHOD;
- type = register_incomplete_type (patch_stage,
- type_wfl, wfl_name, type);
- jdep = CLASSD_LAST (ctxp->classd_list);
- JDEP_MISC (jdep) = id;
- }
-
- /* The argument node: a name and a (possibly) incomplete type */
- arg_node = build_tree_list (name, real_type);
- if (jdep)
- JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
- TREE_CHAIN (arg_node) = arg_types;
- arg_types = arg_node;
- }
- TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node);
- node = build_tree_list (id, meth);
- return node;
-}
-
-static int
-unresolved_type_p (wfl, returned)
- tree wfl;
- tree *returned;
-
-{
- if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
- {
- tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
- if (returned)
- *returned = (decl ? TREE_TYPE (decl) : NULL_TREE);
- return 1;
- }
- if (returned)
- *returned = wfl;
- return 0;
-}
-
-/* From NAME, build a qualified identifier node using the
- qualification from the current package definition. */
-
-static tree
-parser_qualified_classname (name)
- tree name;
-{
- if (ctxp->package)
- return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name));
- else
- return EXPR_WFL_NODE (name);
-}
-
-/* Called once the type a interface extends is resolved. Returns 0 if
- everything is OK. */
-
-static int
-parser_check_super_interface (super_decl, this_decl, this_wfl)
- tree super_decl, this_decl, this_wfl;
-{
- tree super_type = TREE_TYPE (super_decl);
-
- /* Has to be an interface */
- if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl))))
- {
- parse_error_context
- (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'",
- (TYPE_ARRAY_P (super_type) ? "array" : "class"),
- IDENTIFIER_POINTER (DECL_NAME (super_decl)),
- (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
- "interface" : "class"),
- IDENTIFIER_POINTER (DECL_NAME (this_decl)));
- return 1;
- }
-
- /* Check scope: same package OK, other package: OK if public */
- if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl)))
- return 1;
-
- SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
- IDENTIFIER_POINTER (DECL_NAME (this_decl)),
- IDENTIFIER_POINTER (DECL_NAME (super_decl))));
- return 0;
-}
-
-/* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
- 0 if everthing is OK. */
-
-static int
-parser_check_super (super_decl, this_decl, wfl)
- tree super_decl, this_decl, wfl;
-{
- tree super_type = TREE_TYPE (super_decl);
-
- /* SUPER should be a CLASS (neither an array nor an interface) */
- if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
- {
- parse_error_context
- (wfl, "Class `%s' can't subclass %s `%s'",
- IDENTIFIER_POINTER (DECL_NAME (this_decl)),
- (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
- IDENTIFIER_POINTER (DECL_NAME (super_decl)));
- return 1;
- }
-
- if (CLASS_FINAL (TYPE_NAME (super_type)))
- {
- parse_error_context (wfl, "Can't subclass final classes: %s",
- IDENTIFIER_POINTER (DECL_NAME (super_decl)));
- return 1;
- }
-
- /* Check scope: same package OK, other package: OK if public */
- if (check_pkg_class_access (DECL_NAME (super_decl), wfl))
- return 1;
-
- SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
- IDENTIFIER_POINTER (DECL_NAME (this_decl)),
- IDENTIFIER_POINTER (DECL_NAME (super_decl))));
- return 0;
-}
-
-/* Create a new dependency list and link it (in a LIFO manner) to the
- CTXP list of type dependency list. */
-
-static void
-create_jdep_list (ctxp)
- struct parser_ctxt *ctxp;
-{
- jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));
- new->first = new->last = NULL;
- new->next = ctxp->classd_list;
- ctxp->classd_list = new;
-}
-
-static jdeplist *
-reverse_jdep_list (ctxp)
- struct parser_ctxt *ctxp;
-{
- register jdeplist *prev = NULL, *current, *next;
- for (current = ctxp->classd_list; current; current = next)
- {
- next = current->next;
- current->next = prev;
- prev = current;
- }
- return prev;
-}
-
-/* Create a fake pointer based on the ID stored in
- TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
- registered again. */
-
-static tree
-obtain_incomplete_type (type_name)
- tree type_name;
-{
- tree ptr, name;
-
- if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (type_name);
- else if (INCOMPLETE_TYPE_P (type_name))
- name = TYPE_NAME (type_name);
- else
- fatal ("invalid type name - obtain_incomplete_type");
-
- for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr))
- if (TYPE_NAME (ptr) == name)
- break;
-
- if (!ptr)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- BUILD_PTR_FROM_NAME (ptr, name);
- layout_type (ptr);
- pop_obstacks ();
- TREE_CHAIN (ptr) = ctxp->incomplete_class;
- ctxp->incomplete_class = ptr;
- }
-
- return ptr;
-}
-
-/* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
- non NULL instead of computing a new fake type based on WFL. The new
- dependency is inserted in the current type dependency list, in FIFO
- manner. */
-
-static tree
-register_incomplete_type (kind, wfl, decl, ptr)
- int kind;
- tree wfl, decl, ptr;
-{
- jdep *new = (jdep *)xmalloc (sizeof (jdep));
-
- if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */
- ptr = obtain_incomplete_type (wfl);
-
- JDEP_KIND (new) = kind;
- JDEP_DECL (new) = decl;
- JDEP_SOLV (new) = ptr;
- JDEP_WFL (new) = wfl;
- JDEP_CHAIN (new) = NULL;
- JDEP_MISC (new) = NULL_TREE;
- JDEP_GET_PATCH (new) = (tree *)NULL;
-
- JDEP_INSERT (ctxp->classd_list, new);
-
- return ptr;
-}
-
-void
-java_check_circular_reference ()
-{
- tree current;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree type = TREE_TYPE (current);
- if (CLASS_INTERFACE (TYPE_NAME (type)))
- {
- /* Check all interfaces this class extends */
- tree basetype_vec = TYPE_BINFO_BASETYPES (type);
- int n, i;
-
- if (!basetype_vec)
- return;
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
- if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node
- && interface_of_p (type, BINFO_TYPE (vec_elt)))
- parse_error_context (lookup_cl (current),
- "Cyclic interface inheritance");
- }
- }
- else
- if (inherits_from_p (CLASSTYPE_SUPER (type), type))
- parse_error_context (lookup_cl (current),
- "Cyclic class inheritance");
- }
-}
-
-/* safe_layout_class just makes sure that we can load a class without
- disrupting the current_class, input_file, lineno, etc, information
- about the class processed currently. */
-
-void
-safe_layout_class (class)
- tree class;
-{
- tree save_current_class = current_class;
- char *save_input_filename = input_filename;
- int save_lineno = lineno;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- layout_class (class);
- pop_obstacks ();
-
- current_class = save_current_class;
- input_filename = save_input_filename;
- lineno = save_lineno;
- CLASS_LOADED_P (class) = 1;
-}
-
-static tree
-jdep_resolve_class (dep)
- jdep *dep;
-{
- tree decl;
-
- if (JDEP_RESOLVED_P (dep))
- decl = JDEP_RESOLVED_DECL (dep);
- else
- {
- decl = resolve_class (JDEP_TO_RESOLVE (dep),
- JDEP_DECL (dep), JDEP_WFL (dep));
- JDEP_RESOLVED (dep, decl);
- }
-
- if (!decl)
- complete_class_report_errors (dep);
-
- return decl;
-}
-
-/* Complete unsatisfied class declaration and their dependencies */
-
-void
-java_complete_class ()
-{
- tree cclass;
- jdeplist *cclassd;
- int error_found;
- tree type;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- /* Process imports and reverse the import on demand list */
- process_imports ();
- if (ctxp->import_demand_list)
- ctxp->import_demand_list = nreverse (ctxp->import_demand_list);
-
- /* Rever things so we have the right order */
- ctxp->class_list = nreverse (ctxp->class_list);
- ctxp->classd_list = reverse_jdep_list (ctxp);
-
- for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
- cclass && cclassd;
- cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
- {
- jdep *dep;
- for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep))
- {
- tree decl;
- if (!(decl = jdep_resolve_class (dep)))
- continue;
-
- /* Now it's time to patch */
- switch (JDEP_KIND (dep))
- {
- case JDEP_SUPER:
- /* Simply patch super */
- if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
- continue;
- BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
- (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
- break;
-
- case JDEP_FIELD:
- {
- /* We do part of the job done in add_field */
- tree field_decl = JDEP_DECL (dep);
- tree field_type = TREE_TYPE (decl);
- push_obstacks (&permanent_obstack, &permanent_obstack);
- if (TREE_CODE (field_type) == RECORD_TYPE)
- field_type = promote_type (field_type);
- pop_obstacks ();
- TREE_TYPE (field_decl) = field_type;
- DECL_ALIGN (field_decl) = 0;
- layout_decl (field_decl, 0);
- SOURCE_FRONTEND_DEBUG
- (("Completed field/var decl `%s' with `%s'",
- IDENTIFIER_POINTER (DECL_NAME (field_decl)),
- IDENTIFIER_POINTER (DECL_NAME (decl))));
- break;
- }
- case JDEP_METHOD: /* We start patching a method */
- case JDEP_METHOD_RETURN:
- error_found = 0;
- while (1)
- {
- if (decl)
- {
- type = TREE_TYPE(decl);
- if (TREE_CODE (type) == RECORD_TYPE)
- type = promote_type (type);
- JDEP_APPLY_PATCH (dep, type);
- SOURCE_FRONTEND_DEBUG
- (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
- "Completing fct `%s' with ret type `%s'":
- "Completing arg `%s' with type `%s'"),
- IDENTIFIER_POINTER (EXPR_WFL_NODE
- (JDEP_DECL_WFL (dep))),
- IDENTIFIER_POINTER (DECL_NAME (decl))));
- }
- else
- error_found = 1;
- dep = JDEP_CHAIN (dep);
- if (JDEP_KIND (dep) == JDEP_METHOD_END)
- break;
- else
- decl = jdep_resolve_class (dep);
- }
- if (!error_found)
- {
- tree mdecl = JDEP_DECL (dep), signature;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- /* Recompute and reset the signature */
- signature = build_java_signature (TREE_TYPE (mdecl));
- set_java_signature (TREE_TYPE (mdecl), signature);
- pop_obstacks ();
- }
- else
- continue;
- break;
-
- case JDEP_INTERFACE:
- if (parser_check_super_interface (decl, JDEP_DECL (dep),
- JDEP_WFL (dep)))
- continue;
- parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep));
- break;
-
- case JDEP_PARM:
- case JDEP_VARIABLE:
- type = TREE_TYPE(decl);
- if (TREE_CODE (type) == RECORD_TYPE)
- type = promote_type (type);
- JDEP_APPLY_PATCH (dep, type);
- break;
-
- case JDEP_TYPE:
- JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
- SOURCE_FRONTEND_DEBUG
- (("Completing a random type dependency on a '%s' node",
- tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
- break;
-
- case JDEP_EXCEPTION:
- JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
- SOURCE_FRONTEND_DEBUG
- (("Completing `%s' `throws' argument node",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))));
- break;
-
- default:
- fatal ("Can't handle patch code %d - java_complete_class",
- JDEP_KIND (dep));
- }
- }
- }
- pop_obstacks ();
- return;
-}
-
-/* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
- array. */
-
-static tree
-resolve_class (class_type, decl, cl)
- tree class_type, decl, cl;
-{
- char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type));
- char *base = name;
- tree resolved_type = TREE_TYPE (class_type);
- tree resolved_type_decl;
-
- if (resolved_type != NULL_TREE)
- {
- tree resolved_type_decl = TYPE_NAME (resolved_type);
- if (resolved_type_decl == NULL_TREE
- || TREE_CODE (resolved_type_decl) == IDENTIFIER_NODE)
- {
- resolved_type_decl = build_decl (TYPE_DECL,
- TYPE_NAME (class_type),
- resolved_type);
- }
- return resolved_type_decl;
- }
-
- /* 1- Check to see if we have an array. If true, find what we really
- want to resolve */
- while (name[0] == '[')
- name++;
- if (base != name)
- TYPE_NAME (class_type) = get_identifier (name);
-
- /* 2- Resolve the bare type */
- if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl)))
- return NULL_TREE;
- resolved_type = TREE_TYPE (resolved_type_decl);
-
- /* 3- If we have and array, reconstruct the array down to its nesting */
- if (base != name)
- {
- while (base != name)
- {
- if (TREE_CODE (resolved_type) == RECORD_TYPE)
- resolved_type = promote_type (resolved_type);
- resolved_type = build_java_array_type (resolved_type, -1);
- CLASS_LOADED_P (resolved_type) = 1;
- name--;
- }
- /* Build a fake decl for this, since this is what is expected to
- be returned. */
- resolved_type_decl =
- build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type);
- /* Figure how those two things are important for error report. FIXME */
- DECL_SOURCE_LINE (resolved_type_decl) = 0;
- DECL_SOURCE_FILE (resolved_type_decl) = input_filename;
- TYPE_NAME (class_type) = TYPE_NAME (resolved_type);
- }
- TREE_TYPE (class_type) = resolved_type;
- return resolved_type_decl;
-}
-
-/* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
- are used to report error messages. */
-
-tree
-do_resolve_class (class_type, decl, cl)
- tree class_type;
- tree decl;
- tree cl;
-{
- tree new_class_decl;
- tree original_name = NULL_TREE;
-
- /* Do not try to replace TYPE_NAME (class_type) by a variable, since
- its is changed by find_in_imports{_on_demand} */
-
- /* 1- Check for the type in single imports */
- if (find_in_imports (class_type))
- return NULL_TREE;
-
- /* 2- And check for the type in the current compilation unit. If it fails,
- try with a name qualified with the package name if appropriate. */
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
- !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
- load_class (TYPE_NAME (class_type), 0);
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- }
-
- original_name = TYPE_NAME (class_type);
- if (!QUALIFIED_P (TYPE_NAME (class_type)) && ctxp->package)
- TYPE_NAME (class_type) = merge_qualified_name (ctxp->package,
- TYPE_NAME (class_type));
-#if 1
- if (!(new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- load_class (TYPE_NAME (class_type), 0);
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
- !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
- load_class (TYPE_NAME (class_type), 0);
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- }
-#else
- new_name = TYPE_NAME (class_type);
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_name)) != NULL_TREE)
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
- !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
- load_class (new_name, 0);
- return IDENTIFIER_CLASS_VALUE (new_name);
- }
- else
- {
- tree class = read_class (new_name);
- if (class != NULL_TREE)
- {
- tree decl = IDENTIFIER_CLASS_VALUE (new_name);
- if (decl == NULL_TREE)
- decl = push_class (class, new_name);
- return decl;
- }
- }
-#endif
- TYPE_NAME (class_type) = original_name;
-
- /* 3- Check an other compilation unit that bears the name of type */
- load_class (TYPE_NAME (class_type), 0);
- if (check_pkg_class_access (TYPE_NAME (class_type),
- (cl ? cl : lookup_cl (decl))))
- return NULL_TREE;
-
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- return new_class_decl;
-
- /* 4- Check the import on demands. Don't allow bar.baz to be
- imported from foo.* */
- if (!QUALIFIED_P (TYPE_NAME (class_type)))
- if (find_in_imports_on_demand (class_type))
- return NULL_TREE;
-
- /* 5- Last call for a resolution */
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
-}
-
-/* Resolve NAME and lay it out (if not done and if not the current
- parsed class). Return a decl node. This function is meant to be
- called when type resolution is necessary during the walk pass. */
-
-static tree
-resolve_and_layout (something, cl)
- tree something;
- tree cl;
-{
- tree decl;
-
- /* Don't do that on the current class */
- if (something == current_class)
- return TYPE_NAME (current_class);
-
- /* Don't do anything for void and other primitive types */
- if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
- return NULL_TREE;
-
- /* Pointer types can be reall pointer types or fake pointers. When
- finding a real pointer, recheck for primitive types */
- if (TREE_CODE (something) == POINTER_TYPE)
- {
- if (TREE_TYPE (something))
- {
- something = TREE_TYPE (something);
- if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
- return NULL_TREE;
- }
- else
- something = TYPE_NAME (something);
- }
-
- /* Don't do anything for arrays of primitive types */
- if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something)
- && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something)))
- return NULL_TREE;
-
- /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
- or a real TYPE */
- if (TREE_CODE (something) != IDENTIFIER_NODE)
- something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ?
- DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something));
-
- if (!(decl = resolve_no_layout (something, cl)))
- return NULL_TREE;
-
- /* Resolve and layout if necessary */
- layout_class_methods (TREE_TYPE (decl));
- if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))
- CHECK_METHODS (decl);
- if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
- safe_layout_class (TREE_TYPE (decl));
-
- return decl;
-}
-
-/* Resolve a class, returns its decl but doesn't perform any
- layout. The current parsing context is saved and restored */
-
-static tree
-resolve_no_layout (name, cl)
- tree name, cl;
-{
- tree ptr, decl;
- BUILD_PTR_FROM_NAME (ptr, name);
- java_parser_context_save_global ();
- decl = resolve_class (ptr, NULL_TREE, cl);
- java_parser_context_restore_global ();
-
- return decl;
-}
-
-/* Called when reporting errors. Skip leader '[' in a complex array
- type description that failed to be resolved. */
-
-static char *
-purify_type_name (name)
- char *name;
-{
- while (*name && *name == '[')
- name++;
- return name;
-}
-
-/* The type CURRENT refers to can't be found. We print error messages. */
-
-static void
-complete_class_report_errors (dep)
- jdep *dep;
-{
- char *name;
-
- if (!JDEP_WFL (dep))
- return;
-
- name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)));
- switch (JDEP_KIND (dep))
- {
- case JDEP_SUPER:
- parse_error_context
- (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
- purify_type_name (name),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_FIELD:
- parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'",
- purify_type_name (name),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_METHOD: /* Covers arguments */
- parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "argument `%s' of method `%s'",
- purify_type_name (name),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
- break;
- case JDEP_METHOD_RETURN: /* Covers return type */
- parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "return type of method `%s'",
- purify_type_name (name),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
- break;
- case JDEP_INTERFACE:
- parse_error_context
- (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
- (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_VARIABLE:
- parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
- "local variable `%s'",
- purify_type_name (IDENTIFIER_POINTER
- (EXPR_WFL_NODE (JDEP_WFL (dep)))),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_EXCEPTION: /* As specified by `throws' */
- parse_error_context
- (JDEP_WFL (dep), "Class `%s' not found in `throws'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))));
- break;
- default:
- /* Fix for -Wall. Just break doing nothing. The error will be
- caught later */
- break;
- }
-}
-
-/* Check uninitialized final. */
-
-void
-java_check_final ()
-{
-}
-
-/* Return a static string containing the DECL prototype string. If
- DECL is a constructor, use the class name instead of the form
- <init> */
-
-static char *
-get_printable_method_name (decl)
- tree decl;
-{
- char *to_return;
- tree name = NULL_TREE;
-
- if (DECL_CONSTRUCTOR_P (decl))
- {
- name = DECL_NAME (decl);
- DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
- }
-
- to_return = lang_printable_name (decl, 0);
- if (DECL_CONSTRUCTOR_P (decl))
- DECL_NAME (decl) = name;
-
- return to_return;
-}
-
-/* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
- nevertheless needs to be verfied, 1 otherwise. */
-
-static int
-reset_method_name (method)
- tree method;
-{
- if (!IS_CLINIT (method) && DECL_NAME (method) != finit_identifier_node)
- {
- /* NAME is just the plain name when Object is being defined */
- if (DECL_CONTEXT (method) != object_type_node)
- DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ?
- init_identifier_node : GET_METHOD_NAME (method));
- return 0;
- }
- else
- return 1;
-}
-
-/* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
-
-tree
-java_get_real_method_name (method_decl)
- tree method_decl;
-{
- tree method_name = DECL_NAME (method_decl);
- if (DECL_CONSTRUCTOR_P (method_decl))
- return init_identifier_node;
-
- /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
- and still can be a constructor. FIXME */
-
- /* Don't confuse method only bearing the name of their class as
- constructors */
- else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl))
- && ctxp
- && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name)
- && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED
- && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node)
- return init_identifier_node;
- else
- return EXPR_WFL_NODE (method_name);
-}
-
-/* Track method being redefined inside the same class. As a side
- effect, set DECL_NAME to an IDENTIFIER (prior entering this
- function it's a FWL, so we can track errors more accurately */
-
-static int
-check_method_redefinition (class, method)
- tree class, method;
-{
- tree redef, name;
- tree cl = DECL_NAME (method);
- tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
- /* decl name of artificial <clinit> and $finit$ doesn't need to be
- fixed and checked */
-
- /* Reset the method name before running the check. If it returns 1,
- the method doesn't need to be verified with respect to method
- redeclaration and we return 0 */
- if (reset_method_name (method))
- return 0;
-
- name = DECL_NAME (method);
- for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
- {
- if (redef == method)
- break;
- if (DECL_NAME (redef) == name
- && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef)))
- {
- parse_error_context
- (cl, "Duplicate %s declaration `%s'",
- (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
- get_printable_method_name (redef));
- return 1;
- }
- }
- return 0;
-}
-
-/* Check all the methods of CLASS. Methods are first completed then
- checked according to regular method existance rules.
- If no constructor were encountered, then build its declaration. */
-
-static void
-java_check_regular_methods (class_decl)
- tree class_decl;
-{
- int saw_constructor = 0;
- tree method;
- tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl));
- tree super_class = CLASSTYPE_SUPER (class);
- tree saved_found_wfl = NULL_TREE, found = NULL_TREE;
- tree mthrows;
-
- /* It is not necessary to check methods defined in java.lang.Object */
- if (class == object_type_node)
- return;
-
- if (!TYPE_NVIRTUALS (class))
- TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
-
- /* Should take interfaces into account. FIXME */
- for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
- {
- tree sig;
- tree method_wfl = DECL_NAME (method);
- int aflags;
-
- /* If we previously found something and its name was saved,
- reinstall it now */
- if (found && saved_found_wfl)
- {
- DECL_NAME (found) = saved_found_wfl;
- saved_found_wfl = NULL_TREE;
- }
-
- /* Check for redefinitions */
- if (check_method_redefinition (class, method))
- continue;
-
- /* If we see one constructor a mark so we don't generate the
- default one. Also skip other verifications: constructors
- can't be inherited hence hiden or overriden */
- if (DECL_CONSTRUCTOR_P (method))
- {
- saw_constructor = 1;
- continue;
- }
-
- /* We verify things thrown by the method. They must inherits from
- java.lang.Throwable */
- for (mthrows = DECL_FUNCTION_THROWS (method);
- mthrows; mthrows = TREE_CHAIN (mthrows))
- {
- if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
- parse_error_context
- (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be "
- "a subclass of class `java.lang.Throwable'",
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
- }
-
- sig = build_java_argument_signature (TREE_TYPE (method));
- found = lookup_argument_method (super_class, DECL_NAME (method), sig);
-
- /* Nothing overrides or it's a private method. */
- if (!found)
- continue;
- if (METHOD_PRIVATE (found))
- {
- found = NULL_TREE;
- continue;
- }
-
- /* If found wasn't verified, it's DECL_NAME won't be set properly.
- We set it temporarily for the sake of the error report. */
- saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
-
- /* Can't override a method with the same name and different return
- types. */
- if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
- {
- char *t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)),
- 0));
- parse_error_context
- (method_wfl,
- "Method `%s' was defined with return type `%s' in class `%s'",
- lang_printable_name (found, 0), t,
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- free (t);
- }
-
- aflags = get_access_flags_from_decl (found);
- /* If the method has default, access in an other package, then
- issue a warning that the current method doesn't override the
- one that was found elsewhere. Do not issue this warning when
- the match was found in java.lang.Object. */
- if (DECL_CONTEXT (found) != object_type_node
- && ((aflags & 0x7) == 0)
- && !class_in_current_package (DECL_CONTEXT (found))
- && DECL_NAME (found) != clinit_identifier_node
- && flag_not_overriding)
- {
- parse_warning_context
- (method_wfl, "Method `%s' in class `%s' does not "
- "override the corresponding method in class `%s', which is "
- "private to a different package",
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- IDENTIFIER_POINTER (DECL_NAME
- (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* Can't override final. Can't override static. */
- if (METHOD_FINAL (found) || METHOD_STATIC (found))
- {
- /* Static *can* override static */
- if (METHOD_STATIC (found) && METHOD_STATIC (method))
- continue;
- parse_error_context
- (method_wfl,
- "%s methods can't be overriden. Method `%s' is %s in class `%s'",
- (METHOD_FINAL (found) ? "Final" : "Static"),
- lang_printable_name (found, 0),
- (METHOD_FINAL (found) ? "final" : "static"),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* Static method can't override instance method. */
- if (METHOD_STATIC (method))
- {
- parse_error_context
- (method_wfl,
- "Instance methods can't be overriden by a static method. Method "
- "`%s' is an instance method in class `%s'",
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* - Overriding/hiding public must be public
- - Overriding/hiding protected must be protected or public
- - If the overriden or hidden method has default (package)
- access, then the overriding or hiding method must not be
- private; otherwise, a compile-time error occurs */
- if ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method))
- || (METHOD_PROTECTED (found)
- && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method)))
- || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC))
- && METHOD_PRIVATE (method)))
- {
- parse_error_context
- (method_wfl,
- "Methods can't be overridden to be more private. Method `%s' is "
- "not %s in class `%s'", lang_printable_name (method, 0),
- (METHOD_PUBLIC (method) ? "public" :
- (METHOD_PRIVATE (method) ? "private" : "protected")),
- IDENTIFIER_POINTER (DECL_NAME
- (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* Overriding methods must have compatible `throws' clauses on checked
- exceptions, if any */
- check_throws_clauses (method, method_wfl, found);
-
- /* Inheriting multiple methods with the same signature. FIXME */
- }
-
- /* Don't forget eventual pending found and saved_found_wfl. Take
- into account that we might have exited because we saw an
- aritifical method as the last entry. */
-
- if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
- DECL_NAME (found) = saved_found_wfl;
-
- if (!TYPE_NVIRTUALS (class))
- TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
-
- if (!saw_constructor)
- {
- /* No constructor seen, we craft one, at line 0. Since this
- operation takes place after we laid methods out
- (layout_class_methods), we prepare the its DECL
- appropriately. */
- int flags;
- tree decl;
-
- /* If the class is declared PUBLIC, the default constructor is
- PUBLIC otherwise it has default access implied by no access
- modifiers. */
- flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ?
- ACC_PUBLIC : 0);
- decl = create_artificial_method (class, flags, void_type_node,
- init_identifier_node, end_params_node);
- DECL_CONSTRUCTOR_P (decl) = 1;
- layout_class_method (TREE_TYPE (class_decl), NULL_TREE, decl, NULL_TREE);
- }
-}
-
-/* Return a non zero value if the `throws' clause of METHOD (if any)
- is incompatible with the `throws' clause of FOUND (if any). */
-
-static void
-check_throws_clauses (method, method_wfl, found)
- tree method, method_wfl, found;
-{
- tree mthrows, fthrows;
-
- /* Can't check these things with class loaded from bytecode. FIXME */
- if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found)))
- return;
-
- for (mthrows = DECL_FUNCTION_THROWS (method);
- mthrows; mthrows = TREE_CHAIN (mthrows))
- {
- /* We don't verify unchecked expressions */
- if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows)))
- continue;
- /* Checked expression must be compatible */
- for (fthrows = DECL_FUNCTION_THROWS (found);
- fthrows; fthrows = TREE_CHAIN (fthrows))
- if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows)))
- break;
- if (!fthrows)
- {
- parse_error_context
- (method_wfl, "Invalid checked exception class `%s' in "
- "`throws' clause. The exception must be a subclass of an "
- "exception thrown by `%s' from class `%s'",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- }
- }
-}
-
-/* Check abstract method of interface INTERFACE */
-
-static void
-java_check_abstract_methods (interface_decl)
- tree interface_decl;
-{
- int i, n;
- tree method, basetype_vec, found;
- tree interface = TREE_TYPE (interface_decl);
-
- for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
- {
- tree method_wfl = DECL_NAME (method);
-
- /* 2- Check for double definition inside the defining interface */
- if (check_method_redefinition (interface, method))
- continue;
-
- /* 3- Overriding is OK as far as we preserve the return type and
- the thrown exceptions (FIXME) */
- found = lookup_java_interface_method2 (interface, method);
- if (found)
- {
- char *t;
- tree saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
- t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
- parse_error_context
- (method_wfl,
- "Method `%s' was defined with return type `%s' in class `%s'",
- lang_printable_name (found, 0), t,
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- free (t);
- continue;
-
- DECL_NAME (found) = saved_found_wfl;
- }
- }
-
- /* 4- Inherited methods can't differ by their returned types */
- if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
- return;
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree sub_interface_method, sub_interface;
- tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
- if (!vec_elt)
- continue;
- sub_interface = BINFO_TYPE (vec_elt);
- for (sub_interface_method = TYPE_METHODS (sub_interface);
- sub_interface_method;
- sub_interface_method = TREE_CHAIN (sub_interface_method))
- {
- found = lookup_java_interface_method2 (interface,
- sub_interface_method);
- if (found && (found != sub_interface_method))
- {
- tree saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
- parse_error_context
- (lookup_cl (sub_interface_method),
- "Interface `%s' inherits method `%s' from interface `%s'. "
- "This method is redefined with a different return type in "
- "interface `%s'",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME
- (DECL_CONTEXT (sub_interface_method)))),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- DECL_NAME (found) = saved_found_wfl;
- }
- }
- }
-}
-
-/* Lookup methods in interfaces using their name and partial
- signature. Return a matching method only if their types differ. */
-
-static tree
-lookup_java_interface_method2 (class, method_decl)
- tree class, method_decl;
-{
- int i, n;
- tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
-
- if (!basetype_vec)
- return NULL_TREE;
-
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
- if ((BINFO_TYPE (vec_elt) != object_type_node)
- && (to_return =
- lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
- return to_return;
- }
- for (i = 0; i < n; i++)
- {
- to_return = lookup_java_interface_method2
- (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
- if (to_return)
- return to_return;
- }
-
- return NULL_TREE;
-}
-
-/* Lookup method using their name and partial signature. Return a
- matching method only if their types differ. */
-
-static tree
-lookup_java_method2 (clas, method_decl, do_interface)
- tree clas, method_decl;
- int do_interface;
-{
- tree method, method_signature, method_name, method_type, name;
-
- method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
- name = DECL_NAME (method_decl);
- method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
- EXPR_WFL_NODE (name) : name);
- method_type = TREE_TYPE (TREE_TYPE (method_decl));
-
- while (clas != NULL_TREE)
- {
- for (method = TYPE_METHODS (clas);
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- tree method_sig = build_java_argument_signature (TREE_TYPE (method));
- tree name = DECL_NAME (method);
- if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
- EXPR_WFL_NODE (name) : name) == method_name
- && method_sig == method_signature
- && TREE_TYPE (TREE_TYPE (method)) != method_type)
- return method;
- }
- clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas));
- }
- return NULL_TREE;
-}
-
-/* Return the line that matches DECL line number. Used during error
- report */
-
-static tree
-lookup_cl (decl)
- tree decl;
-{
- static tree cl = NULL_TREE;
-
- if (!decl)
- return NULL_TREE;
-
- if (cl == NULL_TREE)
- cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
-
- EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
- EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
-
- return cl;
-}
-
-/* Look for a simple name in the single-type import list */
-
-static tree
-find_name_in_single_imports (name)
- tree name;
-{
- tree node;
-
- for (node = ctxp->import_list; node; node = TREE_CHAIN (node))
- if (TREE_VALUE (node) == name)
- return (EXPR_WFL_NODE (TREE_PURPOSE (node)));
-
- return NULL_TREE;
-}
-
-/* Process all single-type import. */
-
-static int
-process_imports ()
-{
- tree import;
- int error_found;
-
- for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
- {
- tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
-
- /* Don't load twice something already defined. */
- if (IDENTIFIER_CLASS_VALUE (to_be_found))
- continue;
- QUALIFIED_P (to_be_found) = 1;
- load_class (to_be_found, 0);
- error_found =
- check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
- if (!IDENTIFIER_CLASS_VALUE (to_be_found))
- {
- parse_error_context (TREE_PURPOSE (import),
- "Class or interface `%s' not found in import",
- IDENTIFIER_POINTER (to_be_found));
- return 1;
- }
- if (error_found)
- return 1;
- }
- return 0;
-}
-
-/* Possibly find a class imported by a single-type import statement. Return
- 1 if an error occured, 0 otherwise. */
-
-static int
-find_in_imports (class_type)
- tree class_type;
-{
- tree import;
-
- for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
- if (TREE_VALUE (import) == TYPE_NAME (class_type))
- {
- TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
- QUALIFIED_P (TYPE_NAME (class_type)) = 1;
- }
- return 0;
-}
-
-static int
-note_possible_classname (name, len)
- char *name;
- int len;
-{
- tree node;
- if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0)
- len = len - 5;
- else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0)
- len = len - 6;
- else
- return 0;
- node = ident_subst (name, len, "", '/', '.', "");
- IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
- QUALIFIED_P (node) = strchr (name, '/') ? 1 : 0;
- return 1;
-}
-
-/* Read a import directory, gathering potential match for further type
- references. Indifferently reads a filesystem or a ZIP archive
- directory. */
-
-static void
-read_import_dir (wfl)
- tree wfl;
-{
- tree package_id = EXPR_WFL_NODE (wfl);
- char *package_name = IDENTIFIER_POINTER (package_id);
- int package_length = IDENTIFIER_LENGTH (package_id);
- DIR *dirp = NULL;
- JCF *saved_jcf = current_jcf;
-
- int found = 0;
- int k;
- void *entry;
- struct buffer filename[1];
-
-
- if (IS_AN_IMPORT_ON_DEMAND_P (package_id))
- return;
- IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1;
-
- BUFFER_INIT (filename);
- buffer_grow (filename, package_length + 100);
-
- for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
- {
- char *entry_name = jcf_path_name (entry);
- int entry_length = strlen (entry_name);
- if (jcf_path_is_zipfile (entry))
- {
- ZipFile *zipf;
- buffer_grow (filename, entry_length);
- memcpy (filename->data, entry_name, entry_length - 1);
- filename->data[entry_length-1] = '\0';
- zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
- if (zipf == NULL)
- error ("malformed .zip archive in CLASSPATH: %s", entry_name);
- else
- {
- ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory;
- BUFFER_RESET (filename);
- for (k = 0; k < package_length; k++)
- {
- char ch = package_name[k];
- *filename->ptr++ = ch == '.' ? '/' : ch;
- }
- *filename->ptr++ = '/';
-
- for (k = 0; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd))
- {
- char *current_entry = ZIPDIR_FILENAME (zipd);
- int current_entry_len = zipd->filename_length;
-
- if (current_entry_len >= BUFFER_LENGTH (filename)
- && strncmp (filename->data, current_entry,
- BUFFER_LENGTH (filename)) != 0)
- continue;
- found |= note_possible_classname (current_entry,
- current_entry_len);
- }
- }
- }
- else
- {
- BUFFER_RESET (filename);
- buffer_grow (filename, entry_length + package_length + 4);
- strcpy (filename->data, entry_name);
- filename->ptr = filename->data + entry_length;
- for (k = 0; k < package_length; k++)
- {
- char ch = package_name[k];
- *filename->ptr++ = ch == '.' ? '/' : ch;
- }
- *filename->ptr = '\0';
-
- dirp = opendir (filename->data);
- if (dirp == NULL)
- continue;
- *filename->ptr++ = '/';
- for (;;)
- {
- int len;
- char *d_name;
- struct dirent *direntp = readdir (dirp);
- if (!direntp)
- break;
- d_name = direntp->d_name;
- len = strlen (direntp->d_name);
- buffer_grow (filename, len+1);
- strcpy (filename->ptr, d_name);
- found |= note_possible_classname (filename->data + entry_length,
- package_length+len+1);
- }
- if (dirp)
- closedir (dirp);
- }
- }
-
- free (filename->data);
-
- /* Here we should have a unified way of retrieving an entry, to be
- indexed. */
- if (!found)
- {
- static int first = 1;
- if (first)
- {
- char buffer [256];
- sprintf (buffer, "Can't find default package `%s'. Check "
- "the CLASSPATH environment variable and the access to the "
- "archives.", package_name);
- error (buffer);
- java_error_count++;
- first = 0;
- }
- else
- parse_error_context (wfl, "Package `%s' not found in import",
- package_name);
- current_jcf = saved_jcf;
- return;
- }
- current_jcf = saved_jcf;
-}
-
-/* Possibly find a type in the import on demands specified
- types. Returns 1 if an error occured, 0 otherwise. Run throught the
- entire list, to detected potential double definitions. */
-
-static int
-find_in_imports_on_demand (class_type)
- tree class_type;
-{
- tree node, import, node_to_use = NULL_TREE;
- int seen_once = -1;
- tree cl = NULL_TREE;
-
- for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import))
- {
- char *id_name;
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
- obstack_1grow (&temporary_obstack, '.');
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (TYPE_NAME (class_type)),
- IDENTIFIER_LENGTH (TYPE_NAME (class_type)));
- id_name = obstack_finish (&temporary_obstack);
-
- node = maybe_get_identifier (id_name);
- if (node && IS_A_CLASSFILE_NAME (node))
- {
- if (seen_once < 0)
- {
- cl = TREE_PURPOSE (import);
- seen_once = 1;
- node_to_use = node;
- }
- else
- {
- seen_once++;
- parse_error_context
- (import, "Type `%s' also potentially defined in package `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (class_type)),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))));
- }
- }
- }
-
- if (seen_once == 1)
- {
- /* Setup lineno so that it refers to the line of the import (in
- case we parse a class file and encounter errors */
- tree decl;
- int saved_lineno = lineno;
- lineno = EXPR_WFL_LINENO (cl);
- TYPE_NAME (class_type) = node_to_use;
- QUALIFIED_P (TYPE_NAME (class_type)) = 1;
- decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- /* If there is no DECL set for the class or if the class isn't
- loaded and not seen in source yet, the load */
- if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl))
- && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
- load_class (node_to_use, 0);
- lineno = saved_lineno;
- return check_pkg_class_access (TYPE_NAME (class_type), cl);
- }
- else
- return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
-}
-
-static tree
-resolve_package (pkg, next)
- tree pkg, *next;
-{
- tree current;
- tree type_name = NULL_TREE;
- char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg));
-
- /* The trick is to determine when the package name stops and were
- the name of something contained in the package starts. Then we
- return a fully qualified name of what we want to get. */
-
- /* Do a quick search on well known package names */
- if (!strncmp (name, "java.lang.reflect", 17))
- {
- *next =
- TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))));
- type_name = lookup_package_type (name, 17);
- }
- else if (!strncmp (name, "java.lang", 9))
- {
- *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)));
- type_name = lookup_package_type (name, 9);
- }
-
- /* If we found something here, return */
- if (type_name)
- return type_name;
-
- *next = EXPR_WFL_QUALIFICATION (pkg);
-
- /* Try the current package. */
- if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package),
- IDENTIFIER_LENGTH (ctxp->package)))
- {
- type_name =
- lookup_package_type_and_set_next (name,
- IDENTIFIER_LENGTH (ctxp->package),
- next );
- if (type_name)
- return type_name;
- }
-
- /* Search in imported package */
- for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
- {
- tree current_pkg_name = EXPR_WFL_NODE (TREE_PURPOSE (current));
- int len = IDENTIFIER_LENGTH (current_pkg_name);
- if (!strncmp (name, IDENTIFIER_POINTER (current_pkg_name), len))
- {
- tree left, dummy;
-
- breakdown_qualified (&left, &dummy, current_pkg_name);
- len = IDENTIFIER_LENGTH (left);
- type_name = lookup_package_type_and_set_next (name, len, next);
- if (type_name)
- break;
- }
- }
-
- return type_name;
-}
-
-static tree
-lookup_package_type_and_set_next (name, len, next)
- char *name;
- int len;
- tree *next;
-{
- char *ptr;
- tree type_name = lookup_package_type (name, len);
-
- if (!type_name)
- return NULL;
-
- ptr = IDENTIFIER_POINTER (type_name);
- while (ptr && (ptr = strchr (ptr, '.')))
- {
- *next = TREE_CHAIN (*next);
- ptr++;
- }
- return type_name;
-}
-
-static tree
-lookup_package_type (name, from)
- char *name;
- int from;
-{
- char subname [128];
- char *sub = &name[from+1];
- while (*sub != '.' && *sub)
- sub++;
- strncpy (subname, name, sub-name);
- subname [sub-name] = '\0';
- return get_identifier (subname);
-}
-
-/* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
- access violations were found, 1 otherwise. */
-
-static int
-check_pkg_class_access (class_name, cl)
- tree class_name;
- tree cl;
-{
- tree type;
-
- if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name))
- return 0;
-
- if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name))))
- return 0;
-
- if (!CLASS_PUBLIC (TYPE_NAME (type)))
- {
- /* Access to a private class within the same package is
- allowed. */
- tree l, r;
- breakdown_qualified (&l, &r, class_name);
- if (l == ctxp->package)
- return 0;
-
- parse_error_context
- (cl, "Can't access %s `%s'. Only public classes and interfaces in "
- "other packages can be accessed",
- (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
- IDENTIFIER_POINTER (class_name));
- return 1;
- }
- return 0;
-}
-
-/* Local variable declaration. */
-
-static void
-declare_local_variables (modifier, type, vlist)
- int modifier;
- tree type;
- tree vlist;
-{
- tree decl, current, saved_type;
- tree type_wfl = NULL_TREE;
- int must_chain = 0;
-
- /* Push a new block if statements were seen between the last time we
- pushed a block and now. Keep a cound of block to close */
- if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
- {
- tree body = GET_CURRENT_BLOCK (current_function_decl);
- tree b = enter_block ();
- BLOCK_EXPR_ORIGIN (b) = body;
- }
-
- if (modifier)
- {
- int i;
- for (i = 0; i <= 10; i++) if (1 << i & modifier) break;
- if (modifier == ACC_FINAL)
- {
- if (flag_static_local_jdk1_1)
- parse_warning_context (ctxp->modifier_ctx [i],
- "Unsupported JDK1.1 `final' local variable "
- "(treated as non final)");
- }
- else
- {
- parse_error_context
- (ctxp->modifier_ctx [i],
- "Only `final' is allowed as a local variables modifier");
- return;
- }
- }
-
- /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
- hold the TYPE value if a new incomplete has to be created (as
- opposed to being found already existing and reused). */
- SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
-
- /* If TYPE is fully resolved and we don't have a reference, make one */
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
-
- /* Go through all the declared variables */
- for (current = vlist, saved_type = type; current;
- current = TREE_CHAIN (current), type = saved_type)
- {
- tree other, real_type;
- tree wfl = TREE_PURPOSE (current);
- tree name = EXPR_WFL_NODE (wfl);
- tree init = TREE_VALUE (current);
-
- /* Process NAME, as it may specify extra dimension(s) for it */
- type = build_array_from_name (type, type_wfl, name, &name);
-
- /* Variable redefinition check */
- if ((other = lookup_name_in_blocks (name)))
- {
- variable_redefinition_error (wfl, name, TREE_TYPE (other),
- DECL_SOURCE_LINE (other));
- continue;
- }
-
- /* Type adjustment. We may have just readjusted TYPE because
- the variable specified more dimensions. Make sure we have
- a reference if we can and don't have one already. */
- PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
-
- real_type = GET_REAL_TYPE (type);
- /* Never layout this decl. This will be done when its scope
- will be entered */
- decl = build_decl (VAR_DECL, name, real_type);
- BLOCK_CHAIN_DECL (decl);
-
- /* If doing xreferencing, replace the line number with the WFL
- compound value */
- if (flag_emit_xref)
- DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl);
-
- /* Don't try to use an INIT statement when an error was found */
- if (init && java_error_count)
- init = NULL_TREE;
-
- /* Add the initialization function to the current function's code */
- if (init)
- {
- /* Name might have been readjusted */
- EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name;
- MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
- java_method_add_stmt (current_function_decl,
- build_debugable_stmt (EXPR_WFL_LINECOL (init),
- init));
- }
-
- /* Setup dependency the type of the decl */
- if (must_chain)
- {
- jdep *dep;
- register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type);
- dep = CLASSD_LAST (ctxp->classd_list);
- JDEP_GET_PATCH (dep) = &TREE_TYPE (decl);
- }
- }
- SOURCE_FRONTEND_DEBUG (("Defined locals"));
-}
-
-/* Called during parsing. Build decls from argument list. */
-
-static void
-source_start_java_method (fndecl)
- tree fndecl;
-{
- tree tem;
- tree parm_decl;
- int i;
-
- current_function_decl = fndecl;
-
- /* New scope for the function */
- enter_block ();
- for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
- tem != end_params_node; tem = TREE_CHAIN (tem), i++)
- {
- tree type = TREE_VALUE (tem);
- tree name = TREE_PURPOSE (tem);
-
- /* If type is incomplete. Create an incomplete decl and ask for
- the decl to be patched later */
- if (INCOMPLETE_TYPE_P (type))
- {
- jdep *jdep;
- tree real_type = GET_REAL_TYPE (type);
- parm_decl = build_decl (PARM_DECL, name, real_type);
- type = obtain_incomplete_type (type);
- register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type);
- jdep = CLASSD_LAST (ctxp->classd_list);
- JDEP_MISC (jdep) = name;
- JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl);
- }
- else
- parm_decl = build_decl (PARM_DECL, name, type);
-
- BLOCK_CHAIN_DECL (parm_decl);
- }
- tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
- BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
- nreverse (tem);
- DECL_ARG_SLOT_COUNT (current_function_decl) = i;
-}
-
-/* Called during parsing. Creates an artificial method declaration. */
-
-static tree
-create_artificial_method (class, flags, type, name, args)
- tree class;
- int flags;
- tree type, name, args;
-{
- int saved_lineno = lineno;
- tree mdecl;
-
- lineno = 0;
- mdecl = make_node (FUNCTION_TYPE);
- TREE_TYPE (mdecl) = type;
- TYPE_ARG_TYPES (mdecl) = args;
- mdecl = add_method (class, flags, name, build_java_signature (mdecl));
- lineno = saved_lineno;
- DECL_ARTIFICIAL (mdecl) = 1;
- return mdecl;
-}
-
-/* Starts the body if an artifical method. */
-
-static void
-start_artificial_method_body (mdecl)
- tree mdecl;
-{
- DECL_SOURCE_LINE (mdecl) = 1;
- DECL_SOURCE_LINE_MERGE (mdecl, 1);
- source_start_java_method (mdecl);
- enter_block ();
-}
-
-static void
-end_artificial_method_body (mdecl)
- tree mdecl;
-{
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block ();
- exit_block ();
-}
-
-/* Called during expansion. Push decls formerly built from argument
- list so they're usable during expansion. */
-
-static void
-expand_start_java_method (fndecl)
- tree fndecl;
-{
- tree tem, *ptr;
-
- current_function_decl = fndecl;
-
- announce_function (fndecl);
- pushlevel (1); /* Push parameters */
- ptr = &DECL_ARGUMENTS (fndecl);
- tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
- while (tem)
- {
- tree next = TREE_CHAIN (tem);
- tree type = TREE_TYPE (tem);
-#ifdef PROMOTE_PROTOTYPES
- if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
- && INTEGRAL_TYPE_P (type))
- type = integer_type_node;
-#endif
- DECL_ARG_TYPE (tem) = type;
- layout_decl (tem, 0);
- pushdecl (tem);
- *ptr = tem;
- ptr = &TREE_CHAIN (tem);
- tem = next;
- }
- *ptr = NULL_TREE;
- pushdecl_force_head (DECL_ARGUMENTS (fndecl));
- lineno = DECL_SOURCE_LINE_FIRST (fndecl);
-}
-
-/* Terminate a function and expand its body. */
-
-static void
-source_end_java_method ()
-{
- tree fndecl = current_function_decl;
- int flag_asynchronous_exceptions = asynchronous_exceptions;
-
- java_parser_context_save_global ();
- lineno = ctxp->last_ccb_indent1;
-
- /* Set EH language codes */
- java_set_exception_lang_code ();
-
- /* Turn function bodies with only a NOP expr null, so they don't get
- generated at all and we won't get warnings when using the -W
- -Wall flags. */
- if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node)
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
-
- /* Generate function's code */
- if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
- && ! flag_emit_class_files
- && ! flag_emit_xref)
- expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)));
-
- /* pop out of its parameters */
- pushdecl_force_head (DECL_ARGUMENTS (fndecl));
- poplevel (1, 0, 1);
- BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
-
- /* Generate rtl for function exit. */
- if (! flag_emit_class_files && ! flag_emit_xref)
- {
- lineno = DECL_SOURCE_LINE_LAST (fndecl);
- /* Emit catch-finally clauses */
- emit_handlers ();
- expand_function_end (input_filename, lineno, 0);
-
- /* FIXME: If the current method contains any exception handlers,
- force asynchronous_exceptions: this is necessary because signal
- handlers in libjava may throw exceptions. This is far from being
- a perfect solution, but it's better than doing nothing at all.*/
- if (catch_clauses)
- asynchronous_exceptions = 1;
-
- /* Run the optimizers and output assembler code for this function. */
- rest_of_compilation (fndecl);
- }
-
- current_function_decl = NULL_TREE;
- /* permanent_allocation (1); */
- java_parser_context_restore_global ();
- asynchronous_exceptions = flag_asynchronous_exceptions;
-}
-
-/* Record EXPR in the current function block. Complements compound
- expression second operand if necessary. */
-
-tree
-java_method_add_stmt (fndecl, expr)
- tree fndecl, expr;
-{
- return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
-}
-
-static tree
-add_stmt_to_block (b, type, stmt)
- tree b, type, stmt;
-{
- tree body = BLOCK_EXPR_BODY (b), c;
-
- if (java_error_count)
- return body;
-
- if ((c = add_stmt_to_compound (body, type, stmt)) == body)
- return body;
-
- BLOCK_EXPR_BODY (b) = c;
- TREE_SIDE_EFFECTS (c) = 1;
- return c;
-}
-
-/* Add STMT to EXISTING if possible, otherwise create a new
- COMPOUND_EXPR and add STMT to it. */
-
-static tree
-add_stmt_to_compound (existing, type, stmt)
- tree existing, type, stmt;
-{
- if (existing)
- return build (COMPOUND_EXPR, type, existing, stmt);
- else
- return stmt;
-}
-
-/* Hold THIS for the scope of the current public method decl. */
-static tree current_this;
-
-void java_layout_seen_class_methods ()
-{
- tree previous_list = all_class_list;
- tree end = NULL_TREE;
- tree current;
-
- while (1)
- {
- for (current = previous_list;
- current != end; current = TREE_CHAIN (current))
- layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
-
- if (previous_list != all_class_list)
- {
- end = previous_list;
- previous_list = all_class_list;
- }
- else
- break;
- }
-}
-
-/* Layout the methods of all classes loaded in one way on an
- other. Check methods of source parsed classes. Then reorder the
- fields and layout the classes or the type of all source parsed
- classes */
-
-void
-java_layout_classes ()
-{
- tree current;
- int save_error_count = java_error_count;
-
- /* Layout the methods of all classes seen so far */
- java_layout_seen_class_methods ();
- java_parse_abort_on_error ();
- all_class_list = NULL_TREE;
-
- /* Then check the methods of all parsed classes */
- for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
- if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
- CHECK_METHODS (TREE_VALUE (current));
- java_parse_abort_on_error ();
-
- for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
- {
- current_class = TREE_TYPE (TREE_VALUE (current));
-
- /* Reverse the fields, but leave the dummy field in front.
- Fields are already ordered for Object and Class */
- if (TYPE_FIELDS (current_class) && current_class != object_type_node
- && current_class != class_type_node)
- {
- /* If the dummy field is there, reverse the right fields and
- just layout the type for proper fields offset */
- if (!DECL_NAME (TYPE_FIELDS (current_class)))
- {
- tree fields = TYPE_FIELDS (current_class);
- TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
- TYPE_SIZE (current_class) = NULL_TREE;
- layout_type (current_class);
- }
- /* We don't have a dummy field, we need to layout the class,
- after having reversed the fields */
- else
- {
- TYPE_FIELDS (current_class) =
- nreverse (TYPE_FIELDS (current_class));
- TYPE_SIZE (current_class) = NULL_TREE;
- layout_class (current_class);
- }
- }
- else
- layout_class (current_class);
-
- /* From now on, the class is considered completely loaded */
- CLASS_LOADED_P (current_class) = 1;
-
- /* Error reported by the caller */
- if (java_error_count)
- return;
- }
-
- /* We might have reloaded classes durign the process of laying out
- classes for code generation. We must layout the methods of those
- late additions, as constructor checks might use them */
- java_layout_seen_class_methods ();
- java_parse_abort_on_error ();
-}
-
-/* Expand all methods in all registered classes. */
-
-void
-java_complete_expand_methods ()
-{
- tree current;
-
- do_not_fold = flag_emit_xref;
-
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- int is_interface;
- tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current));
- tree decl;
-
- current_class = TREE_TYPE (current);
- is_interface = CLASS_INTERFACE (TYPE_NAME (current_class));
-
- /* Initialize a new constant pool */
- init_outgoing_cpool ();
-
- /* We want <clinit> (if any) to be processed first. */
- decl = tree_last (TYPE_METHODS (class_type));
- if (IS_CLINIT (decl))
- {
- tree fbody = DECL_FUNCTION_BODY (decl);
- tree list;
- if (fbody != NULL_TREE)
- {
- /* First check if we can ignore empty <clinit> */
- tree block_body = BLOCK_EXPR_BODY (fbody);
-
- current_this = NULL_TREE;
- current_function_decl = decl;
- if (block_body != NULL_TREE)
- {
- /* Prevent the use of `this' inside <clinit> */
- ctxp->explicit_constructor_p = 1;
-
- block_body = java_complete_tree (block_body);
- ctxp->explicit_constructor_p = 0;
- BLOCK_EXPR_BODY (fbody) = block_body;
- if (block_body != NULL_TREE
- && TREE_CODE (block_body) == BLOCK
- && BLOCK_EXPR_BODY (block_body) == empty_stmt_node)
- decl = NULL_TREE;
- }
- }
- list = nreverse (TREE_CHAIN (nreverse (TYPE_METHODS (class_type))));
- if (decl != NULL_TREE)
- {
- TREE_CHAIN (decl) = list;
- TYPE_METHODS (class_type) = decl;
- }
- else
- TYPE_METHODS (class_type) = list;
- }
-
- for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
- {
- current_function_decl = decl;
- /* Don't generate debug info on line zero when expanding a
- generated constructor. */
- if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl))
- {
- /* If we found errors, it's too dangerous to try to
- generate and expand a constructor */
- if (!java_error_count)
- {
- restore_line_number_status (1);
- java_complete_expand_method (decl);
- restore_line_number_status (0);
- }
- }
- else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl))
- continue;
- else
- java_complete_expand_method (decl);
- }
-
- /* Now verify constructor circularity (stop after the first one
- we find) */
- if (!is_interface)
- for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
- if (DECL_CONSTRUCTOR_P (decl) &&
- verify_constructor_circularity (decl, decl))
- break;
-
- /* Make the class data, register it and run the rest of decl
- compilation on it */
- if (!java_error_count)
- {
- if (flag_emit_class_files)
- write_classfile (current_class);
- if (flag_emit_xref)
- expand_xref (current_class);
- else if (! flag_syntax_only)
- finish_class (current_class);
- }
- }
-}
-
-/* Hold a list of catch clauses list. The first element of this list is
- the list of the catch clauses of the currently analysed try block. */
-static tree currently_caught_type_list;
-
-/* Complete and expand a method. */
-
-static void
-java_complete_expand_method (mdecl)
- tree mdecl;
-{
- /* Fix constructors before expanding them */
- if (DECL_CONSTRUCTOR_P (mdecl))
- fix_constructors (mdecl);
-
- /* Expand functions that have a body */
- if (DECL_FUNCTION_BODY (mdecl))
- {
- tree fbody = DECL_FUNCTION_BODY (mdecl);
- tree block_body = BLOCK_EXPR_BODY (fbody);
- tree exception_copy;
- expand_start_java_method (mdecl);
- build_result_decl (mdecl);
-
- current_this
- = (!METHOD_STATIC (mdecl) ?
- BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
-
- /* Purge the `throws' list of unchecked exceptions. If we're
- doing xref, save a copy of the list and re-install it
- later. */
- if (flag_emit_xref)
- exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl));
-
- purge_unchecked_exceptions (mdecl);
-
- /* Install exceptions thrown with `throws' */
- PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
-
- if (block_body != NULL_TREE)
- {
- block_body = java_complete_tree (block_body);
- if (!flag_emit_xref)
- check_for_initialization (block_body);
- ctxp->explicit_constructor_p = 0;
- }
- BLOCK_EXPR_BODY (fbody) = block_body;
-
- if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
- && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE
- && !flag_emit_xref)
- missing_return_error (current_function_decl);
-
- complete_start_java_method (mdecl);
-
- /* Don't go any further if we've found error(s) during the
- expansion */
- if (!java_error_count)
- source_end_java_method ();
- else
- {
- pushdecl_force_head (DECL_ARGUMENTS (mdecl));
- poplevel (1, 0, 1);
- }
-
- /* Pop the exceptions and sanity check */
- POP_EXCEPTIONS();
- if (currently_caught_type_list)
- fatal ("Exception list non empty - java_complete_expand_method");
-
- if (flag_emit_xref)
- DECL_FUNCTION_THROWS (mdecl) = exception_copy;
- }
-}
-
-/* Craft a body for default constructor. Patch existing constructor
- bodies with call to super() and field initialization statements if
- necessary. */
-
-static void
-fix_constructors (mdecl)
- tree mdecl;
-{
- tree body = DECL_FUNCTION_BODY (mdecl);
-
- if (!body)
- {
- /* The constructor body must be crafted by hand. It's the
- constructor we defined when we realize we didn't have the
- CLASSNAME() constructor */
-
- tree compound;
-
- /* It is an error for the compiler to generate a default
- constructor if the superclass doesn't have a constructor that
- takes no argument */
- if (verify_constructor_super ())
- {
- tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class));
- char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
- parse_error_context (lookup_cl (TYPE_NAME (current_class)),
- "No constructor matching `%s()' found in "
- "class `%s'", n, n);
- }
-
- start_artificial_method_body (mdecl);
-
- /* We don't generate a super constructor invocation if we're
- compiling java.lang.Object. build_super_invocation takes care
- of that. */
- compound = java_method_add_stmt (mdecl, build_super_invocation ());
-
- end_artificial_method_body (mdecl);
- }
- /* Search for an explicit constructor invocation */
- else
- {
- int found = 0;
- tree main_block = BLOCK_EXPR_BODY (body);
- tree compound = NULL_TREE;
-
- while (body)
- switch (TREE_CODE (body))
- {
- case CALL_EXPR:
- found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
- body = NULL_TREE;
- break;
- case COMPOUND_EXPR:
- case EXPR_WITH_FILE_LOCATION:
- body = TREE_OPERAND (body, 0);
- break;
- case BLOCK:
- body = BLOCK_EXPR_BODY (body);
- break;
- default:
- found = 0;
- body = NULL_TREE;
- }
- /* The constructor is missing an invocation of super() */
- if (!found)
- compound = add_stmt_to_compound (compound, NULL_TREE,
- build_super_invocation ());
-
- /* Fix the constructor main block if we're adding extra stmts */
- if (compound)
- {
- compound = add_stmt_to_compound (compound, NULL_TREE,
- BLOCK_EXPR_BODY (main_block));
- BLOCK_EXPR_BODY (main_block) = compound;
- }
- }
-}
-
-/* Browse constructors in the super class, searching for a constructor
- that doesn't take any argument. Return 0 if one is found, 1
- otherwise. */
-
-static int
-verify_constructor_super ()
-{
- tree class = CLASSTYPE_SUPER (current_class);
- if (!class)
- return 0;
-
- if (class)
- {
- tree mdecl;
- for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
- {
- if (DECL_CONSTRUCTOR_P (mdecl)
- && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
- return 0;
- }
- }
- return 1;
-}
-
-/* Expand finals. */
-
-void
-java_expand_finals ()
-{
-}
-
-/* Generate code for all context remembered for code generation. */
-
-void
-java_expand_classes ()
-{
- int save_error_count = 0;
- java_parse_abort_on_error ();
- if (!(ctxp = ctxp_for_generation))
- return;
- java_layout_classes ();
- java_parse_abort_on_error ();
-
- for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
- {
- ctxp = ctxp_for_generation;
- lang_init_source (2); /* Error msgs have method prototypes */
- java_complete_expand_methods (); /* Complete and expand method bodies */
- java_parse_abort_on_error ();
- java_expand_finals (); /* Expand and check the finals */
- java_parse_abort_on_error ();
- java_check_final (); /* Check unitialized final */
- java_parse_abort_on_error ();
- }
-}
-
-/* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
- a tree list node containing RIGHT. Fore coming RIGHTs will be
- chained to this hook. LOCATION contains the location of the
- separating `.' operator. */
-
-static tree
-make_qualified_primary (primary, right, location)
- tree primary, right;
- int location;
-{
- tree wfl;
-
- /* We want to process THIS . xxx symbolicaly, to keep it consistent
- with the way we're processing SUPER. A THIS from a primary as a
- different form than a SUPER. Turn THIS into something symbolic */
- if (TREE_CODE (primary) == THIS_EXPR)
- {
- wfl = build_wfl_node (this_identifier_node);
- EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
- wfl = make_qualified_name (wfl, right, location);
- PRIMARY_P (wfl) = 1;
- return wfl;
- }
- /* Other non WFL node are wrapped around a WFL */
- else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
- {
- wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
- EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
- EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE);
- }
- else
- {
- wfl = primary;
- if (!EXPR_WFL_QUALIFICATION (primary))
- EXPR_WFL_QUALIFICATION (primary) =
- build_tree_list (primary, NULL_TREE);
- }
-
- EXPR_WFL_LINECOL (right) = location;
- chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE));
- PRIMARY_P (wfl) = 1;
- return wfl;
-}
-
-/* Simple merge of two name separated by a `.' */
-
-static tree
-merge_qualified_name (left, right)
- tree left, right;
-{
- tree node;
- obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left),
- IDENTIFIER_LENGTH (left));
- obstack_1grow (&temporary_obstack, '.');
- obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right),
- IDENTIFIER_LENGTH (right));
- node = get_identifier (obstack_base (&temporary_obstack));
- obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
- QUALIFIED_P (node) = 1;
- return node;
-}
-
-/* Merge the two parts of a qualified name into LEFT. Set the
- location information of the resulting node to LOCATION, usually
- inherited from the location information of the `.' operator. */
-
-static tree
-make_qualified_name (left, right, location)
- tree left, right;
- int location;
-{
-#ifdef USE_COMPONENT_REF
- tree node = build (COMPONENT_REF, NULL_TREE, left, right);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-#else
- tree left_id = EXPR_WFL_NODE (left);
- tree right_id = EXPR_WFL_NODE (right);
- tree wfl, merge;
-
- merge = merge_qualified_name (left_id, right_id);
-
- /* Left wasn't qualified and is now qualified */
- if (!QUALIFIED_P (left_id))
- {
- tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0);
- EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
- EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
- }
-
- wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
- EXPR_WFL_LINECOL (wfl) = location;
- chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
-
- EXPR_WFL_NODE (left) = merge;
- return left;
-#endif
-}
-
-/* Extract the last identifier component of the qualified in WFL. The
- last identifier is removed from the linked list */
-
-static tree
-cut_identifier_in_qualified (wfl)
- tree wfl;
-{
- tree q;
- tree previous = NULL_TREE;
- for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q))
- if (!TREE_CHAIN (q))
- {
- if (!previous)
- fatal ("Operating on a non qualified qualified WFL - "
- "cut_identifier_in_qualified");
- TREE_CHAIN (previous) = NULL_TREE;
- return TREE_PURPOSE (q);
- }
-}
-
-/* Resolve the expression name NAME. Return its decl. */
-
-static tree
-resolve_expression_name (id, orig)
- tree id;
- tree *orig;
-{
- tree name = EXPR_WFL_NODE (id);
- tree decl;
-
- /* 6.5.5.1: Simple expression names */
- if (!PRIMARY_P (id) && !QUALIFIED_P (name))
- {
- /* 15.13.1: NAME can appear within the scope of a local variable
- declaration */
- if ((decl = IDENTIFIER_LOCAL_VALUE (name)))
- return decl;
-
- /* 15.13.1: NAME can appear within a class declaration */
- else
- {
- decl = lookup_field_wrapper (current_class, name);
- if (decl)
- {
- int fs = FIELD_STATIC (decl);
- /* Instance variable (8.3.1.1) can't appear within
- static method, static initializer or initializer for
- a static variable. */
- if (!fs && METHOD_STATIC (current_function_decl))
- {
- static_ref_err (id, name, current_class);
- return error_mark_node;
- }
- /* Instance variables can't appear as an argument of
- an explicit constructor invocation */
- if (!fs && ctxp->explicit_constructor_p)
- {
- parse_error_context
- (id, "Can't reference `%s' before the superclass "
- "constructor has been called", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
-
- /* Otherwise build what it takes to access the field */
- decl = build_field_ref ((fs ? NULL_TREE : current_this),
- DECL_CONTEXT (decl), name);
- if (fs && !flag_emit_class_files && !flag_emit_xref)
- decl = build_class_init (DECL_CONTEXT (decl), decl);
- /* We may be asked to save the real field access node */
- if (orig)
- *orig = decl;
- /* And we return what we got */
- return decl;
- }
- /* Fall down to error report on undefined variable */
- }
- }
- /* 6.5.5.2 Qualified Expression Names */
- else
- {
- if (orig)
- *orig = NULL_TREE;
- qualify_ambiguous_name (id);
- /* 15.10.1 Field Access Using a Primary and/or Expression Name */
- /* 15.10.2: Accessing Superclass Members using super */
- return resolve_field_access (id, NULL, NULL);
- }
-
- /* We've got an error here */
- parse_error_context (id, "Undefined variable `%s'",
- IDENTIFIER_POINTER (name));
-
- return error_mark_node;
-}
-
-static void
-static_ref_err (wfl, field_id, class_type)
- tree wfl, field_id, class_type;
-{
- parse_error_context
- (wfl,
- "Can't make a static reference to nonstatic variable `%s' in class `%s'",
- IDENTIFIER_POINTER (field_id),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
-}
-
-/* 15.10.1 Field Acess Using a Primary and/or Expression Name.
- We return something suitable to generate the field access. We also
- return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
- recipient's address can be null. */
-
-static tree
-resolve_field_access (qual_wfl, field_decl, field_type)
- tree qual_wfl;
- tree *field_decl, *field_type;
-{
- int is_static = 0;
- tree field_ref;
- tree decl, where_found, type_found;
-
- if (resolve_qualified_expression_name (qual_wfl, &decl,
- &where_found, &type_found))
- return error_mark_node;
-
- /* Resolve the LENGTH field of an array here */
- if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found)
- && ! flag_emit_class_files && ! flag_emit_xref)
- {
- tree length = build_java_array_length_access (where_found);
- field_ref =
- build_java_arraynull_check (type_found, length, int_type_node);
- }
- /* We might have been trying to resolve field.method(). In which
- case, the resolution is over and decl is the answer */
- else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
- field_ref = decl;
- else if (JDECL_P (decl))
- {
- int static_final_found = 0;
- if (!type_found)
- type_found = DECL_CONTEXT (decl);
- is_static = JDECL_P (decl) && FIELD_STATIC (decl);
- if (FIELD_FINAL (decl)
- && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
- && DECL_LANG_SPECIFIC (decl)
- && DECL_INITIAL (decl))
- {
- field_ref = DECL_INITIAL (decl);
- static_final_found = 1;
- }
- else
- field_ref = build_field_ref ((is_static && !flag_emit_xref?
- NULL_TREE : where_found),
- type_found, DECL_NAME (decl));
- if (field_ref == error_mark_node)
- return error_mark_node;
- if (is_static && !static_final_found
- && !flag_emit_class_files && !flag_emit_xref)
- {
- field_ref = build_class_init (type_found, field_ref);
- /* If the static field was identified by an expression that
- needs to be generated, make the field access a compound
- expression whose first part is the evaluation of the
- field selector part. */
- if (where_found && TREE_CODE (where_found) != TYPE_DECL
- && TREE_CODE (where_found) != RECORD_TYPE)
- {
- tree type = QUAL_DECL_TYPE (field_ref);
- if (TREE_CODE (type) == RECORD_TYPE)
- type = build_pointer_type (type);
- field_ref = build (COMPOUND_EXPR, type, where_found, field_ref);
- }
- }
- }
- else
- field_ref = decl;
-
- if (field_decl)
- *field_decl = decl;
- if (field_type)
- *field_type = (QUAL_DECL_TYPE (decl) ?
- QUAL_DECL_TYPE (decl) : TREE_TYPE (decl));
- return field_ref;
-}
-
-/* If NODE is an access to f static field, strip out the class
- initialization part and return the field decl, otherwise, return
- NODE. */
-
-static tree
-strip_out_static_field_access_decl (node)
- tree node;
-{
- if (TREE_CODE (node) == COMPOUND_EXPR)
- {
- tree op1 = TREE_OPERAND (node, 1);
- if (TREE_CODE (op1) == COMPOUND_EXPR)
- {
- tree call = TREE_OPERAND (op1, 0);
- if (TREE_CODE (call) == CALL_EXPR
- && TREE_CODE (TREE_OPERAND (call, 0)) == ADDR_EXPR
- && TREE_OPERAND (TREE_OPERAND (call, 0), 0)
- == soft_initclass_node)
- return TREE_OPERAND (op1, 1);
- }
- }
- return node;
-}
-
-/* 6.5.5.2: Qualified Expression Names */
-
-static int
-resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
- tree wfl;
- tree *found_decl, *type_found, *where_found;
-{
- int from_type = 0; /* Field search initiated from a type */
- int from_super = 0, from_cast = 0;
- int previous_call_static = 0;
- int is_static;
- tree decl = NULL_TREE, type = NULL_TREE, q;
- *type_found = *where_found = NULL_TREE;
-
- for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
- {
- tree qual_wfl = QUAL_WFL (q);
-
- /* 15.10.1 Field Access Using a Primary */
- switch (TREE_CODE (qual_wfl))
- {
- case CALL_EXPR:
- case NEW_CLASS_EXPR:
- /* If the access to the function call is a non static field,
- build the code to access it. */
- if (JDECL_P (decl) && !FIELD_STATIC (decl))
- {
- decl = maybe_access_field (decl, *where_found,
- DECL_CONTEXT (decl));
- if (decl == error_mark_node)
- return 1;
- }
- /* And code for the function call */
- if (complete_function_arguments (qual_wfl))
- return 1;
- if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
- CALL_USING_SUPER (qual_wfl) = 1;
- *where_found =
- patch_method_invocation (qual_wfl, decl, type, &is_static, NULL);
- if (*where_found == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (*where_found);
-
- /* If the previous call was static and this one is too,
- build a compound expression to hold the two (because in
- that case, previous function calls aren't transported as
- forcoming function's argument. */
- if (previous_call_static && is_static)
- {
- decl = build (COMPOUND_EXPR, type, decl, *where_found);
- TREE_SIDE_EFFECTS (decl) = 1;
- }
- else
- {
- previous_call_static = is_static;
- decl = *where_found;
- }
- continue;
-
- case NEW_ARRAY_EXPR:
- *where_found = decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- CLASS_LOADED_P (type) = 1;
- continue;
-
- case CONVERT_EXPR:
- *where_found = decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- from_cast = 1;
- continue;
-
- case CONDITIONAL_EXPR:
- case STRING_CST:
- *where_found = decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- continue;
-
- case ARRAY_REF:
- /* If the access to the function call is a non static field,
- build the code to access it. */
- if (JDECL_P (decl) && !FIELD_STATIC (decl))
- {
- decl = maybe_access_field (decl, *where_found, type);
- if (decl == error_mark_node)
- return 1;
- }
- /* And code for the array reference expression */
- decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- type = QUAL_DECL_TYPE (decl);
- continue;
-
- default:
- /* Fix for -Wall Just go to the next statement. Don't
- continue */
- break;
- }
-
- /* If we fall here, we weren't processing a (static) function call. */
- previous_call_static = 0;
-
- /* It can be the keyword THIS */
- if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
- {
- if (!current_this)
- {
- parse_error_context
- (wfl, "Keyword `this' used outside allowed context");
- return 1;
- }
- /* We have to generate code for intermediate acess */
- *where_found = decl = current_this;
- *type_found = type = QUAL_DECL_TYPE (decl);
- continue;
- }
-
- /* 15.10.2 Accessing Superclass Members using SUPER */
- if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
- {
- tree node;
- /* Check on the restricted use of SUPER */
- if (METHOD_STATIC (current_function_decl)
- || current_class == object_type_node)
- {
- parse_error_context
- (wfl, "Keyword `super' used outside allowed context");
- return 1;
- }
- /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
- node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
- CLASSTYPE_SUPER (current_class),
- build_this (EXPR_WFL_LINECOL (qual_wfl)));
- *where_found = decl = java_complete_tree (node);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- from_super = from_type = 1;
- continue;
- }
-
- /* 15.13.1: Can't search for field name in packages, so we
- assume a variable/class name was meant. */
- if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
- {
- tree name = resolve_package (wfl, &q);
- if (name)
- {
- *where_found = decl = resolve_no_layout (name, qual_wfl);
- /* We wan't to be absolutely that the class is laid
- out. We're going to search something inside it. */
- *type_found = type = TREE_TYPE (decl);
- layout_class (type);
- from_type = 1;
- /* Should be a list, really. FIXME */
- RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1;
- RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0;
- }
- else
- {
- if (from_super || from_cast)
- parse_error_context
- ((from_cast ? qual_wfl : wfl),
- "No variable `%s' defined in class `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- lang_printable_name (type, 0));
- else
- parse_error_context
- (qual_wfl, "Undefined variable or class name: `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)));
- return 1;
- }
- }
-
- /* We have a type name. It's been already resolved when the
- expression was qualified. */
- else if (RESOLVE_TYPE_NAME_P (qual_wfl))
- {
- if (!(decl = QUAL_RESOLUTION (q)))
- return 1; /* Error reported already */
-
- if (not_accessible_p (TREE_TYPE (decl), decl, 0))
- {
- parse_error_context
- (qual_wfl, "Can't access %s field `%s.%s' from `%s'",
- java_accstring_lookup (get_access_flags_from_decl (decl)),
- GET_TYPE_NAME (type),
- IDENTIFIER_POINTER (DECL_NAME (decl)),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- return 1;
- }
- check_deprecation (qual_wfl, decl);
-
- type = TREE_TYPE (decl);
- from_type = 1;
- }
- /* We resolve and expression name */
- else
- {
- tree field_decl;
-
- /* If there exists an early resolution, use it. That occurs
- only once and we know that there are more things to
- come. Don't do that when processing something after SUPER
- (we need more thing to be put in place below */
- if (!from_super && QUAL_RESOLUTION (q))
- {
- decl = QUAL_RESOLUTION (q);
- if (!type)
- {
- if (TREE_CODE (decl) == FIELD_DECL && !FIELD_STATIC (decl))
- {
- if (current_this)
- *where_found = current_this;
- else
- {
- static_ref_err (qual_wfl, DECL_NAME (decl),
- current_class);
- return 1;
- }
- }
- else
- {
- *where_found = TREE_TYPE (decl);
- if (TREE_CODE (*where_found) == POINTER_TYPE)
- *where_found = TREE_TYPE (*where_found);
- }
- }
- }
-
- /* We have to search for a field, knowing the type of its
- container. The flag FROM_TYPE indicates that we resolved
- the last member of the expression as a type name, which
- means that for the resolution of this field, we'll look
- for other errors than if it was resolved as a member of
- an other field. */
- else
- {
- int is_static;
- tree field_decl_type; /* For layout */
-
- if (!from_type && !JREFERENCE_TYPE_P (type))
- {
- parse_error_context
- (qual_wfl, "Attempt to reference field `%s' in `%s %s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- lang_printable_name (type, 0),
- IDENTIFIER_POINTER (DECL_NAME (field_decl)));
- return 1;
- }
-
- field_decl = lookup_field_wrapper (type,
- EXPR_WFL_NODE (qual_wfl));
- if (field_decl == NULL_TREE)
- {
- parse_error_context
- (qual_wfl, "No variable `%s' defined in type `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- GET_TYPE_NAME (type));
- return 1;
- }
- if (field_decl == error_mark_node)
- return 1;
-
- /* Layout the type of field_decl, since we may need
- it. Don't do primitive types or loaded classes. The
- situation of non primitive arrays may not handled
- properly here. FIXME */
- if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE)
- field_decl_type = TREE_TYPE (TREE_TYPE (field_decl));
- else
- field_decl_type = TREE_TYPE (field_decl);
- if (!JPRIMITIVE_TYPE_P (field_decl_type)
- && !CLASS_LOADED_P (field_decl_type)
- && !TYPE_ARRAY_P (field_decl_type))
- resolve_and_layout (field_decl_type, NULL_TREE);
- if (TYPE_ARRAY_P (field_decl_type))
- CLASS_LOADED_P (field_decl_type) = 1;
-
- /* Check on accessibility here */
- if (not_accessible_p (type, field_decl, from_super))
- {
- parse_error_context
- (qual_wfl,
- "Can't access %s field `%s.%s' from `%s'",
- java_accstring_lookup
- (get_access_flags_from_decl (field_decl)),
- GET_TYPE_NAME (type),
- IDENTIFIER_POINTER (DECL_NAME (field_decl)),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (current_class))));
- return 1;
- }
- check_deprecation (qual_wfl, field_decl);
-
- /* There are things to check when fields are accessed
- from type. There are no restrictions on a static
- declaration of the field when it is accessed from an
- interface */
- is_static = FIELD_STATIC (field_decl);
- if (!from_super && from_type
- && !TYPE_INTERFACE_P (type) && !is_static)
- {
- static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
- return 1;
- }
- from_cast = from_super = 0;
-
- /* If we need to generate something to get a proper
- handle on what this field is accessed from, do it
- now. */
- if (!is_static)
- {
- decl = maybe_access_field (decl, *where_found, *type_found);
- if (decl == error_mark_node)
- return 1;
- }
-
- /* We want to keep the location were found it, and the type
- we found. */
- *where_found = decl;
- *type_found = type;
-
- /* This is the decl found and eventually the next one to
- search from */
- decl = field_decl;
- }
- from_type = 0;
- type = QUAL_DECL_TYPE (decl);
- }
- }
- *found_decl = decl;
- return 0;
-}
-
-/* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
- can't be accessed from REFERENCE (a record type). */
-
-int not_accessible_p (reference, member, from_super)
- tree reference, member;
- int from_super;
-{
- int access_flag = get_access_flags_from_decl (member);
-
- /* Access always granted for members declared public */
- if (access_flag & ACC_PUBLIC)
- return 0;
-
- /* Check access on protected members */
- if (access_flag & ACC_PROTECTED)
- {
- /* Access granted if it occurs from within the package
- containing the class in which the protected member is
- declared */
- if (class_in_current_package (DECL_CONTEXT (member)))
- return 0;
-
- /* If accessed with the form `super.member', then access is granted */
- if (from_super)
- return 0;
-
- /* Otherwise, access is granted if occuring from the class where
- member is declared or a subclass of it */
- if (inherits_from_p (reference, current_class))
- return 0;
- return 1;
- }
-
- /* Check access on private members. Access is granted only if it
- occurs from within the class in witch it is declared */
- if (access_flag & ACC_PRIVATE)
- return (current_class == DECL_CONTEXT (member) ? 0 : 1);
-
- /* Default access are permitted only when occuring within the
- package in which the type (REFERENCE) is declared. In other words,
- REFERENCE is defined in the current package */
- if (ctxp->package)
- return !class_in_current_package (reference);
-
- /* Otherwise, access is granted */
- return 0;
-}
-
-/* Test deprecated decl access. */
-static void
-check_deprecation (wfl, decl)
- tree wfl, decl;
-{
- char *file = DECL_SOURCE_FILE (decl);
- /* Complain if the field is deprecated and the file it was defined
- in isn't compiled at the same time the file which contains its
- use is */
- if (DECL_DEPRECATED (decl)
- && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file)))
- {
- char the [20];
- switch (TREE_CODE (decl))
- {
- case FUNCTION_DECL:
- strcpy (the, "method");
- break;
- case FIELD_DECL:
- strcpy (the, "field");
- break;
- case TYPE_DECL:
- strcpy (the, "class");
- break;
- default:
- fatal ("unexpected DECL code - check_deprecation");
- }
- parse_warning_context
- (wfl, "The %s `%s' in class `%s' has been deprecated",
- the, lang_printable_name (decl, 0),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))));
- }
-}
-
-/* Returns 1 if class was declared in the current package, 0 otherwise */
-
-static int
-class_in_current_package (class)
- tree class;
-{
- static tree cache = NULL_TREE;
- int qualified_flag;
- tree left;
-
- if (cache == class)
- return 1;
-
- qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
-
- /* If the current package is empty and the name of CLASS is
- qualified, class isn't in the current package. If there is a
- current package and the name of the CLASS is not qualified, class
- isn't in the current package */
- if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag))
- return 0;
-
- /* If there is not package and the name of CLASS isn't qualified,
- they belong to the same unnamed package */
- if (!ctxp->package && !qualified_flag)
- return 1;
-
- /* Compare the left part of the name of CLASS with the package name */
- breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
- if (ctxp->package == left)
- {
- cache = class;
- return 1;
- }
- return 0;
-}
-
-/* This function may generate code to access DECL from WHERE. This is
- done only if certain conditions meet. */
-
-static tree
-maybe_access_field (decl, where, type)
- tree decl, where, type;
-{
- if (TREE_CODE (decl) == FIELD_DECL && decl != current_this
- && !FIELD_STATIC (decl))
- decl = build_field_ref (where ? where : current_this,
- (type ? type : DECL_CONTEXT (decl)),
- DECL_NAME (decl));
- return decl;
-}
-
-/* Build a method invocation, by patching PATCH. If non NULL
- and according to the situation, PRIMARY and WHERE may be
- used. IS_STATIC is set to 1 if the invoked function is static. */
-
-static tree
-patch_method_invocation (patch, primary, where, is_static, ret_decl)
- tree patch, primary, where;
- int *is_static;
- tree *ret_decl;
-{
- tree wfl = TREE_OPERAND (patch, 0);
- tree args = TREE_OPERAND (patch, 1);
- tree name = EXPR_WFL_NODE (wfl);
- tree list;
- int is_static_flag = 0;
- int is_super_init = 0;
- tree this_arg = NULL_TREE;
-
- /* Should be overriden if everything goes well. Otherwise, if
- something fails, it should keep this value. It stop the
- evaluation of a bogus assignment. See java_complete_tree,
- MODIFY_EXPR: for the reasons why we sometimes want to keep on
- evaluating an assignment */
- TREE_TYPE (patch) = error_mark_node;
-
- /* Since lookup functions are messing with line numbers, save the
- context now. */
- java_parser_context_save_global ();
-
- /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
-
- /* Resolution of qualified name, excluding constructors */
- if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch))
- {
- tree class_decl, identifier, identifier_wfl;
- /* Extract the last IDENTIFIER of the qualified
- expression. This is a wfl and we will use it's location
- data during error report. */
- identifier_wfl = cut_identifier_in_qualified (wfl);
- identifier = EXPR_WFL_NODE (identifier_wfl);
-
- /* Given the context, IDENTIFIER is syntactically qualified
- as a MethodName. We need to qualify what's before */
- qualify_ambiguous_name (wfl);
-
- /* Package resolution */
- if (RESOLVE_PACKAGE_NAME_P (wfl))
- {
- tree next, decl, name = resolve_package (wfl, &next);
-
- if (!name)
- {
- tree remainder;
- breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
- parse_error_context (wfl, "Can't search method `%s' in package "
- "`%s'",IDENTIFIER_POINTER (identifier),
- IDENTIFIER_POINTER (remainder));
- PATCH_METHOD_RETURN_ERROR ();
- }
- RESOLVE_PACKAGE_NAME_P (wfl) = 0;
- if ((decl = resolve_no_layout (name, QUAL_WFL (next))))
- {
- QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)) = decl;
- RESOLVE_EXPRESSION_NAME_P (wfl) = 0;
- RESOLVE_TYPE_NAME_P (wfl) = 1;
- }
- else
- {
- RESOLVE_EXPRESSION_NAME_P (wfl) = 1;
- RESOLVE_TYPE_NAME_P (wfl) = 0;
- }
- }
-
- /* We're resolving a call from a type */
- if (RESOLVE_TYPE_NAME_P (wfl))
- {
- tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl));
- tree name = DECL_NAME (decl);
- tree type;
-
- class_decl = resolve_and_layout (name, wfl);
- if (CLASS_INTERFACE (decl))
- {
- parse_error_context
- (identifier_wfl, "Can't make static reference to method "
- "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier),
- IDENTIFIER_POINTER (name));
- PATCH_METHOD_RETURN_ERROR ();
- }
- /* Look the method up in the type selector. The method ought
- to be static. */
- type = TREE_TYPE (class_decl);
- list = lookup_method_invoke (0, wfl, type, identifier, args);
- if (list && !METHOD_STATIC (list))
- {
- char *fct_name = strdup (lang_printable_name (list, 0));
- parse_error_context
- (identifier_wfl,
- "Can't make static reference to method `%s %s' in class `%s'",
- lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
- fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
- free (fct_name);
- PATCH_METHOD_RETURN_ERROR ();
- }
- args = nreverse (args);
- }
- /* We're resolving an expression name */
- else
- {
- tree field, type;
-
- /* 1- Find the field to which the call applies */
- field = resolve_field_access (wfl, NULL, &type);
- if (field == error_mark_node)
- PATCH_METHOD_RETURN_ERROR ();
- /* field is used in lieu of a primary. It alows us not to
- report errors on erroneous use of `this' in
- constructors. */
- primary = field;
-
- /* 2- Do the layout of the class where the last field
- was found, so we can search it. */
- class_decl = resolve_and_layout (type, NULL_TREE);
- if (class_decl != NULL_TREE)
- type = TREE_TYPE (class_decl);
-
- /* 3- Retrieve a filtered list of method matches, Refine
- if necessary. In any cases, point out errors. */
- list = lookup_method_invoke (0, identifier_wfl, type,
- identifier, args);
-
- /* 4- Add the field as an argument */
- args = nreverse (args);
- this_arg = field;
- }
-
- /* IDENTIFIER_WFL will be used to report any problem further */
- wfl = identifier_wfl;
- }
- /* Resolution of simple names, names generated after a primary: or
- constructors */
- else
- {
- tree class_to_search;
- int lc; /* Looking for Constructor */
-
- /* We search constructor in their target class */
- if (CALL_CONSTRUCTOR_P (patch))
- {
- if (TREE_CODE (patch) == NEW_CLASS_EXPR)
- class_to_search = EXPR_WFL_NODE (wfl);
- else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
- this_identifier_node)
- class_to_search = NULL_TREE;
- else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
- super_identifier_node)
- {
- is_super_init = 1;
- if (CLASSTYPE_SUPER (current_class))
- class_to_search =
- DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
- else
- {
- parse_error_context (wfl, "Can't invoke super constructor "
- "on java.lang.Object");
- PATCH_METHOD_RETURN_ERROR ();
- }
- }
-
- /* Class to search is NULL if we're searching the current one */
- if (class_to_search)
- {
- class_to_search = resolve_and_layout (class_to_search,
- NULL_TREE);
- if (!class_to_search)
- {
- parse_error_context
- (wfl, "Class `%s' not found in type declaration",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- PATCH_METHOD_RETURN_ERROR ();
- }
-
- /* Can't instantiate an abstract class, but we can
- invoke it's constructor. It's use within the `new'
- context is denied here. */
- if (CLASS_ABSTRACT (class_to_search)
- && TREE_CODE (patch) == NEW_CLASS_EXPR)
- {
- parse_error_context
- (wfl, "Class `%s' is an abstract class. It can't be "
- "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- PATCH_METHOD_RETURN_ERROR ();
- }
- class_to_search = TREE_TYPE (class_to_search);
- }
- else
- class_to_search = current_class;
- lc = 1;
- }
- /* This is a regular search in the local class, unless an
- alternate class is specified. */
- else
- {
- class_to_search = (where ? where : current_class);
- lc = 0;
- }
-
- /* NAME is a simple identifier or comes from a primary. Search
- in the class whose declaration contain the method being
- invoked. */
- resolve_and_layout (class_to_search, NULL_TREE);
- list = lookup_method_invoke (lc, wfl, class_to_search, name, args);
-
- /* Don't continue if no method were found, as the next statement
- can't be executed then. */
- if (!list)
- PATCH_METHOD_RETURN_ERROR ();
-
- /* Check for static reference if non static methods */
- if (check_for_static_method_reference (wfl, patch, list,
- class_to_search, primary))
- PATCH_METHOD_RETURN_ERROR ();
-
- /* Non static methods are called with the current object extra
- argument. If patch a `new TYPE()', the argument is the value
- returned by the object allocator. If method is resolved as a
- primary, use the primary otherwise use the current THIS. */
- args = nreverse (args);
- if (TREE_CODE (patch) != NEW_CLASS_EXPR)
- this_arg = primary ? primary : current_this;
- }
-
- /* Merge point of all resolution schemes. If we have nothing, this
- is an error, already signaled */
- if (!list)
- PATCH_METHOD_RETURN_ERROR ();
-
- /* Check accessibility, position the is_static flag, build and
- return the call */
- if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0))
- {
- char *fct_name = strdup (lang_printable_name (list, 0));
- parse_error_context
- (wfl, "Can't access %s method `%s %s.%s' from `%s'",
- java_accstring_lookup (get_access_flags_from_decl (list)),
- lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))),
- fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- free (fct_name);
- PATCH_METHOD_RETURN_ERROR ();
- }
- check_deprecation (wfl, list);
-
- is_static_flag = METHOD_STATIC (list);
- if (! METHOD_STATIC (list) && this_arg != NULL_TREE)
- args = tree_cons (NULL_TREE, this_arg, args);
-
- /* In the context of an explicit constructor invocation, we can't
- invoke any method relying on `this'. Exceptions are: we're
- invoking a static function, primary exists and is not the current
- this, we're creating a new object. */
- if (ctxp->explicit_constructor_p
- && !is_static_flag
- && (!primary || primary == current_this)
- && (TREE_CODE (patch) != NEW_CLASS_EXPR))
- {
- parse_error_context
- (wfl, "Can't reference `this' before the superclass constructor has "
- "been called");
- PATCH_METHOD_RETURN_ERROR ();
- }
- java_parser_context_restore_global ();
- if (is_static)
- *is_static = is_static_flag;
- /* Sometimes, we want the decl of the selected method. Such as for
- EH checking */
- if (ret_decl)
- *ret_decl = list;
- patch = patch_invoke (patch, list, args);
- if (is_super_init && CLASS_HAS_FINIT_P (current_class))
- {
- /* Generate the code used to initialize fields declared with an
- initialization statement. For now, it returns a call the the
- artificial function $finit$, if required. */
-
- tree finit_call =
- build_method_invocation (build_expr_wfl (finit_identifier_node,
- input_filename, 0, 0),
- NULL_TREE);
- patch = build (COMPOUND_EXPR, void_type_node, patch,
- java_complete_tree (finit_call));
- CAN_COMPLETE_NORMALLY (patch) = 1;
- }
- return patch;
-}
-
-/* Check that we're not trying to do a static reference to a method in
- non static method. Return 1 if it's the case, 0 otherwise. */
-
-static int
-check_for_static_method_reference (wfl, node, method, where, primary)
- tree wfl, node, method, where, primary;
-{
- if (METHOD_STATIC (current_function_decl)
- && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
- {
- char *fct_name = strdup (lang_printable_name (method, 0));
- parse_error_context
- (wfl, "Can't make static reference to method `%s %s' in class `%s'",
- lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
- free (fct_name);
- return 1;
- }
- return 0;
-}
-
-/* Patch an invoke expression METHOD and ARGS, based on its invocation
- mode. */
-
-static tree
-patch_invoke (patch, method, args)
- tree patch, method, args;
-{
- tree dtable, func;
- tree original_call, t, ta;
-
- /* Last step for args: convert build-in types. If we're dealing with
- a new TYPE() type call, the first argument to the constructor
- isn't found in the incomming argument list, but delivered by
- `new' */
- t = TYPE_ARG_TYPES (TREE_TYPE (method));
- if (TREE_CODE (patch) == NEW_CLASS_EXPR)
- t = TREE_CHAIN (t);
- for (ta = args; t != end_params_node && ta;
- t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
- if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
- TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
- TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
-
- if (flag_emit_class_files || flag_emit_xref)
- func = method;
- else
- {
- tree signature = build_java_signature (TREE_TYPE (method));
- switch (invocation_mode (method, CALL_USING_SUPER (patch)))
- {
- case INVOKE_VIRTUAL:
- dtable = invoke_build_dtable (0, args);
- func = build_invokevirtual (dtable, method);
- break;
-
- case INVOKE_SUPER:
- case INVOKE_STATIC:
- func = build_known_method_ref (method, TREE_TYPE (method),
- DECL_CONTEXT (method),
- signature, args);
- break;
-
- case INVOKE_INTERFACE:
- dtable = invoke_build_dtable (1, args);
- func = build_invokeinterface (dtable, DECL_NAME (method), signature);
- break;
-
- default:
- fatal ("internal error - unknown invocation_mode result");
- }
-
- /* Ensure self_type is initialized, (invokestatic). FIXME */
- func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
- }
-
- TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
- TREE_OPERAND (patch, 0) = func;
- TREE_OPERAND (patch, 1) = args;
- original_call = patch;
-
- /* We're processing a `new TYPE ()' form. New is called an its
- returned value is the first argument to the constructor. We build
- a COMPOUND_EXPR and use saved expression so that the overall NEW
- expression value is a pointer to a newly created and initialized
- class. */
- if (TREE_CODE (original_call) == NEW_CLASS_EXPR)
- {
- tree class = DECL_CONTEXT (method);
- tree c1, saved_new, size, new;
- if (flag_emit_class_files || flag_emit_xref)
- {
- TREE_TYPE (patch) = build_pointer_type (class);
- return patch;
- }
- if (!TYPE_SIZE (class))
- safe_layout_class (class);
- size = size_in_bytes (class);
- new = build (CALL_EXPR, promote_type (class),
- build_address_of (alloc_object_node),
- tree_cons (NULL_TREE, build_class_ref (class),
- build_tree_list (NULL_TREE,
- size_in_bytes (class))),
- NULL_TREE);
- saved_new = save_expr (new);
- c1 = build_tree_list (NULL_TREE, saved_new);
- TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1);
- TREE_OPERAND (original_call, 1) = c1;
- TREE_SET_CODE (original_call, CALL_EXPR);
- patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
- }
- return patch;
-}
-
-static int
-invocation_mode (method, super)
- tree method;
- int super;
-{
- int access = get_access_flags_from_decl (method);
-
- if (super)
- return INVOKE_SUPER;
-
- if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE)
- return INVOKE_STATIC;
-
- if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
- return INVOKE_STATIC;
-
- if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
- return INVOKE_INTERFACE;
-
- if (DECL_CONSTRUCTOR_P (method))
- return INVOKE_STATIC;
-
- return INVOKE_VIRTUAL;
-}
-
-/* Retrieve a refined list of matching methods. It covers the step
- 15.11.2 (Compile-Time Step 2) */
-
-static tree
-lookup_method_invoke (lc, cl, class, name, arg_list)
- int lc;
- tree cl;
- tree class, name, arg_list;
-{
- tree atl = end_params_node; /* Arg Type List */
- tree method, signature, list, node;
- char *candidates; /* Used for error report */
-
- /* Fix the arguments */
- for (node = arg_list; node; node = TREE_CHAIN (node))
- {
- tree current_arg = TREE_TYPE (TREE_VALUE (node));
- /* Non primitive type may have to be resolved */
- if (!JPRIMITIVE_TYPE_P (current_arg))
- resolve_and_layout (current_arg, NULL_TREE);
- /* And promoted */
- if (TREE_CODE (current_arg) == RECORD_TYPE)
- current_arg = promote_type (current_arg);
- atl = tree_cons (NULL_TREE, current_arg, atl);
- }
-
- /* Find all candidates and then refine the list, searching for the
- most specific method. */
- list = find_applicable_accessible_methods_list (lc, class, name, atl);
- list = find_most_specific_methods_list (list);
- if (list && !TREE_CHAIN (list))
- return TREE_VALUE (list);
-
- /* Issue an error. List candidates if any. Candidates are listed
- only if accessible (non accessible methods may end-up here for
- the sake of a better error report). */
- candidates = NULL;
- if (list)
- {
- tree current;
- obstack_grow (&temporary_obstack, ". Candidates are:\n", 18);
- for (current = list; current; current = TREE_CHAIN (current))
- {
- tree cm = TREE_VALUE (current);
- char string [4096];
- if (!cm || not_accessible_p (class, cm, 0))
- continue;
- sprintf
- (string, " `%s' in `%s'%s",
- get_printable_method_name (cm),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))),
- (TREE_CHAIN (current) ? "\n" : ""));
- obstack_grow (&temporary_obstack, string, strlen (string));
- }
- obstack_1grow (&temporary_obstack, '\0');
- candidates = obstack_finish (&temporary_obstack);
- }
- /* Issue the error message */
- method = make_node (FUNCTION_TYPE);
- TYPE_ARG_TYPES (method) = atl;
- signature = build_java_argument_signature (method);
- parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s",
- (lc ? "constructor" : "method"),
- (lc ?
- IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
- IDENTIFIER_POINTER (name)),
- IDENTIFIER_POINTER (signature),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
- (candidates ? candidates : ""));
- return NULL_TREE;
-}
-
-/* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
- when we're looking for a constructor. */
-
-static tree
-find_applicable_accessible_methods_list (lc, class, name, arglist)
- int lc;
- tree class, name, arglist;
-{
- tree list = NULL_TREE, all_list = NULL_TREE;
-
- /* Search interfaces */
- if (CLASS_INTERFACE (TYPE_NAME (class)))
- {
- static tree searched_interfaces = NULL_TREE;
- static int search_not_done = 0;
- int i, n;
- tree basetype_vec = TYPE_BINFO_BASETYPES (class);
-
- /* Have we searched this interface already? */
- if (searched_interfaces)
- {
- tree current;
- for (current = searched_interfaces;
- current; current = TREE_CHAIN (current))
- if (TREE_VALUE (current) == class)
- return NULL;
- }
- searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces);
-
- search_applicable_methods_list
- (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
-
- n = TREE_VEC_LENGTH (basetype_vec);
- for (i = 0; i < n; i++)
- {
- tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
- tree rlist;
-
- /* Skip java.lang.Object (we'll search it once later.) */
- if (t == object_type_node)
- continue;
-
- search_not_done++;
- rlist = find_applicable_accessible_methods_list (lc, t, name,
- arglist);
- all_list = chainon (rlist, (list ? list : all_list));
- search_not_done--;
- }
-
- /* We're done. Reset the searched interfaces list and finally search
- java.lang.Object */
- if (!search_not_done)
- {
- searched_interfaces = NULL_TREE;
- search_applicable_methods_list (lc, TYPE_METHODS (object_type_node),
- name, arglist, &list, &all_list);
- }
- }
- /* Search classes */
- else
- while (class != NULL_TREE)
- {
- search_applicable_methods_list
- (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
- class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class));
- }
-
- /* Either return the list obtained or all selected (but
- inaccessible) methods for better error report. */
- return (!list ? all_list : list);
-}
-
-/* Effectively search for the approriate method in method */
-
-static void
-search_applicable_methods_list(lc, method, name, arglist, list, all_list)
- int lc;
- tree method, name, arglist;
- tree *list, *all_list;
-{
- for (; method; method = TREE_CHAIN (method))
- {
- /* When dealing with constructor, stop here, otherwise search
- other classes */
- if (lc && !DECL_CONSTRUCTOR_P (method))
- continue;
- else if (!lc && (DECL_CONSTRUCTOR_P (method)
- || (GET_METHOD_NAME (method) != name)))
- continue;
-
- if (argument_types_convertible (method, arglist))
- {
- /* Retain accessible methods only */
- if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
- method, 0))
- *list = tree_cons (NULL_TREE, method, *list);
- else
- /* Also retain all selected method here */
- *all_list = tree_cons (NULL_TREE, method, *list);
- }
- }
-}
-
-/* 15.11.2.2 Choose the Most Specific Method */
-
-static tree
-find_most_specific_methods_list (list)
- tree list;
-{
- int max = 0;
- tree current, new_list = NULL_TREE;
- for (current = list; current; current = TREE_CHAIN (current))
- {
- tree method;
- DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0;
-
- for (method = list; method; method = TREE_CHAIN (method))
- {
- /* Don't test a method against itself */
- if (method == current)
- continue;
-
- /* Compare arguments and location where method where declared */
- if (argument_types_convertible (TREE_VALUE (method),
- TREE_VALUE (current))
- && valid_method_invocation_conversion_p
- (DECL_CONTEXT (TREE_VALUE (method)),
- DECL_CONTEXT (TREE_VALUE (current))))
- {
- int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current));
- max = (v > max ? v : max);
- }
- }
- }
-
- /* Review the list and select the maximally specific methods */
- for (current = list; current; current = TREE_CHAIN (current))
- if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
- new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
-
- /* If we can't find one, lower expectations and try to gather multiple
- maximally specific methods */
- while (!new_list)
- {
- while (--max > 0)
- {
- if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
- new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
- }
- return new_list;
- }
-
- return new_list;
-}
-
-/* Make sure that the type of each M2_OR_ARGLIST arguments can be
- converted by method invocation conversion (5.3) to the type of the
- corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
- to change less often than M1. */
-
-static int
-argument_types_convertible (m1, m2_or_arglist)
- tree m1, m2_or_arglist;
-{
- static tree m2_arg_value = NULL_TREE;
- static tree m2_arg_cache = NULL_TREE;
-
- register tree m1_arg, m2_arg;
-
- m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1));
- if (!METHOD_STATIC (m1))
- m1_arg = TREE_CHAIN (m1_arg);
-
- if (m2_arg_value == m2_or_arglist)
- m2_arg = m2_arg_cache;
- else
- {
- /* M2_OR_ARGLIST can be a function DECL or a raw list of
- argument types */
- if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL)
- {
- m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist));
- if (!METHOD_STATIC (m2_or_arglist))
- m2_arg = TREE_CHAIN (m2_arg);
- }
- else
- m2_arg = m2_or_arglist;
-
- m2_arg_value = m2_or_arglist;
- m2_arg_cache = m2_arg;
- }
-
- while (m1_arg != end_params_node && m2_arg != end_params_node)
- {
- resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE);
- if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg),
- TREE_VALUE (m2_arg)))
- break;
- m1_arg = TREE_CHAIN (m1_arg);
- m2_arg = TREE_CHAIN (m2_arg);
- }
- return m1_arg == end_params_node && m2_arg == end_params_node;
-}
-
-/* Qualification routines */
-
-static void
-qualify_ambiguous_name (id)
- tree id;
-{
- tree qual, qual_wfl, name, decl, ptr_type, saved_current_class;
- int again, super_found = 0, this_found = 0, new_array_found = 0;
- int code;
-
- /* We first qualify the first element, then derive qualification of
- others based on the first one. If the first element is qualified
- by a resolution (field or type), this resolution is stored in the
- QUAL_RESOLUTION of the qual element being examined. We need to
- save the current_class since the use of SUPER might change the
- its value. */
- saved_current_class = current_class;
- qual = EXPR_WFL_QUALIFICATION (id);
- do {
-
- /* Simple qualified expression feature a qual_wfl that is a
- WFL. Expression derived from a primary feature more complicated
- things like a CALL_EXPR. Expression from primary need to be
- worked out to extract the part on which the qualification will
- take place. */
- qual_wfl = QUAL_WFL (qual);
- switch (TREE_CODE (qual_wfl))
- {
- case CALL_EXPR:
- qual_wfl = TREE_OPERAND (qual_wfl, 0);
- if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
- {
- qual = EXPR_WFL_QUALIFICATION (qual_wfl);
- qual_wfl = QUAL_WFL (qual);
- }
- break;
- case NEW_ARRAY_EXPR:
- qual = TREE_CHAIN (qual);
- new_array_found = 1;
- continue;
- case NEW_CLASS_EXPR:
- case CONVERT_EXPR:
- qual_wfl = TREE_OPERAND (qual_wfl, 0);
- break;
- case ARRAY_REF:
- while (TREE_CODE (qual_wfl) == ARRAY_REF)
- qual_wfl = TREE_OPERAND (qual_wfl, 0);
- break;
- case STRING_CST:
- qual = TREE_CHAIN (qual);
- qual_wfl = QUAL_WFL (qual);
- break;
- default:
- /* Fix for -Wall. Just break doing nothing */
- break;
- }
-
- ptr_type = current_class;
- again = 0;
- code = TREE_CODE (qual_wfl);
-
- /* Pos evaluation: non WFL leading expression nodes */
- if (code == CONVERT_EXPR
- && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
-
- else if (code == ARRAY_REF &&
- TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
-
- else if (code == CALL_EXPR &&
- TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
-
- else if (code == STRING_CST || code == CONDITIONAL_EXPR)
- {
- qual = TREE_CHAIN (qual);
- qual_wfl = QUAL_WFL (qual);
- again = 1;
- }
- else
- name = EXPR_WFL_NODE (qual_wfl);
-
- /* If we have a THIS (from a primary), we set the context accordingly */
- if (name == this_identifier_node)
- {
- qual = TREE_CHAIN (qual);
- qual_wfl = QUAL_WFL (qual);
- if (TREE_CODE (qual_wfl) == CALL_EXPR)
- again = 1;
- else
- name = EXPR_WFL_NODE (qual_wfl);
- this_found = 1;
- }
- /* If we have a SUPER, we set the context accordingly */
- if (name == super_identifier_node)
- {
- current_class = CLASSTYPE_SUPER (ptr_type);
- /* Check that there is such a thing as a super class. If not,
- return. The error will be caught later on, during the
- resolution */
- if (!current_class)
- {
- current_class = saved_current_class;
- return;
- }
- qual = TREE_CHAIN (qual);
- /* Do one more interation to set things up */
- super_found = again = 1;
- }
- } while (again);
-
- /* If name appears within the scope of a location variable
- declaration or parameter declaration, then it is an expression
- name. We don't carry this test out if we're in the context of the
- use of SUPER or THIS */
- if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
- {
- RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
- QUAL_RESOLUTION (qual) = decl;
- }
-
- /* If within the class/interface NAME was found to be used there
- exists a (possibly inherited) field named NAME, then this is an
- expression name. If we saw a NEW_ARRAY_EXPR before and want to
- address length, it is OK. */
- else if ((decl = lookup_field_wrapper (ptr_type, name))
- || (new_array_found && name == length_identifier_node))
- {
- RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
- QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
- }
-
- /* We reclassify NAME as a type name if:
- - NAME is a class/interface declared within the compilation
- unit containing NAME,
- - NAME is imported via a single-type-import declaration,
- - NAME is declared in an another compilation unit of the package
- of the compilation unit containing NAME,
- - NAME is declared by exactly on type-import-on-demand declaration
- of the compilation unit containing NAME. */
- else if ((decl = resolve_and_layout (name, NULL_TREE)))
- {
- RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
- QUAL_RESOLUTION (qual) = decl;
- }
-
- /* Method call are expression name */
- else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
- || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF
- || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR)
- RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
-
- /* Check here that NAME isn't declared by more than one
- type-import-on-demand declaration of the compilation unit
- containing NAME. FIXME */
-
- /* Otherwise, NAME is reclassified as a package name */
- else
- RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
-
- /* Propagate the qualification accross other components of the
- qualified name */
- for (qual = TREE_CHAIN (qual); qual;
- qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual))
- {
- if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
- RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
- else
- RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
- }
-
- /* Store the global qualification for the ambiguous part of ID back
- into ID fields */
- if (RESOLVE_EXPRESSION_NAME_P (qual_wfl))
- RESOLVE_EXPRESSION_NAME_P (id) = 1;
- else if (RESOLVE_TYPE_NAME_P (qual_wfl))
- RESOLVE_TYPE_NAME_P (id) = 1;
- else if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
- RESOLVE_PACKAGE_NAME_P (id) = 1;
-
- /* Restore the current class */
- current_class = saved_current_class;
-}
-
-static int
-breakdown_qualified (left, right, source)
- tree *left, *right, source;
-{
- char *p = IDENTIFIER_POINTER (source), *base;
- int l = IDENTIFIER_LENGTH (source);
-
- /* Breakdown NAME into REMAINDER . IDENTIFIER */
- base = p;
- p += (l-1);
- while (*p != '.' && p != base)
- p--;
-
- /* We didn't find a '.'. Return an error */
- if (p == base)
- return 1;
-
- *p = '\0';
- if (right)
- *right = get_identifier (p+1);
- *left = get_identifier (IDENTIFIER_POINTER (source));
- *p = '.';
-
- return 0;
-}
-
-/* Patch tree nodes in a function body. When a BLOCK is found, push
- local variable decls if present.
- Same as java_complete_lhs, but does resolve static finals to values. */
-
-static tree
-java_complete_tree (node)
- tree node;
-{
- node = java_complete_lhs (node);
- if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node)
- && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE
- && !flag_emit_xref)
- {
- tree value = DECL_INITIAL (node);
- DECL_INITIAL (node) = NULL_TREE;
- value = fold_constant_for_init (value, node);
- DECL_INITIAL (node) = value;
- if (value != NULL_TREE)
- return value;
- }
- return node;
-}
-
-static tree
-java_stabilize_reference (node)
- tree node;
-{
- if (TREE_CODE (node) == COMPOUND_EXPR)
- {
- tree op0 = TREE_OPERAND (node, 0);
- tree op1 = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 0) = save_expr (op0);
- TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
- return node;
- }
- else
- return stabilize_reference (node);
-}
-
-/* Patch tree nodes in a function body. When a BLOCK is found, push
- local variable decls if present.
- Same as java_complete_tree, but does not resolve static finals to values. */
-
-static tree
-java_complete_lhs (node)
- tree node;
-{
- tree nn, cn, wfl_op1, wfl_op2, wfl_op3;
- int flag;
-
- /* CONVERT_EXPR always has its type set, even though it needs to be
- worked out. */
- if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR)
- return node;
-
- /* The switch block implements cases processing container nodes
- first. Contained nodes are always written back. Leaves come
- next and return a value. */
- switch (TREE_CODE (node))
- {
- case BLOCK:
-
- /* 1- Block section.
- Set the local values on decl names so we can identify them
- faster when they're referenced. At that stage, identifiers
- are legal so we don't check for declaration errors. */
- for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
- {
- DECL_CONTEXT (cn) = current_function_decl;
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn;
- }
- if (BLOCK_EXPR_BODY (node) == NULL_TREE)
- CAN_COMPLETE_NORMALLY (node) = 1;
- else
- {
- tree stmt = BLOCK_EXPR_BODY (node);
- tree *ptr;
- int error_seen = 0;
- if (TREE_CODE (stmt) == COMPOUND_EXPR)
- {
- /* Re-order from (((A; B); C); ...; Z) to
- (A; (B; (C ; (...; Z)))).
- This makes it easier to scan the statements left-to-right
- without using recursion (which might overflow the stack
- if the block has many statements. */
- for (;;)
- {
- tree left = TREE_OPERAND (stmt, 0);
- if (TREE_CODE (left) != COMPOUND_EXPR)
- break;
- TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1);
- TREE_OPERAND (left, 1) = stmt;
- stmt = left;
- }
- BLOCK_EXPR_BODY (node) = stmt;
- }
-
- /* Now do the actual complete, without deep recursion for
- long blocks. */
- ptr = &BLOCK_EXPR_BODY (node);
- while (TREE_CODE (*ptr) == COMPOUND_EXPR
- && TREE_OPERAND (*ptr, 1) != empty_stmt_node)
- {
- tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
- tree *next = &TREE_OPERAND (*ptr, 1);
- TREE_OPERAND (*ptr, 0) = cur;
- if (cur == empty_stmt_node)
- {
- /* Optimization; makes it easier to detect empty bodies.
- Most useful for <clinit> with all-constant initializer. */
- *ptr = *next;
- continue;
- }
- if (TREE_CODE (cur) == ERROR_MARK)
- error_seen++;
- else if (! CAN_COMPLETE_NORMALLY (cur))
- {
- wfl_op2 = *next;
- for (;;)
- {
- if (TREE_CODE (wfl_op2) == BLOCK)
- wfl_op2 = BLOCK_EXPR_BODY (wfl_op2);
- else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR)
- wfl_op2 = TREE_OPERAND (wfl_op2, 0);
- else
- break;
- }
- if (TREE_CODE (wfl_op2) != CASE_EXPR
- && TREE_CODE (wfl_op2) != DEFAULT_EXPR)
- unreachable_stmt_error (*ptr);
- }
- ptr = next;
- }
- *ptr = java_complete_tree (*ptr);
-
- if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0)
- return error_mark_node;
- CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr);
- }
- /* Turn local bindings to null */
- for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE;
-
- TREE_TYPE (node) = void_type_node;
- break;
-
- /* 2- They are expressions but ultimately deal with statements */
-
- case THROW_EXPR:
- wfl_op1 = TREE_OPERAND (node, 0);
- COMPLETE_CHECK_OP_0 (node);
- /* CAN_COMPLETE_NORMALLY (node) = 0; */
- return patch_throw_statement (node, wfl_op1);
-
- case SYNCHRONIZED_EXPR:
- wfl_op1 = TREE_OPERAND (node, 0);
- return patch_synchronized_statement (node, wfl_op1);
-
- case TRY_EXPR:
- return patch_try_statement (node);
-
- case TRY_FINALLY_EXPR:
- COMPLETE_CHECK_OP_0 (node);
- COMPLETE_CHECK_OP_1 (node);
- CAN_COMPLETE_NORMALLY (node)
- = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))
- && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)));
- TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0));
- return node;
-
- case CLEANUP_POINT_EXPR:
- COMPLETE_CHECK_OP_0 (node);
- TREE_TYPE (node) = void_type_node;
- CAN_COMPLETE_NORMALLY (node) =
- CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
- return node;
-
- case WITH_CLEANUP_EXPR:
- COMPLETE_CHECK_OP_0 (node);
- COMPLETE_CHECK_OP_2 (node);
- CAN_COMPLETE_NORMALLY (node) =
- CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
- TREE_TYPE (node) = void_type_node;
- return node;
-
- case LABELED_BLOCK_EXPR:
- PUSH_LABELED_BLOCK (node);
- if (LABELED_BLOCK_BODY (node))
- COMPLETE_CHECK_OP_1 (node);
- TREE_TYPE (node) = void_type_node;
- POP_LABELED_BLOCK ();
-
- if (LABELED_BLOCK_BODY (node) == empty_stmt_node)
- {
- LABELED_BLOCK_BODY (node) = NULL_TREE;
- CAN_COMPLETE_NORMALLY (node) = 1;
- }
- else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node)))
- CAN_COMPLETE_NORMALLY (node) = 1;
- return node;
-
- case EXIT_BLOCK_EXPR:
- /* We don't complete operand 1, because it's the return value of
- the EXIT_BLOCK_EXPR which doesn't exist it Java */
- return patch_bc_statement (node);
-
- case CASE_EXPR:
- cn = java_complete_tree (TREE_OPERAND (node, 0));
- if (cn == error_mark_node)
- return cn;
-
- /* First, the case expression must be constant. Values of final
- fields are accepted. */
- cn = fold (cn);
- if ((TREE_CODE (cn) == COMPOUND_EXPR || TREE_CODE (cn) == COMPONENT_REF)
- && JDECL_P (TREE_OPERAND (cn, 1))
- && FIELD_FINAL (TREE_OPERAND (cn, 1))
- && DECL_INITIAL (TREE_OPERAND (cn, 1)))
- cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
- TREE_OPERAND (cn, 1));
-
- if (!TREE_CONSTANT (cn) && !flag_emit_xref)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (node, "Constant expression required");
- return error_mark_node;
- }
-
- nn = ctxp->current_loop;
-
- /* It must be assignable to the type of the switch expression. */
- if (!try_builtin_assignconv (NULL_TREE,
- TREE_TYPE (TREE_OPERAND (nn, 0)), cn))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context
- (wfl_operator,
- "Incompatible type for case. Can't convert `%s' to `int'",
- lang_printable_name (TREE_TYPE (cn), 0));
- return error_mark_node;
- }
-
- cn = fold (convert (int_type_node, cn));
-
- /* Multiple instance of a case label bearing the same
- value is checked during code generation. The case
- expression is allright so far. */
- TREE_OPERAND (node, 0) = cn;
- TREE_TYPE (node) = void_type_node;
- CAN_COMPLETE_NORMALLY (node) = 1;
- TREE_SIDE_EFFECTS (node) = 1;
- break;
-
- case DEFAULT_EXPR:
- nn = ctxp->current_loop;
- /* Only one default label is allowed per switch statement */
- if (SWITCH_HAS_DEFAULT (nn))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator,
- "Duplicate case label: `default'");
- return error_mark_node;
- }
- else
- SWITCH_HAS_DEFAULT (nn) = 1;
- TREE_TYPE (node) = void_type_node;
- TREE_SIDE_EFFECTS (node) = 1;
- CAN_COMPLETE_NORMALLY (node) = 1;
- break;
-
- case SWITCH_EXPR:
- case LOOP_EXPR:
- PUSH_LOOP (node);
- /* Check whether the loop was enclosed in a labeled
- statement. If not, create one, insert the loop in it and
- return the node */
- nn = patch_loop_statement (node);
-
- /* Anyways, walk the body of the loop */
- if (TREE_CODE (node) == LOOP_EXPR)
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- /* Switch statement: walk the switch expression and the cases */
- else
- node = patch_switch_statement (node);
-
- if (TREE_OPERAND (node, 0) == error_mark_node)
- nn = error_mark_node;
- else
- {
- TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node;
- /* If we returned something different, that's because we
- inserted a label. Pop the label too. */
- if (nn != node)
- {
- if (CAN_COMPLETE_NORMALLY (node))
- CAN_COMPLETE_NORMALLY (nn) = 1;
- POP_LABELED_BLOCK ();
- }
- }
- POP_LOOP ();
- return nn;
-
- case EXIT_EXPR:
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- return patch_exit_expr (node);
-
- case COND_EXPR:
- /* Condition */
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
- /* then-else branches */
- TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
- if (TREE_OPERAND (node, 1) == error_mark_node)
- return error_mark_node;
- TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2));
- if (TREE_OPERAND (node, 2) == error_mark_node)
- return error_mark_node;
- return patch_if_else_statement (node);
- break;
-
- case CONDITIONAL_EXPR:
- /* Condition */
- wfl_op1 = TREE_OPERAND (node, 0);
- COMPLETE_CHECK_OP_0 (node);
- wfl_op2 = TREE_OPERAND (node, 1);
- COMPLETE_CHECK_OP_1 (node);
- wfl_op3 = TREE_OPERAND (node, 2);
- COMPLETE_CHECK_OP_2 (node);
- return patch_conditional_expr (node, wfl_op1, wfl_op2);
-
- /* 3- Expression section */
- case COMPOUND_EXPR:
- wfl_op2 = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 0) = nn =
- java_complete_tree (TREE_OPERAND (node, 0));
- if (wfl_op2 == empty_stmt_node)
- CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn);
- else
- {
- if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK)
- {
- /* An unreachable condition in a do-while statement
- is *not* (technically) an unreachable statement. */
- nn = wfl_op2;
- if (TREE_CODE (nn) == EXPR_WITH_FILE_LOCATION)
- nn = EXPR_WFL_NODE (nn);
- if (TREE_CODE (nn) != EXIT_EXPR)
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
- parse_error_context (wfl_operator, "Unreachable statement");
- }
- }
- TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
- if (TREE_OPERAND (node, 1) == error_mark_node)
- return error_mark_node;
- CAN_COMPLETE_NORMALLY (node)
- = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1));
- }
- TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1));
- break;
-
- case RETURN_EXPR:
- /* CAN_COMPLETE_NORMALLY (node) = 0; */
- return patch_return (node);
-
- case EXPR_WITH_FILE_LOCATION:
- if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
- || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
- {
- tree wfl = node;
- node = resolve_expression_name (node, NULL);
- if (node == error_mark_node)
- return node;
- /* Keep line number information somewhere were it doesn't
- disrupt the completion process. */
- if (flag_emit_xref && TREE_CODE (node) != CALL_EXPR)
- {
- EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 1) = wfl;
- }
- CAN_COMPLETE_NORMALLY (node) = 1;
- }
- else
- {
- tree body;
- int save_lineno = lineno;
- lineno = EXPR_WFL_LINENO (node);
- body = java_complete_tree (EXPR_WFL_NODE (node));
- lineno = save_lineno;
- EXPR_WFL_NODE (node) = body;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
- CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
- if (body == empty_stmt_node)
- {
- /* Optimization; makes it easier to detect empty bodies. */
- return body;
- }
- if (body == error_mark_node)
- {
- /* Its important for the evaluation of assignment that
- this mark on the TREE_TYPE is propagated. */
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
- else
- TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
-
- }
- break;
-
- case NEW_ARRAY_EXPR:
- /* Patch all the dimensions */
- flag = 0;
- for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
- {
- int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
- tree dim = java_complete_tree (TREE_VALUE (cn));
- if (dim == error_mark_node)
- {
- flag = 1;
- continue;
- }
- else
- {
- TREE_VALUE (cn) = dim;
- /* Setup the location of the current dimension, for
- later error report. */
- TREE_PURPOSE (cn) =
- build_expr_wfl (NULL_TREE, input_filename, 0, 0);
- EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
- }
- }
- /* They complete the array creation expression, if no errors
- were found. */
- CAN_COMPLETE_NORMALLY (node) = 1;
- return (flag ? error_mark_node
- : force_evaluation_order (patch_newarray (node)));
-
- case NEW_CLASS_EXPR:
- case CALL_EXPR:
- /* Complete function's argument(s) first */
- if (complete_function_arguments (node))
- return error_mark_node;
- else
- {
- tree decl, wfl = TREE_OPERAND (node, 0);
- int in_this = CALL_THIS_CONSTRUCTOR_P (node);
-
- node = patch_method_invocation (node, NULL_TREE,
- NULL_TREE, 0, &decl);
- if (node == error_mark_node)
- return error_mark_node;
-
- check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl);
- /* If we call this(...), register signature and positions */
- if (in_this)
- DECL_CONSTRUCTOR_CALLS (current_function_decl) =
- tree_cons (wfl, decl,
- DECL_CONSTRUCTOR_CALLS (current_function_decl));
- CAN_COMPLETE_NORMALLY (node) = 1;
- return force_evaluation_order (node);
- }
-
- case MODIFY_EXPR:
- /* Save potential wfls */
- wfl_op1 = TREE_OPERAND (node, 0);
- TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1);
- if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)
- && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
- && DECL_INITIAL (nn) != NULL_TREE)
- {
- tree value = fold_constant_for_init (nn, nn);
- if (value != NULL_TREE)
- {
- tree type = TREE_TYPE (value);
- if (JPRIMITIVE_TYPE_P (type) || type == string_ptr_type_node)
- return empty_stmt_node;
- }
- DECL_INITIAL (nn) = NULL_TREE;
- }
- wfl_op2 = TREE_OPERAND (node, 1);
-
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
-
- if (COMPOUND_ASSIGN_P (wfl_op2))
- {
- tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
-
- /* Hand stablize the lhs on both places */
- TREE_OPERAND (node, 0) = lvalue;
- TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
-
- /* Now complete the RHS. We write it back later on. */
- nn = java_complete_tree (TREE_OPERAND (node, 1));
-
- if ((cn = patch_string (nn)))
- nn = cn;
-
- /* The last part of the rewrite for E1 op= E2 is to have
- E1 = (T)(E1 op E2), with T being the type of E1. */
- nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
- TREE_TYPE (lvalue), nn));
- }
-
- /* If we're about to patch a NEW_ARRAY_INIT, we call a special
- function to complete this RHS */
- else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT)
- nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)),
- TREE_OPERAND (node, 1));
- /* Otherwise we simply complete the RHS */
- else
- nn = java_complete_tree (TREE_OPERAND (node, 1));
-
- if (nn == error_mark_node)
- return error_mark_node;
-
- /* Write back the RHS as we evaluated it. */
- TREE_OPERAND (node, 1) = nn;
-
- /* In case we're handling = with a String as a RHS, we need to
- produce a String out of the RHS (it might still be a
- STRING_CST or a StringBuffer at this stage */
- if ((nn = patch_string (TREE_OPERAND (node, 1))))
- TREE_OPERAND (node, 1) = nn;
- node = patch_assignment (node, wfl_op1, wfl_op2);
- CAN_COMPLETE_NORMALLY (node) = 1;
- return node;
-
- case MULT_EXPR:
- case PLUS_EXPR:
- case MINUS_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case URSHIFT_EXPR:
- case BIT_AND_EXPR:
- case BIT_XOR_EXPR:
- case BIT_IOR_EXPR:
- case TRUNC_MOD_EXPR:
- case RDIV_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- /* Operands 0 and 1 are WFL in certain cases only. patch_binop
- knows how to handle those cases. */
- wfl_op1 = TREE_OPERAND (node, 0);
- wfl_op2 = TREE_OPERAND (node, 1);
-
- CAN_COMPLETE_NORMALLY (node) = 1;
- /* Don't complete string nodes if dealing with the PLUS operand. */
- if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1))
- {
- nn = java_complete_tree (wfl_op1);
- if (nn == error_mark_node)
- return error_mark_node;
- if ((cn = patch_string (nn)))
- nn = cn;
- TREE_OPERAND (node, 0) = nn;
- }
- if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
- {
- nn = java_complete_tree (wfl_op2);
- if (nn == error_mark_node)
- return error_mark_node;
- if ((cn = patch_string (nn)))
- nn = cn;
- TREE_OPERAND (node, 1) = nn;
- }
- return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2));
-
- case INSTANCEOF_EXPR:
- wfl_op1 = TREE_OPERAND (node, 0);
- COMPLETE_CHECK_OP_0 (node);
- if (flag_emit_xref)
- {
- TREE_TYPE (node) = boolean_type_node;
- return node;
- }
- return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1));
-
- case UNARY_PLUS_EXPR:
- case NEGATE_EXPR:
- case TRUTH_NOT_EXPR:
- case BIT_NOT_EXPR:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case CONVERT_EXPR:
- /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
- how to handle those cases. */
- wfl_op1 = TREE_OPERAND (node, 0);
- CAN_COMPLETE_NORMALLY (node) = 1;
- TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
- node = patch_unaryop (node, wfl_op1);
- CAN_COMPLETE_NORMALLY (node) = 1;
- break;
-
- case ARRAY_REF:
- /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
- how to handle those cases. */
- wfl_op1 = TREE_OPERAND (node, 0);
- TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
- if (!flag_emit_class_files && !flag_emit_xref)
- TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0));
- /* The same applies to wfl_op2 */
- wfl_op2 = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
- if (TREE_OPERAND (node, 1) == error_mark_node)
- return error_mark_node;
- if (!flag_emit_class_files && !flag_emit_xref)
- TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
- return patch_array_ref (node);
-
- case RECORD_TYPE:
- return node;;
-
- case COMPONENT_REF:
- /* The first step in the re-write of qualified name handling. FIXME.
- So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
- {
- tree name = TREE_OPERAND (node, 1);
- tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
- if (field == NULL_TREE)
- {
- error ("missing static field `%s'", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- if (! FIELD_STATIC (field))
- {
- error ("not a static field `%s'", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- return field;
- }
- else
- fatal ("unimplemented java_complete_tree for COMPONENT_REF");
- break;
-
- case THIS_EXPR:
- /* Can't use THIS in a static environment */
- if (!current_this)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator, "Keyword `this' used outside "
- "allowed context");
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
- if (ctxp->explicit_constructor_p)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context
- (wfl_operator, "Can't reference `this' or `super' before the "
- "superclass constructor has been called");
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
- return current_this;
-
- default:
- CAN_COMPLETE_NORMALLY (node) = 1;
- /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
- and it's time to turn it into the appropriate String object
- */
- if ((node = patch_string (node)))
- return node;
- fatal ("No case for tree code `%s' - java_complete_tree\n",
- tree_code_name [TREE_CODE (node)]);
- }
- return node;
-}
-
-/* Complete function call's argument. Return a non zero value is an
- error was found. */
-
-static int
-complete_function_arguments (node)
- tree node;
-{
- int flag = 0;
- tree cn;
-
- ctxp->explicit_constructor_p += (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
- for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
- {
- tree wfl = TREE_VALUE (cn), parm, temp;
- parm = java_complete_tree (wfl);
- if (parm == error_mark_node)
- {
- flag = 1;
- continue;
- }
- /* If have a string literal that we haven't transformed yet or a
- crafted string buffer, as a result of use of the the String
- `+' operator. Build `parm.toString()' and expand it. */
- if ((temp = patch_string (parm)))
- parm = temp;
- /* Inline PRIMTYPE.TYPE read access */
- parm = maybe_build_primttype_type_ref (parm, wfl);
-
- TREE_VALUE (cn) = parm;
- }
- ctxp->explicit_constructor_p -= (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
- return flag;
-}
-
-/* Sometimes (for loops and variable initialized during their
- declaration), we want to wrap a statement around a WFL and turn it
- debugable. */
-
-static tree
-build_debugable_stmt (location, stmt)
- int location;
- tree stmt;
-{
- if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
- {
- stmt = build_expr_wfl (stmt, input_filename, 0, 0);
- EXPR_WFL_LINECOL (stmt) = location;
- }
- JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
- return stmt;
-}
-
-static tree
-build_expr_block (body, decls)
- tree body, decls;
-{
- tree node = make_node (BLOCK);
- BLOCK_EXPR_DECLS (node) = decls;
- BLOCK_EXPR_BODY (node) = body;
- if (body)
- TREE_TYPE (node) = TREE_TYPE (body);
- TREE_SIDE_EFFECTS (node) = 1;
- return node;
-}
-
-/* Create a new function block and link it approriately to current
- function block chain */
-
-static tree
-enter_block ()
-{
- return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE)));
-}
-
-/* Link block B supercontext to the previous block. The current
- function DECL is used as supercontext when enter_a_block is called
- for the first time for a given function. The current function body
- (DECL_FUNCTION_BODY) is set to be block B. */
-
-static tree
-enter_a_block (b)
- tree b;
-{
- tree fndecl = current_function_decl;
-
- if (!fndecl) {
- BLOCK_SUPERCONTEXT (b) = current_static_block;
- current_static_block = b;
- }
-
- else if (!DECL_FUNCTION_BODY (fndecl))
- {
- BLOCK_SUPERCONTEXT (b) = fndecl;
- DECL_FUNCTION_BODY (fndecl) = b;
- }
- else
- {
- BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl);
- DECL_FUNCTION_BODY (fndecl) = b;
- }
- return b;
-}
-
-/* Exit a block by changing the current function body
- (DECL_FUNCTION_BODY) to the current block super context, only if
- the block being exited isn't the method's top level one. */
-
-static tree
-exit_block ()
-{
- tree b;
- if (current_function_decl)
- {
- b = DECL_FUNCTION_BODY (current_function_decl);
- if (BLOCK_SUPERCONTEXT (b) != current_function_decl)
- DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b);
- }
- else
- {
- b = current_static_block;
-
- if (BLOCK_SUPERCONTEXT (b))
- current_static_block = BLOCK_SUPERCONTEXT (b);
- }
- return b;
-}
-
-/* Lookup for NAME in the nested function's blocks, all the way up to
- the current toplevel one. It complies with Java's local variable
- scoping rules. */
-
-static tree
-lookup_name_in_blocks (name)
- tree name;
-{
- tree b = GET_CURRENT_BLOCK (current_function_decl);
-
- while (b != current_function_decl)
- {
- tree current;
-
- /* Paranoid sanity check. To be removed */
- if (TREE_CODE (b) != BLOCK)
- fatal ("non block expr function body - lookup_name_in_blocks");
-
- for (current = BLOCK_EXPR_DECLS (b); current;
- current = TREE_CHAIN (current))
- if (DECL_NAME (current) == name)
- return current;
- b = BLOCK_SUPERCONTEXT (b);
- }
- return NULL_TREE;
-}
-
-static void
-maybe_absorb_scoping_blocks ()
-{
- while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl)))
- {
- tree b = exit_block ();
- java_method_add_stmt (current_function_decl, b);
- SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno));
- }
-}
-
-
-/* This section of the source is reserved to build_* functions that
- are building incomplete tree nodes and the patch_* functions that
- are completing them. */
-
-/* Build a super() constructor invocation. Returns empty_stmt_node if
- we're currently dealing with the class java.lang.Object. */
-
-static tree
-build_super_invocation ()
-{
- if (current_class == object_type_node)
- return empty_stmt_node;
- else
- {
- tree super_wfl = build_wfl_node (super_identifier_node);
- return build_method_invocation (super_wfl, NULL_TREE);
- }
-}
-
-/* Build a SUPER/THIS qualified method invocation. */
-
-static tree
-build_this_super_qualified_invocation (use_this, name, args, lloc, rloc)
- int use_this;
- tree name, args;
- int lloc, rloc;
-
-{
- tree invok;
- tree wfl =
- build_wfl_node (use_this ? this_identifier_node : super_identifier_node);
- EXPR_WFL_LINECOL (wfl) = lloc;
- invok = build_method_invocation (name, args);
- return make_qualified_primary (wfl, invok, rloc);
-}
-
-/* Build an incomplete CALL_EXPR node. */
-
-static tree
-build_method_invocation (name, args)
- tree name;
- tree args;
-{
- tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
- return call;
-}
-
-/* Build an incomplete new xxx(...) node. */
-
-static tree
-build_new_invocation (name, args)
- tree name, args;
-{
- tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
- return call;
-}
-
-/* Build an incomplete assignment expression. */
-
-static tree
-build_assignment (op, op_location, lhs, rhs)
- int op, op_location;
- tree lhs, rhs;
-{
- tree assignment;
- /* Build the corresponding binop if we deal with a Compound
- Assignment operator. Mark the binop sub-tree as part of a
- Compound Assignment expression */
- if (op != ASSIGN_TK)
- {
- rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs);
- COMPOUND_ASSIGN_P (rhs) = 1;
- }
- assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs);
- TREE_SIDE_EFFECTS (assignment) = 1;
- EXPR_WFL_LINECOL (assignment) = op_location;
- return assignment;
-}
-
-/* Print an INTEGER_CST node in a static buffer, and return the buffer. */
-
-char *
-print_int_node (node)
- tree node;
-{
- static char buffer [80];
- if (TREE_CONSTANT_OVERFLOW (node))
- sprintf (buffer, "<overflow>");
-
- if (TREE_INT_CST_HIGH (node) == 0)
- sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
- TREE_INT_CST_LOW (node));
- else if (TREE_INT_CST_HIGH (node) == -1
- && TREE_INT_CST_LOW (node) != 0)
- {
- buffer [0] = '-';
- sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED,
- -TREE_INT_CST_LOW (node));
- }
- else
- sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
- TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
-
- return buffer;
-}
-
-/* Return 1 if an assignment to a FINAL is attempted in a non suitable
- context. */
-
-static int
-check_final_assignment (lvalue, wfl)
- tree lvalue, wfl;
-{
- if (JDECL_P (lvalue)
- && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl))
- {
- parse_error_context
- (wfl, "Can't assign a value to the final variable `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- return 1;
- }
- return 0;
-}
-
-/* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
- read. This is needed to avoid circularities in the implementation
- of these fields in libjava. */
-
-static tree
-maybe_build_primttype_type_ref (rhs, wfl)
- tree rhs, wfl;
-{
- tree to_return = NULL_TREE;
- tree rhs_type = TREE_TYPE (rhs);
- if (TREE_CODE (rhs) == COMPOUND_EXPR)
- {
- tree n = TREE_OPERAND (rhs, 1);
- if (TREE_CODE (n) == VAR_DECL
- && DECL_NAME (n) == TYPE_identifier_node
- && rhs_type == class_ptr_type)
- {
- char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
- if (!strncmp (self_name, "java.lang.", 10))
- to_return = build_primtype_type_ref (self_name);
- }
- }
- return (to_return ? to_return : rhs );
-}
-
-/* 15.25 Assignment operators. */
-
-static tree
-patch_assignment (node, wfl_op1, wfl_op2)
- tree node;
- tree wfl_op1;
- tree wfl_op2;
-{
- tree rhs = TREE_OPERAND (node, 1);
- tree lvalue = TREE_OPERAND (node, 0), llvalue;
- tree lhs_type, rhs_type, new_rhs = NULL_TREE;
- int error_found = 0;
- int lvalue_from_array = 0;
-
- /* Can't assign to a final. */
- if (check_final_assignment (lvalue, wfl_op1))
- error_found = 1;
-
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* Lhs can be a named variable */
- if (JDECL_P (lvalue))
- {
- lhs_type = TREE_TYPE (lvalue);
- }
- /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
- comment on reason why */
- else if (TREE_CODE (wfl_op1) == ARRAY_REF)
- {
- lhs_type = TREE_TYPE (lvalue);
- lvalue_from_array = 1;
- }
- /* Or a field access */
- else if (TREE_CODE (lvalue) == COMPONENT_REF)
- lhs_type = TREE_TYPE (lvalue);
- /* Or a function return slot */
- else if (TREE_CODE (lvalue) == RESULT_DECL)
- lhs_type = TREE_TYPE (lvalue);
- /* Otherwise, we might want to try to write into an optimized static
- final, this is an of a different nature, reported further on. */
- else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
- && resolve_expression_name (wfl_op1, &llvalue))
- {
- if (check_final_assignment (llvalue, wfl_op1))
- {
- /* What we should do instead is resetting the all the flags
- previously set, exchange lvalue for llvalue and continue. */
- error_found = 1;
- return error_mark_node;
- }
- else
- lhs_type = TREE_TYPE (lvalue);
- }
- else
- {
- parse_error_context (wfl_op1, "Invalid left hand side of assignment");
- error_found = 1;
- }
-
- rhs_type = TREE_TYPE (rhs);
- /* 5.1 Try the assignment conversion for builtin type. */
- new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs);
-
- /* 5.2 If it failed, try a reference conversion */
- if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs)))
- lhs_type = promote_type (rhs_type);
-
- /* 15.25.2 If we have a compound assignment, convert RHS into the
- type of the LHS */
- else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
- new_rhs = convert (lhs_type, rhs);
-
- /* Explicit cast required. This is an error */
- if (!new_rhs)
- {
- char *t1 = strdup (lang_printable_name (TREE_TYPE (rhs), 0));
- char *t2 = strdup (lang_printable_name (lhs_type, 0));
- tree wfl;
- char operation [32]; /* Max size known */
-
- /* If the assignment is part of a declaration, we use the WFL of
- the declared variable to point out the error and call it a
- declaration problem. If the assignment is a genuine =
- operator, we call is a operator `=' problem, otherwise we
- call it an assignment problem. In both of these last cases,
- we use the WFL of the operator to indicate the error. */
-
- if (MODIFY_EXPR_FROM_INITIALIZATION_P (node))
- {
- wfl = wfl_op1;
- strcpy (operation, "declaration");
- }
- else
- {
- wfl = wfl_operator;
- if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
- strcpy (operation, "assignment");
- else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL)
- strcpy (operation, "`return'");
- else
- strcpy (operation, "`='");
- }
-
- parse_error_context
- (wfl, (!valid_cast_to_p (rhs_type, lhs_type) ?
- "Incompatible type for %s. Can't convert `%s' to `%s'" :
- "Incompatible type for %s. Explicit cast "
- "needed to convert `%s' to `%s'"), operation, t1, t2);
- free (t1); free (t2);
- error_found = 1;
- }
-
- /* Inline read access to java.lang.PRIMTYPE.TYPE */
- if (new_rhs)
- new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2);
-
- if (error_found)
- return error_mark_node;
-
- /* 10.10: Array Store Exception runtime check */
- if (!flag_emit_class_files
- && !flag_emit_xref
- && lvalue_from_array
- && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type))
- && !CLASS_FINAL (TYPE_NAME (GET_SKIP_TYPE (rhs_type))))
- {
- tree check;
- tree base = lvalue;
-
- /* We need to retrieve the right argument for _Jv_CheckArrayStore */
- if (TREE_CODE (lvalue) == COMPOUND_EXPR)
- base = TREE_OPERAND (lvalue, 0);
- else
- {
- if (flag_bounds_check)
- base = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base, 0), 1), 0);
- else
- base = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
- }
-
- /* Build the invocation of _Jv_CheckArrayStore */
- new_rhs = save_expr (new_rhs);
- check = build (CALL_EXPR, void_type_node,
- build_address_of (soft_checkarraystore_node),
- tree_cons (NULL_TREE, base,
- build_tree_list (NULL_TREE, new_rhs)),
- NULL_TREE);
- TREE_SIDE_EFFECTS (check) = 1;
-
- /* We have to decide on an insertion point */
- if (TREE_CODE (lvalue) == COMPOUND_EXPR)
- {
- tree t;
- if (flag_bounds_check)
- {
- t = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0);
- TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0) =
- build (COMPOUND_EXPR, void_type_node, t, check);
- }
- else
- TREE_OPERAND (lvalue, 1) = build (COMPOUND_EXPR, lhs_type,
- check, TREE_OPERAND (lvalue, 1));
- }
- else
- {
- /* Make sure the bound check will happen before the store check */
- if (flag_bounds_check)
- TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0) =
- build (COMPOUND_EXPR, void_type_node,
- TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0), check);
- else
- lvalue = build (COMPOUND_EXPR, lhs_type, check, lvalue);
- }
- }
-
- TREE_OPERAND (node, 0) = lvalue;
- TREE_OPERAND (node, 1) = new_rhs;
- TREE_TYPE (node) = lhs_type;
- return node;
-}
-
-/* Check that type SOURCE can be cast into type DEST. If the cast
- can't occur at all, return 0 otherwise 1. This function is used to
- produce accurate error messages on the reasons why an assignment
- failed. */
-
-static tree
-try_reference_assignconv (lhs_type, rhs)
- tree lhs_type, rhs;
-{
- tree new_rhs = NULL_TREE;
- tree rhs_type = TREE_TYPE (rhs);
-
- if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type))
- {
- /* `null' may be assigned to any reference type */
- if (rhs == null_pointer_node)
- new_rhs = null_pointer_node;
- /* Try the reference assignment conversion */
- else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
- new_rhs = rhs;
- /* This is a magic assignment that we process differently */
- else if (rhs == soft_exceptioninfo_call_node)
- new_rhs = rhs;
- }
- return new_rhs;
-}
-
-/* Check that RHS can be converted into LHS_TYPE by the assignment
- conversion (5.2), for the cases of RHS being a builtin type. Return
- NULL_TREE if the conversion fails or if because RHS isn't of a
- builtin type. Return a converted RHS if the conversion is possible. */
-
-static tree
-try_builtin_assignconv (wfl_op1, lhs_type, rhs)
- tree wfl_op1, lhs_type, rhs;
-{
- tree new_rhs = NULL_TREE;
- tree rhs_type = TREE_TYPE (rhs);
-
- /* Zero accepted everywhere */
- if (TREE_CODE (rhs) == INTEGER_CST
- && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0
- && JPRIMITIVE_TYPE_P (rhs_type))
- new_rhs = convert (lhs_type, rhs);
-
- /* 5.1.1 Try Identity Conversion,
- 5.1.2 Try Widening Primitive Conversion */
- else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
- new_rhs = convert (lhs_type, rhs);
-
- /* Try a narrowing primitive conversion (5.1.3):
- - expression is a constant expression of type int AND
- - variable is byte, short or char AND
- - The value of the expression is representable in the type of the
- variable */
- else if (rhs_type == int_type_node && TREE_CONSTANT (rhs)
- && (lhs_type == byte_type_node || lhs_type == char_type_node
- || lhs_type == short_type_node))
- {
- if (int_fits_type_p (rhs, lhs_type))
- new_rhs = convert (lhs_type, rhs);
- else if (wfl_op1) /* Might be called with a NULL */
- parse_warning_context
- (wfl_op1, "Constant expression `%s' to wide for narrowing "
- "primitive conversion to `%s'",
- print_int_node (rhs), lang_printable_name (lhs_type, 0));
- /* Reported a warning that will turn into an error further
- down, so we don't return */
- }
-
- return new_rhs;
-}
-
-/* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
- conversion (5.1.1) or widening primitve conversion (5.1.2). Return
- 0 is the conversion test fails. This implements parts the method
- invocation convertion (5.3). */
-
-static int
-valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)
- tree lhs_type, rhs_type;
-{
- /* 5.1.1: This is the identity conversion part. */
- if (lhs_type == rhs_type)
- return 1;
-
- /* Reject non primitive types */
- if (!JPRIMITIVE_TYPE_P (lhs_type) || !JPRIMITIVE_TYPE_P (rhs_type))
- return 0;
-
- /* 5.1.2: widening primitive conversion. byte, even if it's smaller
- than a char can't be converted into a char. Short can't too, but
- the < test below takes care of that */
- if (lhs_type == char_type_node && rhs_type == byte_type_node)
- return 0;
-
- /* Accept all promoted type here. Note, we can't use <= in the test
- below, because we still need to bounce out assignments of short
- to char and the likes */
- if (lhs_type == int_type_node
- && (rhs_type == promoted_byte_type_node
- || rhs_type == promoted_short_type_node
- || rhs_type == promoted_char_type_node
- || rhs_type == promoted_boolean_type_node))
- return 1;
-
- /* From here, an integral is widened if its precision is smaller
- than the precision of the LHS or if the LHS is a floating point
- type, or the RHS is a float and the RHS a double. */
- if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type)
- && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
- || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type))
- || (rhs_type == float_type_node && lhs_type == double_type_node))
- return 1;
-
- return 0;
-}
-
-/* Check that something of SOURCE type can be assigned or cast to
- something of DEST type at runtime. Return 1 if the operation is
- valid, 0 otherwise. If CAST is set to 1, we're treating the case
- were SOURCE is cast into DEST, which borrows a lot of the
- assignment check. */
-
-static int
-valid_ref_assignconv_cast_p (source, dest, cast)
- tree source;
- tree dest;
- int cast;
-{
- /* SOURCE or DEST might be null if not from a declared entity. */
- if (!source || !dest)
- return 0;
- if (JNULLP_TYPE_P (source))
- return 1;
- if (TREE_CODE (source) == POINTER_TYPE)
- source = TREE_TYPE (source);
- if (TREE_CODE (dest) == POINTER_TYPE)
- dest = TREE_TYPE (dest);
- /* Case where SOURCE is a class type */
- if (TYPE_CLASS_P (source))
- {
- if (TYPE_CLASS_P (dest))
- return source == dest || inherits_from_p (source, dest)
- || (cast && inherits_from_p (dest, source));
- if (TYPE_INTERFACE_P (dest))
- {
- /* If doing a cast and SOURCE is final, the operation is
- always correct a compile time (because even if SOURCE
- does not implement DEST, a subclass of SOURCE might). */
- if (cast && !CLASS_FINAL (TYPE_NAME (source)))
- return 1;
- /* Otherwise, SOURCE must implement DEST */
- return interface_of_p (dest, source);
- }
- /* DEST is an array, cast permited if SOURCE is of Object type */
- return (cast && source == object_type_node ? 1 : 0);
- }
- if (TYPE_INTERFACE_P (source))
- {
- if (TYPE_CLASS_P (dest))
- {
- /* If not casting, DEST must be the Object type */
- if (!cast)
- return dest == object_type_node;
- /* We're doing a cast. The cast is always valid is class
- DEST is not final, otherwise, DEST must implement SOURCE */
- else if (!CLASS_FINAL (TYPE_NAME (dest)))
- return 1;
- else
- return interface_of_p (source, dest);
- }
- if (TYPE_INTERFACE_P (dest))
- {
- /* If doing a cast, then if SOURCE and DEST contain method
- with the same signature but different return type, then
- this is a (compile time) error */
- if (cast)
- {
- tree method_source, method_dest;
- tree source_type;
- tree source_sig;
- tree source_name;
- for (method_source = TYPE_METHODS (source); method_source;
- method_source = TREE_CHAIN (method_source))
- {
- source_sig =
- build_java_argument_signature (TREE_TYPE (method_source));
- source_type = TREE_TYPE (TREE_TYPE (method_source));
- source_name = DECL_NAME (method_source);
- for (method_dest = TYPE_METHODS (dest);
- method_dest; method_dest = TREE_CHAIN (method_dest))
- if (source_sig ==
- build_java_argument_signature (TREE_TYPE (method_dest))
- && source_name == DECL_NAME (method_dest)
- && source_type != TREE_TYPE (TREE_TYPE (method_dest)))
- return 0;
- }
- return 1;
- }
- else
- return source == dest || interface_of_p (dest, source);
- }
- else /* Array */
- return (cast ?
- (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0);
- }
- if (TYPE_ARRAY_P (source))
- {
- if (TYPE_CLASS_P (dest))
- return dest == object_type_node;
- /* Can't cast an array to an interface unless the interface is
- java.lang.Cloneable */
- if (TYPE_INTERFACE_P (dest))
- return (DECL_NAME (TYPE_NAME (dest)) == java_lang_cloneable ? 1 : 0);
- else /* Arrays */
- {
- tree source_element_type = TYPE_ARRAY_ELEMENT (source);
- tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
-
- /* In case of severe errors, they turn out null */
- if (!dest_element_type || !source_element_type)
- return 0;
- if (source_element_type == dest_element_type)
- return 1;
- return valid_ref_assignconv_cast_p (source_element_type,
- dest_element_type, cast);
- }
- return 0;
- }
- return 0;
-}
-
-static int
-valid_cast_to_p (source, dest)
- tree source;
- tree dest;
-{
- if (TREE_CODE (source) == POINTER_TYPE)
- source = TREE_TYPE (source);
- if (TREE_CODE (dest) == POINTER_TYPE)
- dest = TREE_TYPE (dest);
-
- if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE)
- return valid_ref_assignconv_cast_p (source, dest, 1);
-
- else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest))
- return 1;
-
- return 0;
-}
-
-/* Method invocation conversion test. Return 1 if type SOURCE can be
- converted to type DEST through the methond invocation conversion
- process (5.3) */
-
-static tree
-do_unary_numeric_promotion (arg)
- tree arg;
-{
- tree type = TREE_TYPE (arg);
- if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32
- : TREE_CODE (type) == CHAR_TYPE)
- arg = convert (int_type_node, arg);
- return arg;
-}
-
-/* Return a non zero value if SOURCE can be converted into DEST using
- the method invocation conversion rule (5.3). */
-static int
-valid_method_invocation_conversion_p (dest, source)
- tree dest, source;
-{
- return ((JPRIMITIVE_TYPE_P (source) && JPRIMITIVE_TYPE_P (dest)
- && valid_builtin_assignconv_identity_widening_p (dest, source))
- || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source))
- && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest))
- && valid_ref_assignconv_cast_p (source, dest, 0)));
-}
-
-/* Build an incomplete binop expression. */
-
-static tree
-build_binop (op, op_location, op1, op2)
- enum tree_code op;
- int op_location;
- tree op1, op2;
-{
- tree binop = build (op, NULL_TREE, op1, op2);
- TREE_SIDE_EFFECTS (binop) = 1;
- /* Store the location of the operator, for better error report. The
- string of the operator will be rebuild based on the OP value. */
- EXPR_WFL_LINECOL (binop) = op_location;
- return binop;
-}
-
-/* Build the string of the operator retained by NODE. If NODE is part
- of a compound expression, add an '=' at the end of the string. This
- function is called when an error needs to be reported on an
- operator. The string is returned as a pointer to a static character
- buffer. */
-
-static char *
-operator_string (node)
- tree node;
-{
-#define BUILD_OPERATOR_STRING(S) \
- { \
- sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
- return buffer; \
- }
-
- static char buffer [10];
- switch (TREE_CODE (node))
- {
- case MULT_EXPR: BUILD_OPERATOR_STRING ("*");
- case RDIV_EXPR: BUILD_OPERATOR_STRING ("/");
- case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%");
- case PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
- case MINUS_EXPR: BUILD_OPERATOR_STRING ("-");
- case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<");
- case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>");
- case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>");
- case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&");
- case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^");
- case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|");
- case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&");
- case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||");
- case EQ_EXPR: BUILD_OPERATOR_STRING ("==");
- case NE_EXPR: BUILD_OPERATOR_STRING ("!=");
- case GT_EXPR: BUILD_OPERATOR_STRING (">");
- case GE_EXPR: BUILD_OPERATOR_STRING (">=");
- case LT_EXPR: BUILD_OPERATOR_STRING ("<");
- case LE_EXPR: BUILD_OPERATOR_STRING ("<=");
- case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
- case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-");
- case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!");
- case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~");
- case PREINCREMENT_EXPR: /* Fall through */
- case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++");
- case PREDECREMENT_EXPR: /* Fall through */
- case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--");
- default:
- fatal ("unregistered operator %s - operator_string",
- tree_code_name [TREE_CODE (node)]);
- }
- return NULL;
-#undef BUILD_OPERATOR_STRING
-}
-
-/* Binary operators (15.16 up to 15.18). We return error_mark_node on
- errors but we modify NODE so that it contains the type computed
- according to the expression, when it's fixed. Otherwise, we write
- error_mark_node as the type. It allows us to further the analysis
- of remaining nodes and detects more errors in certain cases. */
-
-static tree
-patch_binop (node, wfl_op1, wfl_op2)
- tree node;
- tree wfl_op1;
- tree wfl_op2;
-{
- tree op1 = TREE_OPERAND (node, 0);
- tree op2 = TREE_OPERAND (node, 1);
- tree op1_type = TREE_TYPE (op1);
- tree op2_type = TREE_TYPE (op2);
- tree prom_type = NULL_TREE;
- int code = TREE_CODE (node);
-
- /* If 1, tell the routine that we have to return error_mark_node
- after checking for the initialization of the RHS */
- int error_found = 0;
-
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- switch (code)
- {
- /* 15.16 Multiplicative operators */
- case MULT_EXPR: /* 15.16.1 Multiplication Operator * */
- case RDIV_EXPR: /* 15.16.2 Division Operator / */
- case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */
- if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
- {
- if (!JPRIMITIVE_TYPE_P (op1_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
- if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- break;
- }
- prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
- /* Change the division operator if necessary */
- if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
- TREE_SET_CODE (node, TRUNC_DIV_EXPR);
-
- /* This one is more complicated. FLOATs are processed by a
- function call to soft_fmod. Duplicate the value of the
- COMPOUND_ASSIGN_P flag. */
- if (code == TRUNC_MOD_EXPR)
- {
- tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
- COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node);
- TREE_SIDE_EFFECTS (mod)
- = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
- return mod;
- }
- break;
-
- /* 15.17 Additive Operators */
- case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */
-
- /* Operation is valid if either one argument is a string
- constant, a String object or a StringBuffer crafted for the
- purpose of the a previous usage of the String concatenation
- operator */
-
- if (TREE_CODE (op1) == STRING_CST
- || TREE_CODE (op2) == STRING_CST
- || JSTRING_TYPE_P (op1_type)
- || JSTRING_TYPE_P (op2_type)
- || IS_CRAFTED_STRING_BUFFER_P (op1)
- || IS_CRAFTED_STRING_BUFFER_P (op2))
- return build_string_concatenation (op1, op2);
-
- case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for
- Numeric Types */
- if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
- {
- if (!JPRIMITIVE_TYPE_P (op1_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
- if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- break;
- }
- prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
- break;
-
- /* 15.18 Shift Operators */
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case URSHIFT_EXPR:
- if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type))
- {
- if (!JINTEGRAL_TYPE_P (op1_type))
- ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
- else
- parse_error_context
- (wfl_operator, (JPRIMITIVE_TYPE_P (op2_type) ?
- "Incompatible type for `%s'. Explicit cast needed to convert "
- "shift distance from `%s' to integral" :
- "Incompatible type for `%s'. Can't convert shift distance from "
- "`%s' to integral"),
- operator_string (node), lang_printable_name (op2_type, 0));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- break;
- }
-
- /* Unary numeric promotion (5.6.1) is performed on each operand
- separatly */
- op1 = do_unary_numeric_promotion (op1);
- op2 = do_unary_numeric_promotion (op2);
-
- /* The type of the shift expression is the type of the promoted
- type of the left-hand operand */
- prom_type = TREE_TYPE (op1);
-
- /* Shift int only up to 0x1f and long up to 0x3f */
- if (prom_type == int_type_node)
- op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
- build_int_2 (0x1f, 0)));
- else
- op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
- build_int_2 (0x3f, 0)));
-
- /* The >>> operator is a >> operating on unsigned quantities */
- if (code == URSHIFT_EXPR && ! flag_emit_class_files)
- {
- tree to_return;
- tree utype = unsigned_type (prom_type);
- op1 = convert (utype, op1);
- TREE_SET_CODE (node, RSHIFT_EXPR);
- TREE_OPERAND (node, 0) = op1;
- TREE_OPERAND (node, 1) = op2;
- TREE_TYPE (node) = utype;
- to_return = convert (prom_type, node);
- /* Copy the original value of the COMPOUND_ASSIGN_P flag */
- COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node);
- TREE_SIDE_EFFECTS (to_return)
- = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
- return to_return;
- }
- break;
-
- /* 15.19.1 Type Comparison Operator instaceof */
- case INSTANCEOF_EXPR:
-
- TREE_TYPE (node) = boolean_type_node;
-
- if (!(op2_type = resolve_type_during_patch (op2)))
- return error_mark_node;
-
- /* The first operand must be a reference type or the null type */
- if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node)
- error_found = 1; /* Error reported further below */
-
- /* The second operand must be a reference type */
- if (!JREFERENCE_TYPE_P (op2_type))
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
- parse_error_context
- (wfl_operator, "Invalid argument `%s' for `instanceof'",
- lang_printable_name (op2_type, 0));
- error_found = 1;
- }
-
- if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1))
- {
- /* If the first operand is null, the result is always false */
- if (op1 == null_pointer_node)
- return boolean_false_node;
- else if (flag_emit_class_files)
- {
- TREE_OPERAND (node, 1) = op2_type;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1);
- return node;
- }
- /* Otherwise we have to invoke instance of to figure it out */
- else
- {
- tree call =
- build (CALL_EXPR, boolean_type_node,
- build_address_of (soft_instanceof_node),
- tree_cons
- (NULL_TREE, op1,
- build_tree_list (NULL_TREE,
- build_class_ref (op2_type))),
- NULL_TREE);
- TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1);
- return call;
- }
- }
- /* There is no way the expression operand can be an instance of
- the type operand. This is a compile time error. */
- else
- {
- char *t1 = strdup (lang_printable_name (op1_type, 0));
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context
- (wfl_operator, "Impossible for `%s' to be instance of `%s'",
- t1, lang_printable_name (op2_type, 0));
- free (t1);
- error_found = 1;
- }
-
- break;
-
- /* 15.21 Bitwise and Logical Operators */
- case BIT_AND_EXPR:
- case BIT_XOR_EXPR:
- case BIT_IOR_EXPR:
- if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type))
- /* Binary numeric promotion is performed on both operand and the
- expression retain that type */
- prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
-
- else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
- && TREE_CODE (op1_type) == BOOLEAN_TYPE)
- /* The type of the bitwise operator expression is BOOLEAN */
- prom_type = boolean_type_node;
- else
- {
- if (!JINTEGRAL_TYPE_P (op1_type))
- ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
- if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type))
- ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- /* Insert a break here if adding thing before the switch's
- break for this case */
- }
- break;
-
- /* 15.22 Conditional-And Operator */
- case TRUTH_ANDIF_EXPR:
- /* 15.23 Conditional-Or Operator */
- case TRUTH_ORIF_EXPR:
- /* Operands must be of BOOLEAN type */
- if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
- TREE_CODE (op2_type) != BOOLEAN_TYPE)
- {
- if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
- ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type);
- if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type))
- ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type);
- TREE_TYPE (node) = boolean_type_node;
- error_found = 1;
- break;
- }
- /* The type of the conditional operators is BOOLEAN */
- prom_type = boolean_type_node;
- break;
-
- /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
- case LT_EXPR:
- case GT_EXPR:
- case LE_EXPR:
- case GE_EXPR:
- /* The type of each of the operands must be a primitive numeric
- type */
- if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type))
- {
- if (!JNUMERIC_TYPE_P (op1_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
- if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
- TREE_TYPE (node) = boolean_type_node;
- error_found = 1;
- break;
- }
- /* Binary numeric promotion is performed on the operands */
- binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
- /* The type of the relation expression is always BOOLEAN */
- prom_type = boolean_type_node;
- break;
-
- /* 15.20 Equality Operator */
- case EQ_EXPR:
- case NE_EXPR:
- /* 15.20.1 Numerical Equality Operators == and != */
- /* Binary numeric promotion is performed on the operands */
- if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
- binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
-
- /* 15.20.2 Boolean Equality Operators == and != */
- else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
- TREE_CODE (op2_type) == BOOLEAN_TYPE)
- ; /* Nothing to do here */
-
- /* 15.20.3 Reference Equality Operators == and != */
- /* Types have to be either references or the null type. If
- they're references, it must be possible to convert either
- type to the other by casting conversion. */
- else if (op1 == null_pointer_node || op2 == null_pointer_node
- || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type)
- && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1)
- || valid_ref_assignconv_cast_p (op2_type,
- op1_type, 1))))
- ; /* Nothing to do here */
-
- /* Else we have an error figure what can't be converted into
- what and report the error */
- else
- {
- char *t1;
- t1 = strdup (lang_printable_name (op1_type, 0));
- parse_error_context
- (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' "
- "to `%s'", operator_string (node), t1,
- lang_printable_name (op2_type, 0));
- free (t1);
- TREE_TYPE (node) = boolean_type_node;
- error_found = 1;
- break;
- }
- prom_type = boolean_type_node;
- break;
- }
-
- if (error_found)
- return error_mark_node;
-
- TREE_OPERAND (node, 0) = op1;
- TREE_OPERAND (node, 1) = op2;
- TREE_TYPE (node) = prom_type;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
-
- if (flag_emit_xref)
- return node;
-
- /* fold does not respect side-effect order as required for Java but not C.
- * Also, it sometimes create SAVE_EXPRs which are bad when emitting
- * bytecode.
- */
- if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2))
- : ! TREE_SIDE_EFFECTS (node))
- node = fold (node);
- return node;
-}
-
-/* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
- zero value, the value of CSTE comes after the valude of STRING */
-
-static tree
-do_merge_string_cste (cste, string, string_len, after)
- tree cste;
- char *string;
- int string_len, after;
-{
- int len = TREE_STRING_LENGTH (cste) + string_len;
- char *old = TREE_STRING_POINTER (cste);
- TREE_STRING_LENGTH (cste) = len;
- TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
- if (after)
- {
- strcpy (TREE_STRING_POINTER (cste), string);
- strcat (TREE_STRING_POINTER (cste), old);
- }
- else
- {
- strcpy (TREE_STRING_POINTER (cste), old);
- strcat (TREE_STRING_POINTER (cste), string);
- }
- return cste;
-}
-
-/* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
- new STRING_CST on success, NULL_TREE on failure */
-
-static tree
-merge_string_cste (op1, op2, after)
- tree op1, op2;
- int after;
-{
- /* Handle two string constants right away */
- if (TREE_CODE (op2) == STRING_CST)
- return do_merge_string_cste (op1, TREE_STRING_POINTER (op2),
- TREE_STRING_LENGTH (op2), after);
-
- /* Reasonable integer constant can be treated right away */
- if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2))
- {
- static char *boolean_true = "true";
- static char *boolean_false = "false";
- static char *null_pointer = "null";
- char ch[3];
- char *string;
-
- if (op2 == boolean_true_node)
- string = boolean_true;
- else if (op2 == boolean_false_node)
- string = boolean_false;
- else if (op2 == null_pointer_node)
- string = null_pointer;
- else if (TREE_TYPE (op2) == char_type_node)
- {
- ch[0] = (char )TREE_INT_CST_LOW (op2);
- ch[1] = '\0';
- string = ch;
- }
- else
- string = print_int_node (op2);
-
- return do_merge_string_cste (op1, string, strlen (string), after);
- }
- return NULL_TREE;
-}
-
-/* Tries to statically concatenate OP1 and OP2 if possible. Either one
- has to be a STRING_CST and the other part must be a STRING_CST or a
- INTEGRAL constant. Return a new STRING_CST if the operation
- succeed, NULL_TREE otherwise.
-
- If the case we want to optimize for space, we might want to return
- NULL_TREE for each invocation of this routine. FIXME */
-
-static tree
-string_constant_concatenation (op1, op2)
- tree op1, op2;
-{
- if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST))
- {
- tree string, rest;
- int invert;
-
- string = (TREE_CODE (op1) == STRING_CST ? op1 : op2);
- rest = (string == op1 ? op2 : op1);
- invert = (string == op1 ? 0 : 1 );
-
- /* Walk REST, only if it looks reasonable */
- if (TREE_CODE (rest) != STRING_CST
- && !IS_CRAFTED_STRING_BUFFER_P (rest)
- && !JSTRING_TYPE_P (TREE_TYPE (rest))
- && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION)
- {
- rest = java_complete_tree (rest);
- if (rest == error_mark_node)
- return error_mark_node;
- rest = fold (rest);
- }
- return merge_string_cste (string, rest, invert);
- }
- return NULL_TREE;
-}
-
-/* Implement the `+' operator. Does static optimization if possible,
- otherwise create (if necessary) and append elements to a
- StringBuffer. The StringBuffer will be carried around until it is
- used for a function call or an assignment. Then toString() will be
- called on it to turn it into a String object. */
-
-static tree
-build_string_concatenation (op1, op2)
- tree op1, op2;
-{
- tree result;
- int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
-
- if (flag_emit_xref)
- return build (PLUS_EXPR, string_type_node, op1, op2);
-
- /* Try to do some static optimization */
- if ((result = string_constant_concatenation (op1, op2)))
- return result;
-
- /* Discard empty strings on either side of the expression */
- if (TREE_CODE (op1) == STRING_CST && TREE_STRING_LENGTH (op1) == 0)
- {
- op1 = op2;
- op2 = NULL_TREE;
- }
- else if (TREE_CODE (op2) == STRING_CST && TREE_STRING_LENGTH (op2) == 0)
- op2 = NULL_TREE;
-
- /* If operands are string constant, turn then into object references */
- if (TREE_CODE (op1) == STRING_CST)
- op1 = patch_string_cst (op1);
- if (op2 && TREE_CODE (op2) == STRING_CST)
- op2 = patch_string_cst (op2);
-
- /* If either one of the constant is null and the other non null
- operand is a String object, return it. */
- if (JSTRING_TYPE_P (TREE_TYPE (op1)) && !op2)
- return op1;
-
- /* If OP1 isn't already a StringBuffer, create and
- initialize a new one */
- if (!IS_CRAFTED_STRING_BUFFER_P (op1))
- {
- /* Two solutions here:
- 1) OP1 is a string reference, we call new StringBuffer(OP1)
- 2) OP1 is something else, we call new StringBuffer().append(OP1). */
- if (JSTRING_TYPE_P (TREE_TYPE (op1)))
- op1 = BUILD_STRING_BUFFER (op1);
- else
- {
- tree aNew = BUILD_STRING_BUFFER (NULL_TREE);
- op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0);
- }
- }
-
- if (op2)
- {
- /* OP1 is no longer the last node holding a crafted StringBuffer */
- IS_CRAFTED_STRING_BUFFER_P (op1) = 0;
- /* Create a node for `{new...,xxx}.append (op2)' */
- if (op2)
- op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
- }
-
- /* Mark the last node holding a crafted StringBuffer */
- IS_CRAFTED_STRING_BUFFER_P (op1) = 1;
-
- TREE_SIDE_EFFECTS (op1) = side_effects;
- return op1;
-}
-
-/* Patch the string node NODE. NODE can be a STRING_CST of a crafted
- StringBuffer. If no string were found to be patched, return
- NULL. */
-
-static tree
-patch_string (node)
- tree node;
-{
- if (node == error_mark_node)
- return error_mark_node;
- if (TREE_CODE (node) == STRING_CST)
- return patch_string_cst (node);
- else if (IS_CRAFTED_STRING_BUFFER_P (node))
- {
- int saved = ctxp->explicit_constructor_p;
- tree invoke = build_method_invocation (wfl_to_string, NULL_TREE);
- tree ret;
- /* Temporary disable forbid the use of `this'. */
- ctxp->explicit_constructor_p = 0;
- ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
- /* Restore it at its previous value */
- ctxp->explicit_constructor_p = saved;
- return ret;
- }
- return NULL_TREE;
-}
-
-/* Build the internal representation of a string constant. */
-
-static tree
-patch_string_cst (node)
- tree node;
-{
- int location;
- if (! flag_emit_class_files)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- node = get_identifier (TREE_STRING_POINTER (node));
- location = alloc_name_constant (CONSTANT_String, node);
- node = build_ref_from_constant_pool (location);
- }
- TREE_TYPE (node) = string_ptr_type_node;
- TREE_CONSTANT (node) = 1;
- return node;
-}
-
-/* Build an incomplete unary operator expression. */
-
-static tree
-build_unaryop (op_token, op_location, op1)
- int op_token, op_location;
- tree op1;
-{
- enum tree_code op;
- tree unaryop;
- switch (op_token)
- {
- case PLUS_TK: op = UNARY_PLUS_EXPR; break;
- case MINUS_TK: op = NEGATE_EXPR; break;
- case NEG_TK: op = TRUTH_NOT_EXPR; break;
- case NOT_TK: op = BIT_NOT_EXPR; break;
- default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
- op_token);
- }
-
- unaryop = build1 (op, NULL_TREE, op1);
- TREE_SIDE_EFFECTS (unaryop) = 1;
- /* Store the location of the operator, for better error report. The
- string of the operator will be rebuild based on the OP value. */
- EXPR_WFL_LINECOL (unaryop) = op_location;
- return unaryop;
-}
-
-/* Special case for the ++/-- operators, since they require an extra
- argument to build, which is set to NULL and patched
- later. IS_POST_P is 1 if the operator, 0 otherwise. */
-
-static tree
-build_incdec (op_token, op_location, op1, is_post_p)
- int op_token, op_location;
- tree op1;
- int is_post_p;
-{
- static enum tree_code lookup [2][2] =
- {
- { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
- { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
- };
- tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
- NULL_TREE, op1, NULL_TREE);
- TREE_SIDE_EFFECTS (node) = 1;
- /* Store the location of the operator, for better error report. The
- string of the operator will be rebuild based on the OP value. */
- EXPR_WFL_LINECOL (node) = op_location;
- return node;
-}
-
-/* Build an incomplete cast operator, based on the use of the
- CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
- set. java_complete_tree is trained to walk a CONVERT_EXPR even
- though its type is already set. */
-
-static tree
-build_cast (location, type, exp)
- int location;
- tree type, exp;
-{
- tree node = build1 (CONVERT_EXPR, type, exp);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* 15.14 Unary operators. We return error_mark_node in case of error,
- but preserve the type of NODE if the type is fixed. */
-
-static tree
-patch_unaryop (node, wfl_op)
- tree node;
- tree wfl_op;
-{
- tree op = TREE_OPERAND (node, 0);
- tree op_type = TREE_TYPE (op);
- tree prom_type = NULL_TREE, value, decl;
- int code = TREE_CODE (node);
- int error_found = 0;
-
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- switch (code)
- {
- /* 15.13.2 Postfix Increment Operator ++ */
- case POSTINCREMENT_EXPR:
- /* 15.13.3 Postfix Increment Operator -- */
- case POSTDECREMENT_EXPR:
- /* 15.14.1 Prefix Increment Operator ++ */
- case PREINCREMENT_EXPR:
- /* 15.14.2 Prefix Decrement Operator -- */
- case PREDECREMENT_EXPR:
- decl = strip_out_static_field_access_decl (op);
- /* We really should have a JAVA_ARRAY_EXPR to avoid this */
- if (!JDECL_P (decl)
- && TREE_CODE (decl) != COMPONENT_REF
- && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF)
- && TREE_CODE (decl) != INDIRECT_REF
- && !(TREE_CODE (decl) == COMPOUND_EXPR
- && TREE_OPERAND (decl, 1)
- && (TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF)))
- {
- tree lvalue;
- /* Before screaming, check that we're not in fact trying to
- increment a optimized static final access, in which case
- we issue an different error message. */
- if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION
- && resolve_expression_name (wfl_op, &lvalue)
- && check_final_assignment (lvalue, wfl_op)))
- parse_error_context (wfl_operator, "Invalid argument to `%s'",
- operator_string (node));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- else if (check_final_assignment (op, wfl_op))
- error_found = 1;
-
- /* From now on, we know that op if a variable and that it has a
- valid wfl. We use wfl_op to locate errors related to the
- ++/-- operand. */
- else if (!JNUMERIC_TYPE_P (op_type))
- {
- parse_error_context
- (wfl_op, "Invalid argument type `%s' to `%s'",
- lang_printable_name (op_type, 0), operator_string (node));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- else
- {
- /* Before the addition, binary numeric promotion is performed on
- both operands */
- value = build_int_2 (1, 0);
- TREE_TYPE (node) =
- binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value);
- /* And write the promoted incremented and increment */
- TREE_OPERAND (node, 0) = op;
- TREE_OPERAND (node, 1) = value;
- /* Convert the overall back into its original type. */
- return fold (convert (op_type, node));
- }
- break;
-
- /* 15.14.3 Unary Plus Operator + */
- case UNARY_PLUS_EXPR:
- /* 15.14.4 Unary Minus Operator - */
- case NEGATE_EXPR:
- if (!JNUMERIC_TYPE_P (op_type))
- {
- ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- /* Unary numeric promotion is performed on operand */
- else
- {
- op = do_unary_numeric_promotion (op);
- prom_type = TREE_TYPE (op);
- if (code == UNARY_PLUS_EXPR)
- return fold (op);
- }
- break;
-
- /* 15.14.5 Bitwise Complement Operator ~ */
- case BIT_NOT_EXPR:
- if (!JINTEGRAL_TYPE_P (op_type))
- {
- ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type);
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- else
- {
- op = do_unary_numeric_promotion (op);
- prom_type = TREE_TYPE (op);
- }
- break;
-
- /* 15.14.6 Logical Complement Operator ! */
- case TRUTH_NOT_EXPR:
- if (TREE_CODE (op_type) != BOOLEAN_TYPE)
- {
- ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type);
- /* But the type is known. We will report an error if further
- attempt of a assignment is made with this rhs */
- TREE_TYPE (node) = boolean_type_node;
- error_found = 1;
- }
- else
- prom_type = boolean_type_node;
- break;
-
- /* 15.15 Cast Expression */
- case CONVERT_EXPR:
- value = patch_cast (node, wfl_operator);
- if (value == error_mark_node)
- {
- /* If this cast is part of an assignment, we tell the code
- that deals with it not to complain about a mismatch,
- because things have been cast, anyways */
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
- else
- {
- value = fold (value);
- TREE_SIDE_EFFECTS (value) = TREE_SIDE_EFFECTS (op);
- return value;
- }
- break;
- }
-
- if (error_found)
- return error_mark_node;
-
- /* There are cases where node has been replaced by something else
- and we don't end up returning here: UNARY_PLUS_EXPR,
- CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
- TREE_OPERAND (node, 0) = fold (op);
- TREE_TYPE (node) = prom_type;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op);
- return fold (node);
-}
-
-/* Generic type resolution that sometimes takes place during node
- patching. Returned the resolved type or generate an error
- message. Return the resolved type or NULL_TREE. */
-
-static tree
-resolve_type_during_patch (type)
- tree type;
-{
- if (unresolved_type_p (type, NULL))
- {
- tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE);
- if (!type_decl)
- {
- parse_error_context (type,
- "Class `%s' not found in type declaration",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
- return NULL_TREE;
- }
- else
- {
- CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1;
- return TREE_TYPE (type_decl);
- }
- }
- return type;
-}
-/* 5.5 Casting Conversion. error_mark_node is returned if an error is
- found. Otherwise NODE or something meant to replace it is returned. */
-
-static tree
-patch_cast (node, wfl_operator)
- tree node;
- tree wfl_operator;
-{
- tree op = TREE_OPERAND (node, 0);
- tree op_type = TREE_TYPE (op);
- tree cast_type = TREE_TYPE (node);
- char *t1;
-
- /* First resolve OP_TYPE if unresolved */
- if (!(cast_type = resolve_type_during_patch (cast_type)))
- return error_mark_node;
-
- /* Check on cast that are proven correct at compile time */
- if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
- {
- static tree convert_narrow ();
- /* Same type */
- if (cast_type == op_type)
- return node;
-
- /* float and double type are converted to the original type main
- variant and then to the target type. */
- if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE)
- op = convert (integer_type_node, op);
-
- /* Try widening/narowwing convertion. Potentially, things need
- to be worked out in gcc so we implement the extreme cases
- correctly. fold_convert() needs to be fixed. */
- return convert (cast_type, op);
- }
-
- /* It's also valid to cast a boolean into a boolean */
- if (op_type == boolean_type_node && cast_type == boolean_type_node)
- return node;
-
- /* null can be casted to references */
- if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type))
- return build_null_of_type (cast_type);
-
- /* The remaining legal casts involve conversion between reference
- types. Check for their compile time correctness. */
- if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
- && valid_ref_assignconv_cast_p (op_type, cast_type, 1))
- {
- TREE_TYPE (node) = promote_type (cast_type);
- /* Now, the case can be determined correct at compile time if
- OP_TYPE can be converted into CAST_TYPE by assignment
- conversion (5.2) */
-
- if (valid_ref_assignconv_cast_p (op_type, cast_type, 0))
- {
- TREE_SET_CODE (node, NOP_EXPR);
- return node;
- }
-
- if (flag_emit_class_files)
- {
- TREE_SET_CODE (node, CONVERT_EXPR);
- return node;
- }
-
- /* The cast requires a run-time check */
- return build (CALL_EXPR, promote_type (cast_type),
- build_address_of (soft_checkcast_node),
- tree_cons (NULL_TREE, build_class_ref (cast_type),
- build_tree_list (NULL_TREE, op)),
- NULL_TREE);
- }
-
- /* Any other casts are proven incorrect at compile time */
- t1 = strdup (lang_printable_name (op_type, 0));
- parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
- t1, lang_printable_name (cast_type, 0));
- free (t1);
- return error_mark_node;
-}
-
-/* Build a null constant and give it the type TYPE. */
-
-static tree
-build_null_of_type (type)
- tree type;
-{
- tree node = build_int_2 (0, 0);
- TREE_TYPE (node) = promote_type (type);
- return node;
-}
-
-/* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
- a list of indices. */
-static tree
-build_array_ref (location, array, index)
- int location;
- tree array, index;
-{
- tree node = build (ARRAY_REF, NULL_TREE, array, index);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* 15.12 Array Access Expression */
-
-static tree
-patch_array_ref (node)
- tree node;
-{
- tree array = TREE_OPERAND (node, 0);
- tree array_type = TREE_TYPE (array);
- tree index = TREE_OPERAND (node, 1);
- tree index_type = TREE_TYPE (index);
- int error_found = 0;
-
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- if (TREE_CODE (array_type) == POINTER_TYPE)
- array_type = TREE_TYPE (array_type);
-
- /* The array reference must be an array */
- if (!TYPE_ARRAY_P (array_type))
- {
- parse_error_context
- (wfl_operator, "`[]' can only be applied to arrays. It can't be "
- "applied to `%s'", lang_printable_name (array_type, 0));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
-
- /* The array index underdoes unary numeric promotion. The promoted
- type must be int */
- index = do_unary_numeric_promotion (index);
- if (TREE_TYPE (index) != int_type_node)
- {
- int could_cast = valid_cast_to_p (index_type, int_type_node);
- parse_error_context
- (wfl_operator,
- (could_cast ? "Incompatible type for `[]'. Explicit cast needed to "
- "convert `%s' to `int'" : "Incompatible type for `[]'. "
- "Can't convert `%s' to `int'"),
- lang_printable_name (index_type, 0));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
-
- if (error_found)
- return error_mark_node;
-
- array_type = TYPE_ARRAY_ELEMENT (array_type);
-
- if (flag_emit_class_files || flag_emit_xref)
- {
- TREE_OPERAND (node, 0) = array;
- TREE_OPERAND (node, 1) = index;
- }
- else
- {
- /* The save_expr is for correct evaluation order. It would be cleaner
- to use force_evaluation_order (see comment there), but that is
- difficult when we also have to deal with bounds checking. */
- if (TREE_SIDE_EFFECTS (index))
- array = save_expr (array);
- node = build_java_arrayaccess (array, array_type, index);
- if (TREE_SIDE_EFFECTS (index))
- node = build (COMPOUND_EXPR, array_type, array, node);
- }
- TREE_TYPE (node) = array_type;
- return node;
-}
-
-/* 15.9 Array Creation Expressions */
-
-static tree
-build_newarray_node (type, dims, extra_dims)
- tree type;
- tree dims;
- int extra_dims;
-{
- tree node =
- build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims),
- build_int_2 (extra_dims, 0));
- return node;
-}
-
-static tree
-patch_newarray (node)
- tree node;
-{
- tree type = TREE_OPERAND (node, 0);
- tree dims = TREE_OPERAND (node, 1);
- tree cdim, array_type;
- int error_found = 0;
- int ndims = 0;
- int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2));
-
- /* Dimension types are verified. It's better for the types to be
- verified in order. */
- for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ )
- {
- int dim_error = 0;
- tree dim = TREE_VALUE (cdim);
-
- /* Dim might have been saved during its evaluation */
- dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim);
-
- /* The type of each specified dimension must be an integral type. */
- if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim)))
- dim_error = 1;
-
- /* Each expression undergoes an unary numeric promotion (5.6.1) and the
- promoted type must be int. */
- else
- {
- dim = do_unary_numeric_promotion (dim);
- if (TREE_TYPE (dim) != int_type_node)
- dim_error = 1;
- }
-
- /* Report errors on types here */
- if (dim_error)
- {
- parse_error_context
- (TREE_PURPOSE (cdim),
- "Incompatible type for dimension in array creation expression. "
- "%s convert `%s' to `int'",
- (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
- "Explicit cast needed to" : "Can't"),
- lang_printable_name (TREE_TYPE (dim), 0));
- error_found = 1;
- }
-
- TREE_PURPOSE (cdim) = NULL_TREE;
- }
-
- /* Resolve array base type if unresolved */
- if (!(type = resolve_type_during_patch (type)))
- error_found = 1;
-
- if (error_found)
- {
- /* We don't want further evaluation of this bogus array creation
- operation */
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
-
- /* Set array_type to the actual (promoted) array type of the result. */
- if (TREE_CODE (type) == RECORD_TYPE)
- type = build_pointer_type (type);
- while (--xdims >= 0)
- {
- type = promote_type (build_java_array_type (type, -1));
- }
- dims = nreverse (dims);
- array_type = type;
- for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim))
- {
- type = array_type;
- array_type = build_java_array_type (type,
- TREE_CODE (cdim) == INTEGER_CST ?
- TREE_INT_CST_LOW (cdim) : -1);
- array_type = promote_type (array_type);
- }
- dims = nreverse (dims);
-
- /* The node is transformed into a function call. Things are done
- differently according to the number of dimensions. If the number
- of dimension is equal to 1, then the nature of the base type
- (primitive or not) matters. */
- if (ndims == 1)
- return build_new_array (type, TREE_VALUE (dims));
-
- /* Can't reuse what's already written in expr.c because it uses the
- JVM stack representation. Provide a build_multianewarray. FIXME */
- return build (CALL_EXPR, array_type,
- build_address_of (soft_multianewarray_node),
- tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)),
- tree_cons (NULL_TREE,
- build_int_2 (ndims, 0), dims )),
- NULL_TREE);
-}
-
-/* 10.6 Array initializer. */
-
-/* Build a wfl for array element that don't have one, so we can
- pin-point errors. */
-
-static tree
-maybe_build_array_element_wfl (node)
- tree node;
-{
- if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
- return build_expr_wfl (NULL_TREE, ctxp->filename,
- ctxp->elc.line, ctxp->elc.prev_col);
- else
- return NULL_TREE;
-}
-
-/* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
- identification of initialized arrays easier to detect during walk
- and expansion. */
-
-static tree
-build_new_array_init (location, values)
- int location;
- tree values;
-{
- tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values);
- tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor);
- EXPR_WFL_LINECOL (to_return) = location;
- return to_return;
-}
-
-/* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
- occurred. Otherwise return NODE after having set its type
- appropriately. */
-
-static tree
-patch_new_array_init (type, node)
- tree type, node;
-{
- int error_seen = 0;
- tree current, element_type;
- HOST_WIDE_INT length;
- int all_constant = 1;
- tree init = TREE_OPERAND (node, 0);
-
- if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type)))
- {
- parse_error_context (node,
- "Invalid array initializer for non-array type `%s'",
- lang_printable_name (type, 1));
- return error_mark_node;
- }
- type = TREE_TYPE (type);
- element_type = TYPE_ARRAY_ELEMENT (type);
-
- CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init));
-
- for (length = 0, current = CONSTRUCTOR_ELTS (init);
- current; length++, current = TREE_CHAIN (current))
- {
- tree elt = TREE_VALUE (current);
- if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
- {
- error_seen |= array_constructor_check_entry (element_type, current);
- elt = TREE_VALUE (current);
- /* When compiling to native code, STRING_CST is converted to
- INDIRECT_REF, but still with a TREE_CONSTANT flag. */
- if (! TREE_CONSTANT (elt) || TREE_CODE (elt) == INDIRECT_REF)
- all_constant = 0;
- }
- else
- {
- TREE_VALUE (current) = patch_new_array_init (element_type, elt);
- TREE_PURPOSE (current) = NULL_TREE;
- all_constant = 0;
- }
- if (elt && TREE_VALUE (elt) == error_mark_node)
- error_seen = 1;
- }
-
- if (error_seen)
- return error_mark_node;
-
- /* Create a new type. We can't reuse the one we have here by
- patching its dimension because it originally is of dimension -1
- hence reused by gcc. This would prevent triangular arrays. */
- type = build_java_array_type (element_type, length);
- TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
- TREE_TYPE (node) = promote_type (type);
- TREE_CONSTANT (init) = all_constant;
- TREE_CONSTANT (node) = all_constant;
- return node;
-}
-
-/* Verify that one entry of the initializer element list can be
- assigned to the array base type. Report 1 if an error occurred, 0
- otherwise. */
-
-static int
-array_constructor_check_entry (type, entry)
- tree type, entry;
-{
- char *array_type_string = NULL; /* For error reports */
- tree value, type_value, new_value, wfl_value, patched;
- int error_seen = 0;
-
- new_value = NULL_TREE;
- wfl_value = TREE_VALUE (entry);
-
- value = java_complete_tree (TREE_VALUE (entry));
- /* patch_string return error_mark_node if arg is error_mark_node */
- if ((patched = patch_string (value)))
- value = patched;
- if (value == error_mark_node)
- return 1;
-
- type_value = TREE_TYPE (value);
-
- /* At anytime, try_builtin_assignconv can report a warning on
- constant overflow during narrowing. */
- SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value);
- new_value = try_builtin_assignconv (wfl_operator, type, value);
- if (!new_value && (new_value = try_reference_assignconv (type, value)))
- type_value = promote_type (type);
-
- /* Check and report errors */
- if (!new_value)
- {
- char *msg = (!valid_cast_to_p (type_value, type) ?
- "Can't" : "Explicit cast needed to");
- if (!array_type_string)
- array_type_string = strdup (lang_printable_name (type, 1));
- parse_error_context
- (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
- msg, lang_printable_name (type_value, 1), array_type_string);
- error_seen = 1;
- }
-
- if (new_value)
- {
- new_value = maybe_build_primttype_type_ref (new_value, wfl_operator);
- TREE_VALUE (entry) = new_value;
- }
-
- if (array_type_string)
- free (array_type_string);
-
- TREE_PURPOSE (entry) = NULL_TREE;
- return error_seen;
-}
-
-static tree
-build_this (location)
- int location;
-{
- tree node = build_wfl_node (this_identifier_node);
- TREE_SET_CODE (node, THIS_EXPR);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* 14.15 The return statement. It builds a modify expression that
- assigns the returned value to the RESULT_DECL that hold the value
- to be returned. */
-
-static tree
-build_return (location, op)
- int location;
- tree op;
-{
- tree node = build1 (RETURN_EXPR, NULL_TREE, op);
- EXPR_WFL_LINECOL (node) = location;
- node = build_debugable_stmt (location, node);
- return node;
-}
-
-static tree
-patch_return (node)
- tree node;
-{
- tree return_exp = TREE_OPERAND (node, 0);
- tree meth = current_function_decl;
- tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl));
- int error_found = 0;
-
- TREE_TYPE (node) = error_mark_node;
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* It's invalid to have a return value within a function that is
- declared with the keyword void or that is a constructor */
- if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth)))
- error_found = 1;
-
- /* It's invalid to use a return statement in a static block */
- if (IS_CLINIT (current_function_decl))
- error_found = 1;
-
- /* It's invalid to have a no return value within a function that
- isn't declared with the keyword `void' */
- if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
- error_found = 2;
-
- if (error_found)
- {
- if (IS_CLINIT (current_function_decl))
- parse_error_context (wfl_operator,
- "`return' inside static initializer.");
-
- else if (!DECL_CONSTRUCTOR_P (meth))
- {
- char *t = strdup (lang_printable_name (mtype, 0));
- parse_error_context (wfl_operator,
- "`return' with%s value from `%s %s'",
- (error_found == 1 ? "" : "out"),
- t, lang_printable_name (meth, 0));
- free (t);
- }
- else
- parse_error_context (wfl_operator,
- "`return' with value from constructor `%s'",
- lang_printable_name (meth, 0));
- return error_mark_node;
- }
-
- /* If we have a return_exp, build a modify expression and expand
- it. Note: at that point, the assignment is declared valid, but we
- may want to carry some more hacks */
- if (return_exp)
- {
- tree exp = java_complete_tree (return_exp);
- tree modify, patched;
-
- /* If the function returned value and EXP are booleans, EXP has
- to be converted into the type of DECL_RESULT, which is integer
- (see complete_start_java_method) */
- if (TREE_TYPE (exp) == boolean_type_node &&
- TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node)
- exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp);
-
- /* `null' can be assigned to a function returning a reference */
- if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) &&
- exp == null_pointer_node)
- exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth)));
-
- if ((patched = patch_string (exp)))
- exp = patched;
-
- modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp);
- EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
- modify = java_complete_tree (modify);
-
- if (modify != error_mark_node)
- {
- TREE_SIDE_EFFECTS (modify) = 1;
- TREE_OPERAND (node, 0) = modify;
- }
- else
- return error_mark_node;
- }
- TREE_TYPE (node) = void_type_node;
- TREE_SIDE_EFFECTS (node) = 1;
- return node;
-}
-
-/* 14.8 The if Statement */
-
-static tree
-build_if_else_statement (location, expression, if_body, else_body)
- int location;
- tree expression, if_body, else_body;
-{
- tree node;
- if (!else_body)
- else_body = empty_stmt_node;
- node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
- EXPR_WFL_LINECOL (node) = location;
- node = build_debugable_stmt (location, node);
- return node;
-}
-
-static tree
-patch_if_else_statement (node)
- tree node;
-{
- tree expression = TREE_OPERAND (node, 0);
-
- TREE_TYPE (node) = error_mark_node;
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* The type of expression must be boolean */
- if (TREE_TYPE (expression) != boolean_type_node
- && TREE_TYPE (expression) != promoted_boolean_type_node)
- {
- parse_error_context
- (wfl_operator,
- "Incompatible type for `if'. Can't convert `%s' to `boolean'",
- lang_printable_name (TREE_TYPE (expression), 0));
- return error_mark_node;
- }
-
- TREE_TYPE (node) = void_type_node;
- TREE_SIDE_EFFECTS (node) = 1;
- CAN_COMPLETE_NORMALLY (node)
- = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
- | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2));
- return node;
-}
-
-/* 14.6 Labeled Statements */
-
-/* Action taken when a lableled statement is parsed. a new
- LABELED_BLOCK_EXPR is created. No statement is attached to the
- label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */
-
-static tree
-build_labeled_block (location, label)
- int location;
- tree label;
-{
- tree label_name ;
- tree label_decl, node;
- if (label == NULL_TREE || label == continue_identifier_node)
- label_name = label;
- else
- {
- label_name = merge_qualified_name (label_id, label);
- /* Issue an error if we try to reuse a label that was previously
- declared */
- if (IDENTIFIER_LOCAL_VALUE (label_name))
- {
- EXPR_WFL_LINECOL (wfl_operator) = location;
- parse_error_context (wfl_operator, "Declaration of `%s' shadows "
- "a previous label declaration",
- IDENTIFIER_POINTER (label));
- EXPR_WFL_LINECOL (wfl_operator) =
- EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
- parse_error_context (wfl_operator, "This is the location of the "
- "previous declaration of label `%s'",
- IDENTIFIER_POINTER (label));
- java_error_count--;
- }
- }
-
- label_decl = create_label_decl (label_name);
- node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE);
- EXPR_WFL_LINECOL (node) = location;
- TREE_SIDE_EFFECTS (node) = 1;
- return node;
-}
-
-/* A labeled statement LBE is attached a statement. */
-
-static tree
-finish_labeled_statement (lbe, statement)
- tree lbe; /* Labeled block expr */
- tree statement;
-{
- /* In anyways, tie the loop to its statement */
- LABELED_BLOCK_BODY (lbe) = statement;
- pop_labeled_block ();
- POP_LABELED_BLOCK ();
- return lbe;
-}
-
-/* 14.10, 14.11, 14.12 Loop Statements */
-
-/* Create an empty LOOP_EXPR and make it the last in the nested loop
- list. */
-
-static tree
-build_new_loop (loop_body)
- tree loop_body;
-{
- tree loop = build (LOOP_EXPR, NULL_TREE, loop_body);
- TREE_SIDE_EFFECTS (loop) = 1;
- PUSH_LOOP (loop);
- return loop;
-}
-
-/* Create a loop body according to the following structure:
- COMPOUND_EXPR
- COMPOUND_EXPR (loop main body)
- EXIT_EXPR (this order is for while/for loops.
- LABELED_BLOCK_EXPR the order is reversed for do loops)
- LABEL_DECL (a continue occuring here branches at the
- BODY end of this labeled block)
- INCREMENT (if any)
-
- REVERSED, if non zero, tells that the loop condition expr comes
- after the body, like in the do-while loop.
-
- To obtain a loop, the loop body structure described above is
- encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
-
- LABELED_BLOCK_EXPR
- LABEL_DECL (use this label to exit the loop)
- LOOP_EXPR
- <structure described above> */
-
-static tree
-build_loop_body (location, condition, reversed)
- int location;
- tree condition;
- int reversed;
-{
- tree first, second, body;
-
- condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */
- EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */
- condition = build_debugable_stmt (location, condition);
- TREE_SIDE_EFFECTS (condition) = 1;
-
- body = build_labeled_block (0, continue_identifier_node);
- first = (reversed ? body : condition);
- second = (reversed ? condition : body);
- return
- build (COMPOUND_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
-}
-
-/* Install CONDITION (if any) and loop BODY (using REVERSED to tell
- their order) on the current loop. Unlink the current loop from the
- loop list. */
-
-static tree
-finish_loop_body (location, condition, body, reversed)
- int location;
- tree condition, body;
- int reversed;
-{
- tree to_return = ctxp->current_loop;
- tree loop_body = LOOP_EXPR_BODY (to_return);
- if (condition)
- {
- tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed);
- /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
- The real EXIT_EXPR is one operand further. */
- EXPR_WFL_LINECOL (cnode) = location;
- /* This one is for accurate error reports */
- EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location;
- TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition;
- }
- LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body;
- POP_LOOP ();
- return to_return;
-}
-
-/* Tailored version of finish_loop_body for FOR loops, when FOR
- loops feature the condition part */
-
-static tree
-finish_for_loop (location, condition, update, body)
- int location;
- tree condition, update, body;
-{
- /* Put the condition and the loop body in place */
- tree loop = finish_loop_body (location, condition, body, 0);
- /* LOOP is the current loop which has been now popped of the loop
- stack. Install the update block */
- LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
- return loop;
-}
-
-/* If the loop isn't surrounded by a labeled statement, create one and
- insert LOOP as its body. */
-
-static tree
-patch_loop_statement (loop)
- tree loop;
-{
- tree loop_label;
- tree block = ctxp->current_labeled_block;
- TREE_TYPE (loop) = void_type_node;
- if (block != NULL_TREE)
- {
- tree block_body = LABELED_BLOCK_BODY (block);
- if (IS_FOR_LOOP_P (loop))
- {
- if (TREE_CODE (block_body) == BLOCK)
- {
- block_body = BLOCK_EXPR_BODY (block_body);
- if (block_body == loop
- || (TREE_CODE (block_body) == COMPOUND_EXPR
- && TREE_OPERAND (block_body, 1) == loop))
- return loop;
- }
- }
- else
- {
- if (block_body == loop)
- return loop;
- }
- }
- loop_label = build_labeled_block (0, NULL_TREE);
- LABELED_BLOCK_BODY (loop_label) = loop;
- PUSH_LABELED_BLOCK (loop_label);
- loop = loop_label;
- return loop;
-}
-
-/* 14.13, 14.14: break and continue Statements */
-
-/* Build a break or a continue statement. a null NAME indicates an
- unlabeled break/continue statement. */
-
-static tree
-build_bc_statement (location, is_break, name)
- int location, is_break;
- tree name;
-{
- tree break_continue, label_block_expr = NULL_TREE;
-
- if (name)
- {
- if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
- (merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
- /* Null means that we don't have a target for this named
- break/continue. In this case, we make the target to be the
- label name, so that the error can be reported accuratly in
- patch_bc_statement. */
- label_block_expr = EXPR_WFL_NODE (name);
- }
- /* Unlabeled break/continue will be handled during the
- break/continue patch operation */
- break_continue
- = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
-
- IS_BREAK_STMT_P (break_continue) = is_break;
- TREE_SIDE_EFFECTS (break_continue) = 1;
- EXPR_WFL_LINECOL (break_continue) = location;
- break_continue = build_debugable_stmt (location, break_continue);
- return break_continue;
-}
-
-/* Verification of a break/continue statement. */
-
-static tree
-patch_bc_statement (node)
- tree node;
-{
- tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
- tree labeled_block = ctxp->current_labeled_block;
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* Having an identifier here means that the target is unknown. */
- if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE)
- {
- parse_error_context (wfl_operator, "No label definition found for `%s'",
- IDENTIFIER_POINTER (bc_label));
- return error_mark_node;
- }
- if (! IS_BREAK_STMT_P (node))
- {
- /* It's a continue statement. */
- for (;; labeled_block = TREE_CHAIN (labeled_block))
- {
- if (labeled_block == NULL_TREE)
- {
- if (bc_label == NULL_TREE)
- parse_error_context (wfl_operator,
- "`continue' must be in loop");
- else
- parse_error_context
- (wfl_operator, "continue label `%s' does not name a loop",
- IDENTIFIER_POINTER (bc_label));
- return error_mark_node;
- }
- if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block))
- == continue_identifier_node)
- && (bc_label == NULL_TREE
- || TREE_CHAIN (labeled_block) == bc_label))
- {
- bc_label = labeled_block;
- break;
- }
- }
- }
- else if (!bc_label)
- {
- for (;; labeled_block = TREE_CHAIN (labeled_block))
- {
- if (labeled_block == NULL_TREE)
- {
- parse_error_context (wfl_operator,
- "`break' must be in loop or switch");
- return error_mark_node;
- }
- target_stmt = LABELED_BLOCK_BODY (labeled_block);
- if (TREE_CODE (target_stmt) == SWITCH_EXPR
- || TREE_CODE (target_stmt) == LOOP_EXPR)
- {
- bc_label = labeled_block;
- break;
- }
- }
- }
-
- EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
- CAN_COMPLETE_NORMALLY (bc_label) = 1;
-
- /* Our break/continue don't return values. */
- TREE_TYPE (node) = void_type_node;
- /* Encapsulate the break within a compound statement so that it's
- expanded all the times by expand_expr (and not clobered
- sometimes, like after a if statement) */
- node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
- TREE_SIDE_EFFECTS (node) = 1;
- return node;
-}
-
-/* Process the exit expression belonging to a loop. Its type must be
- boolean. */
-
-static tree
-patch_exit_expr (node)
- tree node;
-{
- tree expression = TREE_OPERAND (node, 0);
- TREE_TYPE (node) = error_mark_node;
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
- /* The type of expression must be boolean */
- if (TREE_TYPE (expression) != boolean_type_node)
- {
- parse_error_context
- (wfl_operator,
- "Incompatible type for loop conditional. Can't convert `%s' to "
- "`boolean'",
- lang_printable_name (TREE_TYPE (expression), 0));
- return error_mark_node;
- }
- /* Now we know things are allright, invert the condition, fold and
- return */
- TREE_OPERAND (node, 0) =
- fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
-
- if (! integer_zerop (TREE_OPERAND (node, 0))
- && ctxp->current_loop != NULL_TREE
- && TREE_CODE (ctxp->current_loop) == LOOP_EXPR)
- CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1;
- if (! integer_onep (TREE_OPERAND (node, 0)))
- CAN_COMPLETE_NORMALLY (node) = 1;
-
-
- TREE_TYPE (node) = void_type_node;
- return node;
-}
-
-/* 14.9 Switch statement */
-
-static tree
-patch_switch_statement (node)
- tree node;
-{
- tree se = TREE_OPERAND (node, 0), se_type;
-
- /* Complete the switch expression */
- se = TREE_OPERAND (node, 0) = java_complete_tree (se);
- se_type = TREE_TYPE (se);
- /* The type of the switch expression must be char, byte, short or
- int */
- if (!JINTEGRAL_TYPE_P (se_type))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator, "Incompatible type for `switch'. "
- "Can't convert `%s' to `int'",
- lang_printable_name (se_type, 0));
- /* This is what java_complete_tree will check */
- TREE_OPERAND (node, 0) = error_mark_node;
- return error_mark_node;
- }
-
- TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
-
- /* Ready to return */
- if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK)
- {
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
- TREE_TYPE (node) = void_type_node;
- TREE_SIDE_EFFECTS (node) = 1;
- CAN_COMPLETE_NORMALLY (node)
- = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
- || ! SWITCH_HAS_DEFAULT (node);
- return node;
-}
-
-/* 14.18 The try statement */
-
-static tree
-build_try_statement (location, try_block, catches)
- int location;
- tree try_block, catches;
-{
- tree node = build (TRY_EXPR, NULL_TREE, try_block, catches);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-static tree
-build_try_finally_statement (location, try_block, finally)
- int location;
- tree try_block, finally;
-{
- tree node = build (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-static tree
-patch_try_statement (node)
- tree node;
-{
- int error_found = 0;
- tree try = TREE_OPERAND (node, 0);
- /* Exception handlers are considered in left to right order */
- tree catch = nreverse (TREE_OPERAND (node, 1));
- tree current, caught_type_list = NULL_TREE;
-
- /* Check catch clauses, if any. Every time we find an error, we try
- to process the next catch clause. We process the catch clause before
- the try block so that when processing the try block we can check thrown
- exceptions againts the caught type list. */
- for (current = catch; current; current = TREE_CHAIN (current))
- {
- tree carg_decl, carg_type;
- tree sub_current, catch_block, catch_clause;
- int unreachable;
-
- /* At this point, the structure of the catch clause is
- CATCH_EXPR (catch node)
- BLOCK (with the decl of the parameter)
- COMPOUND_EXPR
- MODIFY_EXPR (assignment of the catch parameter)
- BLOCK (catch clause block)
- */
- catch_clause = TREE_OPERAND (current, 0);
- carg_decl = BLOCK_EXPR_DECLS (catch_clause);
- carg_type = TREE_TYPE (TREE_TYPE (carg_decl));
-
- /* Catch clauses can't have more than one parameter declared,
- but it's already enforced by the grammar. Make sure that the
- only parameter of the clause statement in of class Throwable
- or a subclass of Throwable, but that was done earlier. The
- catch clause parameter type has also been resolved. */
-
- /* Just make sure that the catch clause parameter type inherits
- from java.lang.Throwable */
- if (!inherits_from_p (carg_type, throwable_type_node))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
- parse_error_context (wfl_operator,
- "Can't catch class `%s'. Catch clause "
- "parameter type must be a subclass of "
- "class `java.lang.Throwable'",
- lang_printable_name (carg_type, 0));
- error_found = 1;
- continue;
- }
-
- /* Partial check for unreachable catch statement: The catch
- clause is reachable iff is no earlier catch block A in
- the try statement such that the type of the catch
- clause's parameter is the same as or a subclass of the
- type of A's parameter */
- unreachable = 0;
- for (sub_current = catch;
- sub_current != current; sub_current = TREE_CHAIN (sub_current))
- {
- tree sub_catch_clause, decl;
- sub_catch_clause = TREE_OPERAND (sub_current, 0);
- decl = BLOCK_EXPR_DECLS (sub_catch_clause);
-
- if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl))))
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
- parse_error_context
- (wfl_operator, "`catch' not reached because of the catch "
- "clause at line %d", EXPR_WFL_LINENO (sub_current));
- unreachable = error_found = 1;
- break;
- }
- }
- /* Complete the catch clause block */
- catch_block = java_complete_tree (TREE_OPERAND (current, 0));
- if (catch_block == error_mark_node)
- {
- error_found = 1;
- continue;
- }
- if (CAN_COMPLETE_NORMALLY (catch_block))
- CAN_COMPLETE_NORMALLY (node) = 1;
- TREE_OPERAND (current, 0) = catch_block;
-
- if (unreachable)
- continue;
-
- /* Things to do here: the exception must be thrown */
-
- /* Link this type to the caught type list */
- caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list);
- }
-
- PUSH_EXCEPTIONS (caught_type_list);
- if ((try = java_complete_tree (try)) == error_mark_node)
- error_found = 1;
- if (CAN_COMPLETE_NORMALLY (try))
- CAN_COMPLETE_NORMALLY (node) = 1;
- POP_EXCEPTIONS ();
-
- /* Verification ends here */
- if (error_found)
- return error_mark_node;
-
- TREE_OPERAND (node, 0) = try;
- TREE_OPERAND (node, 1) = catch;
- TREE_TYPE (node) = void_type_node;
- return node;
-}
-
-/* 14.17 The synchronized Statement */
-
-static tree
-patch_synchronized_statement (node, wfl_op1)
- tree node, wfl_op1;
-{
- tree expr = java_complete_tree (TREE_OPERAND (node, 0));
- tree block = TREE_OPERAND (node, 1);
-
- tree enter, exit, expr_decl, assignment;
-
- if (expr == error_mark_node)
- {
- block = java_complete_tree (block);
- return expr;
- }
-
- /* The TYPE of expr must be a reference type */
- if (!JREFERENCE_TYPE_P (TREE_TYPE (expr)))
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Incompatible type for `synchronized'"
- ". Can't convert `%s' to `java.lang.Object'",
- lang_printable_name (TREE_TYPE (expr), 0));
- return error_mark_node;
- }
-
- if (flag_emit_xref)
- {
- TREE_OPERAND (node, 0) = expr;
- TREE_OPERAND (node, 1) = java_complete_tree (block);
- CAN_COMPLETE_NORMALLY (node) = 1;
- return node;
- }
-
- /* Generate a try-finally for the synchronized statement, except
- that the handler that catches all throw exception calls
- _Jv_MonitorExit and then rethrow the exception.
- The synchronized statement is then implemented as:
- TRY
- {
- _Jv_MonitorEnter (expression)
- synchronized_block
- _Jv_MonitorExit (expression)
- }
- CATCH_ALL
- {
- e = _Jv_exception_info ();
- _Jv_MonitorExit (expression)
- Throw (e);
- } */
-
- expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr));
- BUILD_MONITOR_ENTER (enter, expr_decl);
- BUILD_MONITOR_EXIT (exit, expr_decl);
- CAN_COMPLETE_NORMALLY (enter) = 1;
- CAN_COMPLETE_NORMALLY (exit) = 1;
- assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
- TREE_SIDE_EFFECTS (assignment) = 1;
- node = build1 (CLEANUP_POINT_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE,
- build (WITH_CLEANUP_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE,
- assignment, enter),
- NULL_TREE, exit),
- block));
- node = build_expr_block (node, expr_decl);
-
- return java_complete_tree (node);
-}
-
-/* 14.16 The throw Statement */
-
-static tree
-patch_throw_statement (node, wfl_op1)
- tree node, wfl_op1;
-{
- tree expr = TREE_OPERAND (node, 0);
- tree type = TREE_TYPE (expr);
- int unchecked_ok = 0, tryblock_throws_ok = 0;
-
- /* Thrown expression must be assignable to java.lang.Throwable */
- if (!try_reference_assignconv (throwable_type_node, expr))
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Can't throw `%s'; it must be a "
- "subclass of class `java.lang.Throwable'",
- lang_printable_name (type, 0));
- /* If the thrown expression was a reference, we further the
- compile-time check. */
- if (!JREFERENCE_TYPE_P (type))
- return error_mark_node;
- }
-
- /* At least one of the following must be true */
-
- /* The type of the throw expression is a not checked exception,
- i.e. is a unchecked expression. */
- unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type));
-
- /* Throw is contained in a try statement and at least one catch
- clause can receive the thrown expression or the current method is
- declared to throw such an exception. Or, the throw statement is
- contained in a method or constructor declaration and the type of
- the Expression is assignable to at least one type listed in the
- throws clause the declaration. */
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- if (!unchecked_ok)
- tryblock_throws_ok = check_thrown_exceptions_do (TREE_TYPE (expr));
- if (!(unchecked_ok || tryblock_throws_ok))
- {
- /* If there is a surrounding try block that has no matching
- clatch clause, report it first. A surrounding try block exits
- only if there is something after the list of checked
- exception thrown by the current function (if any). */
- if (IN_TRY_BLOCK_P ())
- parse_error_context (wfl_operator, "Checked exception `%s' can't be "
- "caught by any of the catch clause(s) "
- "of the surrounding `try' block",
- lang_printable_name (type, 0));
- /* If we have no surrounding try statement and the method doesn't have
- any throws, report it now. FIXME */
-
- /* We report that the exception can't be throw from a try block
- in all circumstances but when the `throw' is inside a static
- block. */
- else if (!EXCEPTIONS_P (currently_caught_type_list)
- && !tryblock_throws_ok)
- {
- if (IS_CLINIT (current_function_decl))
- parse_error_context (wfl_operator, "Checked exception `%s' can't "
- "be thrown in initializer",
- lang_printable_name (type, 0));
- else
- parse_error_context (wfl_operator, "Checked exception `%s' isn't "
- "thrown from a `try' block",
- lang_printable_name (type, 0));
- }
- /* Otherwise, the current method doesn't have the appropriate
- throws declaration */
- else
- parse_error_context (wfl_operator, "Checked exception `%s' doesn't "
- "match any of current method's `throws' "
- "declaration(s)",
- lang_printable_name (type, 0));
- return error_mark_node;
- }
-
- if (! flag_emit_class_files && ! flag_emit_xref)
- BUILD_THROW (node, expr);
-
- /* If doing xrefs, keep the location where the `throw' was seen. */
- if (flag_emit_xref)
- EXPR_WFL_LINECOL (node) = EXPR_WFL_LINECOL (wfl_op1);
- return node;
-}
-
-/* Check that exception said to be thrown by method DECL can be
- effectively caught from where DECL is invoked. */
-
-static void
-check_thrown_exceptions (location, decl)
- int location;
- tree decl;
-{
- tree throws;
- /* For all the unchecked exceptions thrown by DECL */
- for (throws = DECL_FUNCTION_THROWS (decl); throws;
- throws = TREE_CHAIN (throws))
- if (!check_thrown_exceptions_do (TREE_VALUE (throws)))
- {
-#if 1
- /* Temporary hack to suppresses errors about cloning arrays. FIXME */
- if (DECL_NAME (decl) == get_identifier ("clone"))
- continue;
-#endif
- EXPR_WFL_LINECOL (wfl_operator) = location;
- parse_error_context
- (wfl_operator, "Exception `%s' must be caught, or it must be "
- "declared in the `throws' clause of `%s'",
- lang_printable_name (TREE_VALUE (throws), 0),
- IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
- }
-}
-
-/* Return 1 if checked EXCEPTION is caught at the current nesting level of
- try-catch blocks, OR is listed in the `throws' clause of the
- current method. */
-
-static int
-check_thrown_exceptions_do (exception)
- tree exception;
-{
- tree list = currently_caught_type_list;
- resolve_and_layout (exception, NULL_TREE);
- /* First, all the nested try-catch-finally at that stage. The
- last element contains `throws' clause exceptions, if any. */
- if (IS_UNCHECKED_EXCEPTION_P (exception))
- return 1;
- while (list)
- {
- tree caught;
- for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught))
- if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0))
- return 1;
- list = TREE_CHAIN (list);
- }
- return 0;
-}
-
-static void
-purge_unchecked_exceptions (mdecl)
- tree mdecl;
-{
- tree throws = DECL_FUNCTION_THROWS (mdecl);
- tree new = NULL_TREE;
-
- while (throws)
- {
- tree next = TREE_CHAIN (throws);
- if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws)))
- {
- TREE_CHAIN (throws) = new;
- new = throws;
- }
- throws = next;
- }
- /* List is inverted here, but it doesn't matter */
- DECL_FUNCTION_THROWS (mdecl) = new;
-}
-
-/* 15.24 Conditional Operator ?: */
-
-static tree
-patch_conditional_expr (node, wfl_cond, wfl_op1)
- tree node, wfl_cond, wfl_op1;
-{
- tree cond = TREE_OPERAND (node, 0);
- tree op1 = TREE_OPERAND (node, 1);
- tree op2 = TREE_OPERAND (node, 2);
- tree resulting_type = NULL_TREE;
- tree t1, t2, patched;
- int error_found = 0;
-
- /* Operands of ?: might be StringBuffers crafted as a result of a
- string concatenation. Obtain a descent operand here. */
- if ((patched = patch_string (op1)))
- TREE_OPERAND (node, 1) = op1 = patched;
- if ((patched = patch_string (op2)))
- TREE_OPERAND (node, 2) = op2 = patched;
-
- t1 = TREE_TYPE (op1);
- t2 = TREE_TYPE (op2);
-
- /* The first expression must be a boolean */
- if (TREE_TYPE (cond) != boolean_type_node)
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);
- parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
- "convert `%s' to `boolean'",
- lang_printable_name (TREE_TYPE (cond), 0));
- error_found = 1;
- }
-
- /* Second and third can be numeric, boolean (i.e. primitive),
- references or null. Anything else results in an error */
- if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))
- || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node)
- && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))
- || (t1 == boolean_type_node && t2 == boolean_type_node)))
- error_found = 1;
-
- /* Determine the type of the conditional expression. Same types are
- easy to deal with */
- else if (t1 == t2)
- resulting_type = t1;
-
- /* There are different rules for numeric types */
- else if (JNUMERIC_TYPE_P (t1))
- {
- /* if byte/short found, the resulting type is short */
- if ((t1 == byte_type_node && t2 == short_type_node)
- || (t1 == short_type_node && t2 == byte_type_node))
- resulting_type = short_type_node;
-
- /* If t1 is a constant int and t2 is of type byte, short or char
- and t1's value fits in t2, then the resulting type is t2 */
- else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1)))
- && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2))
- resulting_type = t2;
-
- /* If t2 is a constant int and t1 is of type byte, short or char
- and t2's value fits in t1, then the resulting type is t1 */
- else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2)))
- && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1))
- resulting_type = t1;
-
- /* Otherwise, binary numeric promotion is applied and the
- resulting type is the promoted type of operand 1 and 2 */
- else
- resulting_type = binary_numeric_promotion (t1, t2,
- &TREE_OPERAND (node, 1),
- &TREE_OPERAND (node, 2));
- }
-
- /* Cases of a reference and a null type */
- else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node)
- resulting_type = t1;
-
- else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node)
- resulting_type = t2;
-
- /* Last case: different reference types. If a type can be converted
- into the other one by assignment conversion, the latter
- determines the type of the expression */
- else if ((resulting_type = try_reference_assignconv (t1, op2)))
- resulting_type = promote_type (t1);
-
- else if ((resulting_type = try_reference_assignconv (t2, op1)))
- resulting_type = promote_type (t2);
-
- /* If we don't have any resulting type, we're in trouble */
- if (!resulting_type)
- {
- char *t = strdup (lang_printable_name (t1, 0));
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
- "convert `%s' to `%s'", t,
- lang_printable_name (t2, 0));
- free (t);
- error_found = 1;
- }
-
- if (error_found)
- {
- TREE_TYPE (node) = error_mark_node;
- return error_mark_node;
- }
-
- TREE_TYPE (node) = resulting_type;
- TREE_SET_CODE (node, COND_EXPR);
- CAN_COMPLETE_NORMALLY (node) = 1;
- return node;
-}
-
-/* Try to constant fold NODE.
- If NODE is not a constant expression, return NULL_EXPR.
- CONTEXT is a static final VAR_DECL whose initializer we are folding. */
-
-static tree
-fold_constant_for_init (node, context)
- tree node;
- tree context;
-{
- tree op0, op1, val;
- enum tree_code code = TREE_CODE (node);
-
- if (code == STRING_CST)
- return node;
-
- if (code == INTEGER_CST || code == REAL_CST)
- return convert (TREE_TYPE (context), node);
- if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
- return NULL_TREE;
-
- switch (code)
- {
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_MOD_EXPR:
- case RDIV_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case URSHIFT_EXPR:
- case BIT_AND_EXPR:
- case BIT_XOR_EXPR:
- case BIT_IOR_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- op0 = TREE_OPERAND (node, 0);
- op1 = TREE_OPERAND (node, 1);
- val = fold_constant_for_init (op0, context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 0) = val;
- val = fold_constant_for_init (op1, context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 1) = val;
- return patch_binop (node, op0, op1);
-
- case UNARY_PLUS_EXPR:
- case NEGATE_EXPR:
- case TRUTH_NOT_EXPR:
- case BIT_NOT_EXPR:
- case CONVERT_EXPR:
- op0 = TREE_OPERAND (node, 0);
- val = fold_constant_for_init (op0, context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 0) = val;
- return patch_unaryop (node, op0);
- break;
-
- case COND_EXPR:
- val = fold_constant_for_init (TREE_OPERAND (node, 0), context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 0) = val;
- val = fold_constant_for_init (TREE_OPERAND (node, 1), context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 1) = val;
- val = fold_constant_for_init (TREE_OPERAND (node, 2), context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 2) = val;
- return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1)
- : TREE_OPERAND (node, 2);
-
- case VAR_DECL:
- case FIELD_DECL:
- if (! FIELD_FINAL (node)
- || DECL_INITIAL (node) == NULL_TREE)
- return NULL_TREE;
- val = DECL_INITIAL (node);
- /* Guard against infinite recursion. */
- DECL_INITIAL (node) = NULL_TREE;
- val = fold_constant_for_init (val, node);
- DECL_INITIAL (node) = val;
- return val;
-
- case EXPR_WITH_FILE_LOCATION:
- /* Compare java_complete_tree and resolve_expression_name. */
- if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
- || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
- {
- tree name = EXPR_WFL_NODE (node);
- tree decl;
- if (PRIMARY_P (node))
- return NULL_TREE;
- else if (! QUALIFIED_P (name))
- {
- decl = lookup_field_wrapper (DECL_CONTEXT (context), name);
- if (decl == NULL_TREE
- || (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl)))
- return NULL_TREE;
- return fold_constant_for_init (decl, decl);
- }
- else
- {
- /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
- qualify_ambiguous_name (node);
- if (resolve_field_access (node, &decl, NULL)
- && decl != NULL_TREE)
- return fold_constant_for_init (decl, decl);
- return NULL_TREE;
- }
- }
- else
- {
- op0 = TREE_OPERAND (node, 0);
- val = fold_constant_for_init (op0, context);
- if (val == NULL_TREE || ! TREE_CONSTANT (val))
- return NULL_TREE;
- TREE_OPERAND (node, 0) = val;
- return val;
- }
-
-#ifdef USE_COMPONENT_REF
- case IDENTIFIER:
- case COMPONENT_REF:
- ?;
-#endif
-
- default:
- return NULL_TREE;
- }
-}
-
-#ifdef USE_COMPONENT_REF
-/* Context is 'T' for TypeName, 'P' for PackageName,
- 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
-
-tree
-resolve_simple_name (name, context)
- tree name;
- int context;
-{
-}
-
-tree
-resolve_qualified_name (name, context)
- tree name;
- int context;
-{
-}
-#endif
diff --git a/gnu/dist/toolchain/gcc/java/typeck.c b/gnu/dist/toolchain/gcc/java/typeck.c
deleted file mode 100644
index 141624513ea..00000000000
--- a/gnu/dist/toolchain/gcc/java/typeck.c
+++ /dev/null
@@ -1,798 +0,0 @@
-/* Handle types for the GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com> */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "obstack.h"
-#include "flags.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "convert.h"
-#include "toplev.h"
-
-tree * type_map;
-extern struct obstack permanent_obstack;
-
-/* Set the type of the local variable with index SLOT to TYPE. */
-
-void
-set_local_type (slot, type)
- int slot;
- tree type;
-{
- int max_locals = DECL_MAX_LOCALS(current_function_decl);
- int nslots = TYPE_IS_WIDE (type) ? 2 : 1;
- if (slot < 0 || slot + nslots - 1 >= max_locals)
- fatal ("invalid local variable index");
- type_map[slot] = type;
- while (--nslots > 0)
- type_map[++slot] = void_type_node;
-}
-
-/* Convert an IEEE real to an integer type. The result of such a
- conversion when the source operand is a NaN isn't defined by
- IEEE754, but by the Java language standard: it must be zero. This
- conversion produces something like:
-
- ({ double tmp = expr; (tmp != tmp) ? 0 : (int)tmp; })
-
- */
-
-static tree
-convert_ieee_real_to_integer (type, expr)
- tree type, expr;
-{
- expr = save_expr (expr);
-
- return build (COND_EXPR, type,
- build (NE_EXPR, boolean_type_node, expr, expr),
- convert (type, integer_zero_node),
- convert_to_integer (type, expr));
-}
-
-/* Create an expression whose value is that of EXPR,
- converted to type TYPE. The TREE_TYPE of the value
- is always TYPE. This function implements all reasonable
- conversions; callers should filter out those that are
- not permitted by the language being compiled. */
-
-tree
-convert (type, expr)
- tree type, expr;
-{
- register enum tree_code code = TREE_CODE (type);
-
- if (do_not_fold)
- return build1 (NOP_EXPR, type, expr);
-
- if (type == TREE_TYPE (expr)
- || TREE_CODE (expr) == ERROR_MARK)
- return expr;
- if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
- return error_mark_node;
- if (code == VOID_TYPE)
- return build1 (CONVERT_EXPR, type, expr);
- if (code == BOOLEAN_TYPE)
- return fold (convert_to_boolean (type, expr));
- if (code == INTEGER_TYPE)
- {
- if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
-#ifdef TARGET_SOFT_FLOAT
- && !TARGET_SOFT_FLOAT
-#endif
- && !flag_emit_class_files
- && !flag_fast_math
- && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
- return fold (convert_ieee_real_to_integer (type, expr));
- else
- return fold (convert_to_integer (type, expr));
- }
- if (code == REAL_TYPE)
- return fold (convert_to_real (type, expr));
- if (code == CHAR_TYPE)
- return fold (convert_to_char (type, expr));
- if (code == POINTER_TYPE)
- return fold (convert_to_pointer (type, expr));
- error ("conversion to non-scalar type requested");
- return error_mark_node;
-}
-
-
-tree
-convert_to_char (type, expr)
- tree type, expr;
-{
- return build1 (NOP_EXPR, type, expr);
-}
-
-tree
-convert_to_boolean (type, expr)
- tree type, expr;
-{
- return build1 (NOP_EXPR, type, expr);
-}
-
-/* Print an error message for invalid use of an incomplete type.
- VALUE is the expression that was used (or 0 if that isn't known)
- and TYPE is the type that was invalid. */
-
-void
-incomplete_type_error (value, type)
- tree value ATTRIBUTE_UNUSED;
- tree type ATTRIBUTE_UNUSED;
-{
- error ("internal error - use of undefined type");
-}
-
-/* Return a data type that has machine mode MODE.
- If the mode is an integer,
- then UNSIGNEDP selects between signed and unsigned types. */
-
-tree
-type_for_mode (mode, unsignedp)
- enum machine_mode mode;
- int unsignedp;
-{
- if (mode == TYPE_MODE (int_type_node))
- return unsignedp ? unsigned_int_type_node : int_type_node;
- if (mode == TYPE_MODE (long_type_node))
- return unsignedp ? unsigned_long_type_node : long_type_node;
- if (mode == TYPE_MODE (short_type_node))
- return unsignedp ? unsigned_short_type_node : short_type_node;
- if (mode == TYPE_MODE (byte_type_node))
- return unsignedp ? unsigned_byte_type_node : byte_type_node;
- if (mode == TYPE_MODE (float_type_node))
- return float_type_node;
- if (mode == TYPE_MODE (double_type_node))
- return double_type_node;
-
- return 0;
-}
-
-/* Return an integer type with BITS bits of precision,
- that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
-
-tree
-type_for_size (bits, unsignedp)
- unsigned bits;
- int unsignedp;
-{
- if (bits <= TYPE_PRECISION (byte_type_node))
- return unsignedp ? unsigned_byte_type_node : byte_type_node;
- if (bits <= TYPE_PRECISION (short_type_node))
- return unsignedp ? unsigned_short_type_node : short_type_node;
- if (bits <= TYPE_PRECISION (int_type_node))
- return unsignedp ? unsigned_int_type_node : int_type_node;
- if (bits <= TYPE_PRECISION (long_type_node))
- return unsignedp ? unsigned_long_type_node : long_type_node;
- return 0;
-}
-
-/* Return a type the same as TYPE except unsigned or
- signed according to UNSIGNEDP. */
-
-tree
-signed_or_unsigned_type (unsignedp, type)
- int unsignedp;
- tree type;
-{
- if (! INTEGRAL_TYPE_P (type))
- return type;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (int_type_node))
- return unsignedp ? unsigned_int_type_node : int_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (byte_type_node))
- return unsignedp ? unsigned_byte_type_node : byte_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (short_type_node))
- return unsignedp ? unsigned_short_type_node : short_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (long_type_node))
- return unsignedp ? unsigned_long_type_node : long_type_node;
- return type;
-}
-
-/* Return a signed type the same as TYPE in other respects. */
-
-tree
-signed_type (type)
- tree type;
-{
- return signed_or_unsigned_type (0, type);
-}
-
-/* Return an unsigned type the same as TYPE in other respects. */
-
-tree
-unsigned_type (type)
- tree type;
-{
- return signed_or_unsigned_type (1, type);
-
-}
-
-/* Mark EXP saying that we need to be able to take the
- address of it; it should not be allocated in a register.
- Value is 1 if successful. */
-
-int
-mark_addressable (exp)
- tree exp;
-{
- register tree x = exp;
- while (1)
- switch (TREE_CODE (x))
- {
- case ADDR_EXPR:
- case COMPONENT_REF:
- case ARRAY_REF:
- case REALPART_EXPR:
- case IMAGPART_EXPR:
- x = TREE_OPERAND (x, 0);
- break;
-
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case COMPOUND_EXPR:
- x = TREE_OPERAND (x, 1);
- break;
-
- case COND_EXPR:
- return mark_addressable (TREE_OPERAND (x, 1))
- & mark_addressable (TREE_OPERAND (x, 2));
-
- case CONSTRUCTOR:
- TREE_ADDRESSABLE (x) = 1;
- return 1;
-
- case INDIRECT_REF:
- /* We sometimes add a cast *(TYPE*)&FOO to handle type and mode
- incompatibility problems. Handle this case by marking FOO. */
- if (TREE_CODE (TREE_OPERAND (x, 0)) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (TREE_OPERAND (x, 0), 0)) == ADDR_EXPR)
- {
- x = TREE_OPERAND (TREE_OPERAND (x, 0), 0);
- break;
- }
- if (TREE_CODE (TREE_OPERAND (x, 0)) == ADDR_EXPR)
- {
- x = TREE_OPERAND (x, 0);
- break;
- }
- return 1;
-
- case VAR_DECL:
- case CONST_DECL:
- case PARM_DECL:
- case RESULT_DECL:
- case FUNCTION_DECL:
- TREE_ADDRESSABLE (x) = 1;
-#if 0 /* poplevel deals with this now. */
- if (DECL_CONTEXT (x) == 0)
- TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (x)) = 1;
-#endif
- /* drops through */
- default:
- return 1;
- }
-}
-
-/* Thorough checking of the arrayness of TYPE. */
-
-int
-is_array_type_p (type)
- tree type;
-{
- return TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
- && TYPE_ARRAY_P (TREE_TYPE (type));
-}
-
-/* Return the length of a Java array type.
- Return -1 if the length is unknown or non-constant. */
-
-HOST_WIDE_INT
-java_array_type_length (array_type)
- tree array_type;
-{
- tree arfld;
- if (TREE_CODE (array_type) == POINTER_TYPE)
- array_type = TREE_TYPE (array_type);
- arfld = TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (array_type)));
- if (arfld != NULL_TREE)
- {
- tree index_type = TYPE_DOMAIN (TREE_TYPE (arfld));
- tree high = TYPE_MAX_VALUE (index_type);
- if (TREE_CODE (high) == INTEGER_CST)
- return TREE_INT_CST_LOW (high) + 1;
- }
- return -1;
-}
-
-tree
-build_prim_array_type (element_type, length)
- tree element_type;
- HOST_WIDE_INT length;
-{
- tree max_index = build_int_2 (length - 1, 0);
- TREE_TYPE (max_index) = sizetype;
- return build_array_type (element_type, build_index_type (max_index));
-}
-
-/* Return a Java array type with a given ELEMENT_TYPE and LENGTH.
- These are hashed (shared) using IDENTIFIER_SIGNATURE_TYPE.
- The LENGTH is -1 if the length is unknown. */
-
-tree
-build_java_array_type (element_type, length)
- tree element_type;
- HOST_WIDE_INT length;
-{
- tree sig, t, fld;
- char buf[12];
- tree elsig = build_java_signature (element_type);
- tree el_name = element_type;
- sprintf (buf, length >= 0 ? "[%d" : "[", length);
- sig = ident_subst (IDENTIFIER_POINTER (elsig), IDENTIFIER_LENGTH (elsig),
- buf, 0, 0, "");
- t = IDENTIFIER_SIGNATURE_TYPE (sig);
- if (t != NULL_TREE)
- return TREE_TYPE (t);
- t = make_class ();
- IDENTIFIER_SIGNATURE_TYPE (sig) = build_pointer_type (t);
- TYPE_ARRAY_P (t) = 1;
-
- if (TREE_CODE (el_name) == POINTER_TYPE)
- el_name = TREE_TYPE (el_name);
- el_name = TYPE_NAME (el_name);
- if (TREE_CODE (el_name) == TYPE_DECL)
- el_name = DECL_NAME (el_name);
- TYPE_NAME (t) = identifier_subst (el_name, "", '.', '.', "[]");
-
- set_java_signature (t, sig);
- set_super_info (0, t, object_type_node, 0);
- if (TREE_CODE (element_type) == RECORD_TYPE)
- element_type = promote_type (element_type);
- TYPE_ARRAY_ELEMENT (t) = element_type;
-
- /* Add length pseudo-field. */
- push_obstacks (&permanent_obstack, &permanent_obstack);
- fld = build_decl (FIELD_DECL, get_identifier ("length"), int_type_node);
- TYPE_FIELDS (t) = fld;
- DECL_CONTEXT (fld) = t;
- FIELD_PUBLIC (fld) = 1;
- FIELD_FINAL (fld) = 1;
-
- if (length >= 0)
- {
- tree atype = build_prim_array_type (element_type, length);
- tree arfld = build_decl (FIELD_DECL, get_identifier ("data"), atype);
- DECL_CONTEXT (arfld) = t;
- TREE_CHAIN (fld) = arfld;
- }
- else
- TYPE_ALIGN (t) = TYPE_ALIGN (element_type);
- pop_obstacks ();
-
- /* We could layout_class, but that loads java.lang.Object prematurely.
- * This is called by the parser, and it is a bad idea to do load_class
- * in the middle of parsing, because of possible circularity problems. */
- push_super_field (t, object_type_node);
- layout_type (t);
-
- return t;
-}
-
-/* Promote TYPE to the type actually used for fields and parameters. */
-
-tree
-promote_type (type)
- tree type;
-{
- switch (TREE_CODE (type))
- {
- case RECORD_TYPE:
- return build_pointer_type (CLASS_TO_HANDLE_TYPE (type));
- case BOOLEAN_TYPE:
- if (type == boolean_type_node)
- return promoted_boolean_type_node;
- goto handle_int;
- case CHAR_TYPE:
- if (type == char_type_node)
- return promoted_char_type_node;
- goto handle_int;
- case INTEGER_TYPE:
- handle_int:
- if (TYPE_PRECISION (type) < TYPE_PRECISION (int_type_node))
- {
- if (type == short_type_node)
- return promoted_short_type_node;
- if (type == byte_type_node)
- return promoted_byte_type_node;
- return int_type_node;
- }
- /* ... else fall through ... */
- default:
- return type;
- }
-}
-
-/* Parse a signature string, starting at *PTR and ending at LIMIT.
- Return the seen TREE_TYPE, updating *PTR. */
-
-static tree
-parse_signature_type (ptr, limit)
- const unsigned char **ptr, *limit;
-{
- tree type;
- if ((*ptr) >= limit)
- fatal ("bad signature string");
- switch (*(*ptr))
- {
- case 'B': (*ptr)++; return byte_type_node;
- case 'C': (*ptr)++; return char_type_node;
- case 'D': (*ptr)++; return double_type_node;
- case 'F': (*ptr)++; return float_type_node;
- case 'S': (*ptr)++; return short_type_node;
- case 'I': (*ptr)++; return int_type_node;
- case 'J': (*ptr)++; return long_type_node;
- case 'Z': (*ptr)++; return boolean_type_node;
- case 'V': (*ptr)++; return void_type_node;
- case '[':
- for ((*ptr)++; (*ptr) < limit && ISDIGIT (**ptr); ) (*ptr)++;
- type = parse_signature_type (ptr, limit);
- type = build_java_array_type (type, -1);
- break;
- case 'L':
- {
- const unsigned char *start = ++(*ptr);
- register const unsigned char *str = start;
- for ( ; ; str++)
- {
- if (str >= limit)
- fatal ("bad signature string");
- if (*str == ';')
- break;
- }
- *ptr = str+1;
- type = lookup_class (unmangle_classname (start, str - start));
- break;
- }
- default:
- fatal ("unrecognized signature string");
- }
- return promote_type (type);
-}
-
-/* Parse a Java "mangled" signature string, starting at SIG_STRING,
- and SIG_LENGTH bytes long.
- Return a gcc type node. */
-
-tree
-parse_signature_string (sig_string, sig_length)
- const unsigned char *sig_string;
- int sig_length;
-{
- tree result_type;
- const unsigned char *str = sig_string;
- const unsigned char *limit = str + sig_length;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- if (str < limit && str[0] == '(')
- {
- tree argtype_list = NULL_TREE;
- str++;
- while (str < limit && str[0] != ')')
- {
- tree argtype = parse_signature_type (&str, limit);
- argtype_list = tree_cons (NULL_TREE, argtype, argtype_list);
- }
- if (str++, str >= limit)
- fatal ("bad signature string");
- result_type = parse_signature_type (&str, limit);
- argtype_list = chainon (nreverse (argtype_list), end_params_node);
- result_type = build_function_type (result_type, argtype_list);
- }
- else
- result_type = parse_signature_type (&str, limit);
- if (str != limit)
- error ("junk at end of signature string");
- pop_obstacks ();
- return result_type;
-}
-
-/* Convert a signature to its type.
- * Uses IDENTIFIER_SIGNATURE_TYPE as a cache (except for primitive types).
- */
-
-tree
-get_type_from_signature (tree signature)
-{
- unsigned char *sig = (unsigned char *) IDENTIFIER_POINTER (signature);
- int len = IDENTIFIER_LENGTH (signature);
- tree type;
- /* Primitive types aren't cached. */
- if (len <= 1)
- return parse_signature_string (sig, len);
- type = IDENTIFIER_SIGNATURE_TYPE (signature);
- if (type == NULL_TREE)
- {
- type = parse_signature_string (sig, len);
- IDENTIFIER_SIGNATURE_TYPE (signature) = type;
- }
- return type;
-}
-
-/* Return the signature string for the arguments of method type TYPE. */
-
-tree
-build_java_argument_signature (type)
- tree type;
-{
- extern struct obstack temporary_obstack;
- tree sig = TYPE_ARGUMENT_SIGNATURE (type);
- if (sig == NULL_TREE)
- {
- tree args = TYPE_ARG_TYPES (type);
- if (TREE_CODE (type) == METHOD_TYPE)
- args = TREE_CHAIN (args); /* Skip "this" argument. */
- for (; args != end_params_node; args = TREE_CHAIN (args))
- {
- tree t = build_java_signature (TREE_VALUE (args));
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (t), IDENTIFIER_LENGTH (t));
- }
- obstack_1grow (&temporary_obstack, '\0');
-
- sig = get_identifier (obstack_base (&temporary_obstack));
- TYPE_ARGUMENT_SIGNATURE (type) = sig;
- obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
- }
- return sig;
-}
-
-/* Return the signature of the given TYPE. */
-
-tree
-build_java_signature (type)
- tree type;
-{
- tree sig, t;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- while (TREE_CODE (type) == POINTER_TYPE)
- type = TREE_TYPE (type);
- if (TYPE_LANG_SPECIFIC (type) == NULL)
- {
- TYPE_LANG_SPECIFIC (type) = (struct lang_type *)
- perm_calloc (1, sizeof (struct lang_type));
- }
- sig = TYPE_LANG_SPECIFIC (type)->signature;
- if (sig == NULL_TREE)
- {
- char sg[2];
- switch (TREE_CODE (type))
- {
- case BOOLEAN_TYPE: sg[0] = 'Z'; goto native;
- case CHAR_TYPE: sg[0] = 'C'; goto native;
- case VOID_TYPE: sg[0] = 'V'; goto native;
- case INTEGER_TYPE:
- switch (TYPE_PRECISION (type))
- {
- case 8: sg[0] = 'B'; goto native;
- case 16: sg[0] = 'S'; goto native;
- case 32: sg[0] = 'I'; goto native;
- case 64: sg[0] = 'J'; goto native;
- default: goto bad_type;
- }
- case REAL_TYPE:
- switch (TYPE_PRECISION (type))
- {
- case 32: sg[0] = 'F'; goto native;
- case 64: sg[0] = 'D'; goto native;
- default: goto bad_type;
- }
- native:
- sg[1] = 0;
- sig = get_identifier (sg);
- break;
- case RECORD_TYPE:
- if (TYPE_ARRAY_P (type))
- {
- t = build_java_signature (TYPE_ARRAY_ELEMENT (type));
- sig = ident_subst (IDENTIFIER_POINTER (t), IDENTIFIER_LENGTH (t),
- "[", 0, 0, "");
- }
- else
- {
- t = DECL_NAME (TYPE_NAME (type));
- sig = ident_subst (IDENTIFIER_POINTER (t), IDENTIFIER_LENGTH (t),
- "L", '.', '/', ";");
- }
- break;
- case METHOD_TYPE:
- case FUNCTION_TYPE:
- {
- extern struct obstack temporary_obstack;
- sig = build_java_argument_signature (type);
- obstack_1grow (&temporary_obstack, '(');
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (sig), IDENTIFIER_LENGTH (sig));
- obstack_1grow (&temporary_obstack, ')');
-
- t = build_java_signature (TREE_TYPE (type));
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (t), IDENTIFIER_LENGTH (t));
-
- sig = get_identifier (obstack_base (&temporary_obstack));
- obstack_free (&temporary_obstack,
- obstack_base (&temporary_obstack));
- }
- break;
- bad_type:
- default:
- fatal ("internal error - build_java_signature passed invalid type");
- }
- TYPE_LANG_SPECIFIC (type)->signature = sig;
- }
- pop_obstacks ();
- return sig;
-}
-
-/* Save signature string SIG (an IDENTIFIER_NODE) in TYPE for future use. */
-
-void
-set_java_signature (type, sig)
- tree type;
- tree sig;
-{
- tree old_sig;
- while (TREE_CODE (type) == POINTER_TYPE)
- type = TREE_TYPE (type);
- if (TYPE_LANG_SPECIFIC (type) == NULL)
- {
- TYPE_LANG_SPECIFIC (type) = (struct lang_type *)
- perm_calloc (1, sizeof (struct lang_type));
-
- }
- old_sig = TYPE_LANG_SPECIFIC (type)->signature;
- if (old_sig != NULL_TREE && old_sig != sig)
- fatal ("internal error - set_java_signature");
- TYPE_LANG_SPECIFIC (type)->signature = sig;
-#if 0 /* careful about METHOD_TYPE */
- if (IDENTIFIER_SIGNATURE_TYPE (sig) == NULL_TREE && TREE_PERMANENT (type))
- IDENTIFIER_SIGNATURE_TYPE (sig) = type;
-#endif
-}
-
-/* Search in class CLAS (and its superclasses) for a method
- matching METHOD_NAME and argument signature METHOD_SIGNATURE.
- Return a FUNCTION_DECL on success, or NULL_TREE if none found.
- (Contrast lookup_java_method, which takes into account return type.) */
-
-tree
-lookup_argument_method (clas, method_name, method_signature)
- tree clas, method_name, method_signature;
-{
- tree method;
- while (clas != NULL_TREE)
- {
- for (method = TYPE_METHODS (clas);
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- tree method_sig = build_java_argument_signature (TREE_TYPE (method));
- tree name = DECL_NAME (method);
- if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
- EXPR_WFL_NODE (name) : name) == method_name
- && method_sig == method_signature)
- return method;
- }
- clas = CLASSTYPE_SUPER (clas);
- }
- return NULL_TREE;
-}
-
-/* Search in class CLAS (and its superclasses) for a method
- matching METHOD_NAME and signature METHOD_SIGNATURE.
- Return a FUNCTION_DECL on success, or NULL_TREE if none found.
- (Contrast lookup_argument_method, which ignores return type.) */
-
-tree
-lookup_java_method (clas, method_name, method_signature)
- tree clas, method_name, method_signature;
-{
- tree method;
- while (clas != NULL_TREE)
- {
- for (method = TYPE_METHODS (clas);
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- tree method_sig = build_java_signature (TREE_TYPE (method));
- if (DECL_NAME (method) == method_name
- && method_sig == method_signature)
- return method;
- }
- clas = CLASSTYPE_SUPER (clas);
- }
- return NULL_TREE;
-}
-
-/* Search in class CLAS for a constructor matching METHOD_SIGNATURE.
- Return a FUNCTION_DECL on success, or NULL_TREE if none found. */
-
-tree
-lookup_java_constructor (clas, method_signature)
- tree clas, method_signature;
-{
- tree method = TYPE_METHODS (clas);
- for ( ; method != NULL_TREE; method = TREE_CHAIN (method))
- {
- tree method_sig = build_java_signature (TREE_TYPE (method));
- if (DECL_CONSTRUCTOR_P (method) && method_sig == method_signature)
- return method;
- }
- return NULL_TREE;
-}
-
-/* Return a type which is the Binary Numeric Promotion of the pair T1,
- T2 and convert EXP1 and/or EXP2. See 5.6.2 Binary Numeric
- Promotion. It assumes that both T1 and T2 are elligible to BNP. */
-
-tree
-binary_numeric_promotion (t1, t2, exp1, exp2)
- tree t1;
- tree t2;
- tree *exp1;
- tree *exp2;
-{
- if (t1 == double_type_node || t2 == double_type_node)
- {
- if (t1 != double_type_node)
- *exp1 = convert (double_type_node, *exp1);
- if (t2 != double_type_node)
- *exp2 = convert (double_type_node, *exp2);
- return double_type_node;
- }
- if (t1 == float_type_node || t2 == float_type_node)
- {
- if (t1 != float_type_node)
- *exp1 = convert (float_type_node, *exp1);
- if (t2 != float_type_node)
- *exp2 = convert (float_type_node, *exp2);
- return float_type_node;
- }
- if (t1 == long_type_node || t2 == long_type_node)
- {
- if (t1 != long_type_node)
- *exp1 = convert (long_type_node, *exp1);
- if (t2 != long_type_node)
- *exp2 = convert (long_type_node, *exp2);
- return long_type_node;
- }
-
- if (t1 != int_type_node)
- *exp1 = convert (int_type_node, *exp1);
- if (t2 != int_type_node)
- *exp2 = convert (int_type_node, *exp2);
- return int_type_node;
-}
diff --git a/gnu/dist/toolchain/gcc/java/verify.c b/gnu/dist/toolchain/gcc/java/verify.c
deleted file mode 100644
index 2929d7e4b5a..00000000000
--- a/gnu/dist/toolchain/gcc/java/verify.c
+++ /dev/null
@@ -1,1346 +0,0 @@
-/* Handle verification of bytecoded methods for the GNU compiler for
- the Java(TM) language.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "javaop.h"
-#include "java-opcodes.h"
-#include "jcf.h"
-#include "java-except.h"
-#include "toplev.h"
-
-static void push_pending_label PROTO ((tree));
-static tree merge_types PROTO ((tree, tree));
-
-extern int stack_pointer;
-
-/* During verification, start of the current subroutine (jsr target). */
-tree current_subr;
-
-/* A list of pending blocks, chained using LABEL_PENDING_CHAIN.
- A pending block is one that has LABEL_CHANGED set, which means
- it requires (re-) verification. */
-tree pending_blocks;
-
-/* Append TARGET_LABEL to the pending_block stack unless already in it. */
-
-static void
-push_pending_label (target_label)
- tree target_label;
-{
- if (! LABEL_CHANGED (target_label))
- {
- LABEL_PENDING_CHAIN (target_label) = pending_blocks;
- pending_blocks = target_label;
- LABEL_CHANGED (target_label) = 1;
- }
-}
-
-/* Note that TARGET_LABEL is a possible successor instruction.
- Merge the type state etc.
- Return NULL on sucess, or an error message on failure. */
-
-static const char *
-check_pending_block (target_label)
- tree target_label;
-{
- int changed = merge_type_state (target_label);
-
- if (changed)
- {
- if (changed < 0)
- return "types could not be merged";
- push_pending_label (target_label);
- }
-
- if (current_subr == NULL)
- {
- if (LABEL_IN_SUBR (target_label))
- return "might transfer control into subroutine";
- }
- else
- {
- if (LABEL_IN_SUBR (target_label))
- {
- if (LABEL_SUBR_START (target_label) != current_subr)
- return "transfer out of subroutine";
- }
- else if (! LABEL_VERIFIED (target_label))
- {
- LABEL_IN_SUBR (target_label) = 1;
- LABEL_SUBR_START (target_label) = current_subr;
- }
- else
- return "transfer out of subroutine";
- }
- return NULL;
-}
-
-/* Return the "merged" types of TYPE1 and TYPE2.
- If either is primitive, the other must match (after promotion to int).
- For reference types, return the common super-class.
- Return TYPE_UNKNOWN if the types cannot be merged. */
-
-static tree
-merge_types (type1, type2)
- tree type1, type2;
-{
- if (type1 == type2)
- return type1;
- if (type1 == TYPE_UNKNOWN || type2 == TYPE_UNKNOWN
- || type1 == TYPE_RETURN_ADDR || type2 == TYPE_RETURN_ADDR)
- return TYPE_UNKNOWN;
- if (TREE_CODE (type1) == POINTER_TYPE && TREE_CODE (type2) == POINTER_TYPE)
- {
- int depth1, depth2;
- tree tt1, tt2;
- /* ptr_type_node is only used for a null reference,
- which is compatible with any reference type. */
- if (type1 == ptr_type_node || type2 == object_ptr_type_node)
- return type2;
- if (type2 == ptr_type_node || type1 == object_ptr_type_node)
- return type1;
-
- tt1 = HANDLE_TO_CLASS_TYPE (TREE_TYPE (type1));
- tt2 = HANDLE_TO_CLASS_TYPE (TREE_TYPE (type2));
-
- if (TYPE_ARRAY_P (tt1) || TYPE_ARRAY_P (tt2))
- {
- if (TYPE_ARRAY_P (tt1) == TYPE_ARRAY_P (tt2))
- {
- tree el_type1 = TYPE_ARRAY_ELEMENT (tt1);
- tree el_type2 = TYPE_ARRAY_ELEMENT (tt2);
- tree el_type = NULL_TREE;
- if (el_type1 == el_type2)
- el_type = el_type1;
- else if (TREE_CODE (el_type1) == POINTER_TYPE
- && TREE_CODE (el_type2) == POINTER_TYPE)
- el_type = merge_types (el_type1, el_type2);
- if (el_type != NULL_TREE)
- {
- HOST_WIDE_INT len1 = java_array_type_length (tt1);
- HOST_WIDE_INT len2 = java_array_type_length (tt2);
- if (len1 != len2)
- len1 = -1;
- else if (el_type1 == el_type2)
- return type1;
- return promote_type (build_java_array_type (el_type, len1));
- }
- }
- return object_ptr_type_node;
- }
-
- if (CLASS_INTERFACE (TYPE_NAME (tt1)))
- {
- if (CLASS_INTERFACE (TYPE_NAME (tt2)))
- {
- /* This is a kludge, but matches what Sun's verifier does.
- It can be tricked, but is safe as long as type errors
- (i.e. interface method calls) are caught at run-time. */
- return object_ptr_type_node;
- }
- else
- {
- if (can_widen_reference_to (tt2, tt1))
- return type1;
- else
- return TYPE_UNKNOWN;
- }
- }
- else if (CLASS_INTERFACE (TYPE_NAME (tt2)))
- {
- if (can_widen_reference_to (tt1, tt2))
- return type2;
- else
- return TYPE_UNKNOWN;
- }
-
- type1 = tt1;
- type2 = tt2;
-
- depth1 = class_depth (type1);
- depth2 = class_depth (type2);
- for ( ; depth1 > depth2; depth1--)
- type1 = TYPE_BINFO_BASETYPE (type1, 0);
- for ( ; depth2 > depth1; depth2--)
- type2 = TYPE_BINFO_BASETYPE (type2, 0);
- while (type1 != type2)
- {
- type1 = TYPE_BINFO_BASETYPE (type1, 0);
- type2 = TYPE_BINFO_BASETYPE (type2, 0);
- }
- return promote_type (type1);
- }
- if (INTEGRAL_TYPE_P (type1) && INTEGRAL_TYPE_P (type2)
- && TYPE_PRECISION (type1) <= 32 && TYPE_PRECISION (type2) <= 32)
- return int_type_node;
- return TYPE_UNKNOWN;
-}
-
-/* Merge the current type state with that at LABEL.
- Return -1 the the states are incompatible (i.e. on error),
- 0 if there was no change, and 1 if there was a change. */
-
-int
-merge_type_state (label)
- tree label;
-{
- int nlocals = DECL_MAX_LOCALS(current_function_decl);
- int cur_length = stack_pointer + nlocals;
- tree vec = LABEL_TYPE_STATE (label);
- tree return_map;
- if (vec == NULL_TREE)
- {
- vec = make_tree_vec (cur_length);
- LABEL_TYPE_STATE (label) = vec;
- while (--cur_length >= 0)
- TREE_VEC_ELT (vec, cur_length) = type_map [cur_length];
- return 1;
- }
- else
- {
- int i;
- int changed = 0;
- if (LABEL_IS_SUBR_START (label) && LABEL_VERIFIED (label)
- && current_subr != label)
- return_map = LABEL_RETURN_TYPE_STATE (label);
- else
- return_map = NULL_TREE;
- if (TREE_VEC_LENGTH (vec) != cur_length)
- {
- return -1;
- }
- for (i = 0; i < cur_length; i++)
- {
- tree old_type = TREE_VEC_ELT (vec, i);
- tree new_type = merge_types (old_type, type_map [i]);
- if (TREE_VEC_ELT (vec, i) != new_type)
- {
- /* If there has been a change, note that since we must re-verify.
- However, if the label is the start of a subroutine,
- we don't care about local variables that are neither
- set nor used in the sub-routine. */
- if (return_map == NULL_TREE || i >= nlocals
- || TREE_VEC_ELT (return_map, i) != TYPE_UNUSED
- || (TYPE_IS_WIDE (new_type)
- && TREE_VEC_ELT (return_map, i+1) != TYPE_UNUSED))
- changed = 1;
- }
- TREE_VEC_ELT (vec, i) = new_type;
- if (new_type == TYPE_UNKNOWN)
- {
- if (i >= nlocals)
- return -1;
- }
- else if (TYPE_IS_WIDE (new_type))
- i++;
- }
- return changed;
- }
-}
-
-/* Handle dup-like operations. */
-
-static void
-type_stack_dup (size, offset)
- int size, offset;
-{
- tree type[4];
- int index;
- if (size + offset > stack_pointer)
- error ("stack underflow - dup* operation");
- for (index = 0; index < size + offset; index++)
- {
- type[index] = stack_type_map[stack_pointer - 1];
- if (type[index] == void_type_node)
- {
- index++;
- type[index] = stack_type_map[stack_pointer - 2];
- if (! TYPE_IS_WIDE (type[index]))
- fatal ("internal error - dup operation");
- if (index == size || index == size + offset)
- fatal ("dup operation splits 64-bit number");
- }
- pop_type (type[index]);
- }
- for (index = size; --index >= 0; )
- {
- if (type[index] != void_type_node)
- push_type (type[index]);
- }
-
- for (index = size + offset; --index >= 0; )
- {
- if (type[index] != void_type_node)
- push_type (type[index]);
- }
-}
-
-/* This keeps track of a start PC and corresponding initial index. */
-struct pc_index
-{
- int start_pc;
- int index;
-};
-
-/* A helper that is used when sorting exception ranges. */
-static int
-start_pc_cmp (xp, yp)
- const GENERIC_PTR xp;
- const GENERIC_PTR yp;
-{
- struct pc_index *x = (struct pc_index *) xp;
- struct pc_index *y = (struct pc_index *) yp;
- return x->start_pc - y->start_pc;
-}
-
-/* This causes the next iteration to ignore the next instruction
- and look for some other unhandled instruction. */
-#define INVALIDATE_PC (prevpc = -1, oldpc = PC, PC = INVALID_PC)
-#define INVALID_PC (-1)
-
-#define VERIFICATION_ERROR(MESSAGE) \
- do { message = MESSAGE; goto verify_error; } while (0)
-
-#define PUSH_PENDING(LABEL) \
- do { if ((message = check_pending_block (LABEL)) != NULL) \
- goto verify_error; } while (0)
-
-#ifdef __GNUC__
-#define CHECK_PC_IN_RANGE(PC) ({if (PC < 0 || PC > length) goto bad_pc; 1;})
-#else
-#define CHECK_PC_IN_RANGE(PC) (PC < 0 || PC > length ? \
- (fatal("Bad byte codes.\n"), 0) : 1)
-#endif
-
-#define BCODE byte_ops
-
-/* Verify the bytecodes of the current method.
- Return 1 on sucess, 0 on failure. */
-int
-verify_jvm_instructions (jcf, byte_ops, length)
- JCF* jcf;
- unsigned char* byte_ops;
- long length;
-{
- tree label;
- int wide = 0;
- int op_code;
- int PC;
- int oldpc; /* PC of start of instruction. */
- int prevpc; /* If >= 0, PC of previous instruction. */
- const char *message;
- int i;
- register unsigned char *p;
- struct eh_range *prev_eh_ranges = NULL_EH_RANGE;
- struct eh_range *eh_ranges;
- tree return_type = TREE_TYPE (TREE_TYPE (current_function_decl));
- struct pc_index *starts;
- int eh_count;
-
- jint int_value = -1;
-
- pending_blocks = NULL_TREE;
-
- /* Handle the exception table. */
- method_init_exceptions ();
- JCF_SEEK (jcf, DECL_CODE_OFFSET (current_function_decl) + length);
- eh_count = JCF_readu2 (jcf);
-
- /* We read the exception handlers in order of increasing start PC.
- To do this we first read and sort the start PCs. */
- starts = (struct pc_index *) xmalloc (eh_count * sizeof (struct pc_index));
- for (i = 0; i < eh_count; ++i)
- {
- starts[i].start_pc = GET_u2 (jcf->read_ptr + 8 * i);
- starts[i].index = i;
- }
- qsort (starts, eh_count, sizeof (struct pc_index), start_pc_cmp);
-
- for (i = 0; i < eh_count; ++i)
- {
- int start_pc, end_pc, handler_pc, catch_type;
-
- p = jcf->read_ptr + 8 * starts[i].index;
-
- start_pc = GET_u2 (p);
- end_pc = GET_u2 (p+2);
- handler_pc = GET_u2 (p+4);
- catch_type = GET_u2 (p+6);
-
- if (start_pc < 0 || start_pc >= length
- || end_pc < 0 || end_pc > length || start_pc >= end_pc
- || handler_pc < 0 || handler_pc >= length
- || (handler_pc >= start_pc && handler_pc < end_pc)
- || ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START)
- || ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START)
- || ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START))
- {
- error ("bad pc in exception_table");
- free (starts);
- return 0;
- }
-
- add_handler (start_pc, end_pc,
- lookup_label (handler_pc),
- catch_type == 0 ? NULL_TREE
- : get_class_constant (jcf, catch_type));
-
- instruction_bits [handler_pc] |= BCODE_EXCEPTION_TARGET;
- }
-
- free (starts);
- handle_nested_ranges ();
-
- for (PC = 0;;)
- {
- int index;
- tree type, tmp;
- if (((PC != INVALID_PC
- && instruction_bits [PC] & BCODE_TARGET) != 0)
- || PC == 0)
- {
- PUSH_PENDING (lookup_label (PC));
- INVALIDATE_PC;
- }
- /* Check if there are any more pending blocks in the current
- subroutine. Because we push pending blocks in a
- last-in-first-out order, and because we don't push anything
- from our caller until we are done with this subroutine or
- anything nested in it, then we are done if the top of the
- pending_blocks stack is not in a subroutine, or it is in our
- caller. */
- if (current_subr
- && PC == INVALID_PC)
- {
- tree caller = LABEL_SUBR_CONTEXT (current_subr);
-
- if (pending_blocks == NULL_TREE
- || ! LABEL_IN_SUBR (pending_blocks)
- || LABEL_SUBR_START (pending_blocks) == caller)
- {
- int size = DECL_MAX_LOCALS(current_function_decl)+stack_pointer;
- tree ret_map = LABEL_RETURN_TYPE_STATE (current_subr);
- tmp = LABEL_RETURN_LABELS (current_subr);
-
- /* FIXME: If we exit a subroutine via a throw, we might
- have returned to an earlier caller. Obviously a
- "ret" can only return one level, but a throw may
- return many levels.*/
- current_subr = caller;
-
- if (RETURN_MAP_ADJUSTED (ret_map))
- {
- /* Since we are done with this subroutine , set up
- the (so far known) return address as pending -
- with the merged type state. */
- for ( ; tmp != NULL_TREE; tmp = TREE_CHAIN (tmp))
- {
- tree return_label = TREE_VALUE (tmp);
- tree return_state = LABEL_TYPE_STATE (return_label);
- if (return_state == NULL_TREE)
- {
- /* This means means we had not verified the
- subroutine earlier, so this is the first jsr to
- call it. In this case, the type_map of the return
- address is just the current type_map - and that
- is handled by the following PUSH_PENDING. */
- }
- else
- {
- /* In this case we have to do a merge. But first
- restore the type_map for unused slots to those
- that were in effect at the jsr. */
- for (index = size; --index >= 0; )
- {
- type_map[index] = TREE_VEC_ELT (ret_map, index);
- if (type_map[index] == TYPE_UNUSED)
- type_map[index]
- = TREE_VEC_ELT (return_state, index);
- }
- }
- PUSH_PENDING (return_label);
- }
- }
- }
- }
- if (PC == INVALID_PC)
- {
- label = pending_blocks;
- if (label == NULL_TREE)
- break; /* We're done! */
- pending_blocks = LABEL_PENDING_CHAIN (label);
- LABEL_CHANGED (label) = 0;
-
- if (LABEL_IN_SUBR (label))
- current_subr = LABEL_SUBR_START (label);
- else
- current_subr = NULL_TREE;
-
- /* Restore type_map and stack_pointer from
- LABEL_TYPE_STATE (label), and continue
- compiling from there. */
- load_type_state (label);
- PC = LABEL_PC (label);
- }
- else if (PC >= length)
- VERIFICATION_ERROR ("falling through end of method");
-
- /* fprintf (stderr, "** %d\n", PC); */
-
- oldpc = PC;
-
- if (!(instruction_bits [PC] & BCODE_INSTRUCTION_START) && ! wide)
- VERIFICATION_ERROR ("PC not at instruction start");
-
- instruction_bits[PC] |= BCODE_VERIFIED;
-
- eh_ranges = find_handler (oldpc);
-
- op_code = byte_ops[PC++];
- switch (op_code)
- {
- int is_static, is_putting;
- case OPCODE_nop:
- break;
- case OPCODE_iconst_m1:
- case OPCODE_iconst_0: case OPCODE_iconst_1: case OPCODE_iconst_2:
- case OPCODE_iconst_3: case OPCODE_iconst_4: case OPCODE_iconst_5:
- i = op_code - OPCODE_iconst_0;
- goto push_int;
- push_int:
- if (byte_ops[PC] == OPCODE_newarray
- || byte_ops[PC] == OPCODE_newarray)
- int_value = i;
- push_type (int_type_node); break;
- case OPCODE_lconst_0: case OPCODE_lconst_1:
- push_type (long_type_node); break;
- case OPCODE_fconst_0: case OPCODE_fconst_1: case OPCODE_fconst_2:
- push_type (float_type_node); break;
- case OPCODE_dconst_0: case OPCODE_dconst_1:
- push_type (double_type_node); break;
- case OPCODE_bipush:
- i = IMMEDIATE_s1;
- goto push_int;
- case OPCODE_sipush:
- i = IMMEDIATE_s2;
- goto push_int;
- case OPCODE_iload: type = int_type_node; goto general_load;
- case OPCODE_lload: type = long_type_node; goto general_load;
- case OPCODE_fload: type = float_type_node; goto general_load;
- case OPCODE_dload: type = double_type_node; goto general_load;
- case OPCODE_aload: type = ptr_type_node; goto general_load;
- general_load:
- index = wide ? IMMEDIATE_u2 : IMMEDIATE_u1;
- wide = 0;
- goto load;
- case OPCODE_iload_0: type = int_type_node; index = 0; goto load;
- case OPCODE_iload_1: type = int_type_node; index = 1; goto load;
- case OPCODE_iload_2: type = int_type_node; index = 2; goto load;
- case OPCODE_iload_3: type = int_type_node; index = 3; goto load;
- case OPCODE_lload_0: type = long_type_node; index = 0; goto load;
- case OPCODE_lload_1: type = long_type_node; index = 1; goto load;
- case OPCODE_lload_2: type = long_type_node; index = 2; goto load;
- case OPCODE_lload_3: type = long_type_node; index = 3; goto load;
- case OPCODE_fload_0: type = float_type_node; index = 0; goto load;
- case OPCODE_fload_1: type = float_type_node; index = 1; goto load;
- case OPCODE_fload_2: type = float_type_node; index = 2; goto load;
- case OPCODE_fload_3: type = float_type_node; index = 3; goto load;
- case OPCODE_dload_0: type = double_type_node; index = 0; goto load;
- case OPCODE_dload_1: type = double_type_node; index = 1; goto load;
- case OPCODE_dload_2: type = double_type_node; index = 2; goto load;
- case OPCODE_dload_3: type = double_type_node; index = 3; goto load;
- case OPCODE_aload_0: type = ptr_type_node; index = 0; goto load;
- case OPCODE_aload_1: type = ptr_type_node; index = 1; goto load;
- case OPCODE_aload_2: type = ptr_type_node; index = 2; goto load;
- case OPCODE_aload_3: type = ptr_type_node; index = 3; goto load;
- load:
- if (index < 0
- || (index + TYPE_IS_WIDE (type)
- >= DECL_MAX_LOCALS (current_function_decl)))
- VERIFICATION_ERROR ("invalid local variable index in load");
- tmp = type_map[index];
- if (tmp == TYPE_UNKNOWN || tmp == TYPE_SECOND
- || (TYPE_IS_WIDE (type)
- && type_map[index+1] != void_type_node)
- || (type == ptr_type_node
- ? TREE_CODE (tmp) != POINTER_TYPE
- : type == int_type_node
- ? (! INTEGRAL_TYPE_P (tmp) || TYPE_PRECISION (tmp) > 32)
- : type != tmp))
- VERIFICATION_ERROR("invalid local variable type in load");
- push_type (tmp);
- goto note_used;
- case OPCODE_istore: type = int_type_node; goto general_store;
- case OPCODE_lstore: type = long_type_node; goto general_store;
- case OPCODE_fstore: type = float_type_node; goto general_store;
- case OPCODE_dstore: type = double_type_node; goto general_store;
- case OPCODE_astore: type = ptr_type_node; goto general_store;
- general_store:
- index = wide ? IMMEDIATE_u2 : IMMEDIATE_u1;
- wide = 0;
- goto store;
- case OPCODE_istore_0: type = int_type_node; index = 0; goto store;
- case OPCODE_istore_1: type = int_type_node; index = 1; goto store;
- case OPCODE_istore_2: type = int_type_node; index = 2; goto store;
- case OPCODE_istore_3: type = int_type_node; index = 3; goto store;
- case OPCODE_lstore_0: type = long_type_node; index=0; goto store;
- case OPCODE_lstore_1: type = long_type_node; index=1; goto store;
- case OPCODE_lstore_2: type = long_type_node; index=2; goto store;
- case OPCODE_lstore_3: type = long_type_node; index=3; goto store;
- case OPCODE_fstore_0: type=float_type_node; index=0; goto store;
- case OPCODE_fstore_1: type=float_type_node; index=1; goto store;
- case OPCODE_fstore_2: type=float_type_node; index=2; goto store;
- case OPCODE_fstore_3: type=float_type_node; index=3; goto store;
- case OPCODE_dstore_0: type=double_type_node; index=0; goto store;
- case OPCODE_dstore_1: type=double_type_node; index=1; goto store;
- case OPCODE_dstore_2: type=double_type_node; index=2; goto store;
- case OPCODE_dstore_3: type=double_type_node; index=3; goto store;
- case OPCODE_astore_0: type = ptr_type_node; index = 0; goto store;
- case OPCODE_astore_1: type = ptr_type_node; index = 1; goto store;
- case OPCODE_astore_2: type = ptr_type_node; index = 2; goto store;
- case OPCODE_astore_3: type = ptr_type_node; index = 3; goto store;
- store:
- if (index < 0
- || (index + TYPE_IS_WIDE (type)
- >= DECL_MAX_LOCALS (current_function_decl)))
- {
- VERIFICATION_ERROR ("invalid local variable index in store");
- return 0;
- }
- type = pop_type (type);
- type_map[index] = type;
-
- /* If local variable changed, we need to reconsider eh handlers. */
- prev_eh_ranges = NULL_EH_RANGE;
-
- /* Allocate decl and rtx for this variable now, so if we're not
- optmizing, we get a temporary that survives the whole method. */
- find_local_variable (index, type, oldpc);
-
- if (TYPE_IS_WIDE (type))
- type_map[index+1] = TYPE_SECOND;
- /* ... fall through to note_used ... */
- note_used:
- /* For store or load, note that local variable INDEX is used.
- This is needed to verify try-finally sub-routines. */
- if (current_subr)
- {
- tree vec = LABEL_RETURN_TYPE_STATE (current_subr);
- tree subr_vec = LABEL_TYPE_STATE (current_subr);
- int len = 1 + TYPE_IS_WIDE (type);
- while (--len >= 0)
- {
- if (TREE_VEC_ELT (vec, index) == TYPE_UNUSED)
- TREE_VEC_ELT (vec, index) = TREE_VEC_ELT (subr_vec, index);
- }
- }
- break;
- case OPCODE_iadd:
- case OPCODE_iand:
- case OPCODE_idiv:
- case OPCODE_imul:
- case OPCODE_ior:
- case OPCODE_irem:
- case OPCODE_ishl:
- case OPCODE_ishr:
- case OPCODE_isub:
- case OPCODE_iushr:
- case OPCODE_ixor:
- type = int_type_node; goto binop;
- case OPCODE_ineg:
- case OPCODE_i2c:
- case OPCODE_i2b:
- case OPCODE_i2s:
- type = int_type_node; goto unop;
- case OPCODE_ladd:
- case OPCODE_land:
- case OPCODE_ldiv:
- case OPCODE_lsub:
- case OPCODE_lmul:
- case OPCODE_lrem:
- case OPCODE_lor:
- case OPCODE_lxor:
- type = long_type_node; goto binop;
- case OPCODE_lneg:
- type = long_type_node; goto unop;
- case OPCODE_fadd: case OPCODE_fsub:
- case OPCODE_fmul: case OPCODE_fdiv: case OPCODE_frem:
- type = float_type_node; goto binop;
- case OPCODE_fneg:
- type = float_type_node; goto unop;
- case OPCODE_dadd: case OPCODE_dsub:
- case OPCODE_dmul: case OPCODE_ddiv: case OPCODE_drem:
- type = double_type_node; goto binop;
- case OPCODE_dneg:
- type = double_type_node; goto unop;
- unop:
- pop_type (type);
- push_type (type);
- break;
- binop:
- pop_type (type);
- pop_type (type);
- push_type (type);
- break;
- case OPCODE_lshl:
- case OPCODE_lshr:
- case OPCODE_lushr:
- pop_type (int_type_node);
- pop_type (long_type_node);
- push_type (long_type_node);
- break;
- case OPCODE_iinc:
- index = wide ? IMMEDIATE_u2 : IMMEDIATE_u1;
- PC += wide + 1;
- wide = 0;
- if (index < 0 || index >= DECL_MAX_LOCALS (current_function_decl))
- VERIFICATION_ERROR ("invalid local variable index in iinc");
- tmp = type_map[index];
- if (! INTEGRAL_TYPE_P (tmp) || TYPE_PRECISION (tmp) > 32)
- VERIFICATION_ERROR ("invalid local variable type in iinc");
- break;
- case OPCODE_i2l:
- pop_type (int_type_node); push_type (long_type_node); break;
- case OPCODE_i2f:
- pop_type (int_type_node); push_type (float_type_node); break;
- case OPCODE_i2d:
- pop_type (int_type_node); push_type (double_type_node); break;
- case OPCODE_l2i:
- pop_type (long_type_node); push_type (int_type_node); break;
- case OPCODE_l2f:
- pop_type (long_type_node); push_type (float_type_node); break;
- case OPCODE_l2d:
- pop_type (long_type_node); push_type (double_type_node); break;
- case OPCODE_f2i:
- pop_type (float_type_node); push_type (int_type_node); break;
- case OPCODE_f2l:
- pop_type (float_type_node); push_type (long_type_node); break;
- case OPCODE_f2d:
- pop_type (float_type_node); push_type (double_type_node); break;
- case OPCODE_d2i:
- pop_type (double_type_node); push_type (int_type_node); break;
- case OPCODE_d2l:
- pop_type (double_type_node); push_type (long_type_node); break;
- case OPCODE_d2f:
- pop_type (double_type_node); push_type (float_type_node); break;
- case OPCODE_lcmp:
- type = long_type_node; goto compare;
- case OPCODE_fcmpl:
- case OPCODE_fcmpg:
- type = float_type_node; goto compare;
- case OPCODE_dcmpl:
- case OPCODE_dcmpg:
- type = double_type_node; goto compare;
- compare:
- pop_type (type); pop_type (type);
- push_type (int_type_node); break;
- case OPCODE_ifeq:
- case OPCODE_ifne:
- case OPCODE_iflt:
- case OPCODE_ifge:
- case OPCODE_ifgt:
- case OPCODE_ifle:
- pop_type (int_type_node); goto cond;
- case OPCODE_ifnull:
- case OPCODE_ifnonnull:
- pop_type (ptr_type_node ); goto cond;
- case OPCODE_if_icmpeq:
- case OPCODE_if_icmpne:
- case OPCODE_if_icmplt:
- case OPCODE_if_icmpge:
- case OPCODE_if_icmpgt:
- case OPCODE_if_icmple:
- pop_type (int_type_node); pop_type (int_type_node); goto cond;
- case OPCODE_if_acmpeq:
- case OPCODE_if_acmpne:
- pop_type (object_ptr_type_node); pop_type (object_ptr_type_node);
- goto cond;
- cond:
- PUSH_PENDING (lookup_label (oldpc + IMMEDIATE_s2));
- break;
- case OPCODE_goto:
- PUSH_PENDING (lookup_label (oldpc + IMMEDIATE_s2));
- INVALIDATE_PC;
- break;
- case OPCODE_wide:
- switch (byte_ops[PC])
- {
- case OPCODE_iload: case OPCODE_lload:
- case OPCODE_fload: case OPCODE_dload: case OPCODE_aload:
- case OPCODE_istore: case OPCODE_lstore:
- case OPCODE_fstore: case OPCODE_dstore: case OPCODE_astore:
- case OPCODE_iinc:
- case OPCODE_ret:
- wide = 1;
- break;
- default:
- VERIFICATION_ERROR ("invalid use of wide instruction");
- }
- break;
- case OPCODE_return: type = void_type_node; goto ret;
- case OPCODE_ireturn:
- if ((TREE_CODE (return_type) == BOOLEAN_TYPE
- || TREE_CODE (return_type) == CHAR_TYPE
- || TREE_CODE (return_type) == INTEGER_TYPE)
- && TYPE_PRECISION (return_type) <= 32)
- type = return_type;
- else
- type = NULL_TREE;
- goto ret;
- case OPCODE_lreturn: type = long_type_node; goto ret;
- case OPCODE_freturn: type = float_type_node; goto ret;
- case OPCODE_dreturn: type = double_type_node; goto ret;
- case OPCODE_areturn:
- if (TREE_CODE (return_type) == POINTER_TYPE)
- type = return_type;
- else
- type = NULL_TREE;
- goto ret;
- ret:
- if (type != return_type)
- VERIFICATION_ERROR ("incorrect ?return opcode");
- if (type != void_type_node)
- {
- if (pop_type_0 (type) == NULL_TREE)
- VERIFICATION_ERROR ("return value has wrong type");
- }
- INVALIDATE_PC;
- break;
- case OPCODE_getstatic: is_putting = 0; is_static = 1; goto field;
- case OPCODE_putstatic: is_putting = 1; is_static = 1; goto field;
- case OPCODE_getfield: is_putting = 0; is_static = 0; goto field;
- case OPCODE_putfield: is_putting = 1; is_static = 0; goto field;
- field:
- {
- int index = IMMEDIATE_u2;
- tree field_signature = COMPONENT_REF_SIGNATURE (&current_jcf->cpool, index);
- tree field_type = get_type_from_signature (field_signature);
- if (is_putting)
- pop_type (field_type);
- if (! is_static)
- {
- int clindex = COMPONENT_REF_CLASS_INDEX (&current_jcf->cpool,
- index);
- tree self_type = get_class_constant (current_jcf, clindex);
- /* Defer actual checking until next pass. */
- if (pop_type_0 (self_type) == NULL_TREE)
- VERIFICATION_ERROR ("incorrect type for field reference");
- }
- if (! is_putting)
- push_type (field_type);
- break;
- }
- case OPCODE_new:
- push_type (get_class_constant (jcf, IMMEDIATE_u2));
- break;
- case OPCODE_dup: type_stack_dup (1, 0); break;
- case OPCODE_dup_x1: type_stack_dup (1, 1); break;
- case OPCODE_dup_x2: type_stack_dup (1, 2); break;
- case OPCODE_dup2: type_stack_dup (2, 0); break;
- case OPCODE_dup2_x1: type_stack_dup (2, 1); break;
- case OPCODE_dup2_x2: type_stack_dup (2, 2); break;
- case OPCODE_pop: index = 1; goto pop;
- case OPCODE_pop2: index = 2; goto pop;
- pop:
- if (stack_pointer < index)
- VERIFICATION_ERROR ("stack underflow");
- stack_pointer -= index;
- break;
- case OPCODE_swap:
- if (stack_pointer < 2)
- VERIFICATION_ERROR ("stack underflow (in swap)");
- else
- {
- tree type1 = stack_type_map[stack_pointer - 1];
- tree type2 = stack_type_map[stack_pointer - 2];
- if (type1 == void_type_node || type2 == void_type_node)
- VERIFICATION_ERROR ("verifier (swap): double or long value");
- stack_type_map[stack_pointer - 2] = type1;
- stack_type_map[stack_pointer - 1] = type2;
- }
- break;
- case OPCODE_ldc: index = IMMEDIATE_u1; goto ldc;
- case OPCODE_ldc2_w:
- case OPCODE_ldc_w:
- index = IMMEDIATE_u2; goto ldc;
- ldc:
- if (index <= 0 || index >= JPOOL_SIZE(current_jcf))
- VERIFICATION_ERROR ("bad constant pool index in ldc");
- int_value = -1;
- switch (JPOOL_TAG (current_jcf, index) & ~CONSTANT_ResolvedFlag)
- {
- case CONSTANT_Integer: type = int_type_node; goto check_ldc;
- case CONSTANT_Float: type = float_type_node; goto check_ldc;
- case CONSTANT_String: type = string_type_node; goto check_ldc;
- case CONSTANT_Long: type = long_type_node; goto check_ldc;
- case CONSTANT_Double: type = double_type_node; goto check_ldc;
- check_ldc:
- if (TYPE_IS_WIDE (type) == (op_code == OPCODE_ldc2_w))
- break;
- /* ... else fall through ... */
- default:
- VERIFICATION_ERROR ("bad constant pool tag in ldc");
- }
- if (type == int_type_node)
- {
- i = TREE_INT_CST_LOW (get_constant (current_jcf, index));
- goto push_int;
- }
- push_type (type);
- break;
-
- case OPCODE_invokevirtual:
- case OPCODE_invokespecial:
- case OPCODE_invokestatic:
- case OPCODE_invokeinterface:
- {
- int index = IMMEDIATE_u2;
- tree sig = COMPONENT_REF_SIGNATURE (&current_jcf->cpool, index);
- tree self_type = get_class_constant
- (current_jcf, COMPONENT_REF_CLASS_INDEX (&current_jcf->cpool,
- index));
- tree method_name = COMPONENT_REF_NAME (&current_jcf->cpool, index);
- tree method_type;
- method_type = parse_signature_string (IDENTIFIER_POINTER (sig),
- IDENTIFIER_LENGTH (sig));
- if (TREE_CODE (method_type) != FUNCTION_TYPE)
- VERIFICATION_ERROR ("bad method signature");
- pop_argument_types (TYPE_ARG_TYPES (method_type));
-
- /* Can't invoke <clinit> */
- if (method_name == clinit_identifier_node)
- VERIFICATION_ERROR ("invoke opcode can't invoke <clinit>");
- /* Apart invokespecial, can't invoke <init> */
- if (op_code != OPCODE_invokespecial
- && method_name == init_identifier_node)
- VERIFICATION_ERROR ("invoke opcode can't invoke <init>");
-
- if (op_code != OPCODE_invokestatic)
- pop_type (self_type);
-
- switch (op_code)
- {
- case OPCODE_invokeinterface:
- {
- int nargs = IMMEDIATE_u1;
- int notZero = IMMEDIATE_u1;
-
- if (!nargs || notZero)
- VERIFICATION_ERROR
- ("invalid argument number in invokeinterface");
- break;
- }
- }
-
- if (TREE_TYPE (method_type) != void_type_node)
- push_type (TREE_TYPE (method_type));
- break;
- }
-
- case OPCODE_arraylength:
- /* Type checking actually made during code generation */
- pop_type( ptr_type_node );
- push_type( int_type_node );
- break;
-
- /* Q&D verification *or* more checking done during code generation
- for byte/boolean/char/short, the value popped is a int coerced
- into the right type before being stored. */
- case OPCODE_iastore: type = int_type_node; goto astore;
- case OPCODE_lastore: type = long_type_node; goto astore;
- case OPCODE_fastore: type = float_type_node; goto astore;
- case OPCODE_dastore: type = double_type_node; goto astore;
- case OPCODE_aastore: type = ptr_type_node; goto astore;
- case OPCODE_bastore: type = int_type_node; goto astore;
- case OPCODE_castore: type = int_type_node; goto astore;
- case OPCODE_sastore: type = int_type_node; goto astore;
- astore:
- /* FIXME - need better verification here */
- pop_type (type); /* new value */
- pop_type (int_type_node); /* index */
- pop_type (ptr_type_node); /* array */
- break;
-
- /* Q&D verification *or* more checking done during code generation
- for byte/boolean/char/short, the value pushed is a int. */
- case OPCODE_iaload: type = int_type_node; goto aload;
- case OPCODE_laload: type = long_type_node; goto aload;
- case OPCODE_faload: type = float_type_node; goto aload;
- case OPCODE_daload: type = double_type_node; goto aload;
- case OPCODE_aaload: type = ptr_type_node; goto aload;
- case OPCODE_baload: type = promote_type (byte_type_node); goto aload;
- case OPCODE_caload: type = promote_type (char_type_node); goto aload;
- case OPCODE_saload: type = promote_type (short_type_node); goto aload;
- aload:
- pop_type (int_type_node);
- tmp = pop_type (ptr_type_node);
- if (is_array_type_p (tmp))
- type = TYPE_ARRAY_ELEMENT (TREE_TYPE (tmp));
- else if (tmp != TYPE_NULL)
- VERIFICATION_ERROR ("array load from non-array type");
- push_type (type);
- break;
-
- case OPCODE_anewarray:
- type = get_class_constant (current_jcf, IMMEDIATE_u2);
- type = promote_type (type);
- goto newarray;
-
- case OPCODE_newarray:
- index = IMMEDIATE_u1;
- type = decode_newarray_type (index);
- if (type == NULL_TREE)
- VERIFICATION_ERROR ("invalid type code in newarray opcode");
- goto newarray;
-
- newarray:
- if (int_value >= 0 && prevpc >= 0)
- {
- /* If previous instruction pushed int constant,
- we want to use it. */
- switch (byte_ops[prevpc])
- {
- case OPCODE_iconst_0: case OPCODE_iconst_1:
- case OPCODE_iconst_2: case OPCODE_iconst_3:
- case OPCODE_iconst_4: case OPCODE_iconst_5:
- case OPCODE_bipush: case OPCODE_sipush:
- case OPCODE_ldc: case OPCODE_ldc_w:
- break;
- default:
- int_value = -1;
- }
- }
- else
- int_value = -1;
- type = build_java_array_type (type, int_value);
- pop_type (int_type_node);
- push_type (type);
- break;
-
- case OPCODE_multianewarray:
- {
- int ndim, i;
- index = IMMEDIATE_u2;
- ndim = IMMEDIATE_u1;
-
- if( ndim < 1 )
- VERIFICATION_ERROR ("number of dimension lower that 1 in multianewarray" );
-
- for( i = 0; i < ndim; i++ )
- pop_type (int_type_node);
- push_type (get_class_constant (current_jcf, index));
- break;
- }
-
- case OPCODE_aconst_null:
- push_type (ptr_type_node);
- break;
-
- case OPCODE_athrow:
- // FIXME: athrow also empties the stack.
- pop_type (throwable_type_node);
- INVALIDATE_PC;
- break;
-
- case OPCODE_checkcast:
- pop_type (ptr_type_node);
- type = get_class_constant (current_jcf, IMMEDIATE_u2);
- push_type (type);
- break;
- case OPCODE_instanceof:
- pop_type (ptr_type_node);
- get_class_constant (current_jcf, IMMEDIATE_u2);
- push_type (int_type_node);
- break;
-
- case OPCODE_tableswitch:
- {
- jint low, high;
-
- pop_type (int_type_node);
- while (PC%4)
- {
- if (byte_ops[PC++])
- VERIFICATION_ERROR ("bad alignment in tableswitch pad");
- }
- PUSH_PENDING (lookup_label (oldpc+IMMEDIATE_s4));
- low = IMMEDIATE_s4;
- high = IMMEDIATE_s4;
-
- if (low > high)
- VERIFICATION_ERROR ("unsorted low/high value in tableswitch");
-
- while (low++ <= high)
- PUSH_PENDING (lookup_label (oldpc + IMMEDIATE_s4));
- INVALIDATE_PC;
- break;
- }
-
- case OPCODE_lookupswitch:
- {
- jint npairs, last, not_registered = 1;
-
- pop_type (int_type_node);
- while (PC%4)
- {
- if (byte_ops[PC++])
- VERIFICATION_ERROR ("bad alignment in lookupswitch pad");
- }
-
- PUSH_PENDING (lookup_label (oldpc+IMMEDIATE_s4));
- npairs = IMMEDIATE_s4;
-
- if (npairs < 0)
- VERIFICATION_ERROR ("invalid number of targets in lookupswitch");
-
- while (npairs--)
- {
- int match = IMMEDIATE_s4;
- if (not_registered)
- not_registered = 0;
- else if (last >= match)
- VERIFICATION_ERROR ("unsorted match value in lookupswitch");
-
- last = match;
- PUSH_PENDING (lookup_label (oldpc + IMMEDIATE_s4));
- }
- INVALIDATE_PC;
- break;
- }
-
- case OPCODE_monitorenter:
- /* fall thru */
- case OPCODE_monitorexit:
- pop_type (ptr_type_node);
- break;
-
- case OPCODE_goto_w:
- PUSH_PENDING (lookup_label (oldpc + IMMEDIATE_s4));
- INVALIDATE_PC;
- break;
-
- case OPCODE_jsr:
- {
- tree target = lookup_label (oldpc + IMMEDIATE_s2);
- tree return_label = lookup_label (PC);
- push_type (return_address_type_node);
- if (! LABEL_VERIFIED (target))
- {
- /* first time seen */
- tree return_type_map;
- int nlocals = DECL_MAX_LOCALS (current_function_decl);
- index = nlocals + DECL_MAX_STACK (current_function_decl);
- return_type_map = make_tree_vec (index);
- while (index > nlocals)
- TREE_VEC_ELT (return_type_map, --index) = TYPE_UNKNOWN;
- while (index > 0)
- TREE_VEC_ELT (return_type_map, --index) = TYPE_UNUSED;
- LABEL_RETURN_LABEL (target)
- = build_decl (LABEL_DECL, NULL_TREE, TREE_TYPE (target));
- LABEL_PC (LABEL_RETURN_LABEL (target)) = -1;
- LABEL_RETURN_TYPE_STATE (target) = return_type_map;
- LABEL_IS_SUBR_START (target) = 1;
- LABEL_IN_SUBR (target) = 1;
- LABEL_SUBR_START (target) = target;
- LABEL_SUBR_CONTEXT (target) = current_subr;
- }
- else if (! LABEL_IS_SUBR_START (target)
- || LABEL_SUBR_CONTEXT (target) != current_subr)
- VERIFICATION_ERROR ("label part of different subroutines");
-
- i = merge_type_state (target);
- if (i != 0)
- {
- if (i < 0)
- VERIFICATION_ERROR ("types could not be merged at jsr");
- push_pending_label (target);
- }
- current_subr = target;
-
- /* Chain return_pc onto LABEL_RETURN_LABELS (target) if needed. */
- if (! value_member (return_label, LABEL_RETURN_LABELS (target)))
- {
- LABEL_RETURN_LABELS (target)
- = tree_cons (NULL_TREE, return_label,
- LABEL_RETURN_LABELS (target));
- }
-
- if (LABEL_VERIFIED (target))
- {
- tree return_map = LABEL_RETURN_TYPE_STATE (target);
- int len = TREE_VEC_LENGTH (return_map);
- stack_pointer = len - DECL_MAX_LOCALS (current_function_decl);
- while (--len >= 0)
- {
- if (TREE_VEC_ELT (return_map, len) != TYPE_UNUSED)
- type_map[len] = TREE_VEC_ELT (return_map, len);
- }
- current_subr = LABEL_SUBR_CONTEXT (target);
- PUSH_PENDING (return_label);
- }
-
- INVALIDATE_PC;
- }
- break;
- case OPCODE_ret:
- if (current_subr == NULL)
- VERIFICATION_ERROR ("ret instruction not in a jsr subroutine");
- else
- {
- tree ret_map = LABEL_RETURN_TYPE_STATE (current_subr);
- tree caller = LABEL_SUBR_CONTEXT (current_subr);
- int size = DECL_MAX_LOCALS(current_function_decl)+stack_pointer;
- index = wide ? IMMEDIATE_u2 : IMMEDIATE_u1;
- wide = 0;
- INVALIDATE_PC;
- if (index < 0 || index >= DECL_MAX_LOCALS (current_function_decl)
- || type_map[index] != TYPE_RETURN_ADDR)
- VERIFICATION_ERROR ("invalid ret index");
-
- /* The next chunk of code is similar to an inlined version of
- * merge_type_state (LABEL_RETURN_LABEL (current_subr)).
- * The main differences are that LABEL_RETURN_LABEL is
- * pre-allocated by the jsr (but we don't know the size then);
- * and that we have to handle TYPE_UNUSED. */
-
- if (! RETURN_MAP_ADJUSTED (ret_map))
- { /* First return from this subroutine - fix stack pointer. */
- TREE_VEC_LENGTH (ret_map) = size;
- for (index = size; --index >= 0; )
- {
- if (TREE_VEC_ELT (ret_map, index) != TYPE_UNUSED)
- TREE_VEC_ELT (ret_map, index) = type_map[index];
- }
- RETURN_MAP_ADJUSTED (ret_map) = 1;
- }
- else
- {
- if (TREE_VEC_LENGTH (ret_map) != size)
- VERIFICATION_ERROR ("inconsistent stack size on ret");
- for (index = 0; index < size; index++)
- {
- tree type = TREE_VEC_ELT (ret_map, index);
- if (type != TYPE_UNUSED)
- {
- type = merge_types (type, type_map [index]);
- TREE_VEC_ELT (ret_map, index) = type;
- if (type == TYPE_UNKNOWN)
- {
- if (index >= size - stack_pointer)
- VERIFICATION_ERROR
- ("inconsistent types on ret from jsr");
- }
- else if (TYPE_IS_WIDE (type))
- index++;
- }
- }
- }
-
-
- }
- break;
- case OPCODE_jsr_w:
- case OPCODE_ret_w:
- default:
- error ("unknown opcode %d@pc=%d during verification", op_code, PC-1);
- return 0;
- }
-
- prevpc = oldpc;
-
- /* The following test is true if we have entered or exited an exception
- handler range *or* we have done a store to a local variable.
- In either case we need to consider any exception handlers that
- might "follow" this instruction. */
-
- if (eh_ranges != prev_eh_ranges)
- {
- int save_stack_pointer = stack_pointer;
- int index = DECL_MAX_LOCALS (current_function_decl);
- tree save_type = type_map[index];
- tree save_current_subr = current_subr;
- struct eh_range *ranges = find_handler (oldpc);
- stack_pointer = 1;
- for (; ranges != NULL_EH_RANGE; ranges = ranges->outer)
- {
- tree chain = ranges->handlers;
-
- /* We need to determine if the handler is part of current_subr.
- The are two cases: (1) The exception catch range
- is entirely within current_subr. In that case the handler
- is also part of current_subr.
- (2) Some of the catch range is not in current_subr.
- In that case, the handler is *not* part of current_subr.
-
- Figuring out which is the case is not necessarily obvious,
- in the presence of clever code generators (and obfuscators).
- We make a simplifying assumption that in case (2) we
- have that the current_subr is entirely within the catch range.
- In that case we can assume if that if a caller (the jsr) of
- a subroutine is within the catch range, then the handler is
- *not* part of the subroutine, and vice versa. */
-
- current_subr = save_current_subr;
- for ( ; current_subr != NULL_TREE;
- current_subr = LABEL_SUBR_CONTEXT (current_subr))
- {
- tree return_labels = LABEL_RETURN_LABELS (current_subr);
- /* There could be multiple return_labels, but
- we only need to check one. */
- int return_pc = LABEL_PC (TREE_VALUE (return_labels));
- if (return_pc <= ranges->start_pc
- || return_pc > ranges->end_pc)
- break;
- }
-
- for ( ; chain != NULL_TREE; chain = TREE_CHAIN (chain))
- {
- tree handler = TREE_VALUE (chain);
- tree type = TREE_PURPOSE (chain);
- if (type == NULL_TREE) /* a finally handler */
- type = throwable_type_node;
- type_map[index] = promote_type (type);
-
- PUSH_PENDING (handler);
- }
- }
- stack_pointer = save_stack_pointer;
- current_subr = save_current_subr;
- type_map[index] = save_type;
- prev_eh_ranges = eh_ranges;
- }
- }
- return 1;
- bad_pc:
- message = "program counter out of range";
- goto verify_error;
- verify_error:
- error ("verification error at PC=%d", oldpc);
- error (message);
- return 0;
-}
diff --git a/gnu/dist/toolchain/gcc/java/xref.c b/gnu/dist/toolchain/gcc/java/xref.c
deleted file mode 100644
index 8fd51804819..00000000000
--- a/gnu/dist/toolchain/gcc/java/xref.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Write cross reference information extracted from Java(TM)
- source and bytecode files, in one of formats documented below.
- Copyright (C) 1999 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-#include "config.h"
-#include "system.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "xref.h"
-#include "jcf.h"
-#include "parse.h"
-#include "obstack.h"
-
-
-static xref_flag_table xref_table [] = {
- {NULL, NULL, NULL, NULL},
-};
-
-/* Decode an xref flag value. Return 0 if the flag wasn't found. */
-
-int
-xref_flag_value (flag)
- char *flag;
-{
- int i;
- for (i = 0; xref_table [i].key; i++)
- if (!strcmp (flag, xref_table [i].key))
- return i+1;
- return 0;
-}
-
-void
-xref_set_data (flag, data)
- int flag;
- void *data;
-{
- xref_table [flag-1].data = data;
-}
-
-void *
-xref_get_data (flag)
- int flag;
-{
- return xref_table [flag-1].data;
-}
-
-void
-xref_set_current_fp (fp)
- FILE *fp;
-{
- xref_table [flag_emit_xref-1].fp = fp;
-}
-
-/* Branch to the right xref "back-end". */
-
-void
-expand_xref (node)
- tree node;
-{
- /* Maintain these two cached. */
- static FILE *fp = NULL;
- static void (*current_expand) PROTO ((FILE *, tree)) = NULL;
-
- if ( !flag_emit_xref )
- return;
-
- if (!fp)
- fp = xref_table [flag_emit_xref-1].fp;
- if (!current_expand)
- current_expand = xref_table [flag_emit_xref-1].expand;
-
- (*current_expand) (fp, node);
-}
-
-/* Implementation of the xref back-ends. */
-
diff --git a/gnu/dist/toolchain/gcc/java/xref.h b/gnu/dist/toolchain/gcc/java/xref.h
deleted file mode 100644
index 7a98834c2db..00000000000
--- a/gnu/dist/toolchain/gcc/java/xref.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Definitions for the cross reference backend xref.c
- Copyright (C) 1999 Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Exported functions. */
-int xref_flag_value PROTO ((char *));
-void expand_xref PROTO ((tree));
-void xref_set_data PROTO ((int, void *));
-void *xref_get_data PROTO ((int));
-void xref_set_current_fp PROTO ((FILE *));
-
-/* flag_emit_xref range of possible values. */
-
-enum {
- XREF_NONE = 0
-};
-
-/* Lookup table to be used with the value of flag_emit_xref */
-
-typedef struct {
- char *key; /* Activator in -fxref=<key> */
- void (*expand) PROTO ((FILE *, tree)); /* Function to write xrefs out */
- FILE *fp; /* fp to use during the call. */
- void *data; /* Placeholder for additional data */
-} xref_flag_table;
-
-#define XREF_GET_DATA(FLAG, T) ((T)xref_get_data (FLAG))
diff --git a/gnu/dist/toolchain/gcc/java/zextract.c b/gnu/dist/toolchain/gcc/java/zextract.c
deleted file mode 100644
index 5e170b3a7bb..00000000000
--- a/gnu/dist/toolchain/gcc/java/zextract.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* Handle a .class file embedded in a .zip archive.
- This extracts a member from a .zip file, but does not handle
- uncompression (since that is not needed for classes.zip).
-
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, February 1996. */
-
-#include "config.h"
-#include "system.h"
-#include "zipfile.h"
-
-/* This stuff is partly based on the 28 August 1994 public release of the
-Info-ZIP group's portable UnZip zipfile-extraction program (and related
-utilities). */
-
-/*************/
-/* Defines */
-/*************/
-
-#define UNZIP
-#define UNZIP_VERSION 20 /* compatible with PKUNZIP 2.0 */
-#define VMS_UNZIP_VERSION 42 /* if OS-needed-to-extract is VMS: can do */
-
-
-#define ZSUFX ".zip"
-#define CENTRAL_HDR_SIG "\113\001\002" /* the infamous "PK" signature */
-#define LOCAL_HDR_SIG "\113\003\004" /* bytes, sans "P" (so unzip */
-#define END_CENTRAL_SIG "\113\005\006" /* executable not mistaken for */
-#define EXTD_LOCAL_SIG "\113\007\010" /* zipfile itself) */
-
-#define STORED 0 /* compression methods */
-#define SHRUNK 1
-#define REDUCED1 2
-#define REDUCED2 3
-#define REDUCED3 4
-#define REDUCED4 5
-#define IMPLODED 6
-#define TOKENIZED 7
-#define DEFLATED 8
-#define NUM_METHODS 9 /* index of last method + 1 */
-/* don't forget to update list_files() appropriately if NUM_METHODS changes */
-
-#define PK_OK 0 /* no error */
-#define PK_COOL 0 /* no error */
-#define PK_GNARLY 0 /* no error */
-#define PK_WARN 1 /* warning error */
-#define PK_ERR 2 /* error in zipfile */
-#define PK_BADERR 3 /* severe error in zipfile */
-#define PK_MEM 4 /* insufficient memory */
-#define PK_MEM2 5 /* insufficient memory */
-#define PK_MEM3 6 /* insufficient memory */
-#define PK_MEM4 7 /* insufficient memory */
-#define PK_MEM5 8 /* insufficient memory */
-#define PK_NOZIP 9 /* zipfile not found */
-#define PK_PARAM 10 /* bad or illegal parameters specified */
-#define PK_FIND 11 /* no files found */
-#define PK_DISK 50 /* disk full */
-#define PK_EOF 51 /* unexpected EOF */
-
-/*---------------------------------------------------------------------------
- True sizes of the various headers, as defined by PKWARE--so it is not
- likely that these will ever change. But if they do, make sure both these
- defines AND the typedefs below get updated accordingly.
- ---------------------------------------------------------------------------*/
-#define LREC_SIZE 26 /* lengths of local file headers, central */
-#define CREC_SIZE 42 /* directory headers, and the end-of- */
-#define ECREC_SIZE 18 /* central-dir record, respectively */
-
-
-#ifndef SEEK_SET
-# define SEEK_SET 0
-# define SEEK_CUR 1
-# define SEEK_END 2
-#endif
-
-/**************/
-/* Typedefs */
-/**************/
-
-typedef char boolean;
-typedef unsigned char uch; /* code assumes unsigned bytes; these type- */
-typedef unsigned short ush; /* defs replace byte/UWORD/ULONG (which are */
-typedef unsigned long ulg; /* predefined on some systems) & match zip */
-
-/*---------------------------------------------------------------------------
- Zipfile layout declarations. If these headers ever change, make sure the
- xxREC_SIZE defines (above) change with them!
- ---------------------------------------------------------------------------*/
-
- typedef uch local_byte_hdr[ LREC_SIZE ];
-# define L_VERSION_NEEDED_TO_EXTRACT_0 0
-# define L_VERSION_NEEDED_TO_EXTRACT_1 1
-# define L_GENERAL_PURPOSE_BIT_FLAG 2
-# define L_COMPRESSION_METHOD 4
-# define L_LAST_MOD_FILE_TIME 6
-# define L_LAST_MOD_FILE_DATE 8
-# define L_CRC32 10
-# define L_COMPRESSED_SIZE 14
-# define L_UNCOMPRESSED_SIZE 18
-# define L_FILENAME_LENGTH 22
-# define L_EXTRA_FIELD_LENGTH 24
-
- typedef uch cdir_byte_hdr[ CREC_SIZE ];
-# define C_VERSION_MADE_BY_0 0
-# define C_VERSION_MADE_BY_1 1
-# define C_VERSION_NEEDED_TO_EXTRACT_0 2
-# define C_VERSION_NEEDED_TO_EXTRACT_1 3
-# define C_GENERAL_PURPOSE_BIT_FLAG 4
-# define C_COMPRESSION_METHOD 6
-# define C_LAST_MOD_FILE_TIME 8
-# define C_LAST_MOD_FILE_DATE 10
-# define C_CRC32 12
-# define C_COMPRESSED_SIZE 16
-# define C_UNCOMPRESSED_SIZE 20
-# define C_FILENAME_LENGTH 24
-# define C_EXTRA_FIELD_LENGTH 26
-# define C_FILE_COMMENT_LENGTH 28
-# define C_DISK_NUMBER_START 30
-# define C_INTERNAL_FILE_ATTRIBUTES 32
-# define C_EXTERNAL_FILE_ATTRIBUTES 34
-# define C_RELATIVE_OFFSET_LOCAL_HEADER 38
-
- typedef uch ec_byte_rec[ ECREC_SIZE+4 ];
-/* define SIGNATURE 0 space-holder only */
-# define NUMBER_THIS_DISK 4
-# define NUM_DISK_WITH_START_CENTRAL_DIR 6
-# define NUM_ENTRIES_CENTRL_DIR_THS_DISK 8
-# define TOTAL_ENTRIES_CENTRAL_DIR 10
-# define SIZE_CENTRAL_DIRECTORY 12
-# define OFFSET_START_CENTRAL_DIRECTORY 16
-# define ZIPFILE_COMMENT_LENGTH 20
-
-
- typedef struct local_file_header { /* LOCAL */
- uch version_needed_to_extract[2];
- ush general_purpose_bit_flag;
- ush compression_method;
- ush last_mod_file_time;
- ush last_mod_file_date;
- ulg crc32;
- ulg csize;
- ulg ucsize;
- ush filename_length;
- ush extra_field_length;
- } local_file_hdr;
-
- typedef struct central_directory_file_header { /* CENTRAL */
- uch version_made_by[2];
- uch version_needed_to_extract[2];
- ush general_purpose_bit_flag;
- ush compression_method;
- ush last_mod_file_time;
- ush last_mod_file_date;
- ulg crc32;
- ulg csize;
- ulg ucsize;
- ush filename_length;
- ush extra_field_length;
- ush file_comment_length;
- ush disk_number_start;
- ush internal_file_attributes;
- ulg external_file_attributes;
- ulg relative_offset_local_header;
- } cdir_file_hdr;
-
- typedef struct end_central_dir_record { /* END CENTRAL */
- ush number_this_disk;
- ush num_disk_with_start_central_dir;
- ush num_entries_centrl_dir_ths_disk;
- ush total_entries_central_dir;
- ulg size_central_directory;
- ulg offset_start_central_directory;
- ush zipfile_comment_length;
- } ecdir_rec;
-
-
-/************/
-/* Macros */
-/************/
-
-#ifndef MAX
-# define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-
-/***********************/
-/* Function makeword() */
-/***********************/
-
-static ush makeword(b)
- uch *b;
-{
- /*
- * Convert Intel style 'short' integer to non-Intel non-16-bit
- * host format. This routine also takes care of byte-ordering.
- */
- return (ush)((b[1] << 8) | b[0]);
-}
-
-
-/***********************/
-/* Function makelong() */
-/***********************/
-
-static ulg makelong(sig)
- uch *sig;
-{
- /*
- * Convert intel style 'long' variable to non-Intel non-16-bit
- * host format. This routine also takes care of byte-ordering.
- */
- return (((ulg)sig[3]) << 24)
- + (((ulg)sig[2]) << 16)
- + (((ulg)sig[1]) << 8)
- + ((ulg)sig[0]);
-}
-
-int
-read_zip_archive (zipf)
- register ZipFile *zipf;
-{
- int i;
- int dir_last_pad;
- char *dir_ptr;
- char buffer[100];
-
- zipf->size = lseek (zipf->fd, 0L, SEEK_END);
-
- if (zipf->size < (ECREC_SIZE+4) || lseek (zipf->fd, (long)(-(ECREC_SIZE+4)), SEEK_CUR) <= 0)
- return -1;
- if (read (zipf->fd, buffer, ECREC_SIZE+4) != ECREC_SIZE+4)
- return -2;
- zipf->count = makeword(&buffer[TOTAL_ENTRIES_CENTRAL_DIR]);
- zipf->dir_size = makelong(&buffer[SIZE_CENTRAL_DIRECTORY]);
-#define ALLOC malloc
- /* Allocate 1 more to allow appending '\0' to last filename. */
- zipf->central_directory = ALLOC (zipf->dir_size+1);
- if (lseek (zipf->fd, -(zipf->dir_size+ECREC_SIZE+4), SEEK_CUR) < 0)
- return -2;
- if (read (zipf->fd, zipf->central_directory, zipf->dir_size) < 0)
- return -2;
-
-#ifdef TEST
- printf ("number_this_disk = %d\n", makeword(&buffer[NUMBER_THIS_DISK]));
- printf ("num_disk_with_start_central_dir = %d\n", makeword(&buffer[NUM_DISK_WITH_START_CENTRAL_DIR]));
-
- printf ("num_entries_centrl_dir_ths_disk = %d\n",
- makeword(&buffer[NUM_ENTRIES_CENTRL_DIR_THS_DISK]));
- printf ("total_entries_central_dir = %d\n",
- makeword(&buffer[TOTAL_ENTRIES_CENTRAL_DIR]));
- printf ("size_central_directory = %d\n",
- makelong(&buffer[SIZE_CENTRAL_DIRECTORY]));
- printf ("offset_start_central_directory = %d\n",
- makelong(&buffer[OFFSET_START_CENTRAL_DIRECTORY]));
- printf ("zipfile_comment_length = %d\n",
- makeword(&buffer[ZIPFILE_COMMENT_LENGTH]));
-#endif
-
- dir_last_pad = 0;
- dir_ptr = zipf->central_directory;
- for (i = 0; i < zipf->count; i++)
- {
- ZipDirectory *zipd = (ZipDirectory*)(dir_ptr + dir_last_pad);
- long uncompressed_size = makelong (&dir_ptr[4+C_UNCOMPRESSED_SIZE]);
- long filename_length = makeword (&dir_ptr[4+C_FILENAME_LENGTH]);
- long extra_field_length = makeword (&dir_ptr[4+C_EXTRA_FIELD_LENGTH]);
- long file_comment_length = makeword (&dir_ptr[4+C_FILE_COMMENT_LENGTH]);
- int unpadded_direntry_length;
- if ((dir_ptr-zipf->central_directory)+filename_length+CREC_SIZE+4>zipf->dir_size)
- return -1;
-
- zipd->filename_length = filename_length;
- zipd->size = uncompressed_size;
-#ifdef __GNUC__
-#define DIR_ALIGN __alignof__(ZipDirectory)
-#else
-#define DIR_ALIGN sizeof(long)
-#endif
- zipd->filestart = makelong (&dir_ptr[4+C_RELATIVE_OFFSET_LOCAL_HEADER])
- + (LREC_SIZE+4) + filename_length + file_comment_length +
- + (extra_field_length ? extra_field_length+4 : 0);
- /* About the last term of the expression above. Should the same
- apply if file_comment_length is not zero ? I've never seen
- the comment field uses so far. FIXME. */
- zipd->filename_offset = CREC_SIZE+4 - dir_last_pad;
- unpadded_direntry_length
- = zipd->filename_offset + zipd->filename_length + extra_field_length;
- zipd->direntry_size =
- ((unpadded_direntry_length + DIR_ALIGN) / DIR_ALIGN) * DIR_ALIGN;
- dir_last_pad = zipd->direntry_size - unpadded_direntry_length;
- dir_ptr = (char*)zipd + unpadded_direntry_length;
- *dir_ptr = '\0';
- }
- return 0;
-}
-
-#ifdef TEST
-main ()
-{
- ZipFile zipf[1];
- ZipDirectory *zipd;
- int i;
-
- zipf->fd = 0;
-
- i = read_zip_archive (zipf);
- if (i)
- {
- fprintf (stderr, "Bad zip file.\n");
- exit (i);
- }
-
- zipd = (ZipDirectory*) zipf->central_directory;
- for (i = 0; i < zipf->count; i++, zipd = ZIPDIR_NEXT (zipd))
- {
- printf ("%d: size:%d, name(#%d)%s, offset:%d\n",
- i, zipd->size, zipd->filename_length,
- ZIPDIR_FILENAME (zipd),
- zipd->filestart);
- }
-}
-#endif
diff --git a/gnu/dist/toolchain/gcc/java/zipfile.h b/gnu/dist/toolchain/gcc/java/zipfile.h
deleted file mode 100644
index 98a698ff821..00000000000
--- a/gnu/dist/toolchain/gcc/java/zipfile.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Definitions for using a zipped' archive.
-
- Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-struct ZipFile {
- int fd;
- long size;
- long count;
- long dir_size;
- char *central_directory;
-};
-
-typedef struct ZipFile ZipFile;
-
-struct ZipDirectory {
- int direntry_size;
- int filename_offset;
- long size; /* length of file */
- long filestart; /* start of file in archive */
- long filename_length;
- /* char mid_padding[...]; */
- /* char filename[filename_length]; */
- /* char end_padding[...]; */
-};
-
-typedef struct ZipDirectory ZipDirectory;
-
-struct ZipFileCache {
- struct ZipFile z;
- struct ZipFileCache *next;
- char *name;
-};
-
-extern struct ZipFileCache *SeenZipFiles;
-
-#define ZIPDIR_FILENAME(ZIPD) ((char*)(ZIPD)+(ZIPD)->filename_offset)
-#define ZIPDIR_NEXT(ZIPD) \
- ((ZipDirectory*)((char*)(ZIPD)+(ZIPD)->direntry_size))
-#define ZIPMAGIC 0x504b0304
-
-extern ZipFile * opendir_in_zip PROTO ((const char *, int));
-extern int read_zip_archive PROTO ((ZipFile *));
-#ifdef JCF_ZIP
-extern int open_in_zip PROTO ((struct JCF *, const char *,
- const char *, int));
-#endif